guy 7 years ago
parent
commit
b95ab43383
  1. 884
      bi/case.js
  2. 896
      bi/widget.js
  3. 2
      demo/config.js
  4. 27
      demo/js/config/addons.js
  5. 4
      demo/js/config/base.js
  6. 148
      demo/js/config/case.js
  7. 8
      demo/js/config/chart.js
  8. 4
      demo/js/config/component.js
  9. 4
      demo/js/config/core.js
  10. 7216
      dist/bundle.js
  11. 884
      dist/case.js
  12. 197
      dist/demo.js
  13. 30
      dist/resource.css
  14. 896
      dist/widget.js
  15. 45
      docs/SUMMARY.md
  16. 14
      docs/_book/.gitignore
  17. 2530
      docs/_book/COURSE.html
  18. 21
      docs/_book/LICENSE
  19. 2533
      docs/_book/OVERVIEW.html
  20. 2561
      docs/_book/START.html
  21. 2596
      docs/_book/base/bubble.html
  22. 40
      docs/_book/base/bubble.md
  23. 2769
      docs/_book/base/button/button.html
  24. 69
      docs/_book/base/button/button.md
  25. 2588
      docs/_book/base/button/icon_button.html
  26. 39
      docs/_book/base/button/icon_button.md
  27. 2633
      docs/_book/base/button/image_button.html
  28. 49
      docs/_book/base/button/image_button.md
  29. 2692
      docs/_book/base/button/text_button.html
  30. 58
      docs/_book/base/button/text_button.md
  31. 2595
      docs/_book/base/canvas.html
  32. 40
      docs/_book/base/canvas.md
  33. 2649
      docs/_book/base/editor/code_editor.html
  34. 53
      docs/_book/base/editor/code_editor.md
  35. 2823
      docs/_book/base/editor/editor.html
  36. 89
      docs/_book/base/editor/editor.md
  37. 2674
      docs/_book/base/editor/formula_editor.html
  38. 59
      docs/_book/base/editor/formula_editor.md
  39. 2639
      docs/_book/base/editor/multifile_editor.html
  40. 51
      docs/_book/base/editor/multifile_editor.md
  41. 2605
      docs/_book/base/editor/textarea_editor.html
  42. 45
      docs/_book/base/editor/textarea_editor.md
  43. 2743
      docs/_book/base/label.html
  44. 66
      docs/_book/base/label.md
  45. 2578
      docs/_book/base/message.html
  46. 39
      docs/_book/base/message.md
  47. 2732
      docs/_book/base/pager.html
  48. 66
      docs/_book/base/pager.md
  49. 2652
      docs/_book/base/svg.html
  50. 55
      docs/_book/base/svg.md
  51. 2725
      docs/_book/base/table/collection_table.html
  52. 74
      docs/_book/base/table/collection_table.md
  53. 2696
      docs/_book/base/table/grid_table.html
  54. 59
      docs/_book/base/table/grid_table.md
  55. 2744
      docs/_book/base/table/resizable_table.html
  56. 77
      docs/_book/base/table/resizable_table.md
  57. 2763
      docs/_book/base/table/table_view.html
  58. 73
      docs/_book/base/table/table_view.md
  59. 2597
      docs/_book/base/toast.html
  60. 41
      docs/_book/base/toast.md
  61. 2607
      docs/_book/case/button/multi_select_item.html
  62. 53
      docs/_book/case/button/multi_select_item.md
  63. 2616
      docs/_book/case/button/single_select_item.html
  64. 54
      docs/_book/case/button/single_select_item.md
  65. 2614
      docs/_book/case/button/single_select_radio_item.html
  66. 55
      docs/_book/case/button/single_select_radio_item.md
  67. 2621
      docs/_book/case/calendar.html
  68. 47
      docs/_book/case/calendar.md
  69. 2571
      docs/_book/case/clipboard.html
  70. 33
      docs/_book/case/clipboard.md
  71. 2571
      docs/_book/case/color_chooser.html
  72. 32
      docs/_book/case/color_chooser.md
  73. 2602
      docs/_book/case/color_chooser_popup.html
  74. 45
      docs/_book/case/color_chooser_popup.md
  75. 2755
      docs/_book/case/combo/bubble_combo.html
  76. 86
      docs/_book/case/combo/bubble_combo.md
  77. 2694
      docs/_book/case/combo/icon_combo.html
  78. 68
      docs/_book/case/combo/icon_combo.md
  79. 2628
      docs/_book/case/combo/static_combo.html
  80. 58
      docs/_book/case/combo/static_combo.md
  81. 2622
      docs/_book/case/combo/text_value_combo.html
  82. 58
      docs/_book/case/combo/text_value_combo.md
  83. 2614
      docs/_book/case/combo/text_value_downlist_combo.html
  84. 2569
      docs/_book/case/complex_canvas.html
  85. 37
      docs/_book/case/complex_canvas.md
  86. 2833
      docs/_book/case/editor/shelter_editor.html
  87. 93
      docs/_book/case/editor/shelter_editor.md
  88. 2819
      docs/_book/case/editor/sign_editor.html
  89. 91
      docs/_book/case/editor/sign_editor.md
  90. 2832
      docs/_book/case/editor/sign_initial_editor.html
  91. 92
      docs/_book/case/editor/sign_initial_editor.md
  92. 2806
      docs/_book/case/editor/state_editor.html
  93. 89
      docs/_book/case/editor/state_editor.md
  94. 2689
      docs/_book/case/layer/layer_panel.html
  95. 69
      docs/_book/case/layer/layer_panel.md
  96. 2561
      docs/_book/case/layer/multi_popup_layer.html
  97. 34
      docs/_book/case/layer/multi_popup_layer.md
  98. 2743
      docs/_book/case/layer/pane_list.html
  99. 74
      docs/_book/case/layer/pane_list.md
  100. 2607
      docs/_book/case/layer/panel.html
  101. Some files were not shown because too many files have changed in this diff Show More

884
bi/case.js

@ -6437,212 +6437,6 @@ BI.ClearEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.ClearEditor.EVENT_REMOVE = "EVENT_REMOVE"; BI.ClearEditor.EVENT_REMOVE = "EVENT_REMOVE";
BI.ClearEditor.EVENT_EMPTY = "EVENT_EMPTY"; BI.ClearEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.clear_editor", BI.ClearEditor);/** BI.shortcut("bi.clear_editor", BI.ClearEditor);/**
* Created by roy on 15/9/14.
*/
BI.SearchEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.SearchEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-search-editor bi-border",
height: 30,
errorText: "",
watermark: BI.i18nText("BI-Basic_Search"),
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn
});
},
_init: function () {
this.options.height -= 2;
BI.SearchEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.editor = BI.createWidget({
type: "bi.editor",
height: o.height,
watermark: o.watermark,
allowBlank: true,
errorText: o.errorText,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker
});
this.clear = BI.createWidget({
type: "bi.icon_button",
stopEvent: true,
cls: "search-close-h-font"
});
this.clear.on(BI.IconButton.EVENT_CHANGE, function () {
self.setValue("");
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT);
self.fireEvent(BI.SearchEditor.EVENT_CLEAR);
});
BI.createWidget({
element: this,
type: "bi.htape",
items: [
{
el: {
type: "bi.center_adapt",
cls: "search-font",
items: [{
el: {
type: "bi.icon"
}
}]
},
width: 25
},
{
el: self.editor
},
{
el: this.clear,
width: 25
}
]
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.editor.on(BI.Editor.EVENT_FOCUS, function () {
self.fireEvent(BI.SearchEditor.EVENT_FOCUS);
});
this.editor.on(BI.Editor.EVENT_BLUR, function () {
self.fireEvent(BI.SearchEditor.EVENT_BLUR);
});
this.editor.on(BI.Editor.EVENT_CLICK, function () {
self.fireEvent(BI.SearchEditor.EVENT_CLICK);
});
this.editor.on(BI.Editor.EVENT_CHANGE, function () {
self._checkClear();
self.fireEvent(BI.SearchEditor.EVENT_CHANGE);
});
this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.SearchEditor.EVENT_KEY_DOWN, v);
});
this.editor.on(BI.Editor.EVENT_SPACE, function () {
self.fireEvent(BI.SearchEditor.EVENT_SPACE)
});
this.editor.on(BI.Editor.EVENT_BACKSPACE, function () {
self.fireEvent(BI.SearchEditor.EVENT_BACKSPACE)
});
this.editor.on(BI.Editor.EVENT_VALID, function () {
self.fireEvent(BI.SearchEditor.EVENT_VALID)
});
this.editor.on(BI.Editor.EVENT_ERROR, function () {
self.fireEvent(BI.SearchEditor.EVENT_ERROR)
});
this.editor.on(BI.Editor.EVENT_ENTER, function () {
self.fireEvent(BI.SearchEditor.EVENT_ENTER);
});
this.editor.on(BI.Editor.EVENT_RESTRICT, function () {
self.fireEvent(BI.SearchEditor.EVENT_RESTRICT)
});
this.editor.on(BI.Editor.EVENT_EMPTY, function () {
self._checkClear();
self.fireEvent(BI.SearchEditor.EVENT_EMPTY)
});
this.editor.on(BI.Editor.EVENT_REMOVE, function () {
self.fireEvent(BI.SearchEditor.EVENT_REMOVE)
});
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.SearchEditor.EVENT_CONFIRM)
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.SearchEditor.EVENT_START);
});
this.editor.on(BI.Editor.EVENT_PAUSE, function () {
self.fireEvent(BI.SearchEditor.EVENT_PAUSE);
});
this.editor.on(BI.Editor.EVENT_STOP, function () {
self.fireEvent(BI.SearchEditor.EVENT_STOP);
});
this.clear.invisible();
},
_checkClear: function () {
if (!this.getValue()) {
this.clear.invisible();
} else {
this.clear.visible();
}
},
focus: function () {
this.editor.focus();
},
blur: function () {
this.editor.blur();
},
getValue: function () {
if (this.isValid()) {
var res = this.editor.getValue().match(/[\S]+/g);
return BI.isNull(res) ? "" : res[res.length - 1];
}
},
getLastValidValue: function () {
return this.editor.getLastValidValue();
},
setValue: function (v) {
this.editor.setValue(v);
if (BI.isKey(v)) {
this.clear.visible();
}
},
isEditing: function () {
return this.editor.isEditing();
},
isValid: function () {
return this.editor.isValid();
}
});
BI.SearchEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.SearchEditor.EVENT_FOCUS = "EVENT_FOCUS";
BI.SearchEditor.EVENT_BLUR = "EVENT_BLUR";
BI.SearchEditor.EVENT_CLICK = "EVENT_CLICK";
BI.SearchEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
BI.SearchEditor.EVENT_SPACE = "EVENT_SPACE";
BI.SearchEditor.EVENT_BACKSPACE = "EVENT_BACKSPACE";
BI.SearchEditor.EVENT_CLEAR = "EVENT_CLEAR";
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_VALID = "EVENT_VALID";
BI.SearchEditor.EVENT_ERROR = "EVENT_ERROR";
BI.SearchEditor.EVENT_ENTER = "EVENT_ENTER";
BI.SearchEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.SearchEditor.EVENT_REMOVE = "EVENT_REMOVE";
BI.SearchEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.search_editor", BI.SearchEditor);/**
* 小号搜索框
* Created by GUY on 2015/9/29.
* @class BI.SmallSearchEditor
* @extends BI.SearchEditor
*/
BI.SmallSearchEditor = BI.inherit(BI.SearchEditor, {
_defaultConfig: function () {
var conf = BI.SmallSearchEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-small-search-editor",
height: 24
});
},
_init: function () {
BI.SmallSearchEditor.superclass._init.apply(this, arguments);
}
});
BI.shortcut("bi.small_search_editor", BI.SmallSearchEditor);/**
* 带标记的文本框 * 带标记的文本框
* Created by GUY on 2016/1/25. * Created by GUY on 2016/1/25.
* @class BI.ShelterEditor * @class BI.ShelterEditor
@ -7952,187 +7746,6 @@ BI.SimpleStateEditor.EVENT_SPACE = "EVENT_SPACE";
BI.SimpleStateEditor.EVENT_EMPTY = "EVENT_EMPTY"; BI.SimpleStateEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor);/** BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor);/**
* guy
* @class BI.TextEditor
* @extends BI.Single
*/
BI.TextEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.TextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
extraCls: "bi-text-editor bi-border",
hgap: 4,
vgap: 2,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0,
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,
allowBlank: false,
watermark: "",
errorText: "",
height: 30
})
},
_init: function () {
BI.TextEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (BI.isNumber(o.height)) {
this.element.css({height: o.height - 2});
}
if (BI.isNumber(o.width)) {
this.element.css({width: o.width - 2});
}
this.editor = BI.createWidget({
type: "bi.editor",
height: o.height - 2,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
value: o.value,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.editor.on(BI.Editor.EVENT_FOCUS, function () {
self.fireEvent(BI.TextEditor.EVENT_FOCUS);
});
this.editor.on(BI.Editor.EVENT_BLUR, function () {
self.fireEvent(BI.TextEditor.EVENT_BLUR);
});
this.editor.on(BI.Editor.EVENT_CLICK, function () {
self.fireEvent(BI.TextEditor.EVENT_CLICK);
});
this.editor.on(BI.Editor.EVENT_CHANGE, function () {
self.fireEvent(BI.TextEditor.EVENT_CHANGE);
});
this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.TextEditor.EVENT_KEY_DOWN);
});
this.editor.on(BI.Editor.EVENT_SPACE, function (v) {
self.fireEvent(BI.TextEditor.EVENT_SPACE);
});
this.editor.on(BI.Editor.EVENT_BACKSPACE, function (v) {
self.fireEvent(BI.TextEditor.EVENT_BACKSPACE);
});
this.editor.on(BI.Editor.EVENT_VALID, function () {
self.fireEvent(BI.TextEditor.EVENT_VALID);
});
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.TextEditor.EVENT_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_REMOVE, function (v) {
self.fireEvent(BI.TextEditor.EVENT_REMOVE);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.TextEditor.EVENT_START);
});
this.editor.on(BI.Editor.EVENT_PAUSE, function () {
self.fireEvent(BI.TextEditor.EVENT_PAUSE);
});
this.editor.on(BI.Editor.EVENT_STOP, function () {
self.fireEvent(BI.TextEditor.EVENT_STOP);
});
this.editor.on(BI.Editor.EVENT_ERROR, function () {
self.fireEvent(BI.TextEditor.EVENT_ERROR, arguments);
});
this.editor.on(BI.Editor.EVENT_ENTER, function () {
self.fireEvent(BI.TextEditor.EVENT_ENTER);
});
this.editor.on(BI.Editor.EVENT_RESTRICT, function () {
self.fireEvent(BI.TextEditor.EVENT_RESTRICT);
});
this.editor.on(BI.Editor.EVENT_EMPTY, function () {
self.fireEvent(BI.TextEditor.EVENT_EMPTY);
});
BI.createWidget({
type: "bi.vertical",
scrolly: false,
element: this,
items: [this.editor]
});
},
focus: function () {
this.editor.focus();
},
blur: function () {
this.editor.blur();
},
setErrorText: function (text) {
this.editor.setErrorText(text);
},
getErrorText: function () {
return this.editor.getErrorText();
},
isValid: function () {
return this.editor.isValid();
},
setValue: function (v) {
this.editor.setValue(v);
},
getValue: function () {
return this.editor.getValue();
}
});
BI.TextEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.TextEditor.EVENT_FOCUS = "EVENT_FOCUS";
BI.TextEditor.EVENT_BLUR = "EVENT_BLUR";
BI.TextEditor.EVENT_CLICK = "EVENT_CLICK";
BI.TextEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
BI.TextEditor.EVENT_SPACE = "EVENT_SPACE";
BI.TextEditor.EVENT_BACKSPACE = "EVENT_BACKSPACE";
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_VALID = "EVENT_VALID";
BI.TextEditor.EVENT_ERROR = "EVENT_ERROR";
BI.TextEditor.EVENT_ENTER = "EVENT_ENTER";
BI.TextEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.TextEditor.EVENT_REMOVE = "EVENT_REMOVE";
BI.TextEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.text_editor", BI.TextEditor);/**
* 小号搜索框
* Created by GUY on 2015/9/29.
* @class BI.SmallTextEditor
* @extends BI.SearchEditor
*/
BI.SmallTextEditor = BI.inherit(BI.TextEditor, {
_defaultConfig: function () {
var conf = BI.SmallTextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-small-text-editor",
height: 25
});
},
_init: function () {
BI.SmallTextEditor.superclass._init.apply(this, arguments);
}
});
BI.shortcut("bi.small_text_editor", BI.SmallTextEditor);/**
* 有确定取消按钮的弹出层 * 有确定取消按钮的弹出层
* @class BI.BarFloatSection * @class BI.BarFloatSection
* @extends BI.FloatSection * @extends BI.FloatSection
@ -11891,6 +11504,503 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
}); });
BI.MultiSelectBar.EVENT_CHANGE = "MultiSelectBar.EVENT_CHANGE"; BI.MultiSelectBar.EVENT_CHANGE = "MultiSelectBar.EVENT_CHANGE";
BI.shortcut("bi.multi_select_bar", BI.MultiSelectBar);/** BI.shortcut("bi.multi_select_bar", BI.MultiSelectBar);/**
* 表关联树
*
* Created by GUY on 2015/12/15.
* @class BI.BranchRelation
* @extends BI.Widget
*/
BI.BranchRelation = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.BranchRelation.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-branch-relation-tree",
items: [],
centerOffset: 0,//重心偏移量
direction: BI.Direction.Bottom,
align: BI.VerticalAlign.Top
})
},
_init: function () {
BI.BranchRelation.superclass._init.apply(this, arguments);
this.populate(this.options.items);
},
//树分层
_stratification: function () {
var levels = [];
this.tree.recursion(function (node, route) {
//node.isRoot = route.length <= 1;
node.leaf = node.isLeaf();
if (!levels[route.length - 1]) {
levels[route.length - 1] = [];
}
levels[route.length - 1].push(node);
});
return levels;
},
//计算所有节点的叶子结点个数
_calculateLeaves: function () {
var count = 0;
function track(node) {
var c = 0;
if (node.isLeaf()) {
return 1;
}
BI.each(node.getChildren(), function (i, child) {
c += track(child);
});
node.set("leaves", c);
return c;
}
count = track(this.tree.getRoot());
return count;
},
//树平移
_translate: function (levels) {
var adjust = [];
var maxLevel = levels.length;
BI.each(levels, function (i, nodes) {
if (!adjust[i]) {
adjust[i] = [];
}
BI.each(nodes, function (j, node) {
if (node.isLeaf() && i < maxLevel - 1) {
var newNode = new BI.Node(BI.UUID());
//newNode.isEmptyRoot = node.isRoot || node.isEmptyRoot;
newNode.isNew = true;
//把node向下一层移
var tar = 0;
if (j > 0) {
var c = nodes[j - 1].getLastChild();
tar = levels[i + 1].indexOf(c) + 1;
}
levels[i + 1].splice(tar, 0, node);
//新增一个临时树节点
var index = node.parent.getChildIndex(node.id);
node.parent.removeChildByIndex(index);
node.parent.addChild(newNode, index);
newNode.addChild(node);
adjust[i].push(newNode);
nodes[j] = newNode;
} else {
adjust[i].push(node);
}
})
});
return adjust;
},
//树补白
_fill: function (levels) {
var adjust = [];
var maxLevel = levels.length;
BI.each(levels, function (i, nodes) {
if (!adjust[i]) {
adjust[i] = [];
}
BI.each(nodes, function (j, node) {
if (node.isLeaf() && i < maxLevel - 1) {
var newNode = new BI.Node(BI.UUID());
newNode.leaf = true;
newNode.width = node.width;
newNode.height = node.height;
newNode.isNew = true;
//把node向下一层移
var tar = 0;
if (j > 0) {
var c = nodes[j - 1].getLastChild();
tar = levels[i + 1].indexOf(c) + 1;
}
levels[i + 1].splice(tar, 0, newNode);
//新增一个临时树节点
node.addChild(newNode);
}
adjust[i].push(node);
})
});
return adjust;
},
//树调整
_adjust: function (adjust) {
while (true) {
var isAllNeedAjust = false;
BI.backEach(adjust, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (!node.isNew) {
var needAdjust = true;
BI.any(node.getChildren(), function (k, n) {
if (!n.isNew) {
needAdjust = false;
return true;
}
});
if (!node.isLeaf() && needAdjust === true) {
var allChilds = [];
BI.each(node.getChildren(), function (k, n) {
allChilds = allChilds.concat(n.getChildren());
});
node.removeAllChilds();
BI.each(allChilds, function (k, c) {
node.addChild(c);
});
var newNode = new BI.Node(BI.UUID());
//newNode.isEmptyRoot = node.isRoot || node.isEmptyRoot;
newNode.isNew = true;
var index = node.parent.getChildIndex(node.id);
node.parent.removeChildByIndex(index);
node.parent.addChild(newNode, index);
newNode.addChild(node);
isAllNeedAjust = true;
}
}
})
});
if (isAllNeedAjust === false) {
break;
} else {//树重构
adjust = this._stratification();
}
}
return adjust;
},
_calculateWidth: function () {
var o = this.options;
var width = 0;
function track1(node) {
var w = 0;
if (node.isLeaf()) {
return node.width;
}
BI.each(node.getChildren(), function (i, child) {
w += track1(child);
});
return w;
}
function track2(node) {
var w = 0;
if (node.isLeaf()) {
return node.height;
}
BI.each(node.getChildren(), function (i, child) {
w += track2(child);
});
return w;
}
if (this._isVertical()) {
width = track1(this.tree.getRoot());
} else {
width = track2(this.tree.getRoot());
}
return width;
},
_isVertical: function () {
var o = this.options;
return o.direction === BI.Direction.Top || o.direction === BI.Direction.Bottom;
},
_calculateHeight: function () {
var o = this.options;
var height = 0;
function track1(node) {
var h = 0;
BI.each(node.getChildren(), function (i, child) {
h = Math.max(h, track1(child));
});
return h + (node.height || 0);
}
function track2(node) {
var h = 0;
BI.each(node.getChildren(), function (i, child) {
h = Math.max(h, track2(child));
});
return h + (node.width || 0);
}
if (this._isVertical()) {
height = track1(this.tree.getRoot());
} else {
height = track2(this.tree.getRoot());
}
return height;
},
_calculateXY: function (levels) {
var o = this.options;
var width = this._calculateWidth();
var height = this._calculateHeight();
var levelCount = levels.length;
var allLeavesCount = this._calculateLeaves();
//计算坐标
var xy = {};
var levelHeight = height / levelCount;
BI.each(levels, function (i, nodes) {
//计算权重
var weights = [];
BI.each(nodes, function (j, node) {
weights[j] = (node.get("leaves") || 1) / allLeavesCount;
});
BI.each(nodes, function (j, node) {
//求前j个元素的权重
var weight = BI.sum(weights.slice(0, j));
//求坐标
var x = weight * width + weights[j] * width / 2;
var y = i * levelHeight + levelHeight / 2;
xy[node.id] = {x: x, y: y};
})
});
return xy;
},
_stroke: function (levels, xy) {
var height = this._calculateHeight();
var levelCount = levels.length;
var levelHeight = height / levelCount;
var self = this, o = this.options;
switch (o.direction) {
case BI.Direction.Top:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y + levelHeight / 2;
path += "M" + start.x + "," + (start.y + o.centerOffset) + "L" + start.x + "," + split;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + e.x + "," + (e.y + o.centerOffset) + "L" + e.x + "," + split;
});
if (end.length > 0) {
path += "M" + BI.first(end).x + "," + split + "L" + BI.last(end).x + "," + split;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
case BI.Direction.Bottom:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y - levelHeight / 2;
path += "M" + start.x + "," + (start.y - o.centerOffset) + "L" + start.x + "," + split;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + e.x + "," + (e.y - o.centerOffset) + "L" + e.x + "," + split;
});
if (end.length > 0) {
path += "M" + BI.first(end).x + "," + split + "L" + BI.last(end).x + "," + split;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
case BI.Direction.Left:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y + levelHeight / 2;
path += "M" + (start.y + o.centerOffset) + "," + start.x + "L" + split + "," + start.x;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + (e.y + o.centerOffset) + "," + e.x + "L" + split + "," + e.x;
});
if (end.length > 0) {
path += "M" + split + "," + BI.first(end).x + "L" + split + "," + BI.last(end).x;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
case BI.Direction.Right:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y - levelHeight / 2;
path += "M" + (start.y - o.centerOffset) + "," + start.x + "L" + split + "," + start.x;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + (e.y - o.centerOffset) + "," + e.x + "L" + split + "," + e.x;
});
if (end.length > 0) {
path += "M" + split + "," + BI.first(end).x + "L" + split + "," + BI.last(end).x;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
}
},
_createBranches: function (levels) {
var self = this, o = this.options;
if (o.direction === BI.Direction.Bottom || o.direction === BI.Direction.Right) {
levels = levels.reverse();
}
var xy = this._calculateXY(levels);
//画图
this._stroke(levels, xy);
},
_isNeedAdjust: function () {
var o = this.options;
return o.direction === BI.Direction.Top && o.align === BI.VerticalAlign.Bottom || o.direction === BI.Direction.Bottom && o.align === BI.VerticalAlign.Top
|| o.direction === BI.Direction.Left && o.align === BI.HorizontalAlign.Right || o.direction === BI.Direction.Right && o.align === BI.HorizontalAlign.Left
},
setValue: function (value) {
},
getValue: function () {
},
_transformToTreeFormat: function (sNodes) {
var i, l;
if (!sNodes) {
return [];
}
if (BI.isArray(sNodes)) {
var r = [];
var tmpMap = [];
for (i = 0, l = sNodes.length; i < l; i++) {
tmpMap[sNodes[i].id] = sNodes[i];
}
for (i = 0, l = sNodes.length; i < l; i++) {
if (tmpMap[sNodes[i].pId] && sNodes[i].id != sNodes[i].pId) {
if (!tmpMap[sNodes[i].pId].children) {
tmpMap[sNodes[i].pId].children = [];
}
tmpMap[sNodes[i].pId].children.push(sNodes[i]);
} else {
r.push(sNodes[i]);
}
}
return r;
} else {
return [sNodes];
}
},
populate: function (items) {
var self = this, o = this.options;
o.items = items || [];
this.empty();
items = this._transformToTreeFormat(o.items);
this.tree = new BI.Tree();
this.tree.initTree(items);
this.svg = BI.createWidget({
type: "bi.svg"
});
//树分层
var levels = this._stratification();
if (this._isNeedAdjust()) {
//树平移
var adjust = this._translate(levels);
//树调整
adjust = this._adjust(adjust);
this._createBranches(adjust);
} else {
var adjust = this._fill(levels);
this._createBranches(adjust);
}
var container = BI.createWidget({
type: "bi.layout",
width: this._isVertical() ? this._calculateWidth() : this._calculateHeight(),
height: this._isVertical() ? this._calculateHeight() : this._calculateWidth()
});
BI.createWidget({
type: "bi.absolute",
element: container,
items: [{
el: this.svg,
top: 0,
left: 0,
right: 0,
bottom: 0
}]
});
if (this._isVertical()) {
items = [{
type: "bi.handstand_branch_tree",
expander: {
direction: o.direction
},
el: {
layouts: [{
type: "bi.horizontal_adapt",
verticalAlign: o.align
}]
},
items: items
}]
} else {
items = [{
type: "bi.branch_tree",
expander: {
direction: o.direction
},
el: {
layouts: [{
type: "bi.vertical"
}, {
type: o.align === BI.HorizontalAlign.Left ? "bi.left" : "bi.right"
}]
},
items: items
}]
}
BI.createWidget({
type: "bi.adaptive",
element: container,
items: items
});
BI.createWidget({
type: "bi.center_adapt",
scrollable: true,
element: this,
items: [container]
});
}
});
BI.BranchRelation.EVENT_CHANGE = "BranchRelation.EVENT_CHANGE";
BI.shortcut("bi.branch_relation", BI.BranchRelation);/**
* 倒立的Branch * 倒立的Branch
* @class BI.HandStandBranchExpander * @class BI.HandStandBranchExpander
* @extend BI.Widget * @extend BI.Widget

896
bi/widget.js

@ -1842,503 +1842,6 @@ BI.extend(BI.Arrangement, {
} }
}); });
BI.shortcut('bi.arrangement', BI.Arrangement);/** BI.shortcut('bi.arrangement', BI.Arrangement);/**
* 表关联树
*
* Created by GUY on 2015/12/15.
* @class BI.BranchRelation
* @extends BI.Widget
*/
BI.BranchRelation = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.BranchRelation.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-branch-relation-tree",
items: [],
centerOffset: 0,//重心偏移量
direction: BI.Direction.Bottom,
align: BI.VerticalAlign.Top
})
},
_init: function () {
BI.BranchRelation.superclass._init.apply(this, arguments);
this.populate(this.options.items);
},
//树分层
_stratification: function () {
var levels = [];
this.tree.recursion(function (node, route) {
//node.isRoot = route.length <= 1;
node.leaf = node.isLeaf();
if (!levels[route.length - 1]) {
levels[route.length - 1] = [];
}
levels[route.length - 1].push(node);
});
return levels;
},
//计算所有节点的叶子结点个数
_calculateLeaves: function () {
var count = 0;
function track(node) {
var c = 0;
if (node.isLeaf()) {
return 1;
}
BI.each(node.getChildren(), function (i, child) {
c += track(child);
});
node.set("leaves", c);
return c;
}
count = track(this.tree.getRoot());
return count;
},
//树平移
_translate: function (levels) {
var adjust = [];
var maxLevel = levels.length;
BI.each(levels, function (i, nodes) {
if (!adjust[i]) {
adjust[i] = [];
}
BI.each(nodes, function (j, node) {
if (node.isLeaf() && i < maxLevel - 1) {
var newNode = new BI.Node(BI.UUID());
//newNode.isEmptyRoot = node.isRoot || node.isEmptyRoot;
newNode.isNew = true;
//把node向下一层移
var tar = 0;
if (j > 0) {
var c = nodes[j - 1].getLastChild();
tar = levels[i + 1].indexOf(c) + 1;
}
levels[i + 1].splice(tar, 0, node);
//新增一个临时树节点
var index = node.parent.getChildIndex(node.id);
node.parent.removeChildByIndex(index);
node.parent.addChild(newNode, index);
newNode.addChild(node);
adjust[i].push(newNode);
nodes[j] = newNode;
} else {
adjust[i].push(node);
}
})
});
return adjust;
},
//树补白
_fill: function (levels) {
var adjust = [];
var maxLevel = levels.length;
BI.each(levels, function (i, nodes) {
if (!adjust[i]) {
adjust[i] = [];
}
BI.each(nodes, function (j, node) {
if (node.isLeaf() && i < maxLevel - 1) {
var newNode = new BI.Node(BI.UUID());
newNode.leaf = true;
newNode.width = node.width;
newNode.height = node.height;
newNode.isNew = true;
//把node向下一层移
var tar = 0;
if (j > 0) {
var c = nodes[j - 1].getLastChild();
tar = levels[i + 1].indexOf(c) + 1;
}
levels[i + 1].splice(tar, 0, newNode);
//新增一个临时树节点
node.addChild(newNode);
}
adjust[i].push(node);
})
});
return adjust;
},
//树调整
_adjust: function (adjust) {
while (true) {
var isAllNeedAjust = false;
BI.backEach(adjust, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (!node.isNew) {
var needAdjust = true;
BI.any(node.getChildren(), function (k, n) {
if (!n.isNew) {
needAdjust = false;
return true;
}
});
if (!node.isLeaf() && needAdjust === true) {
var allChilds = [];
BI.each(node.getChildren(), function (k, n) {
allChilds = allChilds.concat(n.getChildren());
});
node.removeAllChilds();
BI.each(allChilds, function (k, c) {
node.addChild(c);
});
var newNode = new BI.Node(BI.UUID());
//newNode.isEmptyRoot = node.isRoot || node.isEmptyRoot;
newNode.isNew = true;
var index = node.parent.getChildIndex(node.id);
node.parent.removeChildByIndex(index);
node.parent.addChild(newNode, index);
newNode.addChild(node);
isAllNeedAjust = true;
}
}
})
});
if (isAllNeedAjust === false) {
break;
} else {//树重构
adjust = this._stratification();
}
}
return adjust;
},
_calculateWidth: function () {
var o = this.options;
var width = 0;
function track1(node) {
var w = 0;
if (node.isLeaf()) {
return node.width;
}
BI.each(node.getChildren(), function (i, child) {
w += track1(child);
});
return w;
}
function track2(node) {
var w = 0;
if (node.isLeaf()) {
return node.height;
}
BI.each(node.getChildren(), function (i, child) {
w += track2(child);
});
return w;
}
if (this._isVertical()) {
width = track1(this.tree.getRoot());
} else {
width = track2(this.tree.getRoot());
}
return width;
},
_isVertical: function () {
var o = this.options;
return o.direction === BI.Direction.Top || o.direction === BI.Direction.Bottom;
},
_calculateHeight: function () {
var o = this.options;
var height = 0;
function track1(node) {
var h = 0;
BI.each(node.getChildren(), function (i, child) {
h = Math.max(h, track1(child));
});
return h + (node.height || 0);
}
function track2(node) {
var h = 0;
BI.each(node.getChildren(), function (i, child) {
h = Math.max(h, track2(child));
});
return h + (node.width || 0);
}
if (this._isVertical()) {
height = track1(this.tree.getRoot());
} else {
height = track2(this.tree.getRoot());
}
return height;
},
_calculateXY: function (levels) {
var o = this.options;
var width = this._calculateWidth();
var height = this._calculateHeight();
var levelCount = levels.length;
var allLeavesCount = this._calculateLeaves();
//计算坐标
var xy = {};
var levelHeight = height / levelCount;
BI.each(levels, function (i, nodes) {
//计算权重
var weights = [];
BI.each(nodes, function (j, node) {
weights[j] = (node.get("leaves") || 1) / allLeavesCount;
});
BI.each(nodes, function (j, node) {
//求前j个元素的权重
var weight = BI.sum(weights.slice(0, j));
//求坐标
var x = weight * width + weights[j] * width / 2;
var y = i * levelHeight + levelHeight / 2;
xy[node.id] = {x: x, y: y};
})
});
return xy;
},
_stroke: function (levels, xy) {
var height = this._calculateHeight();
var levelCount = levels.length;
var levelHeight = height / levelCount;
var self = this, o = this.options;
switch (o.direction) {
case BI.Direction.Top:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y + levelHeight / 2;
path += "M" + start.x + "," + (start.y + o.centerOffset) + "L" + start.x + "," + split;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + e.x + "," + (e.y + o.centerOffset) + "L" + e.x + "," + split;
});
if (end.length > 0) {
path += "M" + BI.first(end).x + "," + split + "L" + BI.last(end).x + "," + split;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
case BI.Direction.Bottom:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y - levelHeight / 2;
path += "M" + start.x + "," + (start.y - o.centerOffset) + "L" + start.x + "," + split;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + e.x + "," + (e.y - o.centerOffset) + "L" + e.x + "," + split;
});
if (end.length > 0) {
path += "M" + BI.first(end).x + "," + split + "L" + BI.last(end).x + "," + split;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
case BI.Direction.Left:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y + levelHeight / 2;
path += "M" + (start.y + o.centerOffset) + "," + start.x + "L" + split + "," + start.x;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + (e.y + o.centerOffset) + "," + e.x + "L" + split + "," + e.x;
});
if (end.length > 0) {
path += "M" + split + "," + BI.first(end).x + "L" + split + "," + BI.last(end).x;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
case BI.Direction.Right:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y - levelHeight / 2;
path += "M" + (start.y - o.centerOffset) + "," + start.x + "L" + split + "," + start.x;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + (e.y - o.centerOffset) + "," + e.x + "L" + split + "," + e.x;
});
if (end.length > 0) {
path += "M" + split + "," + BI.first(end).x + "L" + split + "," + BI.last(end).x;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
}
},
_createBranches: function (levels) {
var self = this, o = this.options;
if (o.direction === BI.Direction.Bottom || o.direction === BI.Direction.Right) {
levels = levels.reverse();
}
var xy = this._calculateXY(levels);
//画图
this._stroke(levels, xy);
},
_isNeedAdjust: function () {
var o = this.options;
return o.direction === BI.Direction.Top && o.align === BI.VerticalAlign.Bottom || o.direction === BI.Direction.Bottom && o.align === BI.VerticalAlign.Top
|| o.direction === BI.Direction.Left && o.align === BI.HorizontalAlign.Right || o.direction === BI.Direction.Right && o.align === BI.HorizontalAlign.Left
},
setValue: function (value) {
},
getValue: function () {
},
_transformToTreeFormat: function (sNodes) {
var i, l;
if (!sNodes) {
return [];
}
if (BI.isArray(sNodes)) {
var r = [];
var tmpMap = [];
for (i = 0, l = sNodes.length; i < l; i++) {
tmpMap[sNodes[i].id] = sNodes[i];
}
for (i = 0, l = sNodes.length; i < l; i++) {
if (tmpMap[sNodes[i].pId] && sNodes[i].id != sNodes[i].pId) {
if (!tmpMap[sNodes[i].pId].children) {
tmpMap[sNodes[i].pId].children = [];
}
tmpMap[sNodes[i].pId].children.push(sNodes[i]);
} else {
r.push(sNodes[i]);
}
}
return r;
} else {
return [sNodes];
}
},
populate: function (items) {
var self = this, o = this.options;
o.items = items || [];
this.empty();
items = this._transformToTreeFormat(o.items);
this.tree = new BI.Tree();
this.tree.initTree(items);
this.svg = BI.createWidget({
type: "bi.svg"
});
//树分层
var levels = this._stratification();
if (this._isNeedAdjust()) {
//树平移
var adjust = this._translate(levels);
//树调整
adjust = this._adjust(adjust);
this._createBranches(adjust);
} else {
var adjust = this._fill(levels);
this._createBranches(adjust);
}
var container = BI.createWidget({
type: "bi.layout",
width: this._isVertical() ? this._calculateWidth() : this._calculateHeight(),
height: this._isVertical() ? this._calculateHeight() : this._calculateWidth()
});
BI.createWidget({
type: "bi.absolute",
element: container,
items: [{
el: this.svg,
top: 0,
left: 0,
right: 0,
bottom: 0
}]
});
if (this._isVertical()) {
items = [{
type: "bi.handstand_branch_tree",
expander: {
direction: o.direction
},
el: {
layouts: [{
type: "bi.horizontal_adapt",
verticalAlign: o.align
}]
},
items: items
}]
} else {
items = [{
type: "bi.branch_tree",
expander: {
direction: o.direction
},
el: {
layouts: [{
type: "bi.vertical"
}, {
type: o.align === BI.HorizontalAlign.Left ? "bi.left" : "bi.right"
}]
},
items: items
}]
}
BI.createWidget({
type: "bi.adaptive",
element: container,
items: items
});
BI.createWidget({
type: "bi.center_adapt",
scrollable: true,
element: this,
items: [container]
});
}
});
BI.BranchRelation.EVENT_CHANGE = "BranchRelation.EVENT_CHANGE";
BI.shortcut("bi.branch_relation", BI.BranchRelation);/**
* 日期控件中的月份下拉框 * 日期控件中的月份下拉框
* *
* Created by GUY on 2015/9/7. * Created by GUY on 2015/9/7.
@ -3250,7 +2753,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, {
} }
}); });
BI.shortcut("bi.date_pane_widget", BI.DatePaneWidget);/** BI.shortcut("bi.date_pane", BI.DatePaneWidget);/**
* Created by Urthur on 2017/7/14. * Created by Urthur on 2017/7/14.
*/ */
BI.DateTimeCombo = BI.inherit(BI.Single, { BI.DateTimeCombo = BI.inherit(BI.Single, {
@ -3328,8 +2831,8 @@ BI.DateTimeCombo = BI.inherit(BI.Single, {
}); });
var triggerBtn = BI.createWidget({ var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button", type: "bi.icon_button",
cls: "bi-trigger-date-button chart-date-normal-font bi-border-right", cls: "bi-trigger-icon-button date-font bi-border-right",
width: 30, width: 30,
height: 24 height: 24
}); });
@ -4557,6 +4060,393 @@ BI.DownListPopup = BI.inherit(BI.Pane, {
BI.DownListPopup.EVENT_CHANGE = "EVENT_CHANGE"; BI.DownListPopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.DownListPopup.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE"; BI.DownListPopup.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE";
BI.shortcut("bi.down_list_popup", BI.DownListPopup);/** BI.shortcut("bi.down_list_popup", BI.DownListPopup);/**
* Created by roy on 15/9/14.
*/
BI.SearchEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.SearchEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-search-editor bi-border",
height: 30,
errorText: "",
watermark: BI.i18nText("BI-Basic_Search"),
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn
});
},
_init: function () {
this.options.height -= 2;
BI.SearchEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.editor = BI.createWidget({
type: "bi.editor",
height: o.height,
watermark: o.watermark,
allowBlank: true,
errorText: o.errorText,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker
});
this.clear = BI.createWidget({
type: "bi.icon_button",
stopEvent: true,
cls: "search-close-h-font"
});
this.clear.on(BI.IconButton.EVENT_CHANGE, function () {
self.setValue("");
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT);
self.fireEvent(BI.SearchEditor.EVENT_CLEAR);
});
BI.createWidget({
element: this,
type: "bi.htape",
items: [
{
el: {
type: "bi.center_adapt",
cls: "search-font",
items: [{
el: {
type: "bi.icon"
}
}]
},
width: 25
},
{
el: self.editor
},
{
el: this.clear,
width: 25
}
]
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.editor.on(BI.Editor.EVENT_FOCUS, function () {
self.fireEvent(BI.SearchEditor.EVENT_FOCUS);
});
this.editor.on(BI.Editor.EVENT_BLUR, function () {
self.fireEvent(BI.SearchEditor.EVENT_BLUR);
});
this.editor.on(BI.Editor.EVENT_CLICK, function () {
self.fireEvent(BI.SearchEditor.EVENT_CLICK);
});
this.editor.on(BI.Editor.EVENT_CHANGE, function () {
self._checkClear();
self.fireEvent(BI.SearchEditor.EVENT_CHANGE);
});
this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.SearchEditor.EVENT_KEY_DOWN, v);
});
this.editor.on(BI.Editor.EVENT_SPACE, function () {
self.fireEvent(BI.SearchEditor.EVENT_SPACE)
});
this.editor.on(BI.Editor.EVENT_BACKSPACE, function () {
self.fireEvent(BI.SearchEditor.EVENT_BACKSPACE)
});
this.editor.on(BI.Editor.EVENT_VALID, function () {
self.fireEvent(BI.SearchEditor.EVENT_VALID)
});
this.editor.on(BI.Editor.EVENT_ERROR, function () {
self.fireEvent(BI.SearchEditor.EVENT_ERROR)
});
this.editor.on(BI.Editor.EVENT_ENTER, function () {
self.fireEvent(BI.SearchEditor.EVENT_ENTER);
});
this.editor.on(BI.Editor.EVENT_RESTRICT, function () {
self.fireEvent(BI.SearchEditor.EVENT_RESTRICT)
});
this.editor.on(BI.Editor.EVENT_EMPTY, function () {
self._checkClear();
self.fireEvent(BI.SearchEditor.EVENT_EMPTY)
});
this.editor.on(BI.Editor.EVENT_REMOVE, function () {
self.fireEvent(BI.SearchEditor.EVENT_REMOVE)
});
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.SearchEditor.EVENT_CONFIRM)
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.SearchEditor.EVENT_START);
});
this.editor.on(BI.Editor.EVENT_PAUSE, function () {
self.fireEvent(BI.SearchEditor.EVENT_PAUSE);
});
this.editor.on(BI.Editor.EVENT_STOP, function () {
self.fireEvent(BI.SearchEditor.EVENT_STOP);
});
this.clear.invisible();
},
_checkClear: function () {
if (!this.getValue()) {
this.clear.invisible();
} else {
this.clear.visible();
}
},
focus: function () {
this.editor.focus();
},
blur: function () {
this.editor.blur();
},
getValue: function () {
if (this.isValid()) {
var res = this.editor.getValue().match(/[\S]+/g);
return BI.isNull(res) ? "" : res[res.length - 1];
}
},
getLastValidValue: function () {
return this.editor.getLastValidValue();
},
setValue: function (v) {
this.editor.setValue(v);
if (BI.isKey(v)) {
this.clear.visible();
}
},
isEditing: function () {
return this.editor.isEditing();
},
isValid: function () {
return this.editor.isValid();
}
});
BI.SearchEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.SearchEditor.EVENT_FOCUS = "EVENT_FOCUS";
BI.SearchEditor.EVENT_BLUR = "EVENT_BLUR";
BI.SearchEditor.EVENT_CLICK = "EVENT_CLICK";
BI.SearchEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
BI.SearchEditor.EVENT_SPACE = "EVENT_SPACE";
BI.SearchEditor.EVENT_BACKSPACE = "EVENT_BACKSPACE";
BI.SearchEditor.EVENT_CLEAR = "EVENT_CLEAR";
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_VALID = "EVENT_VALID";
BI.SearchEditor.EVENT_ERROR = "EVENT_ERROR";
BI.SearchEditor.EVENT_ENTER = "EVENT_ENTER";
BI.SearchEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.SearchEditor.EVENT_REMOVE = "EVENT_REMOVE";
BI.SearchEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.search_editor", BI.SearchEditor);/**
* 小号搜索框
* Created by GUY on 2015/9/29.
* @class BI.SmallSearchEditor
* @extends BI.SearchEditor
*/
BI.SmallSearchEditor = BI.inherit(BI.SearchEditor, {
_defaultConfig: function () {
var conf = BI.SmallSearchEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-small-search-editor",
height: 24
});
},
_init: function () {
BI.SmallSearchEditor.superclass._init.apply(this, arguments);
}
});
BI.shortcut("bi.small_search_editor", BI.SmallSearchEditor);/**
* guy
* @class BI.TextEditor
* @extends BI.Single
*/
BI.TextEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.TextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
extraCls: "bi-text-editor bi-border",
hgap: 4,
vgap: 2,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0,
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,
allowBlank: false,
watermark: "",
errorText: "",
height: 30
})
},
_init: function () {
BI.TextEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (BI.isNumber(o.height)) {
this.element.css({height: o.height - 2});
}
if (BI.isNumber(o.width)) {
this.element.css({width: o.width - 2});
}
this.editor = BI.createWidget({
type: "bi.editor",
height: o.height - 2,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
value: o.value,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.editor.on(BI.Editor.EVENT_FOCUS, function () {
self.fireEvent(BI.TextEditor.EVENT_FOCUS);
});
this.editor.on(BI.Editor.EVENT_BLUR, function () {
self.fireEvent(BI.TextEditor.EVENT_BLUR);
});
this.editor.on(BI.Editor.EVENT_CLICK, function () {
self.fireEvent(BI.TextEditor.EVENT_CLICK);
});
this.editor.on(BI.Editor.EVENT_CHANGE, function () {
self.fireEvent(BI.TextEditor.EVENT_CHANGE);
});
this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.TextEditor.EVENT_KEY_DOWN);
});
this.editor.on(BI.Editor.EVENT_SPACE, function (v) {
self.fireEvent(BI.TextEditor.EVENT_SPACE);
});
this.editor.on(BI.Editor.EVENT_BACKSPACE, function (v) {
self.fireEvent(BI.TextEditor.EVENT_BACKSPACE);
});
this.editor.on(BI.Editor.EVENT_VALID, function () {
self.fireEvent(BI.TextEditor.EVENT_VALID);
});
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.TextEditor.EVENT_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_REMOVE, function (v) {
self.fireEvent(BI.TextEditor.EVENT_REMOVE);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.TextEditor.EVENT_START);
});
this.editor.on(BI.Editor.EVENT_PAUSE, function () {
self.fireEvent(BI.TextEditor.EVENT_PAUSE);
});
this.editor.on(BI.Editor.EVENT_STOP, function () {
self.fireEvent(BI.TextEditor.EVENT_STOP);
});
this.editor.on(BI.Editor.EVENT_ERROR, function () {
self.fireEvent(BI.TextEditor.EVENT_ERROR, arguments);
});
this.editor.on(BI.Editor.EVENT_ENTER, function () {
self.fireEvent(BI.TextEditor.EVENT_ENTER);
});
this.editor.on(BI.Editor.EVENT_RESTRICT, function () {
self.fireEvent(BI.TextEditor.EVENT_RESTRICT);
});
this.editor.on(BI.Editor.EVENT_EMPTY, function () {
self.fireEvent(BI.TextEditor.EVENT_EMPTY);
});
BI.createWidget({
type: "bi.vertical",
scrolly: false,
element: this,
items: [this.editor]
});
},
focus: function () {
this.editor.focus();
},
blur: function () {
this.editor.blur();
},
setErrorText: function (text) {
this.editor.setErrorText(text);
},
getErrorText: function () {
return this.editor.getErrorText();
},
isValid: function () {
return this.editor.isValid();
},
setValue: function (v) {
this.editor.setValue(v);
},
getValue: function () {
return this.editor.getValue();
}
});
BI.TextEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.TextEditor.EVENT_FOCUS = "EVENT_FOCUS";
BI.TextEditor.EVENT_BLUR = "EVENT_BLUR";
BI.TextEditor.EVENT_CLICK = "EVENT_CLICK";
BI.TextEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
BI.TextEditor.EVENT_SPACE = "EVENT_SPACE";
BI.TextEditor.EVENT_BACKSPACE = "EVENT_BACKSPACE";
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_VALID = "EVENT_VALID";
BI.TextEditor.EVENT_ERROR = "EVENT_ERROR";
BI.TextEditor.EVENT_ENTER = "EVENT_ENTER";
BI.TextEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.TextEditor.EVENT_REMOVE = "EVENT_REMOVE";
BI.TextEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.text_editor", BI.TextEditor);/**
* 小号搜索框
* Created by GUY on 2015/9/29.
* @class BI.SmallTextEditor
* @extends BI.SearchEditor
*/
BI.SmallTextEditor = BI.inherit(BI.TextEditor, {
_defaultConfig: function () {
var conf = BI.SmallTextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-small-text-editor",
height: 25
});
},
_init: function () {
BI.SmallTextEditor.superclass._init.apply(this, arguments);
}
});
BI.shortcut("bi.small_text_editor", BI.SmallTextEditor);/**
* *
* Created by GUY on 2016/3/28. * Created by GUY on 2016/3/28.
* @class BI.ExcelTableCell * @class BI.ExcelTableCell
@ -6739,8 +6629,8 @@ BI.MultiDateCombo = BI.inherit(BI.Single, {
}); });
var triggerBtn = BI.createWidget({ var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button", type: "bi.icon_button",
cls: "bi-trigger-date-button chart-date-normal-font", cls: "bi-trigger-icon-button date-font",
width: 30, width: 30,
height: 23 height: 23
}); });
@ -6753,7 +6643,7 @@ BI.MultiDateCombo = BI.inherit(BI.Single, {
}); });
this.changeIcon = BI.createWidget({ this.changeIcon = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: "bi-trigger-date-change widget-date-h-change-font", cls: "bi-trigger-icon-button date-change-h-font",
width: 30, width: 30,
height: 23 height: 23
}); });

2
demo/config.js

File diff suppressed because one or more lines are too long

27
demo/js/config/addons.js

@ -0,0 +1,27 @@
Demo.ADDONS_CONFIG = [{
id: 6,
text: "addons"
}, {
pId: 6,
id: 601,
text: "拓展图表控件"
}, {
pId: 601,
text: "柱状图",
value: "demo.axis_chart"
}, {
pId: 6,
id: 602,
text: "sliders"
}, {
pId: 602,
text: "bi.single_slider"
}, {
id: 100000,
text: "小demo",
value: "demo.platform_level_tree"
}, {
pId: 100000,
text: "平台用",
value: "demo.platform_level_tree"
}];

4
demo/js/config/base.js

@ -118,4 +118,8 @@ Demo.BASE_CONFIG = [{
pId: 2, pId: 2,
text: "bi.svg", text: "bi.svg",
value: "demo.svg" value: "demo.svg"
}, {
pId: 2,
text: "bi.canvas",
value: "demo.canvas"
}]; }];

148
demo/js/config/case.js

@ -2,6 +2,22 @@ Demo.CASE_CONFIG = [{
id: 3, id: 3,
text: "实例控件", text: "实例控件",
open: false open: false
}, {
pId: 3,
id: 300,
text: "按钮"
}, {
pId: 300,
text: "bi.multi_select_item",
value: "demo.multi_select_item"
}, {
pId: 300,
text: "bi.single_select_item",
value: "demo.single_select_item"
}, {
pId: 300,
text: "bi.single_select_radio_item",
value: "demo.single_select_radio_item"
}, { }, {
pId: 3, pId: 3,
id: 301, id: 301,
@ -22,58 +38,162 @@ Demo.CASE_CONFIG = [{
pId: 301, pId: 301,
text: "bi.state_editor", text: "bi.state_editor",
value: "demo.state_editor" value: "demo.state_editor"
}, {
pId: 301,
text: "bi.simple_state_editor",
value: "demo.simple_state_editor"
}, {
pId: 301,
text: "bi.clear_editor",
value: "demo.clear_editor"
}, { }, {
pId: 3, pId: 3,
id: 302, id: 302,
text: "combo" text: "列表"
}, {
pId: 302,
text: "bi.select_list",
value: "demo.select_list"
}, {
pId: 302,
text: "bi.lazy_loader",
value: "demo.lazy_loader"
}, {
pId: 302,
text: "bi.list_loader",
value: "demo.list_loader"
}, { }, {
pId: 302, pId: 302,
text: "bi.sort_list",
value: "demo.sort_list"
}, {
pId: 3,
id: 303,
text: "面板"
}, {
pId: 303,
text: "bi.pane_list",
value: "demo.pane_list"
}, {
pId: 303,
text: "bi.panel",
value: "demo.panel"
}, {
pId: 3,
id: 304,
text: "popup弹出层"
}, {
pId: 304,
text: "bi.multi_popup_view",
value: "demo.multi_popup_view"
}, {
pId: 304,
text: "bi.popup_panel",
value: "demo.popup_panel"
}, {
pId: 3,
id: 305,
text: "触发器trigger"
}, {
pId: 305,
text: "bi.editor_trigger",
value: "demo.editor_trigger"
}, {
pId: 305,
text: "bi.icon_trigger",
value: "demo.icon_trigger"
}, {
pId: 305,
text: "bi.text_trigger",
value: "demo.text_trigger"
}, {
pId: 305,
text: "bi.select_text_trigger",
value: "demo.select_text_trigger"
}, {
pId: 3,
id: 306,
text: "combo"
}, {
pId: 306,
text: "bi.bubble_combo", text: "bi.bubble_combo",
value: "demo.bubble_combo" value: "demo.bubble_combo"
}, {
pId: 306,
text: "bi.icon_combo",
value: "demo.icon_combo"
}, {
pId: 306,
text: "bi.static_combo",
value: "demo.static_combo"
}, {
pId: 306,
text: "bi.text_value_combo",
value: "demo.text_value_combo"
}, {
pId: 306,
text: "bi.text_value_check_combo",
value: "demo.text_value_check_combo"
}, {
pId: 306,
text: "bi.text_value_down_list_combo",
value: "demo.text_value_down_list_combo"
}, { }, {
pId: 3, pId: 3,
id: 303, id: 307,
text: "tree" text: "tree"
}, { }, {
pId: 303, pId: 307,
text: "bi.branch_tree", text: "bi.branch_tree",
value: "demo.branch_tree" value: "demo.branch_tree"
}, { }, {
pId: 303, pId: 307,
text: "bi.handstand_branch_tree", text: "bi.handstand_branch_tree",
value: "demo.handstand_branch_tree" value: "demo.handstand_branch_tree"
}, { }, {
pId: 303, pId: 307,
text: "bi.display_tree", text: "bi.display_tree",
value: "demo.display_tree" value: "demo.display_tree"
}, { }, {
pId: 303, pId: 307,
text: "bi.simple_tree", text: "bi.simple_tree",
value: "demo.simple_tree" value: "demo.simple_tree"
}, { }, {
pId: 303, pId: 307,
text: "bi.level_tree", text: "bi.level_tree",
value: "demo.level_tree" value: "demo.level_tree"
}, { }, {
pId: 303, pId: 307,
text: "bi.branch_relation", text: "bi.branch_relation",
value: "demo.branch_relation" value: "demo.branch_relation"
}, { }, {
pId: 3, pId: 3,
id: 304, id: 308,
text: "table" text: "table"
}, { }, {
pId: 304, pId: 308,
text: "bi.adaptive_table", text: "bi.adaptive_table",
value: "demo.adaptive_table" value: "demo.adaptive_table"
}, { }, {
pId: 304, pId: 308,
text: "bi.tree_table", text: "bi.tree_table",
value: "demo.tree_table" value: "demo.tree_table"
}, { }, {
pId: 304, pId: 308,
text: "bi.layer_tree_table", text: "bi.layer_tree_table",
value: "demo.layer_tree_table" value: "demo.layer_tree_table"
}, {
pId: 3,
id: 309,
text: "pager"
}, {
pId: 309,
text: "bi.all_count_pager",
value: "demo.all_count_pager"
}, {
pId: 309,
text: "bi.direction_pager",
value: "demo.direction_pager"
}, { }, {
pId: 3, pId: 3,
text: "bi.calendar", text: "bi.calendar",
@ -90,6 +210,10 @@ Demo.CASE_CONFIG = [{
pId: 3, pId: 3,
text: "bi.color_chooser", text: "bi.color_chooser",
value: "demo.color_chooser" value: "demo.color_chooser"
}, {
pId: 3,
text: "bi.color_chooser_popup",
value: "demo.color_chooser_popup"
}, { }, {
pId: 3, pId: 3,
text: "bi.segment", text: "bi.segment",

8
demo/js/config/chart.js

@ -1,8 +0,0 @@
Demo.CHART_CONFIG = [{
id: 6,
text: "图表控件"
}, {
pId: 6,
text: "柱状图",
value: "demo.axis_chart"
}];

4
demo/js/config/component.js

@ -20,8 +20,4 @@ Demo.COMPONENT_CONFIG = [{
pId: 5, pId: 5,
text: "bi.tree_value_chooser_pane", text: "bi.tree_value_chooser_pane",
value: "demo.tree_value_chooser_pane" value: "demo.tree_value_chooser_pane"
}, {
pId: 5,
text: "平台用",
value: "demo.platform_level_tree"
}]; }];

4
demo/js/config/core.js

@ -163,8 +163,8 @@ Demo.CORE_CONFIG = [{
value: "demo.layer_popup" value: "demo.layer_popup"
}, { }, {
pId: 10202, pId: 10202,
text: "bi.layer_searcher", text: "bi.searcher_view",
value: "demo.layer_searcher" value: "demo.searcher_view"
}, { }, {
pId: 1, pId: 1,
text: "widget", text: "widget",

7216
dist/bundle.js vendored

File diff suppressed because it is too large Load Diff

884
dist/case.js vendored

@ -6437,212 +6437,6 @@ BI.ClearEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.ClearEditor.EVENT_REMOVE = "EVENT_REMOVE"; BI.ClearEditor.EVENT_REMOVE = "EVENT_REMOVE";
BI.ClearEditor.EVENT_EMPTY = "EVENT_EMPTY"; BI.ClearEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.clear_editor", BI.ClearEditor);/** BI.shortcut("bi.clear_editor", BI.ClearEditor);/**
* Created by roy on 15/9/14.
*/
BI.SearchEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.SearchEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-search-editor bi-border",
height: 30,
errorText: "",
watermark: BI.i18nText("BI-Basic_Search"),
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn
});
},
_init: function () {
this.options.height -= 2;
BI.SearchEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.editor = BI.createWidget({
type: "bi.editor",
height: o.height,
watermark: o.watermark,
allowBlank: true,
errorText: o.errorText,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker
});
this.clear = BI.createWidget({
type: "bi.icon_button",
stopEvent: true,
cls: "search-close-h-font"
});
this.clear.on(BI.IconButton.EVENT_CHANGE, function () {
self.setValue("");
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT);
self.fireEvent(BI.SearchEditor.EVENT_CLEAR);
});
BI.createWidget({
element: this,
type: "bi.htape",
items: [
{
el: {
type: "bi.center_adapt",
cls: "search-font",
items: [{
el: {
type: "bi.icon"
}
}]
},
width: 25
},
{
el: self.editor
},
{
el: this.clear,
width: 25
}
]
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.editor.on(BI.Editor.EVENT_FOCUS, function () {
self.fireEvent(BI.SearchEditor.EVENT_FOCUS);
});
this.editor.on(BI.Editor.EVENT_BLUR, function () {
self.fireEvent(BI.SearchEditor.EVENT_BLUR);
});
this.editor.on(BI.Editor.EVENT_CLICK, function () {
self.fireEvent(BI.SearchEditor.EVENT_CLICK);
});
this.editor.on(BI.Editor.EVENT_CHANGE, function () {
self._checkClear();
self.fireEvent(BI.SearchEditor.EVENT_CHANGE);
});
this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.SearchEditor.EVENT_KEY_DOWN, v);
});
this.editor.on(BI.Editor.EVENT_SPACE, function () {
self.fireEvent(BI.SearchEditor.EVENT_SPACE)
});
this.editor.on(BI.Editor.EVENT_BACKSPACE, function () {
self.fireEvent(BI.SearchEditor.EVENT_BACKSPACE)
});
this.editor.on(BI.Editor.EVENT_VALID, function () {
self.fireEvent(BI.SearchEditor.EVENT_VALID)
});
this.editor.on(BI.Editor.EVENT_ERROR, function () {
self.fireEvent(BI.SearchEditor.EVENT_ERROR)
});
this.editor.on(BI.Editor.EVENT_ENTER, function () {
self.fireEvent(BI.SearchEditor.EVENT_ENTER);
});
this.editor.on(BI.Editor.EVENT_RESTRICT, function () {
self.fireEvent(BI.SearchEditor.EVENT_RESTRICT)
});
this.editor.on(BI.Editor.EVENT_EMPTY, function () {
self._checkClear();
self.fireEvent(BI.SearchEditor.EVENT_EMPTY)
});
this.editor.on(BI.Editor.EVENT_REMOVE, function () {
self.fireEvent(BI.SearchEditor.EVENT_REMOVE)
});
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.SearchEditor.EVENT_CONFIRM)
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.SearchEditor.EVENT_START);
});
this.editor.on(BI.Editor.EVENT_PAUSE, function () {
self.fireEvent(BI.SearchEditor.EVENT_PAUSE);
});
this.editor.on(BI.Editor.EVENT_STOP, function () {
self.fireEvent(BI.SearchEditor.EVENT_STOP);
});
this.clear.invisible();
},
_checkClear: function () {
if (!this.getValue()) {
this.clear.invisible();
} else {
this.clear.visible();
}
},
focus: function () {
this.editor.focus();
},
blur: function () {
this.editor.blur();
},
getValue: function () {
if (this.isValid()) {
var res = this.editor.getValue().match(/[\S]+/g);
return BI.isNull(res) ? "" : res[res.length - 1];
}
},
getLastValidValue: function () {
return this.editor.getLastValidValue();
},
setValue: function (v) {
this.editor.setValue(v);
if (BI.isKey(v)) {
this.clear.visible();
}
},
isEditing: function () {
return this.editor.isEditing();
},
isValid: function () {
return this.editor.isValid();
}
});
BI.SearchEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.SearchEditor.EVENT_FOCUS = "EVENT_FOCUS";
BI.SearchEditor.EVENT_BLUR = "EVENT_BLUR";
BI.SearchEditor.EVENT_CLICK = "EVENT_CLICK";
BI.SearchEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
BI.SearchEditor.EVENT_SPACE = "EVENT_SPACE";
BI.SearchEditor.EVENT_BACKSPACE = "EVENT_BACKSPACE";
BI.SearchEditor.EVENT_CLEAR = "EVENT_CLEAR";
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_VALID = "EVENT_VALID";
BI.SearchEditor.EVENT_ERROR = "EVENT_ERROR";
BI.SearchEditor.EVENT_ENTER = "EVENT_ENTER";
BI.SearchEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.SearchEditor.EVENT_REMOVE = "EVENT_REMOVE";
BI.SearchEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.search_editor", BI.SearchEditor);/**
* 小号搜索框
* Created by GUY on 2015/9/29.
* @class BI.SmallSearchEditor
* @extends BI.SearchEditor
*/
BI.SmallSearchEditor = BI.inherit(BI.SearchEditor, {
_defaultConfig: function () {
var conf = BI.SmallSearchEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-small-search-editor",
height: 24
});
},
_init: function () {
BI.SmallSearchEditor.superclass._init.apply(this, arguments);
}
});
BI.shortcut("bi.small_search_editor", BI.SmallSearchEditor);/**
* 带标记的文本框 * 带标记的文本框
* Created by GUY on 2016/1/25. * Created by GUY on 2016/1/25.
* @class BI.ShelterEditor * @class BI.ShelterEditor
@ -7952,187 +7746,6 @@ BI.SimpleStateEditor.EVENT_SPACE = "EVENT_SPACE";
BI.SimpleStateEditor.EVENT_EMPTY = "EVENT_EMPTY"; BI.SimpleStateEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor);/** BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor);/**
* guy
* @class BI.TextEditor
* @extends BI.Single
*/
BI.TextEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.TextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
extraCls: "bi-text-editor bi-border",
hgap: 4,
vgap: 2,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0,
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,
allowBlank: false,
watermark: "",
errorText: "",
height: 30
})
},
_init: function () {
BI.TextEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (BI.isNumber(o.height)) {
this.element.css({height: o.height - 2});
}
if (BI.isNumber(o.width)) {
this.element.css({width: o.width - 2});
}
this.editor = BI.createWidget({
type: "bi.editor",
height: o.height - 2,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
value: o.value,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.editor.on(BI.Editor.EVENT_FOCUS, function () {
self.fireEvent(BI.TextEditor.EVENT_FOCUS);
});
this.editor.on(BI.Editor.EVENT_BLUR, function () {
self.fireEvent(BI.TextEditor.EVENT_BLUR);
});
this.editor.on(BI.Editor.EVENT_CLICK, function () {
self.fireEvent(BI.TextEditor.EVENT_CLICK);
});
this.editor.on(BI.Editor.EVENT_CHANGE, function () {
self.fireEvent(BI.TextEditor.EVENT_CHANGE);
});
this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.TextEditor.EVENT_KEY_DOWN);
});
this.editor.on(BI.Editor.EVENT_SPACE, function (v) {
self.fireEvent(BI.TextEditor.EVENT_SPACE);
});
this.editor.on(BI.Editor.EVENT_BACKSPACE, function (v) {
self.fireEvent(BI.TextEditor.EVENT_BACKSPACE);
});
this.editor.on(BI.Editor.EVENT_VALID, function () {
self.fireEvent(BI.TextEditor.EVENT_VALID);
});
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.TextEditor.EVENT_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_REMOVE, function (v) {
self.fireEvent(BI.TextEditor.EVENT_REMOVE);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.TextEditor.EVENT_START);
});
this.editor.on(BI.Editor.EVENT_PAUSE, function () {
self.fireEvent(BI.TextEditor.EVENT_PAUSE);
});
this.editor.on(BI.Editor.EVENT_STOP, function () {
self.fireEvent(BI.TextEditor.EVENT_STOP);
});
this.editor.on(BI.Editor.EVENT_ERROR, function () {
self.fireEvent(BI.TextEditor.EVENT_ERROR, arguments);
});
this.editor.on(BI.Editor.EVENT_ENTER, function () {
self.fireEvent(BI.TextEditor.EVENT_ENTER);
});
this.editor.on(BI.Editor.EVENT_RESTRICT, function () {
self.fireEvent(BI.TextEditor.EVENT_RESTRICT);
});
this.editor.on(BI.Editor.EVENT_EMPTY, function () {
self.fireEvent(BI.TextEditor.EVENT_EMPTY);
});
BI.createWidget({
type: "bi.vertical",
scrolly: false,
element: this,
items: [this.editor]
});
},
focus: function () {
this.editor.focus();
},
blur: function () {
this.editor.blur();
},
setErrorText: function (text) {
this.editor.setErrorText(text);
},
getErrorText: function () {
return this.editor.getErrorText();
},
isValid: function () {
return this.editor.isValid();
},
setValue: function (v) {
this.editor.setValue(v);
},
getValue: function () {
return this.editor.getValue();
}
});
BI.TextEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.TextEditor.EVENT_FOCUS = "EVENT_FOCUS";
BI.TextEditor.EVENT_BLUR = "EVENT_BLUR";
BI.TextEditor.EVENT_CLICK = "EVENT_CLICK";
BI.TextEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
BI.TextEditor.EVENT_SPACE = "EVENT_SPACE";
BI.TextEditor.EVENT_BACKSPACE = "EVENT_BACKSPACE";
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_VALID = "EVENT_VALID";
BI.TextEditor.EVENT_ERROR = "EVENT_ERROR";
BI.TextEditor.EVENT_ENTER = "EVENT_ENTER";
BI.TextEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.TextEditor.EVENT_REMOVE = "EVENT_REMOVE";
BI.TextEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.text_editor", BI.TextEditor);/**
* 小号搜索框
* Created by GUY on 2015/9/29.
* @class BI.SmallTextEditor
* @extends BI.SearchEditor
*/
BI.SmallTextEditor = BI.inherit(BI.TextEditor, {
_defaultConfig: function () {
var conf = BI.SmallTextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-small-text-editor",
height: 25
});
},
_init: function () {
BI.SmallTextEditor.superclass._init.apply(this, arguments);
}
});
BI.shortcut("bi.small_text_editor", BI.SmallTextEditor);/**
* 有确定取消按钮的弹出层 * 有确定取消按钮的弹出层
* @class BI.BarFloatSection * @class BI.BarFloatSection
* @extends BI.FloatSection * @extends BI.FloatSection
@ -11891,6 +11504,503 @@ BI.MultiSelectBar = BI.inherit(BI.BasicButton, {
}); });
BI.MultiSelectBar.EVENT_CHANGE = "MultiSelectBar.EVENT_CHANGE"; BI.MultiSelectBar.EVENT_CHANGE = "MultiSelectBar.EVENT_CHANGE";
BI.shortcut("bi.multi_select_bar", BI.MultiSelectBar);/** BI.shortcut("bi.multi_select_bar", BI.MultiSelectBar);/**
* 表关联树
*
* Created by GUY on 2015/12/15.
* @class BI.BranchRelation
* @extends BI.Widget
*/
BI.BranchRelation = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.BranchRelation.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-branch-relation-tree",
items: [],
centerOffset: 0,//重心偏移量
direction: BI.Direction.Bottom,
align: BI.VerticalAlign.Top
})
},
_init: function () {
BI.BranchRelation.superclass._init.apply(this, arguments);
this.populate(this.options.items);
},
//树分层
_stratification: function () {
var levels = [];
this.tree.recursion(function (node, route) {
//node.isRoot = route.length <= 1;
node.leaf = node.isLeaf();
if (!levels[route.length - 1]) {
levels[route.length - 1] = [];
}
levels[route.length - 1].push(node);
});
return levels;
},
//计算所有节点的叶子结点个数
_calculateLeaves: function () {
var count = 0;
function track(node) {
var c = 0;
if (node.isLeaf()) {
return 1;
}
BI.each(node.getChildren(), function (i, child) {
c += track(child);
});
node.set("leaves", c);
return c;
}
count = track(this.tree.getRoot());
return count;
},
//树平移
_translate: function (levels) {
var adjust = [];
var maxLevel = levels.length;
BI.each(levels, function (i, nodes) {
if (!adjust[i]) {
adjust[i] = [];
}
BI.each(nodes, function (j, node) {
if (node.isLeaf() && i < maxLevel - 1) {
var newNode = new BI.Node(BI.UUID());
//newNode.isEmptyRoot = node.isRoot || node.isEmptyRoot;
newNode.isNew = true;
//把node向下一层移
var tar = 0;
if (j > 0) {
var c = nodes[j - 1].getLastChild();
tar = levels[i + 1].indexOf(c) + 1;
}
levels[i + 1].splice(tar, 0, node);
//新增一个临时树节点
var index = node.parent.getChildIndex(node.id);
node.parent.removeChildByIndex(index);
node.parent.addChild(newNode, index);
newNode.addChild(node);
adjust[i].push(newNode);
nodes[j] = newNode;
} else {
adjust[i].push(node);
}
})
});
return adjust;
},
//树补白
_fill: function (levels) {
var adjust = [];
var maxLevel = levels.length;
BI.each(levels, function (i, nodes) {
if (!adjust[i]) {
adjust[i] = [];
}
BI.each(nodes, function (j, node) {
if (node.isLeaf() && i < maxLevel - 1) {
var newNode = new BI.Node(BI.UUID());
newNode.leaf = true;
newNode.width = node.width;
newNode.height = node.height;
newNode.isNew = true;
//把node向下一层移
var tar = 0;
if (j > 0) {
var c = nodes[j - 1].getLastChild();
tar = levels[i + 1].indexOf(c) + 1;
}
levels[i + 1].splice(tar, 0, newNode);
//新增一个临时树节点
node.addChild(newNode);
}
adjust[i].push(node);
})
});
return adjust;
},
//树调整
_adjust: function (adjust) {
while (true) {
var isAllNeedAjust = false;
BI.backEach(adjust, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (!node.isNew) {
var needAdjust = true;
BI.any(node.getChildren(), function (k, n) {
if (!n.isNew) {
needAdjust = false;
return true;
}
});
if (!node.isLeaf() && needAdjust === true) {
var allChilds = [];
BI.each(node.getChildren(), function (k, n) {
allChilds = allChilds.concat(n.getChildren());
});
node.removeAllChilds();
BI.each(allChilds, function (k, c) {
node.addChild(c);
});
var newNode = new BI.Node(BI.UUID());
//newNode.isEmptyRoot = node.isRoot || node.isEmptyRoot;
newNode.isNew = true;
var index = node.parent.getChildIndex(node.id);
node.parent.removeChildByIndex(index);
node.parent.addChild(newNode, index);
newNode.addChild(node);
isAllNeedAjust = true;
}
}
})
});
if (isAllNeedAjust === false) {
break;
} else {//树重构
adjust = this._stratification();
}
}
return adjust;
},
_calculateWidth: function () {
var o = this.options;
var width = 0;
function track1(node) {
var w = 0;
if (node.isLeaf()) {
return node.width;
}
BI.each(node.getChildren(), function (i, child) {
w += track1(child);
});
return w;
}
function track2(node) {
var w = 0;
if (node.isLeaf()) {
return node.height;
}
BI.each(node.getChildren(), function (i, child) {
w += track2(child);
});
return w;
}
if (this._isVertical()) {
width = track1(this.tree.getRoot());
} else {
width = track2(this.tree.getRoot());
}
return width;
},
_isVertical: function () {
var o = this.options;
return o.direction === BI.Direction.Top || o.direction === BI.Direction.Bottom;
},
_calculateHeight: function () {
var o = this.options;
var height = 0;
function track1(node) {
var h = 0;
BI.each(node.getChildren(), function (i, child) {
h = Math.max(h, track1(child));
});
return h + (node.height || 0);
}
function track2(node) {
var h = 0;
BI.each(node.getChildren(), function (i, child) {
h = Math.max(h, track2(child));
});
return h + (node.width || 0);
}
if (this._isVertical()) {
height = track1(this.tree.getRoot());
} else {
height = track2(this.tree.getRoot());
}
return height;
},
_calculateXY: function (levels) {
var o = this.options;
var width = this._calculateWidth();
var height = this._calculateHeight();
var levelCount = levels.length;
var allLeavesCount = this._calculateLeaves();
//计算坐标
var xy = {};
var levelHeight = height / levelCount;
BI.each(levels, function (i, nodes) {
//计算权重
var weights = [];
BI.each(nodes, function (j, node) {
weights[j] = (node.get("leaves") || 1) / allLeavesCount;
});
BI.each(nodes, function (j, node) {
//求前j个元素的权重
var weight = BI.sum(weights.slice(0, j));
//求坐标
var x = weight * width + weights[j] * width / 2;
var y = i * levelHeight + levelHeight / 2;
xy[node.id] = {x: x, y: y};
})
});
return xy;
},
_stroke: function (levels, xy) {
var height = this._calculateHeight();
var levelCount = levels.length;
var levelHeight = height / levelCount;
var self = this, o = this.options;
switch (o.direction) {
case BI.Direction.Top:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y + levelHeight / 2;
path += "M" + start.x + "," + (start.y + o.centerOffset) + "L" + start.x + "," + split;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + e.x + "," + (e.y + o.centerOffset) + "L" + e.x + "," + split;
});
if (end.length > 0) {
path += "M" + BI.first(end).x + "," + split + "L" + BI.last(end).x + "," + split;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
case BI.Direction.Bottom:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y - levelHeight / 2;
path += "M" + start.x + "," + (start.y - o.centerOffset) + "L" + start.x + "," + split;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + e.x + "," + (e.y - o.centerOffset) + "L" + e.x + "," + split;
});
if (end.length > 0) {
path += "M" + BI.first(end).x + "," + split + "L" + BI.last(end).x + "," + split;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
case BI.Direction.Left:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y + levelHeight / 2;
path += "M" + (start.y + o.centerOffset) + "," + start.x + "L" + split + "," + start.x;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + (e.y + o.centerOffset) + "," + e.x + "L" + split + "," + e.x;
});
if (end.length > 0) {
path += "M" + split + "," + BI.first(end).x + "L" + split + "," + BI.last(end).x;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
case BI.Direction.Right:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y - levelHeight / 2;
path += "M" + (start.y - o.centerOffset) + "," + start.x + "L" + split + "," + start.x;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + (e.y - o.centerOffset) + "," + e.x + "L" + split + "," + e.x;
});
if (end.length > 0) {
path += "M" + split + "," + BI.first(end).x + "L" + split + "," + BI.last(end).x;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
}
},
_createBranches: function (levels) {
var self = this, o = this.options;
if (o.direction === BI.Direction.Bottom || o.direction === BI.Direction.Right) {
levels = levels.reverse();
}
var xy = this._calculateXY(levels);
//画图
this._stroke(levels, xy);
},
_isNeedAdjust: function () {
var o = this.options;
return o.direction === BI.Direction.Top && o.align === BI.VerticalAlign.Bottom || o.direction === BI.Direction.Bottom && o.align === BI.VerticalAlign.Top
|| o.direction === BI.Direction.Left && o.align === BI.HorizontalAlign.Right || o.direction === BI.Direction.Right && o.align === BI.HorizontalAlign.Left
},
setValue: function (value) {
},
getValue: function () {
},
_transformToTreeFormat: function (sNodes) {
var i, l;
if (!sNodes) {
return [];
}
if (BI.isArray(sNodes)) {
var r = [];
var tmpMap = [];
for (i = 0, l = sNodes.length; i < l; i++) {
tmpMap[sNodes[i].id] = sNodes[i];
}
for (i = 0, l = sNodes.length; i < l; i++) {
if (tmpMap[sNodes[i].pId] && sNodes[i].id != sNodes[i].pId) {
if (!tmpMap[sNodes[i].pId].children) {
tmpMap[sNodes[i].pId].children = [];
}
tmpMap[sNodes[i].pId].children.push(sNodes[i]);
} else {
r.push(sNodes[i]);
}
}
return r;
} else {
return [sNodes];
}
},
populate: function (items) {
var self = this, o = this.options;
o.items = items || [];
this.empty();
items = this._transformToTreeFormat(o.items);
this.tree = new BI.Tree();
this.tree.initTree(items);
this.svg = BI.createWidget({
type: "bi.svg"
});
//树分层
var levels = this._stratification();
if (this._isNeedAdjust()) {
//树平移
var adjust = this._translate(levels);
//树调整
adjust = this._adjust(adjust);
this._createBranches(adjust);
} else {
var adjust = this._fill(levels);
this._createBranches(adjust);
}
var container = BI.createWidget({
type: "bi.layout",
width: this._isVertical() ? this._calculateWidth() : this._calculateHeight(),
height: this._isVertical() ? this._calculateHeight() : this._calculateWidth()
});
BI.createWidget({
type: "bi.absolute",
element: container,
items: [{
el: this.svg,
top: 0,
left: 0,
right: 0,
bottom: 0
}]
});
if (this._isVertical()) {
items = [{
type: "bi.handstand_branch_tree",
expander: {
direction: o.direction
},
el: {
layouts: [{
type: "bi.horizontal_adapt",
verticalAlign: o.align
}]
},
items: items
}]
} else {
items = [{
type: "bi.branch_tree",
expander: {
direction: o.direction
},
el: {
layouts: [{
type: "bi.vertical"
}, {
type: o.align === BI.HorizontalAlign.Left ? "bi.left" : "bi.right"
}]
},
items: items
}]
}
BI.createWidget({
type: "bi.adaptive",
element: container,
items: items
});
BI.createWidget({
type: "bi.center_adapt",
scrollable: true,
element: this,
items: [container]
});
}
});
BI.BranchRelation.EVENT_CHANGE = "BranchRelation.EVENT_CHANGE";
BI.shortcut("bi.branch_relation", BI.BranchRelation);/**
* 倒立的Branch * 倒立的Branch
* @class BI.HandStandBranchExpander * @class BI.HandStandBranchExpander
* @extend BI.Widget * @extend BI.Widget

197
dist/demo.js vendored

File diff suppressed because one or more lines are too long

30
dist/resource.css vendored

@ -466,6 +466,36 @@ textarea::-webkit-scrollbar-thumb:hover {
content: "\e604"; content: "\e604";
color: inherit; color: inherit;
} }
.date-font .b-font {
*zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#xe61b;');
}
.date-font .b-font:before {
content: "\e61b";
color: inherit;
}
.date-font.native .b-font:before,
.date-font.disabled .b-font:before {
content: "\e61b";
color: inherit;
}
.date-change-h-font .b-font {
*zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#xe660;');
}
.date-change-h-font .b-font:before {
content: "\e660";
color: inherit;
}
.date-change-h-font:hover .b-font:before,
.date-change-h-font:focus .b-font:before,
.date-change-h-font.hover .b-font:before {
content: "\e660";
color: inherit;
}
.date-change-h-font.native .b-font:before,
.date-change-h-font.disabled .b-font:before {
content: "\e660";
color: inherit;
}
.dot-font .b-font { .dot-font .b-font {
*zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#xe606;'); *zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#xe606;');
} }

896
dist/widget.js vendored

@ -1842,503 +1842,6 @@ BI.extend(BI.Arrangement, {
} }
}); });
BI.shortcut('bi.arrangement', BI.Arrangement);/** BI.shortcut('bi.arrangement', BI.Arrangement);/**
* 表关联树
*
* Created by GUY on 2015/12/15.
* @class BI.BranchRelation
* @extends BI.Widget
*/
BI.BranchRelation = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.BranchRelation.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-branch-relation-tree",
items: [],
centerOffset: 0,//重心偏移量
direction: BI.Direction.Bottom,
align: BI.VerticalAlign.Top
})
},
_init: function () {
BI.BranchRelation.superclass._init.apply(this, arguments);
this.populate(this.options.items);
},
//树分层
_stratification: function () {
var levels = [];
this.tree.recursion(function (node, route) {
//node.isRoot = route.length <= 1;
node.leaf = node.isLeaf();
if (!levels[route.length - 1]) {
levels[route.length - 1] = [];
}
levels[route.length - 1].push(node);
});
return levels;
},
//计算所有节点的叶子结点个数
_calculateLeaves: function () {
var count = 0;
function track(node) {
var c = 0;
if (node.isLeaf()) {
return 1;
}
BI.each(node.getChildren(), function (i, child) {
c += track(child);
});
node.set("leaves", c);
return c;
}
count = track(this.tree.getRoot());
return count;
},
//树平移
_translate: function (levels) {
var adjust = [];
var maxLevel = levels.length;
BI.each(levels, function (i, nodes) {
if (!adjust[i]) {
adjust[i] = [];
}
BI.each(nodes, function (j, node) {
if (node.isLeaf() && i < maxLevel - 1) {
var newNode = new BI.Node(BI.UUID());
//newNode.isEmptyRoot = node.isRoot || node.isEmptyRoot;
newNode.isNew = true;
//把node向下一层移
var tar = 0;
if (j > 0) {
var c = nodes[j - 1].getLastChild();
tar = levels[i + 1].indexOf(c) + 1;
}
levels[i + 1].splice(tar, 0, node);
//新增一个临时树节点
var index = node.parent.getChildIndex(node.id);
node.parent.removeChildByIndex(index);
node.parent.addChild(newNode, index);
newNode.addChild(node);
adjust[i].push(newNode);
nodes[j] = newNode;
} else {
adjust[i].push(node);
}
})
});
return adjust;
},
//树补白
_fill: function (levels) {
var adjust = [];
var maxLevel = levels.length;
BI.each(levels, function (i, nodes) {
if (!adjust[i]) {
adjust[i] = [];
}
BI.each(nodes, function (j, node) {
if (node.isLeaf() && i < maxLevel - 1) {
var newNode = new BI.Node(BI.UUID());
newNode.leaf = true;
newNode.width = node.width;
newNode.height = node.height;
newNode.isNew = true;
//把node向下一层移
var tar = 0;
if (j > 0) {
var c = nodes[j - 1].getLastChild();
tar = levels[i + 1].indexOf(c) + 1;
}
levels[i + 1].splice(tar, 0, newNode);
//新增一个临时树节点
node.addChild(newNode);
}
adjust[i].push(node);
})
});
return adjust;
},
//树调整
_adjust: function (adjust) {
while (true) {
var isAllNeedAjust = false;
BI.backEach(adjust, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (!node.isNew) {
var needAdjust = true;
BI.any(node.getChildren(), function (k, n) {
if (!n.isNew) {
needAdjust = false;
return true;
}
});
if (!node.isLeaf() && needAdjust === true) {
var allChilds = [];
BI.each(node.getChildren(), function (k, n) {
allChilds = allChilds.concat(n.getChildren());
});
node.removeAllChilds();
BI.each(allChilds, function (k, c) {
node.addChild(c);
});
var newNode = new BI.Node(BI.UUID());
//newNode.isEmptyRoot = node.isRoot || node.isEmptyRoot;
newNode.isNew = true;
var index = node.parent.getChildIndex(node.id);
node.parent.removeChildByIndex(index);
node.parent.addChild(newNode, index);
newNode.addChild(node);
isAllNeedAjust = true;
}
}
})
});
if (isAllNeedAjust === false) {
break;
} else {//树重构
adjust = this._stratification();
}
}
return adjust;
},
_calculateWidth: function () {
var o = this.options;
var width = 0;
function track1(node) {
var w = 0;
if (node.isLeaf()) {
return node.width;
}
BI.each(node.getChildren(), function (i, child) {
w += track1(child);
});
return w;
}
function track2(node) {
var w = 0;
if (node.isLeaf()) {
return node.height;
}
BI.each(node.getChildren(), function (i, child) {
w += track2(child);
});
return w;
}
if (this._isVertical()) {
width = track1(this.tree.getRoot());
} else {
width = track2(this.tree.getRoot());
}
return width;
},
_isVertical: function () {
var o = this.options;
return o.direction === BI.Direction.Top || o.direction === BI.Direction.Bottom;
},
_calculateHeight: function () {
var o = this.options;
var height = 0;
function track1(node) {
var h = 0;
BI.each(node.getChildren(), function (i, child) {
h = Math.max(h, track1(child));
});
return h + (node.height || 0);
}
function track2(node) {
var h = 0;
BI.each(node.getChildren(), function (i, child) {
h = Math.max(h, track2(child));
});
return h + (node.width || 0);
}
if (this._isVertical()) {
height = track1(this.tree.getRoot());
} else {
height = track2(this.tree.getRoot());
}
return height;
},
_calculateXY: function (levels) {
var o = this.options;
var width = this._calculateWidth();
var height = this._calculateHeight();
var levelCount = levels.length;
var allLeavesCount = this._calculateLeaves();
//计算坐标
var xy = {};
var levelHeight = height / levelCount;
BI.each(levels, function (i, nodes) {
//计算权重
var weights = [];
BI.each(nodes, function (j, node) {
weights[j] = (node.get("leaves") || 1) / allLeavesCount;
});
BI.each(nodes, function (j, node) {
//求前j个元素的权重
var weight = BI.sum(weights.slice(0, j));
//求坐标
var x = weight * width + weights[j] * width / 2;
var y = i * levelHeight + levelHeight / 2;
xy[node.id] = {x: x, y: y};
})
});
return xy;
},
_stroke: function (levels, xy) {
var height = this._calculateHeight();
var levelCount = levels.length;
var levelHeight = height / levelCount;
var self = this, o = this.options;
switch (o.direction) {
case BI.Direction.Top:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y + levelHeight / 2;
path += "M" + start.x + "," + (start.y + o.centerOffset) + "L" + start.x + "," + split;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + e.x + "," + (e.y + o.centerOffset) + "L" + e.x + "," + split;
});
if (end.length > 0) {
path += "M" + BI.first(end).x + "," + split + "L" + BI.last(end).x + "," + split;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
case BI.Direction.Bottom:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y - levelHeight / 2;
path += "M" + start.x + "," + (start.y - o.centerOffset) + "L" + start.x + "," + split;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + e.x + "," + (e.y - o.centerOffset) + "L" + e.x + "," + split;
});
if (end.length > 0) {
path += "M" + BI.first(end).x + "," + split + "L" + BI.last(end).x + "," + split;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
case BI.Direction.Left:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y + levelHeight / 2;
path += "M" + (start.y + o.centerOffset) + "," + start.x + "L" + split + "," + start.x;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + (e.y + o.centerOffset) + "," + e.x + "L" + split + "," + e.x;
});
if (end.length > 0) {
path += "M" + split + "," + BI.first(end).x + "L" + split + "," + BI.last(end).x;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
case BI.Direction.Right:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y - levelHeight / 2;
path += "M" + (start.y - o.centerOffset) + "," + start.x + "L" + split + "," + start.x;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + (e.y - o.centerOffset) + "," + e.x + "L" + split + "," + e.x;
});
if (end.length > 0) {
path += "M" + split + "," + BI.first(end).x + "L" + split + "," + BI.last(end).x;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
})
});
break;
}
},
_createBranches: function (levels) {
var self = this, o = this.options;
if (o.direction === BI.Direction.Bottom || o.direction === BI.Direction.Right) {
levels = levels.reverse();
}
var xy = this._calculateXY(levels);
//画图
this._stroke(levels, xy);
},
_isNeedAdjust: function () {
var o = this.options;
return o.direction === BI.Direction.Top && o.align === BI.VerticalAlign.Bottom || o.direction === BI.Direction.Bottom && o.align === BI.VerticalAlign.Top
|| o.direction === BI.Direction.Left && o.align === BI.HorizontalAlign.Right || o.direction === BI.Direction.Right && o.align === BI.HorizontalAlign.Left
},
setValue: function (value) {
},
getValue: function () {
},
_transformToTreeFormat: function (sNodes) {
var i, l;
if (!sNodes) {
return [];
}
if (BI.isArray(sNodes)) {
var r = [];
var tmpMap = [];
for (i = 0, l = sNodes.length; i < l; i++) {
tmpMap[sNodes[i].id] = sNodes[i];
}
for (i = 0, l = sNodes.length; i < l; i++) {
if (tmpMap[sNodes[i].pId] && sNodes[i].id != sNodes[i].pId) {
if (!tmpMap[sNodes[i].pId].children) {
tmpMap[sNodes[i].pId].children = [];
}
tmpMap[sNodes[i].pId].children.push(sNodes[i]);
} else {
r.push(sNodes[i]);
}
}
return r;
} else {
return [sNodes];
}
},
populate: function (items) {
var self = this, o = this.options;
o.items = items || [];
this.empty();
items = this._transformToTreeFormat(o.items);
this.tree = new BI.Tree();
this.tree.initTree(items);
this.svg = BI.createWidget({
type: "bi.svg"
});
//树分层
var levels = this._stratification();
if (this._isNeedAdjust()) {
//树平移
var adjust = this._translate(levels);
//树调整
adjust = this._adjust(adjust);
this._createBranches(adjust);
} else {
var adjust = this._fill(levels);
this._createBranches(adjust);
}
var container = BI.createWidget({
type: "bi.layout",
width: this._isVertical() ? this._calculateWidth() : this._calculateHeight(),
height: this._isVertical() ? this._calculateHeight() : this._calculateWidth()
});
BI.createWidget({
type: "bi.absolute",
element: container,
items: [{
el: this.svg,
top: 0,
left: 0,
right: 0,
bottom: 0
}]
});
if (this._isVertical()) {
items = [{
type: "bi.handstand_branch_tree",
expander: {
direction: o.direction
},
el: {
layouts: [{
type: "bi.horizontal_adapt",
verticalAlign: o.align
}]
},
items: items
}]
} else {
items = [{
type: "bi.branch_tree",
expander: {
direction: o.direction
},
el: {
layouts: [{
type: "bi.vertical"
}, {
type: o.align === BI.HorizontalAlign.Left ? "bi.left" : "bi.right"
}]
},
items: items
}]
}
BI.createWidget({
type: "bi.adaptive",
element: container,
items: items
});
BI.createWidget({
type: "bi.center_adapt",
scrollable: true,
element: this,
items: [container]
});
}
});
BI.BranchRelation.EVENT_CHANGE = "BranchRelation.EVENT_CHANGE";
BI.shortcut("bi.branch_relation", BI.BranchRelation);/**
* 日期控件中的月份下拉框 * 日期控件中的月份下拉框
* *
* Created by GUY on 2015/9/7. * Created by GUY on 2015/9/7.
@ -3250,7 +2753,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, {
} }
}); });
BI.shortcut("bi.date_pane_widget", BI.DatePaneWidget);/** BI.shortcut("bi.date_pane", BI.DatePaneWidget);/**
* Created by Urthur on 2017/7/14. * Created by Urthur on 2017/7/14.
*/ */
BI.DateTimeCombo = BI.inherit(BI.Single, { BI.DateTimeCombo = BI.inherit(BI.Single, {
@ -3328,8 +2831,8 @@ BI.DateTimeCombo = BI.inherit(BI.Single, {
}); });
var triggerBtn = BI.createWidget({ var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button", type: "bi.icon_button",
cls: "bi-trigger-date-button chart-date-normal-font bi-border-right", cls: "bi-trigger-icon-button date-font bi-border-right",
width: 30, width: 30,
height: 24 height: 24
}); });
@ -4557,6 +4060,393 @@ BI.DownListPopup = BI.inherit(BI.Pane, {
BI.DownListPopup.EVENT_CHANGE = "EVENT_CHANGE"; BI.DownListPopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.DownListPopup.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE"; BI.DownListPopup.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE";
BI.shortcut("bi.down_list_popup", BI.DownListPopup);/** BI.shortcut("bi.down_list_popup", BI.DownListPopup);/**
* Created by roy on 15/9/14.
*/
BI.SearchEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.SearchEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-search-editor bi-border",
height: 30,
errorText: "",
watermark: BI.i18nText("BI-Basic_Search"),
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn
});
},
_init: function () {
this.options.height -= 2;
BI.SearchEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.editor = BI.createWidget({
type: "bi.editor",
height: o.height,
watermark: o.watermark,
allowBlank: true,
errorText: o.errorText,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker
});
this.clear = BI.createWidget({
type: "bi.icon_button",
stopEvent: true,
cls: "search-close-h-font"
});
this.clear.on(BI.IconButton.EVENT_CHANGE, function () {
self.setValue("");
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT);
self.fireEvent(BI.SearchEditor.EVENT_CLEAR);
});
BI.createWidget({
element: this,
type: "bi.htape",
items: [
{
el: {
type: "bi.center_adapt",
cls: "search-font",
items: [{
el: {
type: "bi.icon"
}
}]
},
width: 25
},
{
el: self.editor
},
{
el: this.clear,
width: 25
}
]
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.editor.on(BI.Editor.EVENT_FOCUS, function () {
self.fireEvent(BI.SearchEditor.EVENT_FOCUS);
});
this.editor.on(BI.Editor.EVENT_BLUR, function () {
self.fireEvent(BI.SearchEditor.EVENT_BLUR);
});
this.editor.on(BI.Editor.EVENT_CLICK, function () {
self.fireEvent(BI.SearchEditor.EVENT_CLICK);
});
this.editor.on(BI.Editor.EVENT_CHANGE, function () {
self._checkClear();
self.fireEvent(BI.SearchEditor.EVENT_CHANGE);
});
this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.SearchEditor.EVENT_KEY_DOWN, v);
});
this.editor.on(BI.Editor.EVENT_SPACE, function () {
self.fireEvent(BI.SearchEditor.EVENT_SPACE)
});
this.editor.on(BI.Editor.EVENT_BACKSPACE, function () {
self.fireEvent(BI.SearchEditor.EVENT_BACKSPACE)
});
this.editor.on(BI.Editor.EVENT_VALID, function () {
self.fireEvent(BI.SearchEditor.EVENT_VALID)
});
this.editor.on(BI.Editor.EVENT_ERROR, function () {
self.fireEvent(BI.SearchEditor.EVENT_ERROR)
});
this.editor.on(BI.Editor.EVENT_ENTER, function () {
self.fireEvent(BI.SearchEditor.EVENT_ENTER);
});
this.editor.on(BI.Editor.EVENT_RESTRICT, function () {
self.fireEvent(BI.SearchEditor.EVENT_RESTRICT)
});
this.editor.on(BI.Editor.EVENT_EMPTY, function () {
self._checkClear();
self.fireEvent(BI.SearchEditor.EVENT_EMPTY)
});
this.editor.on(BI.Editor.EVENT_REMOVE, function () {
self.fireEvent(BI.SearchEditor.EVENT_REMOVE)
});
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.SearchEditor.EVENT_CONFIRM)
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.SearchEditor.EVENT_START);
});
this.editor.on(BI.Editor.EVENT_PAUSE, function () {
self.fireEvent(BI.SearchEditor.EVENT_PAUSE);
});
this.editor.on(BI.Editor.EVENT_STOP, function () {
self.fireEvent(BI.SearchEditor.EVENT_STOP);
});
this.clear.invisible();
},
_checkClear: function () {
if (!this.getValue()) {
this.clear.invisible();
} else {
this.clear.visible();
}
},
focus: function () {
this.editor.focus();
},
blur: function () {
this.editor.blur();
},
getValue: function () {
if (this.isValid()) {
var res = this.editor.getValue().match(/[\S]+/g);
return BI.isNull(res) ? "" : res[res.length - 1];
}
},
getLastValidValue: function () {
return this.editor.getLastValidValue();
},
setValue: function (v) {
this.editor.setValue(v);
if (BI.isKey(v)) {
this.clear.visible();
}
},
isEditing: function () {
return this.editor.isEditing();
},
isValid: function () {
return this.editor.isValid();
}
});
BI.SearchEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.SearchEditor.EVENT_FOCUS = "EVENT_FOCUS";
BI.SearchEditor.EVENT_BLUR = "EVENT_BLUR";
BI.SearchEditor.EVENT_CLICK = "EVENT_CLICK";
BI.SearchEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
BI.SearchEditor.EVENT_SPACE = "EVENT_SPACE";
BI.SearchEditor.EVENT_BACKSPACE = "EVENT_BACKSPACE";
BI.SearchEditor.EVENT_CLEAR = "EVENT_CLEAR";
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_VALID = "EVENT_VALID";
BI.SearchEditor.EVENT_ERROR = "EVENT_ERROR";
BI.SearchEditor.EVENT_ENTER = "EVENT_ENTER";
BI.SearchEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.SearchEditor.EVENT_REMOVE = "EVENT_REMOVE";
BI.SearchEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.search_editor", BI.SearchEditor);/**
* 小号搜索框
* Created by GUY on 2015/9/29.
* @class BI.SmallSearchEditor
* @extends BI.SearchEditor
*/
BI.SmallSearchEditor = BI.inherit(BI.SearchEditor, {
_defaultConfig: function () {
var conf = BI.SmallSearchEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-small-search-editor",
height: 24
});
},
_init: function () {
BI.SmallSearchEditor.superclass._init.apply(this, arguments);
}
});
BI.shortcut("bi.small_search_editor", BI.SmallSearchEditor);/**
* guy
* @class BI.TextEditor
* @extends BI.Single
*/
BI.TextEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.TextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
extraCls: "bi-text-editor bi-border",
hgap: 4,
vgap: 2,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0,
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,
allowBlank: false,
watermark: "",
errorText: "",
height: 30
})
},
_init: function () {
BI.TextEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (BI.isNumber(o.height)) {
this.element.css({height: o.height - 2});
}
if (BI.isNumber(o.width)) {
this.element.css({width: o.width - 2});
}
this.editor = BI.createWidget({
type: "bi.editor",
height: o.height - 2,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
value: o.value,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.editor.on(BI.Editor.EVENT_FOCUS, function () {
self.fireEvent(BI.TextEditor.EVENT_FOCUS);
});
this.editor.on(BI.Editor.EVENT_BLUR, function () {
self.fireEvent(BI.TextEditor.EVENT_BLUR);
});
this.editor.on(BI.Editor.EVENT_CLICK, function () {
self.fireEvent(BI.TextEditor.EVENT_CLICK);
});
this.editor.on(BI.Editor.EVENT_CHANGE, function () {
self.fireEvent(BI.TextEditor.EVENT_CHANGE);
});
this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.TextEditor.EVENT_KEY_DOWN);
});
this.editor.on(BI.Editor.EVENT_SPACE, function (v) {
self.fireEvent(BI.TextEditor.EVENT_SPACE);
});
this.editor.on(BI.Editor.EVENT_BACKSPACE, function (v) {
self.fireEvent(BI.TextEditor.EVENT_BACKSPACE);
});
this.editor.on(BI.Editor.EVENT_VALID, function () {
self.fireEvent(BI.TextEditor.EVENT_VALID);
});
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.TextEditor.EVENT_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_REMOVE, function (v) {
self.fireEvent(BI.TextEditor.EVENT_REMOVE);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.TextEditor.EVENT_START);
});
this.editor.on(BI.Editor.EVENT_PAUSE, function () {
self.fireEvent(BI.TextEditor.EVENT_PAUSE);
});
this.editor.on(BI.Editor.EVENT_STOP, function () {
self.fireEvent(BI.TextEditor.EVENT_STOP);
});
this.editor.on(BI.Editor.EVENT_ERROR, function () {
self.fireEvent(BI.TextEditor.EVENT_ERROR, arguments);
});
this.editor.on(BI.Editor.EVENT_ENTER, function () {
self.fireEvent(BI.TextEditor.EVENT_ENTER);
});
this.editor.on(BI.Editor.EVENT_RESTRICT, function () {
self.fireEvent(BI.TextEditor.EVENT_RESTRICT);
});
this.editor.on(BI.Editor.EVENT_EMPTY, function () {
self.fireEvent(BI.TextEditor.EVENT_EMPTY);
});
BI.createWidget({
type: "bi.vertical",
scrolly: false,
element: this,
items: [this.editor]
});
},
focus: function () {
this.editor.focus();
},
blur: function () {
this.editor.blur();
},
setErrorText: function (text) {
this.editor.setErrorText(text);
},
getErrorText: function () {
return this.editor.getErrorText();
},
isValid: function () {
return this.editor.isValid();
},
setValue: function (v) {
this.editor.setValue(v);
},
getValue: function () {
return this.editor.getValue();
}
});
BI.TextEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.TextEditor.EVENT_FOCUS = "EVENT_FOCUS";
BI.TextEditor.EVENT_BLUR = "EVENT_BLUR";
BI.TextEditor.EVENT_CLICK = "EVENT_CLICK";
BI.TextEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
BI.TextEditor.EVENT_SPACE = "EVENT_SPACE";
BI.TextEditor.EVENT_BACKSPACE = "EVENT_BACKSPACE";
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_VALID = "EVENT_VALID";
BI.TextEditor.EVENT_ERROR = "EVENT_ERROR";
BI.TextEditor.EVENT_ENTER = "EVENT_ENTER";
BI.TextEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.TextEditor.EVENT_REMOVE = "EVENT_REMOVE";
BI.TextEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.text_editor", BI.TextEditor);/**
* 小号搜索框
* Created by GUY on 2015/9/29.
* @class BI.SmallTextEditor
* @extends BI.SearchEditor
*/
BI.SmallTextEditor = BI.inherit(BI.TextEditor, {
_defaultConfig: function () {
var conf = BI.SmallTextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-small-text-editor",
height: 25
});
},
_init: function () {
BI.SmallTextEditor.superclass._init.apply(this, arguments);
}
});
BI.shortcut("bi.small_text_editor", BI.SmallTextEditor);/**
* *
* Created by GUY on 2016/3/28. * Created by GUY on 2016/3/28.
* @class BI.ExcelTableCell * @class BI.ExcelTableCell
@ -6739,8 +6629,8 @@ BI.MultiDateCombo = BI.inherit(BI.Single, {
}); });
var triggerBtn = BI.createWidget({ var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button", type: "bi.icon_button",
cls: "bi-trigger-date-button chart-date-normal-font", cls: "bi-trigger-icon-button date-font",
width: 30, width: 30,
height: 23 height: 23
}); });
@ -6753,7 +6643,7 @@ BI.MultiDateCombo = BI.inherit(BI.Single, {
}); });
this.changeIcon = BI.createWidget({ this.changeIcon = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: "bi-trigger-date-change widget-date-h-change-font", cls: "bi-trigger-icon-button date-change-h-font",
width: 30, width: 30,
height: 23 height: 23
}); });

45
docs/SUMMARY.md

@ -46,8 +46,8 @@
* [tab](core/combination/tab.md) * [tab](core/combination/tab.md)
* 弹出层 * 弹出层
* [float_box](core/layer/layer_float_box.md) * [float_box](core/layer/layer_float_box.md)
* [popup](core/layer/layer_popup.md) * [popup_view](core/layer/layer_popup.md)
* [searcher](core/layer/layer_searcher.md) * [searcher_view](core/layer/layer_searcher.md)
* [widget](core/widget.md) * [widget](core/widget.md)
* [single](core/single.md) * [single](core/single.md)
* [basic_button](core/basic_button.md) * [basic_button](core/basic_button.md)
@ -70,6 +70,7 @@
* [multifile_editor](base/editor/multifile_editor.md) * [multifile_editor](base/editor/multifile_editor.md)
* [textarea_editor](base/editor/textarea_editor.md) * [textarea_editor](base/editor/textarea_editor.md)
* [formula_editor](base/editor/formula_editor.md) * [formula_editor](base/editor/formula_editor.md)
* [rich_editor](base/editor/rich_editor.md)
* 表格 * 表格
* [table_view](base/table/table_view.md) * [table_view](base/table/table_view.md)
* [grid_table](base/table/grid_table.md) * [grid_table](base/table/grid_table.md)
@ -84,21 +85,24 @@
* [multi_select_item](case/button/multi_select_item.md) * [multi_select_item](case/button/multi_select_item.md)
* [single_select_item](case/button/single_select_item.md) * [single_select_item](case/button/single_select_item.md)
* [single_select_radio_item](case/button/single_select_radio_item.md) * [single_select_radio_item](case/button/single_select_radio_item.md)
* 编辑 * 文本
* [shelter_editor](case/editor/shelter_editor.md) * [shelter_editor](case/editor/shelter_editor.md)
* [sign_editor](case/editor/sign_editor.md) * [sign_editor](case/editor/sign_editor.md)
* [sign_initial_editor](case/editor/sign_initial_editor.md) * [sign_initial_editor](case/editor/sign_initial_editor.md)
* [state_editor](case/editor/state_editor.md) * [state_editor](case/editor/state_editor.md)
* 弹出层 * [simple_state_editor](case/editor/simple_state_editor.md)
* [multi_popup_layer](case/layer/multi_popup_layer.md) * [clear_editor](detailed/text_input/bi.clear_editor.md)
* [layer_panel](case/layer/layer_panel.md)
* [pane_list](case/layer/pane_list.md)
* [panel](case/layer/panel.md)
* 列表 * 列表
* [select_list](case/list/list.select.md) * [select_list](case/list/list.select.md)
* [lazy_loader](case/loader/lazy_loader.md) * [lazy_loader](case/loader/lazy_loader.md)
* [list_loader](case/loader/list_loader.md) * [list_loader](case/loader/list_loader.md)
* [sort_list](case/loader/sort_list.md) * [sort_list(jquery-sortable封装)](case/loader/sort_list.md)
* 面板
* [pane_list](case/layer/pane_list.md)
* [panel](case/layer/panel.md)
* popup弹出层
* [multi_popup_view](case/layer/multi_popup_layer.md)
* [popup_panel](case/layer/layer_panel.md)
* 触发器 * 触发器
* [editor_trigger](case/trigger/editor_trigger.md) * [editor_trigger](case/trigger/editor_trigger.md)
* [icon_trigger](case/trigger/icon_trigger.md) * [icon_trigger](case/trigger/icon_trigger.md)
@ -108,7 +112,8 @@
* [icon_combo](case/combo/icon_combo.md) * [icon_combo](case/combo/icon_combo.md)
* [static_combo](case/combo/static_combo.md) * [static_combo](case/combo/static_combo.md)
* [text_value_combo](case/combo/text_value_combo.md) * [text_value_combo](case/combo/text_value_combo.md)
* [text_value_downlist_combo](case/combo/text_value_downlist_combo.md) * [text_value_check_combo](case/combo/text_value_check_combo.md)
* [text_value_down_list_combo](case/combo/text_value_down_list_combo.md)
* 树 * 树
* [branch_tree](case/tree/branch_tree.md) * [branch_tree](case/tree/branch_tree.md)
* [handstand_branch_tree](case/tree/handstand_branch_tree.md) * [handstand_branch_tree](case/tree/handstand_branch_tree.md)
@ -137,18 +142,18 @@
* [各种items](detailed/bi.button/items.md) * [各种items](detailed/bi.button/items.md)
* [各种节点nodes](detailed/bi.button/node.md) * [各种节点nodes](detailed/bi.button/node.md)
* [各种segment](detailed/bi.button/segment.md) * [各种segment](detailed/bi.button/segment.md)
* 树形结构 * 树
* [multi_tree_combo](detailed/tree/bi.multi_tree_combo.md) * [multi_tree_combo](detailed/tree/bi.multi_tree_combo.md)
* [switch_tree](detailed/tree/bi.switch_tree.md) * [switch_tree](detailed/tree/bi.switch_tree.md)
* 表格 * 表格
* [preview_table](detailed/table/bi.preview_table.md) * [preview_table](detailed/table/bi.preview_table.md)
* [responsive_table](detailed/table/bi.responsive_table.md) * [responsive_table](detailed/table/bi.responsive_table.md)
* [excel_table](detailed/table/bi.excel_table.md) * [excel_table](detailed/table/bi.excel_table.md)
* [sequence_table](detailed/table/bi.sequence_table.md)
* [page_table](detailed/table/bi.page_table.md) * [page_table](detailed/table/bi.page_table.md)
* 文本框控件 * 文本框控件
* [bi.text_editor](detailed/text_input/bi.text_editor.md) * [text_editor](detailed/text_input/bi.text_editor.md)
* [bi.search_editor](detailed/text_input/bi.search_editor.md) * [search_editor](detailed/text_input/bi.search_editor.md)
* [bi.clear_editor](detailed/text_input/bi.clear_editor.md)
* [finetuning_number_editor](detailed/text_input/finetuning_number_editor.md) * [finetuning_number_editor](detailed/text_input/finetuning_number_editor.md)
* [year_combo](detailed/year_combo.md) * [year_combo](detailed/year_combo.md)
* [month_combo](detailed/month_combo.md) * [month_combo](detailed/month_combo.md)
@ -158,7 +163,7 @@
* [multi_select_combo](detailed/multi_select_combo.md) * [multi_select_combo](detailed/multi_select_combo.md)
* 简单日期控件 * 简单日期控件
* [date_combo](detailed/date/date_combo.md) * [date_combo](detailed/date/date_combo.md)
* [date_pane_widget](detailed/date/date_pane_widget.md) * [date_pane](detailed/date/date_pane_widget.md)
* [year_month_combo](detailed/date/year_month_combo.md) * [year_month_combo](detailed/date/year_month_combo.md)
* [year_quarter_combo](detailed/date/year_quarter_combo.md) * [year_quarter_combo](detailed/date/year_quarter_combo.md)
* [custom_date_time](detailed/date/custom_date_time.md) * [custom_date_time](detailed/date/custom_date_time.md)
@ -173,5 +178,13 @@
* [relation_view](detailed/relation_view.md) * [relation_view](detailed/relation_view.md)
* [dialog](detailed/dialog.md) * [dialog](detailed/dialog.md)
* [file_manager](detailed/file_manager.md) * [file_manager](detailed/file_manager.md)
* [slider](detailed/slider.md) ## 部件
* [value_chooser_combo](components/value_chooser_combo.md)
* [value_chooser_pane](components/value_chooser_pane.md)
* [all_value_chooser_combo](components/all_value_chooser_combo.md)
* [tree_value_chooser_combo](components/tree_value_chooser_combo.md)
* [tree_value_chooser_pane](components/tree_value_chooser_pane.md)
* addons
* sliders
* [single_slider](detailed/single_slider.md)

14
docs/_book/.gitignore vendored

@ -1,14 +0,0 @@
.DS_Store
.svn
.sass-cache
.vscode
.tmp
node_modules
bower_components
tmp
dist
archive
archive.zip
*.log
#_book
test

2530
docs/_book/COURSE.html

File diff suppressed because it is too large Load Diff

21
docs/_book/LICENSE

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2017 gittz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

2533
docs/_book/OVERVIEW.html

File diff suppressed because it is too large Load Diff

2561
docs/_book/START.html

File diff suppressed because it is too large Load Diff

2596
docs/_book/base/bubble.html

File diff suppressed because it is too large Load Diff

40
docs/_book/base/bubble.md

@ -1,40 +0,0 @@
# bi.bubble
#### 气泡提示
{% method %}
[source](https://jsfiddle.net/fineui/4u705v2v/)
{% common %}
```javascript
BI.createWidget({
type: 'bi.bubble',
element: "#wrapper",
height: 30,
text: "测试"
})
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :----- | :---- |:----
| direction | 气泡显示位置 | string | — | "top" |
| height | 气泡高度 | number | — | 35 |
| text | 气泡显示内容 | string | — | " " |
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| setText | 设置文本值 | 需要设置的文本值text|
---

2769
docs/_book/base/button/button.html

File diff suppressed because it is too large Load Diff

69
docs/_book/base/button/button.md

@ -1,69 +0,0 @@
# bi.button
## 文字类型的按钮,基类[BI.BasicButton](/core/basicButton.md)
{% method %}
[source](https://jsfiddle.net/fineui/txqwwzLm/)
{% common %}
```javascript
BI.createWidget({
type: 'bi.button',
element: "#wrapper",
text: '一般按钮',
level: 'common',
height: 30
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| hgap | 效果相当于文本框左右padding值,如果clear属性为true,该属性值置0 | number | — | 10 |
| vgap | 效果相当于文本框上下padding值 | number | — | 0 |
| lgap | 效果相当于文本框left-padding值 | number | — | 0 |
| rgap | 效果相当于文本框right-padding值 | number | — | 0 |
| tgap |效果相当于文本框top-padding值 | number | — | 0 |
| bgap | 效果相当于文本框bottom-padding值 | number | — | 0 |
| width | 宽度 | number | — | — |
| height | 高度 | number | — | — |
##### 高级属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| level |按钮类型 | string| common,success,warning,ignore | common |
| minWidth | 最小宽度,如果block/clear中某一项为true,此项值为0,否则为90 | number | — | 90 |
| shadow | 是否显示阴影 | boolean| true,false | props.clear !== true |
| isShadowShowingOnSelected|选中状态下是否显示阴影 | boolean| true,false | true |
| readonly | 是否只读 | boolean | true,false | true |
| iconClass | 图标类型 | string| — | " "|
| block| 是否块状显示,即不显示边框,没有最小宽度的限制 | boolean| true,false | false |
| clear| 是否去掉边框和背景 |boolean| true,false | false |
| textAlign | 文字布局 | string | left,center,right | cneter |
| whiteSpace | 元素内的空白处理方式 | string | normal,nowrap | nowrap|
| forceCenter | 是否无论如何都要居中, 不考虑超出边界的情况, 在未知宽度和高度时有效 | boolean | true,false | false |
| textWidth| 按钮文本宽度 | number| — | null |
| textHeight | 按钮文本高度 | number| — | null |
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| doRedMark | 文本标红 | — |
| unRedMark | 取消文本标红| —|
| doHighLight | 文本高亮 | —|
| unHighLight | 取消文本高亮 | —|
| setText| 设置文本值 | 需要设置的文本值text|
| doClick | 点击事件 | —|
| destroy | 销毁事件 |— |
| setValue | 设置文本值 | 需要设置的文本值text |
---

2588
docs/_book/base/button/icon_button.html

File diff suppressed because it is too large Load Diff

39
docs/_book/base/button/icon_button.md

@ -1,39 +0,0 @@
# bi.icon_button
## 图标button,基类[BI.BasicButton](/core/basicButton.md)
{% method %}
[source](https://jsfiddle.net/fineui/g52u14ay/)
{% common %}
```javascript
BI.createWidget({
type: 'bi.icon_button',
cls: "close-ha-font",
width: 20,
height: 20
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| iconWidth | 图标宽度 | number| — | null |
| iconHeight | 图标高度 | number| — | null |
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| doClick | 点击事件 | —|
---

2633
docs/_book/base/button/image_button.html

File diff suppressed because it is too large Load Diff

49
docs/_book/base/button/image_button.md

@ -1,49 +0,0 @@
# bi.image_button
## 图片的button,基类[BI.BasicButton](/core/basicButton.md)
{% method %}
[source](https://jsfiddle.net/fineui/yc0g9gLw/)
{% common %}
```javascript
BI.createWidget({
type: 'bi.image_button',
src: "http://www.easyicon.net/api/resizeApi.php?id=1206741&size=128",
width: 100,
height: 100
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| src |图片路径 |string | —|" " |
| iconWidth | 图标宽度 | number/string| — | "100%" |
| iconHeight | 图标高度 | number/string | — | "100%"|
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| doClick | 点击事件 | —|
| setWidth | 设置按钮宽度| 宽度width |
| setHeight | 设置按钮高度 | 高度height|
| setImageWidth | 设置图片宽度| 宽度width |
| setImageHeight| 设置图片高度| 高度height|
| getImageWidth | 获取图片宽度| —|
| getImageHeight | 获取图片高度| —|
| setSrc| 设置图片路径| src |
| getSrc |获取图片路径| — |
---

2692
docs/_book/base/button/text_button.html

File diff suppressed because it is too large Load Diff

58
docs/_book/base/button/text_button.md

@ -1,58 +0,0 @@
# bi.text_button
## 可以点击的一行文字,基类[BI.BasicButton](/core/basicButton.md)
{% method %}
[source](https://jsfiddle.net/fineui/5p99L39q/)
{% common %}
```javascript
BI.createWidget({
type: 'bi.text_button',
text: '文字按钮',
height: 30
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| hgap | 效果相当于文本框左右padding值,如果clear属性为true,该属性值置0 | number | — | 10 |
| lgap | 效果相当于文本框left-padding值 | number | — | 0 |
| rgap | 效果相当于文本框right-padding值 | number | — | 0 |
| text|按钮文本内容 | string| — | — |
| textWidth| 按钮文本宽度 | number| — | null |
| textHeight | 按钮文本高度 | number| — | null |
##### 高级属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| py | 拼音 | string| | " " |
| textAlign | 文字布局 | string | left,center,right | cneter |
| whiteSpace | 元素内的空白处理方式 | string | normal,nowrap | nowrap|
| forceCenter | 是否无论如何都要居中, 不考虑超出边界的情况, 在未知宽度和高度时有效 | boolean | true,false | false |
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| doRedMark | 文本标红 | — |
| unRedMark | 取消文本标红| —|
| doHighLight | 文本高亮 | —|
| unHighLight | 取消文本高亮 | —|
| setText| 设置文本值 | 需要设置的文本值text|
| doClick | 点击事件 | —|
| setValue | 设置文本值 | 需要设置的文本值text |
| setStyle | 设置文本样式 |需要设置的文本标签样式,例{"color":"#000"} |
---

2595
docs/_book/base/canvas.html

File diff suppressed because it is too large Load Diff

40
docs/_book/base/canvas.md

@ -1,40 +0,0 @@
# bi.canvas
## canvas绘图,基类[BI.Widget](/core/widget.md)
{% method %}
[source](https://jsfiddle.net/fineui/gcgd1va0/)
{% common %}
```javascript
var canvas = BI.createWidget({
type: "bi.canvas",
element: "#wrapper",
width: 500,
height: 600
});
canvas.circle(150, 50, 20, "green");
canvas.stroke();
```
{% endmethod %}
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| line | 绘制线段| (x0, y0, x1, y1) |
| rect | 绘制矩形 | (x,y,w,h,color)分别表示左上角的横坐标、纵坐标,矩形宽、高、以及绘制的颜色|
| circle | 绘制圆形 | (x, y, radius, color)分别表示原点的横坐标,纵坐标,半径以及颜色 |
| hollow | 填充中空的路径 | — |
| solid | 填充实心的路径 | — |
| gradient | 绘制渐变色 | (x0, y0, x1, y1, start, end) |
| reset | 重置画布 | —|
| stroke | 绘制 | callback |
---

2649
docs/_book/base/editor/code_editor.html

File diff suppressed because it is too large Load Diff

53
docs/_book/base/editor/code_editor.md

@ -1,53 +0,0 @@
# bi.code_editor
## 代码文本框,基类[BI.Single](/core/single.md)
{% method %}
[source](https://jsfiddle.net/fineui/fx86hLgm/)
{% common %}
```javascript
BI.createWidget({
type: "bi.code_editor",
cls: "mvc-border",
width: 600,
height: 400
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| watermark | 文本框placeholder | string | — | " " |
| readOnly | 是否只读 | boolean | true,false | false|
| lineHeight | 行高 | number|— | 2|
| value | 文本框值| string| —| " "|
| paramFormatter| 参数显示值构造函数 | function| — | value |
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| insertParam | 插入参数 | param |
| insertString | 插入字符串 | str|
| getValue | 获取文本框值|—|
| setValue | 设置文本框值|value|
| focus | 文本框获取焦点| — |
| blur | 文本框失焦|—|
| setStyle | 设置文本样式 |需要设置的文本标签样式style,例{"color":"#000"} |
| getStyle | 获取文本样式 |— |
| refresh | 刷新文本框 | —|
---

2823
docs/_book/base/editor/editor.html

File diff suppressed because it is too large Load Diff

89
docs/_book/base/editor/editor.md

@ -1,89 +0,0 @@
# bi.editor
## 文本框,基类[BI.Single](/core/single.md)
{% method %}
[source](https://jsfiddle.net/fineui/4eLytgve/)
{% common %}
```javascript
BI.createWidget({
type: "bi.editor",
element: "#wrapper",
errorText: "字段不可重名!",
width: 200,
height: 30
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| hgap | 效果相当于文本框左右padding值 | number | — | 4 |
| vgap | 效果相当于文本框上下padding值 | number | — | 2 |
| lgap | 效果相当于文本框left-padding值 | number | — | 0 |
| rgap | 效果相当于文本框right-padding值 | number | — | 0 |
| tgap |效果相当于文本框top-padding值 | number | — | 0 |
| bgap | 效果相当于文本框bottom-padding值 | number | — | 0 |
| validationChecker | 输入较验函数 |function| — | — |
| quitChecker | 是否允许退出编辑函数 | function | — | — |
| allowBlank | 是否允许空值 | boolean | true,false | false |
| watermark | 文本框placeholder | string | — | " " |
| errorText | 错误提示 | string/function | —| " "|
| tipType| 提示类型 | string |success,warning | "warning"|
| inputType| 输入框类型| string| 参考input输入框类型 | "text"|
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| setErrorText | 设置错误文本 | text |
| getErrorText | 获取错误文本 | —|
| setErrorVisible | 设置错误文本可见|b |
| disableError | 设置error不可用|— |
| enableError| 设置error可用| —|
| disableWaterMark | 设置文本框placeholder不可用| —|
| enableWaterMark | 恢复文本框placeholder可用| — |
| focus | 文本框获取焦点| — |
| blur | 文本框失焦|—|
| selectAll | 选中文本框文本| —|
| onKeyDown |按键事件|key|
| setValue | 设置文本框值|value|
| getLastValidValue | 获取文本框最后一次输入的有效值| —|
| resetLastValidValue| 重置文本框最后一次输入的有效值|value|
| getValue | 获取文本框值|—|
| isEditing | 文本框是否处于编辑状态|—|
| isValid | 文本框值是否有效|—|
## 事件
| 事件 | 说明 |
| :------ |:------------- |
|BI.Editor.EVENT_CHANGE | editor的value发生改变触发 |
|BI.Editor.EVENT_FOCUS | focus事件 |
|BI.Editor.EVENT_BLUR | blur事件 |
|BI.Editor.EVENT_CLICK | 点击编辑框触发(不在编辑状态时) |
|BI.Editor.EVENT_KEY_DOWN | keyDown时触发 |
|BI.Editor.EVENT_SPACE | 按下空格触发 |
|BI.Editor.EVENT_BACKSPACE | 按下Backspace触发 |
|BI.Editor.EVENT_START | 开始输入触发 |
|BI.Editor.EVENT_PAUSE | 暂停输入触发(输入空白字符) |
|BI.Editor.EVENT_STOP | 停止输入触发 |
|BI.Editor.EVENT_CONFIRM | 确定输入触发(blur时且输入值有效) |
|BI.Editor.EVENT_VALID | 输入值有效的状态事件 |
|BI.Editor.EVENT_ERROR | 输入值无效的状态事件 |
|BI.Editor.EVENT_ENTER | 回车事件 |
|BI.Editor.EVENT_RESTRICT | 回车但是值不合法 |
|BI.Editor.EVENT_REMOVE | 输入为空时按下backspace |
|BI.Editor.EVENT_EMPTY | 输入框为空时触发 |
---

2674
docs/_book/base/editor/formula_editor.html

File diff suppressed because it is too large Load Diff

59
docs/_book/base/editor/formula_editor.md

@ -1,59 +0,0 @@
# bi.formula_editor
## 公式编辑控件,基类[BI.Single](/core/single.md)
{% method %}
[source](https://jsfiddle.net/fineui/qnquz4o0/)
{% common %}
```javascript
BI.createWidget({
type: "bi.formula_editor",
cls: "bi-border",
watermark:'请输入公式',
value: 'SUM(C5, 16, 26)',
width: "100%",
height: "100%"
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| value | 文本域的值 | string | — | " "|
| watermark | 文本框placeholder| string | —| " " |
| fieldTextValueMap | 字段集合 | onject | —| {}|
| showHint | 是否显示提示信息 | boolean | true,false | true |
| lineHeight | 行高 | number | —| 2|
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| disableWaterMark | 设置文本框placeholder不可用 | — |
| focus | 文本框获取焦点| — |
| insertField | 添加字段 | field |
| insertFunction | 插入函数 | fn |
| insertOperator | 插入操作符| op|
| setFunction | 设置函数 | v|
| insertString | 插入字符串 | str|
| getFormulaString | 获取公式框内容 |— |
| getUsedFields | 获取可用字段 | — |
| getCheckString | 获取校验内容 | — |
| getValue | 获取文本框值|—|
| setValue | 设置文本框值|value|
| setFieldTextValueMap | 设置字段集合 | fieldTextValueMap |
| refresh | 刷新文本框 | —|
---

2639
docs/_book/base/editor/multifile_editor.html

File diff suppressed because it is too large Load Diff

51
docs/_book/base/editor/multifile_editor.md

@ -1,51 +0,0 @@
# bi.multifile_editor
## 多文件,基类[BI.Single](/core/single.md)
{% method %}
[source](https://jsfiddle.net/fineui/25r3r5fq/)
{% common %}
```javascript
BI.createWidget({
type: "bi.multifile_editor",
width: 400,
height: 300
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| multiple | 是否支持多选 | boolean | true,false| false |
| maxSize | 允许上传最大字节数 | number |— | -1 |
| accept | 允许上传的文件类型 | string | —| " "|
| url | 文件路径 | string | —| " "|
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| select | 选择文件 | —|
| getValue | 获取文件名称 | —|
| upload | 文件上传| —|
| reset | 重置| —|
## 事件
| 事件 | 说明 |
| :------ |:------------- |
|BI.MultifileEditor.EVENT_UPLOADSTART | 开始上传时触发 |
|BI.MultifileEditor.EVENT_PROGRESS | 上传过程中触发 |
|BI.MultifileEditor.EVENT_UPLOADED | 上传结束后触发 |
---

2605
docs/_book/base/editor/textarea_editor.html

File diff suppressed because it is too large Load Diff

45
docs/_book/base/editor/textarea_editor.md

@ -1,45 +0,0 @@
# bi.textarea_editor
## 文本域,基类[BI.Single](/core/single.md)
{% method %}
[source](https://jsfiddle.net/fineui/90721e0a/)
{% common %}
```javascript
BI.createWidget({
type: "bi.textarea_editor",
width: 400,
height: 300
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| value | 文本域的值 | string | — | " "|
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| getValue | 获取文本域值|—|
| setValue | 设置文本域值|value|
| setStyle | 设置文本域样式 |需要设置的文本域样式style,例{"color":"#000"} |
| getStyle | 获取文本域样式 |— |
| focus | 文本域获取焦点| — |
| blur | 文本域失焦|—|
---

2743
docs/_book/base/label.html

File diff suppressed because it is too large Load Diff

66
docs/_book/base/label.md

@ -1,66 +0,0 @@
# bi.label
#### 文本标签
{% method %}
[source](https://jsfiddle.net/fineui/47f5ps1j/)
{% common %}
```javascript
BI.createWidget({
type: "bi.label",
textWidth: 100,
textHeight: 30,
text: "基本标签"
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :----- | :----|:----
| hgap | 效果相当于容器左右padding值 | number | —| 0 |
| vgap | 效果相当于容器上下padding值 | number | —| 0 |
| lgap | 效果相当于容器left-padding值 | number | — | 0 |
| rgap | 效果相当于容器right-padding值 | number | —| 0 |
| tgap | 效果相当于容器top-padding值 | number | — | 0 |
| bgap | 效果相当于容器bottom-padding值 | number | — | 0 |
| textWidth | 文本标签宽度 | number| — | null |
| textHeight | 文本标签宽度 | number| — | null |
| text | 文本内容 | string | — | " " |
##### 高级属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :----- | :----|:----
| textAlign | 文本对齐方式 | string | left,center,right | center |
| whiteSpace | 元素内空白处理方式 | string| normal,nowrap | nowrap|
| forceCenter | 是否无论如何都要居中, 不考虑超出边界的情况, 在未知宽度和高度时有效 | boolean | true,false | true |
| py | 拼音 | string | — | 空 |
| keyword | 设置标红的关键词 | string | —| 空 |
| disabled | 灰化 | boolean| true,false | 无 |
| title | 提示title | string | — | 空 |
| warningTitle | 错误提示title | string | — | 空 |
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| doRedMark | 文本标红 | — |
| unRedMark | 取消文本标红| —|
| doHighLight | 文本高亮 | —|
| unHighLight | 取消文本高亮 | —|
| setText| 设置文本值 | 需要设置的文本值text|
| getText| 获取文本值 | —|
| setStyle | 设置文本样式 |需要设置的文本标签样式,例{"color":"#000"} |
| setValue | 设置文本值 | 需要设置的文本值text |
---

2578
docs/_book/base/message.html

File diff suppressed because it is too large Load Diff

39
docs/_book/base/message.md

@ -1,39 +0,0 @@
# bi.Msg
#### 消息提示
{% method %}
[source](https://jsfiddle.net/fineui/feu8kf4u/)
{% common %}
```javascript
BI.createWidget({
type: "bi.button",
element: "#wrapper",
text : '点击我弹出一个消息框',
height : 30,
handler : function() {
BI.Msg.confirm('测试消息框',"我是测试消息框的内容");
}
});
```
{% endmethod %}
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| alert | 警告消息框 | title, message, callback|
| confirm | 确认消息框 | title, message, callback |
| prompt | 提示消息框 | title, message, value, callback, min_width |
| toast | toast提示 | message, level, context|
---

2732
docs/_book/base/pager.html

File diff suppressed because it is too large Load Diff

66
docs/_book/base/pager.md

@ -1,66 +0,0 @@
# bi.pager
## 分页控件,基类[BI.Widget](/core/widget.md)
{% method %}
[source](https://jsfiddle.net/fineui/rhhte9b3/)
{% common %}
```javascript
BI.createWidget({
type: "bi.pager",
height: 50,
pages: 18,
groups: 5,
curr: 6,
first: "首页",
last: "尾页"
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| dynamicShow | 是否动态显示上一页、下一页、首页、尾页, 若为false,则指对其设置使能状态 | boolean| true,false | true|
| dynamicShowFirstLast | 是否动态显示首页、尾页,dynamicShow为false时生效| boolean| true,false | false |
| dynamicShowPrevNext | 是否动态显示上一页、下一页,dynamicShow为false时生效 | boolean| true,false | false|
| pages | 是否显示总页数 | boolean/number| false,number|false|
| curr | 初始化当前页 | function | —| function(){return 1;}|
| groups | 连续显示分页数 | number | — | 0 |
| jump | 页数跳转| function |— | —|
| first | 是否显示首页 | boolean | true,false| false|
| last | 是否显示尾页 | boolean | true,false| false|
| prev | 上一页 | string,object —| — |"上一页" |
| next | 下一页 | sting,object| —| "下一页" |
| firstPage | 第一页 | number|— | 1 |
| lastPage | 最后一页,在万不得已时才会调用这个函数获取最后一页的页码, 主要作用于setValue方法 | function | —| function(){ return 1;}|
| hasPrev | 判断是否有上一页,pages不可用时有效 | function | —| — |
| hasNext | 判断是否有下一页,pages不可用时有效 | function |— | — |
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| getCurrentPage | 获取当前页码 | —|
| setAllPages | 设置总页数 | pages |
| hasPrev | 判断是否有上一页 | v |
| hasNext | 判断是否有下一页 | v |
| setValue | 设置当前页码 | v |
| getValue | 获取当前页码 | —|
| attr | 设置属性 | key,value |
| populate | 刷新或者清空列表| —|
## 事件
| 名称 | 说明 |
| :------ |:------------- |
| BI.Pager.EVENT_AFTER_POPULATE | pager刷新完成事件 |
---

2652
docs/_book/base/svg.html

File diff suppressed because it is too large Load Diff

55
docs/_book/base/svg.md

@ -1,55 +0,0 @@
# bi.svg
## svg绘图,基类[BI.Widget](/core/widget.md)
{% method %}
[source](https://jsfiddle.net/fineui/1xn8snp3/)
{% common %}
```javascript
var svg = BI.createWidget({
type: "bi.svg",
width: 500,
height: 600
});
svg.path("M10,10L50,50M50,10L10,50")
.attr({stroke: "red"});
```
{% endmethod %}
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| add | 添加对象到json数组 | json |
| path | 绘制路径 | pathString |
| image | 绘制图片 | (src,x,y,w,h)分别表示图片路径,绘制的原点横、纵坐标,宽、高 |
| rect | 绘制矩形 | (x,y,w,h,r)分别表示左上角的横坐标、纵坐标,矩形宽、高、以及矩形的圆角border-radius大小|
| circle | 绘制圆形 | (x,y,r)分别表示原点的横坐标,纵坐标,以及半径 |
| ellipse | 绘制椭圆 |(x,y,rx,ry)分别表示原点的横、纵坐标,以及水平半径和垂直半径|
| text | 绘制文本 | (x,y,text)分别表示绘制的原点横、纵坐标以及要绘制的文本内容|
| print | 根据制定参数打印出路径 | (x, y, string, font, size, origin, letter_spacing, line_spacing) |
| setStart | 开始绘制 | — |
| setFinish | 结束绘制 | — |
| setSize | 设置画布尺寸 | (width,height)分别表示画布宽高|
| setViewBox | 设置画布可视区域 | (x,y,width,height,fit)分别表示可视区域原点坐标以及可视区域宽高,以及是否根据可视区域进行调整 |
| getById | 根据id返回元素 | id |
| getElementByPoint | 获根据给定的点坐标返回元素 | (x,y)|
| getElementsByPoint | 获根据给定的点坐标返回元素 | (x,y) |
| getFont | 通过给定的参数在已注册的字体中找到字体对象 | (family, weight, style, stretch) |
| set | 绘制形状的集合 | — |
| remove | 设置总页数 | pages |
| clear | 判断是否有上一页 | v |
---

2725
docs/_book/base/table/collection_table.html

File diff suppressed because it is too large Load Diff

74
docs/_book/base/table/collection_table.md

@ -1,74 +0,0 @@
# bi.collection_table
### 基本的表格 继承BI.Widget
{% method %}
[source](https://jsfiddle.net/fineui/x2zxfzhp/)
{% common %}
```javascript
BI.createWidget({
type: "bi.collection_table",
element: "body",
columnSize: [200,200],
items: [
[{
type: "bi.label",
cls: "layout-bg1",
text: "第一行第一列"
}, {
type: "bi.label",
cls: "layout-bg2",
text: "第一行第二列"
}],
[{
type: "bi.label",
cls: "layout-bg3",
text: "第二行第一列"
}, {
type: "bi.label",
cls: "layout-bg4",
text: "第二行第二列"
}]
]
});
```
{% endmethod %}
## 参数设置
| 参数 | 说明 | 类型 | 默认值 |
| ---------------- | ------------- | -------------------- | ----------------- |
| isNeedFreeze | 是否冻结列 | boolean | false |
| freezeCols | 冻结的列 | array | [] |
| isNeedMerge | 是否需要合并单元格 | boolean | false |
| mergeCols | 合并的单元格列号 | array | [] |
| mergeRule | 合并规则, 默认相等时合并 | function(row1, row2) | 默认row1 = row2 时合并 |
| columnSize | 单元格宽度集合 | array | [] |
| headerRowSize | 表头高度 | number | 25 |
| rowSize | 普通单元格高度 | number | 25 |
| regionColumnSize | 列项间的 | array | [] |
| items | 子组件 | array | [] |
## 方法
| 方法名 | 说明 | 参数 |
| ------------------------- | ----------- | ---------- |
| setWidth | 设置宽度 | width |
| setHeight | 设置高度 | height |
| setColumnSize | 设置列宽 | columnSize |
| getColumnSize | 得到列宽 | — |
| setRegionColumnSize | 设置列项之间的间隙 | columnSize |
| getRegionColumnSize | 获得列项之间的间隙 | — |
| getScrollRegionColumnSize | 获取横向滚动条宽度 | — |
| setVerticalScroll | 设置纵向滚动距离 | scrollTop |
| setLeftHorizontalScroll | 设置左到右横向滚动距离 | scrollLeft |
| setRightHorizontalScroll | 设置右往左横向滚动距离 | scrollLeft |
| getVerticalScroll | 获取纵向滚动距离 | — |
| getLeftHorizontalScroll | 获取左到右横向滚动距离 | — |
| getRightHorizontalScroll | 获取右往左横向滚动距离 | — |
| getColumns | 获取列项 | — |
| populate | 增加行 | rows |
| restore | 存储数据 | — |
------

2696
docs/_book/base/table/grid_table.html

File diff suppressed because it is too large Load Diff

59
docs/_book/base/table/grid_table.md

@ -1,59 +0,0 @@
# bi.grid_table
### 列表展示的table,继承BI.Widget
{% method %}
[source](https://jsfiddle.net/fineui/a936vcvj/)
{% common %}
```javascript
BI.createWidget({
type: "bi.grid_table",
element: 'body',
width: 600,
height: 500,
isResizeAdapt: true,
isNeedResize: true,
isNeedFreeze: true,
freezeCols: [0, 1],
columnSize: [50,50,200,250,400],
items: items,
header: header
});
```
{% endmethod %}
## 参数设置
| 参数 | 说明 | 类型 | 默认值 |
| ---------------- | ------- | ------- | ----- |
| isNeedFreeze | 是否需要冻结 | boolean | false |
| freezeCols | 冻结列 | array | [] |
| columnSize | 单元格宽度集合 | array | [] |
| headerRowSize | 表头高度 | number | 25 |
| rowSize | 普通单元格高度 | number | 25 |
| regionColumnSize | 列项间的 | array | [] |
| header | 表头 | array | [] |
| items | 子组件 | array | [] |
## 方法
| 方法名 | 说明 | 参数 |
| ------------------------ | ----------- | ---------- |
| setWidth | 设置宽度 | width |
| setHeight | 设置高度 | height |
| getRegionSize | 获取间隙大小 | — |
| setColumnSize | 设置列宽 | columnSize |
| getColumnSize | 得到列宽 | — |
| setRegionColumnSize | 设置列项之间的间隙 | columnSize |
| getRegionColumnSize | 获得列项之间的间隙 | — |
| setVerticalScroll | 设置纵向滚动距离 | scrollTop |
| setLeftHorizontalScroll | 设置左到右横向滚动距离 | scrollLeft |
| setRightHorizontalScroll | 设置右往左横向滚动距离 | scrollLeft |
| getVerticalScroll | 获取纵向滚动距离 | — |
| getLeftHorizontalScroll | 获取左到右横向滚动距离 | — |
| getRightHorizontalScroll | 获取右往左横向滚动距离 | — |
| populate | 刷新内容 | rows |
| restore | 储存 | — |
------

2744
docs/_book/base/table/resizable_table.html

File diff suppressed because it is too large Load Diff

77
docs/_book/base/table/resizable_table.md

@ -1,77 +0,0 @@
# bi.resizable_table
### 可调整列宽的grid表格,继承BI.Widget
{% method %}
[source](https://jsfiddle.net/fineui/0e7p2ezc/)
{% common %}
```javascript
BI.createWidget({
type: "bi.resizable_table",
element: "body",
columnSize: [200,200],
items: [
[{
type: "bi.label",
cls: "layout-bg1",
text: "第一行第一列"
}, {
type: "bi.label",
cls: "layout-bg2",
text: "第一行第二列"
}],
[{
type: "bi.label",
cls: "layout-bg3",
text: "第二行第一列"
}, {
type: "bi.label",
cls: "layout-bg4",
text: "第二行第二列"
}]
]
});
```
{% endmethod %}
## 参数设置
| 参数 | 说明 | 类型 | 默认值 |
| ---------------- | --------- | ------- | ----- |
| isNeedFreeze | 是否需要冻结列 | boolean | false |
| freezeCols | 冻结的列 | array | [] |
| isNeedResize | 是否需要调整大小 | boolean | false |
| isResizeAdapt | 是否调整时自适应 | boolean | true |
| isNeedMerge | 是否需要合并单元格 | boolean | false |
| mergeCols | 合并的单元格列号 | array | [] |
| columnSize | 单元格宽度集合 | array | [] |
| minColumnSize | 最小列宽 | array | [] |
| maxColumnSize | 最大列宽 | array | [] |
| headerRowSize | 表头高度 | number | 25 |
| rowSize | 普通单元格高度 | number | 25 |
| header | 表头 | array | [] |
| regionColumnSize | 列项间的 | array | [] |
| items | 子组件 | array | [] |
## 方法
| 方法名 | 说明 | 参数 |
| ------------------------ | ----------- | ------------- |
| setWidth | 设置宽度 | — |
| setHeight | 设置高度 | — |
| setColumnSize | 设置列宽 | columnSize |
| getColumnSize | 得到列宽 | — |
| setRegionColumnSize | 设置列项之间的间隙 | columnSize |
| getRegionColumnSize | 获得列项之间的间隙 | — |
| setVerticalScroll | 设置纵向滚动距离 | scrollTop |
| setLeftHorizontalScroll | 设置左到右横向滚动距离 | scrollLeft |
| setRightHorizontalScroll | 设置右往左横向滚动距离 | scrollLeft |
| getVerticalScroll | 获取纵向滚动距离 | — |
| getLeftHorizontalScroll | 获取左到右横向滚动距离 | — |
| getRightHorizontalScroll | 获取右往左横向滚动距离 | — |
| attr | 设置属性 | key:键,value:值 |
| populate | 刷新内容 | rows |
| restore | 保存表 | — |
------

2763
docs/_book/base/table/table_view.html

File diff suppressed because it is too large Load Diff

73
docs/_book/base/table/table_view.md

@ -1,73 +0,0 @@
# bi.table_view
### 能处理静态宽度以及动态宽度的表
{% method %}
[source](https://jsfiddle.net/fineui/mbazb80a/)
{% common %}
```javascript
BI.createWidget({
type: "bi.table_view",
element: 'body',
isNeedMerge: true,
isNeedFreeze: true,
freezeCols: [0, 1],
mergeCols: [0, 1],
columnSize: [100, 200, 300, 400, 500],
items: [],
header: []
});
```
{% endmethod %}
## 参数设置
| 参数 | 说明 | 类型 | 默认值 |
| ---------------- | ------------- | -------------------- | ----------------- |
| isNeedMerge | 是否需要合并单元格 | boolean | false |
| mergeCols | 合并的单元格列号 | array | [] |
| mergeRule | 合并规则, 默认相等时合并 | function(row1, row2) | 默认row1 = row2 时合并 |
| columnSize | 单元格宽度集合 | array | [] |
| headerRowSize | 表头高度 | number | 25 |
| footerRowSize | 表尾高度 | number | 25 |
| rowSize | 普通单元格高度 | number | 25 |
| regionColumnSize | 列项间的 | array | false |
| header | 表头 | array | [] |
| footer | 表尾 | array | false |
| items | 子组件 | array | [] |
## 方法
| 方法名 | 说明 | 参数 |
| ---------------------------- | ---------------- | ---------- |
| resize | 调整表格 | — |
| setColumnSize | 设置列宽 | columnSize |
| getColumnSize | 得到列宽 | — |
| getCalculateColumnSize | 获得计算后的列宽 | — |
| setHeaderColumnSize | 设置表头的列宽 | columnSize |
| setRegionColumnSize | 设置列项之间的间隙 | columnSize |
| getRegionColumnSize | 获得列项之间的间隙 | — |
| getCalculateRegionColumnSize | 获取计算后的列项之间的间隙 | — |
| getCalculateRegionRowSize | 获取计算后的列项上下之间的间隙 | — |
| getClientRegionColumnSize | 获取浏览器中显示的列项之间的间隙 | — |
| getScrollRegionColumnSize | 获取横向滚动条宽度 | — |
| getScrollRegionRowSize | 获取纵向滚动条宽度 | — |
| hasVerticalScroll | 是否含有数值滚动条 | — |
| setVerticalScroll | 设置纵向滚动距离 | scrollTop |
| setLeftHorizontalScroll | 设置左到右横向滚动距离 | scrollLeft |
| setRightHorizontalScroll | 设置右往左横向滚动距离 | scrollLeft |
| getVerticalScroll | 获取纵向滚动距离 | — |
| getLeftHorizontalScroll | 获取左到右横向滚动距离 | — |
| getRightHorizontalScroll | 获取右往左横向滚动距离 | — |
| getColumns | 获取列项 | — |
| populate | 刷新内容 | rows |
## 事件
| 事件 | 说明 |
| :------------------------------ | :------------------ |
| BI.Table.EVENT_TABLE_AFTER_INIT | table初始化完成后触发 |
| BI.Table.EVENT_TABLE_RESIZE | table大小调整时触发(窗口变化等) |
| BI.Table.EVENT_TABLE_SCROLL | 滚动事件 |
---

2597
docs/_book/base/toast.html

File diff suppressed because it is too large Load Diff

41
docs/_book/base/toast.md

@ -1,41 +0,0 @@
# bi.toast
#### toast提示
{% method %}
[source](https://jsfiddle.net/fineui/wop751sg/)
{% common %}
```javascript
BI.createWidget({
type: 'bi.toast',
element: "#wrapper",
height: 30,
level: "warning",
text: "toast测试"
})
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :----- | :---- |:----
| level | 提示类型 | string | success,warning | "success" |
| height | 高度 | number | — | 30 |
| text | 显示内容 | string | — | " " |
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| setText | 设置文本值 | 需要设置的文本值text |
---

2607
docs/_book/case/button/multi_select_item.html

File diff suppressed because it is too large Load Diff

53
docs/_book/case/button/multi_select_item.md

@ -1,53 +0,0 @@
# bi.multi_select_item
## 复选框item,基类[BI.BasicButton](/core/basic_button.md)
{% method %}
[source](https://jsfiddle.net/fineui/0z1fud88/)
{% common %}
```javascript
BI.createWidget({
type: 'bi.vertical',
element: "#wrapper",
items: [{
type: "bi.label",
height: 30,
text: "复选item"
}, {
type: "bi.multi_select_item",
text: "复选项"
}]
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| height | 高度 | number | — | 30
| logic | 布局逻辑 | object | — | {dynamic:false} |
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| setSelected| 设置选中值| v |
| doRedMark | 标红 |—|
| unRedMark | 取消标红 | — |
| doClick | 点击事件| —
---

2616
docs/_book/case/button/single_select_item.html

File diff suppressed because it is too large Load Diff

54
docs/_book/case/button/single_select_item.md

@ -1,54 +0,0 @@
# bi.single_select_item
## 可以点击的label,基类[BI.BasicButton](/core/basic_button.md)
{% method %}
[source](https://jsfiddle.net/fineui/19qqcej4/)
{% common %}
```javascript
BI.createWidget({
type: 'bi.vertical',
element: "#wrapper",
items: [{
type: "bi.label",
height: 30,
text: "复选item"
}, {
type: "bi.single_select_item",
text: "复选项"
}]
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| height | 高度 | number | — | 25
| hgap | 效果相当于文本框左右padding值 |number | —| 10 |
|textAlign |文本对齐方式 |string |left,center,right |"left"
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| setSelected| 设置选中值| v |
| doRedMark | 标红 |—|
| unRedMark | 取消标红 | — |
| doClick | 点击事件| —
---

2614
docs/_book/case/button/single_select_radio_item.html

File diff suppressed because it is too large Load Diff

55
docs/_book/case/button/single_select_radio_item.md

@ -1,55 +0,0 @@
# bi.single_select_radio_item
## 单选框item,基类[BI.BasicButton](/core/basic_button.md)
{% method %}
[source](https://jsfiddle.net/fineui/d3vw4438/)
{% common %}
```javascript
BI.createWidget({
type: 'bi.vertical',
element: "#wrapper",
items: [{
type: "bi.label",
height: 30,
text: "单选item"
}, {
type: "bi.single_select_radio_item",
text: "单选项"
}]
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| height | 高度 | number | — | 25
| hgap | 效果相当于文本框左右padding值 |number | —| 10 |
|textAlign |文本对齐方式 |string |left,center,right |"left"
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| setSelected| 设置选中值| v |
| doRedMark | 标红 |—|
| unRedMark | 取消标红 | — |
| doClick | 点击事件| —
---

2621
docs/_book/case/calendar.html

File diff suppressed because it is too large Load Diff

47
docs/_book/case/calendar.md

@ -1,47 +0,0 @@
# bi.calendar
### 日历控件
{% method %}
[source](https://jsfiddle.net/fineui/4sfsaoma/)
{% common %}
```javascript
BI.createWidget({
type: 'bi.calendar',
min: '1900-01-01', //最小日期
max: '2099-12-31', //最大日期
year: 2015,
month: 7, //7表示八月
day: 25,
});
```
{% endmethod %}
### 参数
| 参数 | 说明 | 类型 | 默认值 |
| ----- | ----- | ------ | ------------ |
| min | 最小日期 | string | '1900-01-01' |
| max | 最大日期 | string | '2099-12-31' |
| year | 设定的年份 | number | 2015 |
| month | 设定的月份 | number | 7 |
| day | 设定的日期 | number | 25 |
### 方法
| 方法名 | 说明 | 参数 |
| ----------- | ------- | -------------------------- |
| isFrontDate | 是否为最小日期 | — |
| isFinalDate | 是否为最大日期 | — |
| setValue | 设置日期 | object: {year, month, day} |
| getVlaue | 获得日期 | — |
------

2571
docs/_book/case/clipboard.html

File diff suppressed because it is too large Load Diff

33
docs/_book/case/clipboard.md

@ -1,33 +0,0 @@
# bi.clipboard
### 剪切板
{% method %}
[source](https://jsfiddle.net/fineui/kLzq99c3/)
{% common %}
```javascript
BI.createWidget({
type: 'bi.clipboard',
width: 100,
height: 100,
copy: function () {},
afterCopy: function () {}
});
```
{% endmethod %}
### 参数
| 参数 | 说明 | 类型 | 默认值 |
| --------- | ---------- | -------- | ---------- |
| copy | 获取需要拷贝的值 | function | BI.emptyFn |
| afterCopy | 完成拷贝后执行的方法 | function | BI.emptyFn |
------

2571
docs/_book/case/color_chooser.html

File diff suppressed because it is too large Load Diff

32
docs/_book/case/color_chooser.md

@ -1,32 +0,0 @@
# bi.color_chooser
### 选色控件
{% method %}
[source](https://jsfiddle.net/fineui/z4fwweg9/)
{% common %}
```javascript
BI.createWidget({
type: "bi.color_chooser",
element: "#wrapper",
width: 30,
height: 30
});
```
{% endmethod %}
### 方法
| 方法名 | 说明 | 参数 |
| ------------- | ------ | ----- |
| isViewVisible | 判断是否显示 | — |
| setValue | 设置颜色值 | color |
| getValue | 获取颜色值 | — |
------

2602
docs/_book/case/color_chooser_popup.html

File diff suppressed because it is too large Load Diff

45
docs/_book/case/color_chooser_popup.md

@ -1,45 +0,0 @@
# bi.color_chooser_popup
### 选色控件弹窗
{% method %}
[source](https://jsfiddle.net/fineui/xL7moydu/)
{% common %}
```javascript
BI.createWidget({
type: "bi.color_chooser_popup",
});
```
{% endmethod %}
### 参数
| 参数 | 说明 | 类型 | 默认值 |
| ------ | ---- | ------ | ---- |
| height | 高度 | number | 145 |
### 方法
| 方法名 | 说明 | 参数 |
| -------------- | -------- | ------ |
| setStoreColors | 设置储存的颜色值 | colors |
| setValue | 设置颜色值 | color |
| getValue | 获取颜色值 | — |
### 事件
| 事件 | 说明 |
| ------------------ | -------- |
| EVENT_VALUE_CHANGE | 颜色值改变时触发 |
------

2755
docs/_book/case/combo/bubble_combo.html

File diff suppressed because it is too large Load Diff

86
docs/_book/case/combo/bubble_combo.md

@ -1,86 +0,0 @@
# bi.bubble_combo
## 表示一个可以展开的节点, 不仅有选中状态而且有展开状态, 基类[BI.Widget](/core/widget.md)
{% method %}
[source](https://jsfiddle.net/fineui/urvt04so/)
{% common %}
```javascript
BI.createWidget({
type: "bi.bubble_combo",
element:"#wrapper",
el: {
type: "bi.button",
text: "测试",
height: 25
},
popup: {
el: {
type: "bi.button_group",
items: BI.makeArray(100, {
type: "bi.text_item",
height: 25,
text: "item"
}),
layouts: [{
type: "bi.vertical"
}]
},
maxHeight: 200
}
})
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| text | 组件text值 | string | —| "" |
| value | 组件value值 | string |— |""|
| stopEvent | 阻止事件 |boolean | true,false | false |
| stopPropagation | 阻止冒泡 | boolean | true,false| false |
| selected | button的选中状态 | boolean | true,false |false |
| once | 点击一次选中有效,再点无效 | boolean | true,false | false|
| forceSelected | 点击即选中, 选中了就不会被取消,与once的区别是forceSelected不影响事件的触发| boolean | true,false| false|
| forceNotSelected | 无论怎么点击都不会被选中 | boolean| true,false | false|
| disableSelected | 使能选中| boolean | true,false| false|
| shadow | 是否显示阴影 | boolean| true,false| false|
| isShadowShowingOnSelected| 选中状态下是否显示阴影|boolean| true,false | false|
| trigger | 被选元素要触发的事件 | string | mousedown, mouseup, click, dblclick, lclick | null|
| handler | 点击事件回调 | function | —| BI.emptyFn |
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| bindEvent | 绑定事件| —|
| beforeClick | 点击事件之前 | —|
| doClick | 点击事件 | — |
| handle | 返回该对象 | —|
| hover | hover事件| —|
| dishover | 取消hover事件| —|
|setSelected | 设置选中的文本| b|
| isSelected | 是否被选中| —|
| isOnce | 是否只允许点击一次| —|
| isForceSelected| 判断是否点击即选中| —|
| isForceNotSelected| 判断是否怎么点击都不会被选中|—|
| isDisableSelected| 判断是否让选中|—|
| setText| 设置文本值|—|
| getText| 获取文本值|—|
| empty| 清空组件|—|
| destroy| 销毁组件|—|
---

2694
docs/_book/case/combo/icon_combo.html

File diff suppressed because it is too large Load Diff

68
docs/_book/case/combo/icon_combo.md

@ -1,68 +0,0 @@
# bi.icon_combo
## 切换trigger图标的combo 基类[BI.Widget](/core/widget.md)
{% method %}
[source](https://jsfiddle.net/fineui/z02vzvtb/)
{% common %}
```javascript
BI.createWidget({
type: "bi.icon_combo",
element: "#wrapper",
iconClass: "rename-font",
items: [{
value: "第一项",
iconClass: "delete-font"
}, {
value: "第二项",
iconClass: "rename-font"
}, {
value: "第三项",
iconClass: "move-font"
}]
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| width | 宽度 | number | — | 24
| height | 高度 | number | — | 24
| iconClass | icon的类名 | string | —|" "|
| el | 自定义下拉框trigger| object | —|{ } |
| popup | 弹出层| object | —| { }
| minWidth| 最小宽度| number | —|100|
| maxWidth | 最大宽度 | string/number | — | "auto"|
| maxHeight | 最大高度 | number | —| 300
| adjustLength | 弹出列表和trigger的距离 | number | — | 0 |
| adjustXOffset | 调整横向偏移 | number | — | 0 |
| adjustYOffset |调整纵向偏移 | number | — | 0 |
| offsetStyle | 弹出层显示位置 | string | left,right,center | "left,right,center"|
| chooseType | 选择类型 | const | 参考button_group | BI.ButtonGroup.CHOOSE_TYPE_SINGLE |
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| setValue| 设置value值|—|
| getValue| 获取value值|—|
| showView | 显示弹出层 | —|
| hideView | 隐藏弹出层 |—|
| populate | 刷新列表 | items |
---

2628
docs/_book/case/combo/static_combo.html

File diff suppressed because it is too large Load Diff

58
docs/_book/case/combo/static_combo.md

@ -1,58 +0,0 @@
# bi.static_combo
## 单选combo,trigger显示项不会改变 基类[BI.Widget](/core/widget.md)
{% method %}
[source](https://jsfiddle.net/fineui/kn64gfzn/)
{% common %}
```javascript
BI.createWidget({
type: "bi.static_combo",
element: "#wrapper",
text: "Value 不变",
items: [{
text: "1",
value: 1
}, {
text: "2",
value: 2
}, {
text: "3",
value: 3
}]
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| height | 高度 | number | — | 24
| el | 自定义下拉框trigger| object | —|{ } |
| items | 子组件 | array | — | [ ]
| text | 文本内容 | string | — | " " |
| chooseType | 选择类型 | const |参考button_group | BI.ButtonGroup.CHOOSE_TYPE_SINGLE |
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| setValue| 设置value值|—|
| getValue| 获取value值|—|
| populate | 刷新列表 | items |
---

2622
docs/_book/case/combo/text_value_combo.html

File diff suppressed because it is too large Load Diff

58
docs/_book/case/combo/text_value_combo.md

@ -1,58 +0,0 @@
# bi.text_value_combo
## 基类[BI.Widget](/core/widget.md)
{% method %}
[source](https://jsfiddle.net/fineui/hcf0kd9m/)
{% common %}
```javascript
BI.createWidget({
type: "bi.text_value_combo",
element: "#wrapper",
text: "value_combo",
width: 300,
items: [{
text: "1",
value: 1
}, {
text: "2",
value: 2
}, {
text: "3",
value: 3
}]
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| height | 高度 | number | — | 30
| el | 自定义下拉框trigger| object |—|{ } |
| text | 文本内容 | string | — | " " |
| chooseType | 选择类型 | const |参考button_group | BI.ButtonGroup.CHOOSE_TYPE_SINGLE |
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| setValue| 设置value值|—|
| getValue| 获取value值|—|
| populate | 刷新列表 | items |
---

2614
docs/_book/case/combo/text_value_downlist_combo.html

File diff suppressed because it is too large Load Diff

2569
docs/_book/case/complex_canvas.html

File diff suppressed because it is too large Load Diff

37
docs/_book/case/complex_canvas.md

@ -1,37 +0,0 @@
# complex_canvas
## 复杂的canvas绘图
{% method %}
[source](https://jsfiddle.net/fineui/psozjkgn/)
{% common %}
```javascript
var canvas = BI.createWidget({
type: "bi.complex_canvas",
width: 500,
height: 600
});
canvas.branch(55, 100, 10, 10, 100, 10, 200, 10, {
offset: 20,
strokeStyle: "red",
lineWidth: 2
});
canvas.stroke();
```
{% endmethod %}
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| branch | 绘制树枝节点| (x0, y0, x1, y1, x2, y2) (以x0, y0为根节点,分支到x1,y1, x2,y2...)|
| stroke | 绘制 | |
---

2833
docs/_book/case/editor/shelter_editor.html

File diff suppressed because it is too large Load Diff

93
docs/_book/case/editor/shelter_editor.md

@ -1,93 +0,0 @@
# bi.shelter_editor
## 带标记的文本框,需手动控制进入编辑状态 基类[BI.Widget](/core/widget.md)
{% method %}
[source](https://jsfiddle.net/fineui/9Lbx6kga/)
{% common %}
```javascript
BI.createWidget({
element: "#wrapper",
type: "bi.shelter_editor",
cls: "bi-border",
width: 300,
watermark: "这个是带标记的"
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| hgap | 效果相当于文本框左右padding值 | number | — | 4 |
| vgap | 效果相当于文本框上下padding值 | number | — | 2 |
| lgap | 效果相当于文本框left-padding值 | number | — | 0 |
| rgap | 效果相当于文本框right-padding值 | number | — | 0 |
| tgap |效果相当于文本框top-padding值 | number | — | 0 |
| bgap | 效果相当于文本框bottom-padding值 | number | — | 0 |
| validationChecker | 输入较验函数 |function| — | — |
| quitChecker | 是否允许退出编辑函数 | function | — | — |
| allowBlank | 是否允许空值 | boolean | true,false | true |
| watermark | 文本框placeholder | string | — | " " |
| errorText | 错误提示 | string/function | —| " "|
| height| 高度| number |— | 30|
| textAlign| 对齐方式 | string |left,center,right |"left"|
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| setErrorText | 设置错误文本 | text |
| getErrorText | 获取错误文本 | —|
| focus | 文本框获取焦点| — |
| blur | 文本框失焦|—|
| onKeyDown |按键事件|key|
| setValue | 设置文本框值|value|
| getLastValidValue | 获取文本框最后一次输入的有效值| —|
| setTextStyle| 设置文本框样式| style |
| getValue | 获取文本框值|—|
| isEditing | 文本框是否处于编辑状态|—|
| isValid | 文本框值是否有效|—|
| doRedMark | 文本标红 | — |
| unRedMark | 取消文本标红| —|
| doHighLight | 文本高亮 | —|
| unHighLight | 取消文本高亮 | —|
| setTitle| 设置title | title|
| setWarningTitle| 设置错误title | title |
| setState | 设置文本框值 |—
| getState | 获取文本框值 | —
## 事件
| 事件 | 说明 |
| :------ |:------------- |
|BI.Editor.EVENT_CHANGE | editor的value发生改变触发 |
|BI.Editor.EVENT_FOCUS | focus事件 |
|BI.Editor.EVENT_BLUR | blur事件 |
|BI.Editor.EVENT_CLICK | 点击编辑框触发(不在编辑状态时) |
|BI.Editor.EVENT_KEY_DOWN | keyDown时触发 |
|BI.Editor.EVENT_SPACE | 按下空格触发 |
|BI.Editor.EVENT_BACKSPACE | 按下Backspace触发 |
|BI.Editor.EVENT_START | 开始输入触发 |
|BI.Editor.EVENT_PAUSE | 暂停输入触发(输入空白字符) |
|BI.Editor.EVENT_STOP | 停止输入触发 |
|BI.Editor.EVENT_CONFIRM | 确定输入触发(blur时且输入值有效) |
|BI.Editor.EVENT_VALID | 输入值有效的状态事件 |
|BI.Editor.EVENT_ERROR | 输入值无效的状态事件 |
|BI.Editor.EVENT_ENTER | 回车事件 |
|BI.Editor.EVENT_RESTRICT | 回车但是值不合法 |
|BI.Editor.EVENT_REMOVE | 输入为空时按下backspace |
|BI.Editor.EVENT_EMPTY | 输入框为空时触发 |
---

2819
docs/_book/case/editor/sign_editor.html

File diff suppressed because it is too large Load Diff

91
docs/_book/case/editor/sign_editor.md

@ -1,91 +0,0 @@
# bi.sign_editor
## 带标记的文本框,基类[BI.Widget](/core/widget.md)
{% method %}
[source](https://jsfiddle.net/fineui/tmdedu5t/)
{% common %}
```javascript
BI.createWidget({
element: "#wrapper",
type: "bi.sign_editor",
cls:"layout-bg5",
value: "123",
text: "456",
width: 300
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| hgap | 效果相当于文本框左右padding值 | number | — | 4 |
| vgap | 效果相当于文本框上下padding值 | number | —| 2 |
| lgap | 效果相当于文本框left-padding值 | number | — | 0 |
| rgap | 效果相当于文本框right-padding值 | number | — | 0 |
| tgap |效果相当于文本框top-padding值 | number | — | 0 |
| bgap | 效果相当于文本框bottom-padding值 | number | — | 0 |
| validationChecker | 输入较验函数 |function| — | — |
| quitChecker | 是否允许退出编辑函数 | function | — | — |
| allowBlank | 是否允许空值 | boolean | true,false | true |
| watermark | 文本框placeholder | string | — | " " |
| errorText | 错误提示 | string/function | —| " "|
| height| 高度| number |— | 30|
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| setErrorText | 设置错误文本 | text |
| getErrorText | 获取错误文本 | —|
| focus | 文本框获取焦点| — |
| blur | 文本框失焦|—|
| setValue | 设置文本框值|value|
| getLastValidValue | 获取文本框最后一次输入的有效值| —|
| getValue | 获取文本框值|—|
| isEditing | 文本框是否处于编辑状态|—|
| isValid | 文本框值是否有效|—|
| doRedMark | 文本标红 | — |
| unRedMark | 取消文本标红| —|
| doHighLight | 文本高亮 | —|
| unHighLight | 取消文本高亮 | —|
| setTitle| 设置title | title|
| setWarningTitle| 设置错误title | title |
| setState | 设置文本框值 |—
| getState | 获取文本框值 | —
## 事件
| 事件 | 说明 |
| :------ |:------------- |
|BI.Editor.EVENT_CHANGE | editor的value发生改变触发 |
|BI.Editor.EVENT_FOCUS | focus事件 |
|BI.Editor.EVENT_BLUR | blur事件 |
|BI.Editor.EVENT_CLICK | 点击编辑框触发(不在编辑状态时) |
|BI.Editor.EVENT_KEY_DOWN | keyDown时触发 |
|BI.Editor.EVENT_SPACE | 按下空格触发 |
|BI.Editor.EVENT_BACKSPACE | 按下Backspace触发 |
|BI.Editor.EVENT_START | 开始输入触发 |
|BI.Editor.EVENT_PAUSE | 暂停输入触发(输入空白字符) |
|BI.Editor.EVENT_STOP | 停止输入触发 |
|BI.Editor.EVENT_CONFIRM | 确定输入触发(blur时且输入值有效) |
|BI.Editor.EVENT_VALID | 输入值有效的状态事件 |
|BI.Editor.EVENT_ERROR | 输入值无效的状态事件 |
|BI.Editor.EVENT_ENTER | 回车事件 |
|BI.Editor.EVENT_RESTRICT | 回车但是值不合法 |
|BI.Editor.EVENT_REMOVE | 输入为空时按下backspace |
|BI.Editor.EVENT_EMPTY | 输入框为空时触发 |
---

2832
docs/_book/case/editor/sign_initial_editor.html

File diff suppressed because it is too large Load Diff

92
docs/_book/case/editor/sign_initial_editor.md

@ -1,92 +0,0 @@
# bi.sign_initial_editor
## 指定初始值 之后初始值会一直显示的editor 基类[BI.Widget](/core/widget.md)
{% method %}
[source](https://jsfiddle.net/fineui/9vjghevp/)
{% common %}
```javascript
BI.createWidget({
element: "#wrapper",
type: "bi.sign_initial_editor",
cls: "layout-bg5",
text: "原始值",
width: 300
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| hgap | 效果相当于文本框左右padding值 | number | — | 4 |
| vgap | 效果相当于文本框上下padding值 | number | — | 2 |
| lgap | 效果相当于文本框left-padding值 | number | — | 0 |
| rgap | 效果相当于文本框right-padding值 | number | — | 0 |
| tgap |效果相当于文本框top-padding值 | number | —| 0 |
| bgap | 效果相当于文本框bottom-padding值 | number | | 0 |
| validationChecker | 输入较验函数 |function| — | — |
| quitChecker | 是否允许退出编辑函数 | function | — | — |
| allowBlank | 是否允许空值 | boolean | true,false | true |
| watermark | 文本框placeholder | string | — | " " |
| errorText | 错误提示 | string/function | —| " "|
| height| 高度| number |— | 30|
| text | 文本内容 | string | —| " " |
| value | 文本value值 | string | — | " " |
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| setErrorText | 设置错误文本 | text |
| getErrorText | 获取错误文本 | —|
| focus | 文本框获取焦点| — |
| blur | 文本框失焦|—|
| setValue | 设置文本框值|value|
| getLastValidValue | 获取文本框最后一次输入的有效值| —|
| getValue | 获取文本框值|—|
| isEditing | 文本框是否处于编辑状态|—|
| isValid | 文本框值是否有效|—|
| doRedMark | 文本标红 | — |
| unRedMark | 取消文本标红| —|
| doHighLight | 文本高亮 | —|
| unHighLight | 取消文本高亮 | —|
| setTitle| 设置title | title|
| setWarningTitle| 设置错误title | title |
| setState | 设置文本框值 |—
| getState | 获取文本框值 | —
## 事件
| 事件 | 说明 |
| :------ |:------------- |
|BI.Editor.EVENT_CHANGE | editor的value发生改变触发 |
|BI.Editor.EVENT_FOCUS | focus事件 |
|BI.Editor.EVENT_BLUR | blur事件 |
|BI.Editor.EVENT_CLICK | 点击编辑框触发(不在编辑状态时) |
|BI.Editor.EVENT_KEY_DOWN | keyDown时触发 |
|BI.Editor.EVENT_SPACE | 按下空格触发 |
|BI.Editor.EVENT_BACKSPACE | 按下Backspace触发 |
|BI.Editor.EVENT_START | 开始输入触发 |
|BI.Editor.EVENT_PAUSE | 暂停输入触发(输入空白字符) |
|BI.Editor.EVENT_STOP | 停止输入触发 |
|BI.Editor.EVENT_CONFIRM | 确定输入触发(blur时且输入值有效) |
|BI.Editor.EVENT_VALID | 输入值有效的状态事件 |
|BI.Editor.EVENT_ERROR | 输入值无效的状态事件 |
|BI.Editor.EVENT_ENTER | 回车事件 |
|BI.Editor.EVENT_RESTRICT | 回车但是值不合法 |
|BI.Editor.EVENT_REMOVE | 输入为空时按下backspace |
|BI.Editor.EVENT_EMPTY | 输入框为空时触发 |
---

2806
docs/_book/case/editor/state_editor.html

File diff suppressed because it is too large Load Diff

89
docs/_book/case/editor/state_editor.md

@ -1,89 +0,0 @@
# bi.state_editor
## 记录状态的输入框,基类[BI.Widget](/core/widget.md)
{% method %}
[source](https://jsfiddle.net/fineui/p68bwkmv/)
{% common %}
```javascript
BI.createWidget({
element: "#wrapper",
type: "bi.state_editor",
value: "123",
text: "456",
width: 300
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| hgap | 效果相当于文本框左右padding值 | number | — | 4 |
| vgap | 效果相当于文本框上下padding值 | number | — | 2 |
| lgap | 效果相当于文本框left-padding值 | number | — | 0 |
| rgap | 效果相当于文本框right-padding值 | number | — | 0 |
| tgap |效果相当于文本框top-padding值 | number | —| 0 |
| bgap | 效果相当于文本框bottom-padding值 | number | — | 0 |
| validationChecker | 输入较验函数 |function| — | — |
| quitChecker | 是否允许退出编辑函数 | function |— | — |
| allowBlank | 是否允许空值 | boolean | true,false | true |
| watermark | 文本框placeholder | string | —| " " |
| errorText | 错误提示 | string/function |— | " "|
| height| 高度| number |— | 30|
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| setErrorText | 设置错误文本 | text |
| getErrorText | 获取错误文本 | —|
| focus | 文本框获取焦点| — |
| blur | 文本框失焦|—|
| setValue | 设置文本框值|value|
| getLastValidValue | 获取文本框最后一次输入的有效值| —|
| getValue | 获取文本框值|—|
| isEditing | 文本框是否处于编辑状态|—|
| isValid | 文本框值是否有效|—|
| doRedMark | 文本标红 | — |
| unRedMark | 取消文本标红| —|
| doHighLight | 文本高亮 | —|
| unHighLight | 取消文本高亮 | —|
| setState | 设置文本框值 |—
| getState | 获取文本框值 | —
## 事件
| 事件 | 说明 |
| :------ |:------------- |
|BI.Editor.EVENT_CHANGE | editor的value发生改变触发 |
|BI.Editor.EVENT_FOCUS | focus事件 |
|BI.Editor.EVENT_BLUR | blur事件 |
|BI.Editor.EVENT_CLICK | 点击编辑框触发(不在编辑状态时) |
|BI.Editor.EVENT_KEY_DOWN | keyDown时触发 |
|BI.Editor.EVENT_SPACE | 按下空格触发 |
|BI.Editor.EVENT_BACKSPACE | 按下Backspace触发 |
|BI.Editor.EVENT_START | 开始输入触发 |
|BI.Editor.EVENT_PAUSE | 暂停输入触发(输入空白字符) |
|BI.Editor.EVENT_STOP | 停止输入触发 |
|BI.Editor.EVENT_CONFIRM | 确定输入触发(blur时且输入值有效) |
|BI.Editor.EVENT_VALID | 输入值有效的状态事件 |
|BI.Editor.EVENT_ERROR | 输入值无效的状态事件 |
|BI.Editor.EVENT_ENTER | 回车事件 |
|BI.Editor.EVENT_RESTRICT | 回车但是值不合法 |
|BI.Editor.EVENT_REMOVE | 输入为空时按下backspace |
|BI.Editor.EVENT_EMPTY | 输入框为空时触发 |
---

2689
docs/_book/case/layer/layer_panel.html

File diff suppressed because it is too large Load Diff

69
docs/_book/case/layer/layer_panel.md

@ -1,69 +0,0 @@
# bi.popup_panel
## 可以理解为MultiPopupView和Panel两个面板的结合体,基类[BI.MultiPopupView](case/layer/multi_popup_layer.md)
{% method %}
[source](https://jsfiddle.net/fineui/zhnqvera/)
{% common %}
```javascript
BI.createWidget({
element: "#wrapper",
type: "bi.popup_panel",
title: "测试",
width: 300
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| title | 标题 | string | — | " "
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| prependItems | 内部前插入 | items |
| addItems | 内部后插入 | items |
| removeItemAt | 移除指定索引处的item | indexs |
| populate | 刷新列表 | items |
| setNotSelectedValue| 设置未被选中的值 | value,可以是单个值也可以是个数组|
| setValue | 设置value值 | value,可以是单个值也可以是个数组 |
| getNotSelectedValue | 获取没有被选中的值 | —|
| getValue | 获取被选中的值 |—|
| getAllButtons | 获取所有button |—|
| getAllLeaves | 获取所有的叶子节点 | —|
| getSelectedButtons | 获取所有被选中的元素 | —|
| getNotSelectedButtons | 获取所有未被选中的元素 | —|
| getIndexByValue | 根据value值获取value在数组中的索引 | value|
| getNodeById | 根据id获取节点 | id |
| getNodeByValue | 根据value值获取节点 | value |
| empty| 清空组件|—|
| hasPrev| 是否有上一页|—|
| hasNext | 是否有下一页 | —
## 事件
| 事件 | 说明 |
| :------ |:------------- |
|BI.PopupPanel.EVENT_CHANGE | panel的value发生改变触发 |
| BI.PopupPanel.EVENT_CLOSE | panel的关闭事件
| BI.PopupPanel.EVENT_CLICK_TOOLBAR_BUTTON | 点击工具栏事件
---

2561
docs/_book/case/layer/multi_popup_layer.html

File diff suppressed because it is too large Load Diff

34
docs/_book/case/layer/multi_popup_layer.md

@ -1,34 +0,0 @@
# bi.multi_popup_view
## 下拉框弹出层的多选版本,toolbar带有若干按钮, zIndex在1000w,基类[BI.MultiPopupView](case/layer/multi_popup_layer.md)
{% method %}
[source](https://jsfiddle.net/fineui/8of9a7cy/)
{% common %}
```javascript
BI.createWidget({
element: "#wrapper",
type: "bi.multi_popup_view",
width: 300
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| buttons | 按钮组 |array | — | BI.i18nText("BI-Basic_Sure")
---

2743
docs/_book/case/layer/pane_list.html

File diff suppressed because it is too large Load Diff

74
docs/_book/case/layer/pane_list.md

@ -1,74 +0,0 @@
# bi.list_pane
## list面板,基类[BI.Widget](/core/widget.md)
{% method %}
[source](https://jsfiddle.net/fineui/7Lv8q9p9/)
{% common %}
```javascript
BI.createWidget({
type: 'bi.list_pane',
element: "#wrapper",
cls: "bi-border",
items: []
});
```
{% endmethod %}
## API
##### 基础属性
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :------ |:------------- | :-----| :----|:----
| items | 列表 | array | — | [ ]
| itemsCreator | 列表创建器| function | — | —
| hasNext | 是否有下一页 | function | —| —
| onLoad | 正在加载 | function | —| —
| el | 开启panel的元素 | object | —|{type: "bi.button_group" }|
| logic | 布局逻辑 | object |— | { dynamic:true}
| hgap | 效果相当于容器左右padding值 | number | — | 0 |
| vgap | 效果相当于容器上下padding值 | number | —| 0 |
| lgap | 效果相当于容器left-padding值 | number | —| 0 |
| rgap | 效果相当于容器right-padding值 | number | — | 0 |
| tgap | 效果相当于容器top-padding值 | number | — | 0 |
| bgap | 效果相当于容器bottom-padding值 | number | — | 0 |
## 对外方法
| 名称 | 说明 | 回调参数
| :------ |:------------- | :-----
| prependItems | 内部前插入 | items |
| addItems | 内部后插入 | items |
| removeItemAt | 移除指定索引处的item | indexs |
| populate | 刷新列表 | items |
| setNotSelectedValue| 设置未被选中的值 | value,可以是单个值也可以是个数组|
| setValue | 设置value值 | value,可以是单个值也可以是个数组 |
| getNotSelectedValue | 获取没有被选中的值 | —|
| getValue | 获取被选中的值 |—|
| getAllButtons | 获取所有button |—|
| getAllLeaves | 获取所有的叶子节点 | —|
| getSelectedButtons | 获取所有被选中的元素 | —|
| getNotSelectedButtons | 获取所有未被选中的元素 | —|
| getIndexByValue | 根据value值获取value在数组中的索引 | value|
| getNodeById | 根据id获取节点 | id |
| getNodeByValue | 根据value值获取节点 | value |
| empty| 清空组件|—|
| hasPrev| 是否有上一页|—|
| hasNext | 是否有下一页 | —
---

2607
docs/_book/case/layer/panel.html

File diff suppressed because it is too large Load Diff

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

Loading…
Cancel
Save