Browse Source

无JIRA任务 整理

es6
windy 8 years ago
parent
commit
fbc1900ec4
  1. 6
      Gruntfile.js
  2. 3
      demo/js/base/demo.canvas.js
  3. 3
      demo/js/base/demo.collection.js
  4. 3
      demo/js/base/demo.combo.js
  5. 348
      demo/js/config/widget.js
  6. 88
      demo/js/widget/demo.multiselectcombo.js
  7. 14
      demo/js/widget/demo.multiselecttree.js
  8. 32803
      dist/base.js
  9. 228
      dist/core.js
  10. BIN
      dist/icon/check-box-disable.png
  11. BIN
      dist/icon/check-box-normal.png
  12. 14
      src/base/collection/collection.js
  13. 38
      src/base/combination/combo.js
  14. 11
      src/base/combination/expander.js
  15. 4
      src/base/combination/group.button.js
  16. 4
      src/base/combination/loader.js
  17. 115
      src/base/combination/map.button.js
  18. 4
      src/base/combination/navigation.js
  19. 27
      src/base/combination/searcher.js
  20. 4
      src/base/combination/switcher.js
  21. 4
      src/base/combination/tab.js
  22. 116
      src/base/combination/tree.button.js
  23. 2
      src/base/farbtastic/farbtastic.js
  24. 88
      src/base/formula/codemirror/addon/formula-hint.js
  25. 80
      src/base/formula/codemirror/addon/formula-mode.js
  26. 432
      src/base/formula/codemirror/addon/show-hint.js
  27. 8736
      src/base/formula/codemirror/codemirror.js
  28. 9
      src/base/formula/formulaeditor.js
  29. 21
      src/base/foundation/bi.message.js
  30. 10
      src/base/grid/grid.js
  31. 19
      src/base/layer/layer.popup.js
  32. 20
      src/base/pager/pager.js
  33. 2
      src/base/pane.js
  34. 192
      src/base/reqloading/loading.request.js
  35. 5
      src/base/single/a/a.js
  36. 4
      src/base/single/bar/bar.loading.js
  37. 37
      src/base/single/button/button.basic.js
  38. 3
      src/base/single/button/buttons/button.icon.js
  39. 3
      src/base/single/button/buttons/button.image.js
  40. 29
      src/base/single/button/buttons/button.text.js
  41. 119
      src/base/single/button/listitem/blankiconicontextitem.js
  42. 4
      src/base/single/editor/editor.code.js
  43. 4
      src/base/single/editor/editor.js
  44. 81
      src/base/single/editor/editor.textarea.js
  45. 2
      src/base/single/img/img.js
  46. 1
      src/base/single/input/checkbox.js
  47. 70
      src/base/single/input/file.js
  48. 46
      src/base/single/input/input.js
  49. 1
      src/base/single/input/radio.js
  50. 44
      src/base/single/label/label.js
  51. 4
      src/base/single/text.js
  52. 117
      src/base/timeouttoast/widget.timeouttoast.js
  53. 0
      src/base/tree/parttree.js
  54. 38
      src/base/tree/synctree.js
  55. 21
      src/base/tree/treeview.js
  56. 284
      src/core/base.js
  57. 2
      src/core/controller.js
  58. 47
      src/core/loader/loader.style.js
  59. 2
      src/core/var.js
  60. 6
      src/core/wrapper/layout/layout.card.js
  61. 21
      src/css/base/base.css
  62. 11
      src/css/base/chart/chart.combine.css
  63. 11
      src/css/base/combo/popup.bubble.css
  64. 9
      src/css/base/dom.css
  65. 32
      src/css/base/logintimeout/login.timeout.css
  66. 9
      src/css/base/pager/pager.all.count.css
  67. 2
      src/css/base/pager/pager.direction.css
  68. 10
      src/css/base/reqloading/loading.request.css
  69. 6
      src/css/base/single/editor/editor.state.css
  70. 6
      src/css/base/single/editor/editor.state.simple.css
  71. 2
      src/css/base/single/text.css
  72. 44
      src/css/base/third/ztree/zTreeStyle.css
  73. 34
      src/css/base/timeouttoast/widget.timeouttoast.css
  74. 1
      src/css/base/view/popupview.css
  75. 38
      src/css/base/wrapper/flex.center.css
  76. 66
      src/css/base/wrapper/flex.horizontal.css
  77. 46
      src/css/base/wrapper/flex.vertical.center.css
  78. 41
      src/css/base/wrapper/flex.wrapper.center.css
  79. 67
      src/css/base/wrapper/flex.wrapper.horizontal.css
  80. 48
      src/css/base/wrapper/flex.wrapper.vertical.center.css
  81. 24
      src/less/base/base.less
  82. 13
      src/less/base/chart/chart.combine.less
  83. 16
      src/less/base/combo/combo.bubble.less
  84. 8
      src/less/base/combo/popup.bubble.less
  85. 7
      src/less/base/dom.less
  86. 30
      src/less/base/logintimeout/login.timeout.less
  87. 5
      src/less/base/pager/pager.all.count.less
  88. 2
      src/less/base/pager/pager.direction.less
  89. 12
      src/less/base/pager/pager.number.less
  90. 12
      src/less/base/pager/pager.skip.less
  91. 19
      src/less/base/reqloading/loading.request.less
  92. 4
      src/less/base/single/editor/editor.state.less
  93. 4
      src/less/base/single/editor/editor.state.simple.less
  94. 2
      src/less/base/single/text.less
  95. 8
      src/less/base/table/table.grid.scrollbar.less
  96. 1796
      src/less/base/third/jquery.mCustomScrollbar.less
  97. BIN
      src/less/base/third/ztree/img/line_conn.gif
  98. BIN
      src/less/base/third/ztree/img/loading.gif
  99. BIN
      src/less/base/third/ztree/img/zTreeStandard.gif
  100. BIN
      src/less/base/third/ztree/img/zTreeStandard.png
  101. Some files were not shown because too many files have changed in this diff Show More

6
Gruntfile.js

@ -40,6 +40,12 @@ module.exports = function (grunt) {
'src/base/single/text.js', 'src/base/single/text.js',
'src/base/single/button/button.basic.js', 'src/base/single/button/button.basic.js',
'src/base/single/button/button.node.js', 'src/base/single/button/button.node.js',
'src/base/combination/group.button.js',
'src/base/combination/tree.button.js',
'src/base/combination/map.button.js',
'src/base/tree/treeview.js',
'src/base/tree/synctree.js',
'src/base/tree/parttree.js',
'src/base/**/*.js' 'src/base/**/*.js'
], ],
dest: 'dist/base.js' dest: 'dist/base.js'

3
demo/js/base/demo.canvas.js

@ -1,3 +0,0 @@
/**
* Created by User on 2017/3/22.
*/

3
demo/js/base/demo.collection.js

@ -1,3 +0,0 @@
/**
* Created by User on 2017/3/22.
*/

3
demo/js/base/demo.combo.js

@ -1,3 +0,0 @@
/**
* Created by User on 2017/3/22.
*/

348
demo/js/config/widget.js

@ -1,356 +1,8 @@
Demo.WIDGET_CONFIG = [{ Demo.WIDGET_CONFIG = [{
id: 4, id: 4,
text: "详细控件" text: "详细控件"
}, {
pId: 4,
text: "bi.loading_mask",
value: "demo.loadingmask"
}, {
pId: 4,
text: "可以切换的树",
value: "demo.switch_tree"
}, {
pId: 4,
text: "进度条",
value: "demo.progressbar"
}, {
pId: 4,
text: "bi.text_editor",
value: "demo.text_editor"
}, {
pId: 4,
text: "bi.search_editor",
value: "demo.search_editor"
}, {
pId: 4,
text: "bi.adapt_editor",
value: "demo.adapt_editor"
}, {
pId: 4,
text: "bi.sign_initial_editor",
value: "demo.sign_initial_editor"
}, {
pId: 4,
text: "bi.sign_style_editor",
value: "demo.sign_style_editor"
}, {
pId: 4,
text: "bi.year_combo",
value: "demo.year_combo"
}, {
pId: 4,
text: "bi.month_combo",
value: "demo.month_combo"
}, {
pId: 4,
text: "bi.quarter_combo",
value: "demo.quarter_combo"
}, {
pId: 4,
text: "bi.date_combo",
value: "demo.date_combo"
}, {
pId: 4,
text: "bi.down_list_combo",
value: "demo.down_list_combo"
}, {
pId: 4,
text: "bi.text_value_combo",
value: "demo.text_icon_combo"
}, {
pId: 4,
text: "bi.static_combo",
value: "demo.single_select_combo"
}, {
pId: 4,
text: "bi.text_value_down_list_combo",
value: "demo.text_icon_down_list_combo"
}, {
pId: 4,
text: "bi.param_date_combo",
value: "demo.param_date_combo"
}, {
pId: 4,
text: "bi.icon_combo",
value: "demo.icon_combo"
}, {
pId: 4,
text: "bi.formula_combo",
value: "demo.formula_combo"
}, {
pId: 4,
text: "bi.formula_insert",
value: "demo.formula_insert"
}, {
pId: 4,
text: "bi.formula_pane",
value: "demo.formula_pane"
}, {
pId: 4,
text: "bi.select_data_tree",
value: "demo.select_data_tree"
}, {
pId: 4,
text: "bi.select_data_switcher",
value: "demo.select_data_switcher"
}, {
pId: 4,
text: "bi.select_data_search_result",
value: "demo.select_data_search_result"
}, {
pId: 4,
text: "bi.select_data_searcher(点这)",
value: "demo.select_data_searcher"
}, {
pId: 4,
text: "bi.multidate_combo",
value: "demo.multidate_combo"
}, {
pId: 4,
text: "bi.time_interval",
value: "demo.time_interval"
}, {
pId: 4,
text: "bi.numerical_interval",
value: "demo.numerical_interval"
}, {
pId: 4,
text: "bi.multi_select_trigger",
value: "demo.multi_select_trigger"
}, {
pId: 4,
text: "bi.multi_select_search_pane",
value: "demo.multi_select_search_pane"
}, {
pId: 4,
text: "bi.multi_select_popup_view",
value: "demo.multi_select_popup_view"
}, {
pId: 4,
text: "bi.multi_select_check_pane",
value: "demo.multi_select_check_pane"
}, { }, {
pId: 4, pId: 4,
text: "bi.multi_select_combo", text: "bi.multi_select_combo",
value: "demo.multi_select_combo" value: "demo.multi_select_combo"
}, {
pId: 4,
text: "bi.move2group_combo",
value: "demo.move2group_combo"
}, {
pId: 4,
text: "bi.copy2group_combo",
value: "demo.copy2group_combo"
}, {
pId: 4,
text: "bi.single_tree_combo",
value: "demo.single_tree_combo"
}, {
pId: 4,
text: "bi.multilayer_single_tree_combo",
value: "demo.multilayer_single_tree_combo"
}, {
pId: 4,
text: "bi.select_tree_combo",
value: "demo.select_tree_combo"
}, {
pId: 4,
text: "bi.multilayer_select_tree_combo",
value: "demo.multilayer_select_tree_combo"
}, {
pId: 4,
text: "bi.dialog",
value: "demo.dialog"
}, {
pId: 4,
text: "bi.multi_tree",
value: "demo.multi_tree"
}, {
pId: 4,
text: "bi.simple_select_data_searcher",
value: "demo.simple_select_data_searcher"
}, {
pId: 4,
text: "bi.filter_pane",
value: "demo.filter_pane"
}, {
pId: 4,
text: "bi.filter_operation",
value: "demo.filter_operation"
}, {
pId: 4,
text: "bi.filter",
value: "demo.filter"
}, {
pId: 4,
text: "bi.color_chooser",
value: "demo.color_chooser"
}, {
pId: 4,
text: "bi.text_toolbar",
value: "demo.text_toolbar"
}, {
pId: 4,
text: "bi.text_area",
value: "demo.text_area"
}, {
pId: 4,
text: "bi.path_chooser",
value: "demo.path_chooser"
}, {
pId: 4,
text: "bi.direction_path_chooser",
value: "demo.direction_path_chooser"
}, {
pId: 4,
text: "bi.file_manager",
value: "demo.file_manager"
}, {
pId: 4,
text: "bi.branch_relation",
value: "demo.branch_relation"
}, {
pId: 4,
text: "bi.relation_view",
value: "demo.relation_view"
}, {
pId: 4,
text: "bi.preview_table",
value: "demo.preview_table"
}, {
pId: 4,
text: "bi.adaptive_table",
value: "demo.adaptive_table"
}, {
pId: 4,
text: "bi.adaptive_table(冻结表头)",
value: "demo.adaptive_table2"
}, {
pId: 4,
text: "bi.custom_scroll_table",
value: "demo.custom_scroll_table"
}, {
pId: 4,
text: "bi.page_table",
value: "demo.page_table"
}, {
pId: 4,
text: "bi.page_table(冻结)",
value: "demo.page_table2"
}, {
pId: 4,
text: "bi.page_table(调整列宽)",
value: "demo.page_table3"
}, {
pId: 4,
text: "bi.excel_table",
value: "demo.excel_table"
}, {
pId: 4,
text: "bi.sortable_table",
value: "demo.sortable_table"
}, {
pId: 4,
text: "bi.excel_view_display_manager",
value: "demo.excel_view_display_manager"
}, {
pId: 4,
text: "bi.sequence_table",
value: "demo.sequence_table"
}, {
pId: 4,
text: "bi.sequence_table(带有汇总)",
value: "demo.sequence_table2"
}, {
pId: 4,
text: "bi.upload_image",
value: "demo.upload_image"
}, {
pId: 4,
text: "bi.web_page",
value: "demo.web_page"
}, {
pId: 4,
text: "bi.arrangement_droppable",
value: "demo.arrangement_droppable"
}, {
pId: 4,
text: "bi.arrangement",
value: "demo.arrangement"
}, {
pId: 4,
text: "bi.adaptive_arrangement",
value: "demo.adaptive_arrangement"
}, {
pId: 4,
text: "bi.arrangement(网格布局)",
value: "demo.grid_arrangement"
}, {
pId: 4,
text: "bi.adaptive_arrangement(网格布局)",
value: "demo.grid_adaptive_arrangement"
}, {
pId: 4,
text: "bi.simple_searcher",
value: "demo.simple_searcher"
}, {
pId: 4,
text: "选色",
value: "demo.select_color_combo"
}, {
pId: 4,
text: "bi.detail_chart",
value: "demo.detail_chart"
}, {
pId: 4,
text: "柱形",
value: "demo.column_charts"
}, {
pId: 4,
text: "条形图",
value: "demo.bar_charts"
}, {
pId: 4,
text: "面积图",
value: "demo.area_charts"
}, {
pId: 4,
text: "其他",
value: "demo.other_charts"
}, {
pId: 4,
text: "文本标签",
value: "demo.list_label"
}, {
pId: 4,
text: "树标签",
value: "demo.tree_label"
}, {
pId: 4,
text: "滑块",
value: "demo.slider"
}, {
pId: 4,
text: "区间双滑块",
value: "demo.interval_slider"
}, {
pId: 4,
text: "文本列表",
value: "demo.string_list"
}, {
pId: 4,
text: "树列表",
value: "demo.tree_list"
}, {
pId: 4,
text: "日期面板",
value: "demo.data_pane"
}, {
pId: 4,
text: "螺旋分析tab控件",
value: "demo.dynamic_group_tab"
}, {
pId: 4,
text: "数值微调器",
value: "demo.finetuning_number_editor"
}]; }];

88
demo/js/widget/demo.multiselectcombo.js

File diff suppressed because one or more lines are too long

14
demo/js/widget/demo.multiselecttree.js

@ -0,0 +1,14 @@
/**
* Created by User on 2017/3/22.
*/
Demo.MultiSelectTree = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-multi-select-tree"
},
render: function () {
return {
type: "bi.vertical",
}
}
});
$.shortcut("demo.multi_select_tree", Demo.MultiSelectTree);

32803
dist/base.js vendored

File diff suppressed because it is too large Load Diff

228
dist/core.js vendored

@ -13698,6 +13698,10 @@ if (!window.BI) {
return (string + "").toLocaleLowerCase(); return (string + "").toLocaleLowerCase();
}, },
isEndWithBlank: function (string) {
return /(\s|\u00A0)$/.test(string);
},
isLiteral: function (exp) { isLiteral: function (exp) {
var literalValueRE = /^\s?(true|false|-?[\d\.]+|'[^']*'|"[^"]*")\s?$/ var literalValueRE = /^\s?(true|false|-?[\d\.]+|'[^']*'|"[^"]*")\s?$/
return literalValueRE.test(exp) return literalValueRE.test(exp)
@ -19644,7 +19648,7 @@ BI.Cache = {
* 控制器 * 控制器
* Controller层超类 * Controller层超类
* @class BI.Controller * @class BI.Controller
* @extends FR.OB * @extends BI.OB
* @abstract * @abstract
*/ */
BI.Controller = BI.inherit(BI.OB, { BI.Controller = BI.inherit(BI.OB, {
@ -22009,6 +22013,52 @@ BI.ShowListener = BI.inherit(BI.OB, {
} }
}); });
BI.ShowListener.EVENT_CHANGE = "ShowListener.EVENT_CHANGE";/** BI.ShowListener.EVENT_CHANGE = "ShowListener.EVENT_CHANGE";/**
* style加载管理器
*
* Created by GUY on 2015/9/7.
* @class
*/
BI.StyleLoaderManager = BI.inherit(BI.OB, {
_defaultConfig: function () {
return BI.extend(BI.StyleLoaderManager.superclass._defaultConfig.apply(this, arguments), {});
},
_init: function () {
BI.StyleLoaderManager.superclass._init.apply(this, arguments);
this.stylesManager = {};
},
loadStyle: function (name, styleString) {
var d = document, styles = d.createElement('style');
d.getElementsByTagName('head')[0].appendChild(styles);
styles.setAttribute('type', 'text/css');
if (styles.styleSheet) {
styles.styleSheet.cssText = styleString;
} else {
styles.appendChild(document.createTextNode(styleString));
}
this.stylesManager[name] = styles;
return this;
},
get: function (name) {
return this.stylesManager[name];
},
has: function (name) {
return this.stylesManager[name] != null;
},
removeStyle: function (name) {
if (!this.has(name)) {
return this;
}
this.stylesManager[name].parentNode.removeChild(this.stylesManager[name]);
delete this.stylesManager[name];
return this;
}
});/**
* @class BI.Logic * @class BI.Logic
* @extends BI.OB * @extends BI.OB
*/ */
@ -23160,6 +23210,66 @@ Function.prototype.after = function (func) {
func.apply(this, arguments); func.apply(this, arguments);
return ret; return ret;
} }
};/*!
* jLayout JQuery Plugin v0.11
*
* Licensed under the revised BSD License.
* Copyright 2008, Bram Stein
* All rights reserved.
*/
if (jQuery) {
(function($){
// richer:容器在其各个边缘留出的空间
$.fn.insets = function () {
var p = this.padding(),
b = this.border();
return {
'top': p.top,
'bottom': p.bottom + b.bottom + b.top,
'left': p.left,
'right': p.right + b.right + b.left
};
};
// richer:获取 && 设置jQuery元素的边界
$.fn.bounds = function (value) {
var tmp = {hasIgnoredBounds : true};
if (value) {
if (!isNaN(value.x)) {
tmp.left = value.x;
}
if (!isNaN(value.y)) {
tmp.top = value.y;
}
if (value.width != null) {
tmp.width = (value.width - (this.outerWidth(true) - this.width()));
tmp.width = (tmp.width >= 0) ? tmp.width : value.width;
// fix chrome
//tmp.width = (tmp.width >= 0) ? tmp.width : 0;
}
if (value.height != null) {
tmp.height = value.height - (this.outerHeight(true) - this.height());
tmp.height = (tmp.height >= 0) ? tmp.height : value.height;
// fix chrome
//tmp.height = (tmp.height >= 0) ? tmp.height : value.0;
}
this.css(tmp);
return this;
}
else {
// richer:注意此方法只对可见元素有效
tmp = this.position();
return {
'x': tmp.left,
'y': tmp.top,
// richer:这里计算外部宽度和高度的时候,都不包括边框
'width': this.outerWidth(),
'height': this.outerHeight()
};
}
};
})(jQuery);
};if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || };if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' ||
(0.9).toFixed(0) === '0' || (1.255).toFixed(2) !== '1.25' || (0.9).toFixed(0) === '0' || (1.255).toFixed(2) !== '1.25' ||
(1000000000000000128).toFixed(0) !== "1000000000000000128") { (1000000000000000128).toFixed(0) !== "1000000000000000128") {
@ -23644,51 +23754,6 @@ $.extend(String, {
return args[i]; return args[i];
}); });
} }
});/**
* guy
* 状态常量
*/
_.extend(BI, {
Status: {
SUCCESS: 1,
WRONG: 2,
START: 3,
END: 4,
WAITING: 5,
READY: 6,
RUNNING: 7,
OUTOFBOUNDS: 8,
NULL: -1
},
Direction: {
Top: "top",
Bottom: "bottom",
Left: "left",
Right: "right",
Custom: "custom"
},
Axis: {
Vertical: "vertical",
Horizontal: "horizontal"
},
Selection: {
Default: -999,
None: -1,
Single: 0,
Multi: 1,
All: 2
},
HorizontalAlign: {
Left: "left",
Right: "right",
Center: "center"
},
VerticalAlign: {
Middle: "middle",
Top: "top",
Bottom: "bottom"
}
});BI.EventListener = { });BI.EventListener = {
listen: function listen(target, eventType, callback) { listen: function listen(target, eventType, callback) {
if (target.addEventListener) { if (target.addEventListener) {
@ -23995,7 +24060,70 @@ _.extend(BI, {
emptyStr: "", emptyStr: "",
emptyFn: function () { emptyFn: function () {
}, },
empty: null empty: null,
KeyCode: {
BACKSPACE: 8,
COMMA: 188,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESCAPE: 27,
HOME: 36,
LEFT: 37,
NUMPAD_ADD: 107,
NUMPAD_DECIMAL: 110,
NUMPAD_DIVIDE: 111,
NUMPAD_ENTER: 108,
NUMPAD_MULTIPLY: 106,
NUMPAD_SUBTRACT: 109,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
RIGHT: 39,
SPACE: 32,
TAB: 9,
UP: 38
},
Status: {
SUCCESS: 1,
WRONG: 2,
START: 3,
END: 4,
WAITING: 5,
READY: 6,
RUNNING: 7,
OUTOFBOUNDS: 8,
NULL: -1
},
Direction: {
Top: "top",
Bottom: "bottom",
Left: "left",
Right: "right",
Custom: "custom"
},
Axis: {
Vertical: "vertical",
Horizontal: "horizontal"
},
Selection: {
Default: -999,
None: -1,
Single: 0,
Multi: 1,
All: 2
},
HorizontalAlign: {
Left: "left",
Right: "right",
Center: "center"
},
VerticalAlign: {
Middle: "middle",
Top: "top",
Bottom: "bottom"
}
});/** });/**
* absolute实现的居中布局 * absolute实现的居中布局
* @class BI.AbsoluteCenterLayout * @class BI.AbsoluteCenterLayout
@ -25844,7 +25972,6 @@ BI.CardLayout = BI.inherit(BI.Layout, {
.appendTo(this.element); .appendTo(this.element);
widget.invisible(); widget.invisible();
this.addWidget(this._getCardName(cardName), widget); this.addWidget(this._getCardName(cardName), widget);
widget._mount();
return widget; return widget;
}, },
@ -25862,7 +25989,10 @@ BI.CardLayout = BI.inherit(BI.Layout, {
//动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了 //动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了
!flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.element.hide(); !flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.element.hide();
} else { } else {
(BI.Action && action instanceof BI.Action) ? action.actionPerformed(void 0, el, callback) : el.element.show(0, callback); (BI.Action && action instanceof BI.Action) ? action.actionPerformed(void 0, el, callback) : el.element.show(0, function () {
el._mount();
callback && callback();
});
} }
}); });
}, },

BIN
dist/icon/check-box-disable.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

BIN
dist/icon/check-box-normal.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

14
src/base/collection/collection.js

@ -58,20 +58,14 @@ BI.Collection = BI.inherit(BI.Widget, {
this._calculateSizeAndPositionData(); this._calculateSizeAndPositionData();
this._populate(); this._populate();
} }
},
mounted: function () {
var o = this.options;
if (o.scrollLeft !== 0 || o.scrollTop !== 0) { if (o.scrollLeft !== 0 || o.scrollTop !== 0) {
this.element.scrollTop(o.scrollTop); BI.nextTick(function () {
this.element.scrollLeft(o.scrollLeft); self.element.scrollTop(o.scrollTop);
self.element.scrollLeft(o.scrollLeft);
});
} }
}, },
destroyed: function () {
this._debounceRelease = null;
},
_calculateSizeAndPositionData: function () { _calculateSizeAndPositionData: function () {
var o = this.options; var o = this.options;
var cellMetadata = []; var cellMetadata = [];

38
src/base/combination/combo.js

@ -4,14 +4,17 @@
*/ */
BI.Combo = BI.inherit(BI.Widget, { BI.Combo = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.Combo.superclass._defaultConfig.apply(this, arguments), { var conf = BI.Combo.superclass._defaultConfig.apply(this, arguments);
baseCls: "bi-combo", return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-combo",
trigger: "click", trigger: "click",
toggle: true, toggle: true,
direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
isDefaultInit: false, isDefaultInit: false,
isNeedAdjustHeight: true,//是否需要高度调整 isNeedAdjustHeight: true,//是否需要高度调整
isNeedAdjustWidth: true, isNeedAdjustWidth: true,
stopEvent: false,
stopPropagation: false,
adjustLength: 0,//调整的距离 adjustLength: 0,//调整的距离
adjustXOffset: 0, adjustXOffset: 0,
adjustYOffset: 0, adjustYOffset: 0,
@ -88,6 +91,14 @@ BI.Combo = BI.inherit(BI.Widget, {
_initPullDownAction: function () { _initPullDownAction: function () {
var self = this, o = this.options; var self = this, o = this.options;
var evs = this.options.trigger.split(","); var evs = this.options.trigger.split(",");
var st = function (e) {
if (o.stopEvent) {
e.stopEvent();
}
if (o.stopPropagation) {
e.stopPropagation();
}
};
BI.each(evs, function (i, ev) { BI.each(evs, function (i, ev) {
switch (ev) { switch (ev) {
case "hover": case "hover":
@ -107,8 +118,7 @@ BI.Combo = BI.inherit(BI.Widget, {
}); });
break; break;
case "click": case "click":
if (ev) { var debounce = BI.debounce(function (e) {
self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), BI.debounce(function (e) {
if (self.combo.element.__isMouseInBounds__(e)) { if (self.combo.element.__isMouseInBounds__(e)) {
if (self.isEnabled() && self.combo.isEnabled()) { if (self.isEnabled() && self.combo.isEnabled()) {
o.toggle ? self._toggle() : self._popupView(); o.toggle ? self._toggle() : self._popupView();
@ -121,11 +131,14 @@ BI.Combo = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true)); }, BI.EVENT_RESPONSE_TIME, true);
} self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function(e){
debounce(e);
st(e);
});
break; break;
} }
}) });
}, },
_initCombo: function () { _initCombo: function () {
@ -292,6 +305,7 @@ BI.Combo = BI.inherit(BI.Widget, {
top: p.top top: p.top
}); });
} }
this.position = p;
this.popupView.setVisible(isVisible); this.popupView.setVisible(isVisible);
}, },
@ -315,7 +329,7 @@ BI.Combo = BI.inherit(BI.Widget, {
BI.Combo.superclass.setEnable.apply(this, arguments); BI.Combo.superclass.setEnable.apply(this, arguments);
this.combo && this.combo.setEnable(arg); this.combo && this.combo.setEnable(arg);
this.popupView && this.popupView.setEnable(arg); this.popupView && this.popupView.setEnable(arg);
!arg && this._hideView(); !arg && this.isViewVisible() && this._hideView();
}, },
setValue: function (v) { setValue: function (v) {
@ -347,6 +361,10 @@ BI.Combo = BI.inherit(BI.Widget, {
return this.popupView; return this.popupView;
}, },
getPopupPosition: function () {
return this.position;
},
doBehavior: function () { doBehavior: function () {
this._assertPopupView(); this._assertPopupView();
this.popupView && this.popupView.doBehavior.apply(this.popupView, arguments); this.popupView && this.popupView.doBehavior.apply(this.popupView, arguments);
@ -356,14 +374,14 @@ BI.Combo = BI.inherit(BI.Widget, {
this._toggle(); this._toggle();
}, },
destroyed: function () { destroy: function () {
$(document).unbind("mousedown." + this.getName()) $(document).unbind("mousedown." + this.getName())
.unbind("mousewheel." + this.getName()) .unbind("mousewheel." + this.getName())
.unbind("mouseenter." + this.getName()) .unbind("mouseenter." + this.getName())
.unbind("mousemove." + this.getName()) .unbind("mousemove." + this.getName())
.unbind("mouseleave." + this.getName()); .unbind("mouseleave." + this.getName());
this.popupView && this.popupView.destroy();
BI.Resizers.remove(this.getName()); BI.Resizers.remove(this.getName());
BI.Combo.superclass.destroy.apply(this, arguments);
} }
}); });
BI.Combo.EVENT_TRIGGER_CHANGE = "EVENT_TRIGGER_CHANGE"; BI.Combo.EVENT_TRIGGER_CHANGE = "EVENT_TRIGGER_CHANGE";

11
src/base/combination/expander.js

@ -35,8 +35,13 @@ BI.Expander = BI.inherit(BI.Widget, {
self._hideView(); self._hideView();
} }
if (self.isEnabled() && this.isEnabled()) { if (self.isEnabled() && this.isEnabled()) {
if (type === BI.Events.EXPAND || type === BI.Events.COLLAPSE) { if (type === BI.Events.EXPAND) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Expander.EVENT_EXPAND);
}
if(type === BI.Events.COLLAPSE) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
self.fireEvent(BI.Expander.EVENT_COLLAPSE);
} }
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.fireEvent(BI.Expander.EVENT_TRIGGER_CHANGE, value, obj); self.fireEvent(BI.Expander.EVENT_TRIGGER_CHANGE, value, obj);
@ -254,8 +259,8 @@ BI.Expander = BI.inherit(BI.Widget, {
return this.popupView && this.popupView.getNodeByValue(value); return this.popupView && this.popupView.getNodeByValue(value);
}, },
destroyed: function () { destroy: function () {
this.popupView && this.popupView.destroy(); BI.Expander.superclass.destroy.apply(this, arguments);
} }
}); });
BI.Expander.EVENT_EXPAND = "EVENT_EXPAND"; BI.Expander.EVENT_EXPAND = "EVENT_EXPAND";

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

@ -298,6 +298,10 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
} }
}); });
return node; return node;
},
destroy: function () {
BI.ButtonGroup.superclass.destroy.apply(this, arguments);
} }
}); });
BI.extend(BI.ButtonGroup, { BI.extend(BI.ButtonGroup, {

4
src/base/combination/loader.js

@ -252,6 +252,10 @@ BI.Loader = BI.inherit(BI.Widget, {
BI.each([this.prev, this.next], function (i, ob) { BI.each([this.prev, this.next], function (i, ob) {
ob && ob.setVisible(false); ob && ob.setVisible(false);
}); });
},
destroy: function () {
BI.Loader.superclass.destroy.apply(this, arguments);
} }
}); });
BI.Loader.EVENT_CHANGE = "EVENT_CHANGE"; BI.Loader.EVENT_CHANGE = "EVENT_CHANGE";

115
src/base/combination/map.button.js

@ -0,0 +1,115 @@
/**
* value作为key值缓存button 不支持顺序读写
* 适合用于频繁增删的一组button
* Created by GUY on 2015/8/10.
* @class BI.ButtonMap
* @extends BI.ButtonTree
*/
BI.ButtonMap = BI.inherit(BI.ButtonTree, {
_defaultConfig: function () {
return BI.extend(BI.ButtonMap.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-button-map"
})
},
_init: function () {
BI.ButtonMap.superclass._init.apply(this, arguments);
},
_createBtns: function (items) {
var self = this, o = this.options;
var buttons = BI.createWidgets(BI.createItems(items, {type: "bi.text_button", once: o.chooseType === 0}));
var keys = BI.map(items, function (i, item) {
item = BI.stripEL(item);
if (!(item.id || item.value)) {
throw new Error("item必须包含id或value属性");
}
return item.id || item.value;
});
return BI.object(keys, buttons);
},
setValue: function (v) {
var self = this;
v = BI.isArray(v) ? v : [v];
BI.each(this.buttons, function (val, item) {
if (!BI.isFunction(item.setSelected)) {
item.setValue(v);
return;
}
if (v.contains(val)) {
item.setSelected && item.setSelected(true);
} else {
item.setSelected && item.setSelected(false);
}
});
},
setNotSelectedValue: function (v) {
var self = this;
v = BI.isArray(v) ? v : [v];
BI.each(this.buttons, function (val, item) {
if (!BI.isFunction(item.setSelected)) {
item.setNotSelectedValue(v);
return;
}
if (v.contains(val)) {
item.setSelected && item.setSelected(false);
} else {
item.setSelected && item.setSelected(true);
}
});
},
populate: function (items) {
var self = this;
var args = [].slice.call(arguments);
var linkHashMap = new BI.LinkHashMap();
var val = function (item) {
return item.id || item.value;
};
if (!this.buttons) {
this.buttons = {};
}
//所有已存在的和新添加的
var willCreated = [];
BI.each(items, function (i, item) {
item = BI.stripEL(item);
if (self.buttons[val(item)]) {
var ob = self.buttons[val(item)];
args[0] = item.items;
args[2] = item;
ob.populate && ob.populate.apply(ob, args);
} else {
willCreated.push(item);
}
});
//创建新元素
args[0] = willCreated;
var newBtns = this._btnsCreator.apply(this, args);
//整理
var array = [];
BI.each(items, function (i, item) {
item = BI.stripEL(item);
var button = self.buttons[val(item)] || newBtns[val(item)];
linkHashMap.add(val(item), button);
array.push(button);
});
this.buttons = linkHashMap.map;
BI.DOM.hang(this.buttons);
this.empty();
var packages = this._packageItems(items, this._packageBtns(array));
BI.createWidget(BI.extend({element: this}, this._packageLayout(packages)));
},
getIndexByValue: function (value) {
throw new Error("不能使用getIndexByValue方法");
}
});
BI.ButtonMap.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut("bi.button_map", BI.ButtonMap);

4
src/base/combination/navigation.js

@ -127,6 +127,10 @@ BI.Navigation = BI.inherit(BI.Widget, {
empty: function(){ empty: function(){
this.layout.deleteAllCard(); this.layout.deleteAllCard();
this.cardMap = {}; this.cardMap = {};
},
destroy: function(){
BI.Navigation.superclass.destroy.apply(this, arguments);
} }
}); });
BI.Navigation.EVENT_CHANGE = "EVENT_CHANGE"; BI.Navigation.EVENT_CHANGE = "EVENT_CHANGE";

27
src/base/combination/searcher.js

@ -90,27 +90,26 @@ BI.Searcher = BI.inherit(BI.Widget, {
type: "bi.searcher_view", type: "bi.searcher_view",
chooseType: o.chooseType chooseType: o.chooseType
}); });
BI.Maskers.create(this.getName(), o.adapter, { BI.Maskers.create(this.getName(), o.adapter, BI.extend({
offset: o.masker.offset,
container: this, container: this,
render: this.popupView render: this.popupView
}); }, o.masker));
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
if (o.isAutoSync) { if (o.isAutoSync) {
var values = o.adapter.getValue(); var values = o.adapter && o.adapter.getValue();
if (!obj.isSelected()) { if (!obj.isSelected()) {
o.adapter.setValue(BI.deepWithout(values, obj.getValue())); o.adapter && o.adapter.setValue(BI.deepWithout(values, obj.getValue()));
} else { } else {
switch (o.chooseType) { switch (o.chooseType) {
case BI.ButtonGroup.CHOOSE_TYPE_SINGLE: case BI.ButtonGroup.CHOOSE_TYPE_SINGLE:
o.adapter.setValue([obj.getValue()]); o.adapter && o.adapter.setValue([obj.getValue()]);
break; break;
case BI.ButtonGroup.CHOOSE_TYPE_MULTI: case BI.ButtonGroup.CHOOSE_TYPE_MULTI:
values.push(obj.getValue()); values.push(obj.getValue());
o.adapter.setValue(values); o.adapter && o.adapter.setValue(values);
break; break;
} }
} }
@ -140,7 +139,9 @@ BI.Searcher = BI.inherit(BI.Widget, {
_pauseSearch: function () { _pauseSearch: function () {
var o = this.options, name = this.getName(); var o = this.options, name = this.getName();
this._stop = true; this._stop = true;
BI.nextTick(function (name) {
BI.Maskers.hide(name); BI.Maskers.hide(name);
}, this.getName());
if (BI.Maskers.has(name) && this._isSearching === true) { if (BI.Maskers.has(name) && this._isSearching === true) {
this.popupView && this.popupView.pauseSearch && this.popupView.pauseSearch(); this.popupView && this.popupView.pauseSearch && this.popupView.pauseSearch();
this.fireEvent(BI.Searcher.EVENT_PAUSE); this.fireEvent(BI.Searcher.EVENT_PAUSE);
@ -181,7 +182,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
o.onSearch({ o.onSearch({
times: 1, times: 1,
keyword: keyword, keyword: keyword,
selectedValues: o.adapter.getValue() selectedValues: o.adapter && o.adapter.getValue()
}, function (searchResult, matchResult) { }, function (searchResult, matchResult) {
if (!self._stop) { if (!self._stop) {
var args = [].slice.call(arguments); var args = [].slice.call(arguments);
@ -190,7 +191,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
} }
BI.Maskers.show(self.getName()); BI.Maskers.show(self.getName());
self.popupView.populate.apply(self.popupView, args); self.popupView.populate.apply(self.popupView, args);
o.isAutoSync && self.popupView.setValue(o.adapter.getValue()); o.isAutoSync && self.popupView.setValue(o.adapter && o.adapter.getValue());
self.popupView.loaded && self.popupView.loaded(); self.popupView.loaded && self.popupView.loaded();
self.fireEvent(BI.Searcher.EVENT_SEARCHING); self.fireEvent(BI.Searcher.EVENT_SEARCHING);
} }
@ -258,6 +259,10 @@ BI.Searcher = BI.inherit(BI.Widget, {
return this.editor.getValue(); return this.editor.getValue();
}, },
getKeywords: function () {
return this.editor.getKeywords();
},
getValue: function () { getValue: function () {
var o = this.options; var o = this.options;
if (o.isAutoSync) { if (o.isAutoSync) {
@ -283,9 +288,9 @@ BI.Searcher = BI.inherit(BI.Widget, {
this.popupView && this.popupView.empty(); this.popupView && this.popupView.empty();
}, },
destroyed: function () { destroy: function () {
this.popupView && this.popupView.destroy();
BI.Maskers.remove(this.getName()); BI.Maskers.remove(this.getName());
BI.Searcher.superclass.destroy.apply(this, arguments);
} }
}); });
BI.Searcher.EVENT_CHANGE = "EVENT_CHANGE"; BI.Searcher.EVENT_CHANGE = "EVENT_CHANGE";

4
src/base/combination/switcher.js

@ -258,8 +258,8 @@ BI.Switcher = BI.inherit(BI.Widget, {
this.popupView && this.popupView.empty(); this.popupView && this.popupView.empty();
}, },
destroyed: function () { destroy: function () {
this.popupView && this.popupView.destroy(); BI.Switcher.superclass.destroy.apply(this, arguments);
} }
}); });
BI.Switcher.EVENT_EXPAND = "EVENT_EXPAND"; BI.Switcher.EVENT_EXPAND = "EVENT_EXPAND";

4
src/base/combination/tab.js

@ -114,9 +114,9 @@ BI.Tab = BI.inherit(BI.Widget, {
this.cardMap = {}; this.cardMap = {};
}, },
destroyed: function () { destroy: function () {
this.layout.deleteAllCard();
this.cardMap = {}; this.cardMap = {};
BI.Tab.superclass.destroy.apply(this, arguments);
} }
}); });
BI.Tab.EVENT_CHANGE = "EVENT_CHANGE"; BI.Tab.EVENT_CHANGE = "EVENT_CHANGE";

116
src/base/combination/tree.button.js

@ -180,119 +180,3 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
BI.ButtonTree.EVENT_CHANGE = "EVENT_CHANGE"; BI.ButtonTree.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut("bi.button_tree", BI.ButtonTree); $.shortcut("bi.button_tree", BI.ButtonTree);
/**
* value作为key值缓存button 不支持顺序读写
* 适合用于频繁增删的一组button
* Created by GUY on 2015/8/10.
* @class BI.ButtonMap
* @extends BI.ButtonTree
*/
BI.ButtonMap = BI.inherit(BI.ButtonTree, {
_defaultConfig: function () {
return BI.extend(BI.ButtonMap.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-button-map"
})
},
_init: function () {
BI.ButtonMap.superclass._init.apply(this, arguments);
},
_createBtns: function (items) {
var self = this, o = this.options;
var buttons = BI.createWidgets(BI.createItems(items, {type: "bi.text_button", once: o.chooseType === 0}));
var keys = BI.map(items, function (i, item) {
item = BI.stripEL(item);
if (!(item.id || item.value)) {
throw new Error("item必须包含id或value属性");
}
return item.id || item.value;
});
return BI.object(keys, buttons);
},
setValue: function (v) {
var self = this;
v = BI.isArray(v) ? v : [v];
BI.each(this.buttons, function (val, item) {
if (!BI.isFunction(item.setSelected)) {
item.setValue(v);
return;
}
if (v.contains(val)) {
item.setSelected && item.setSelected(true);
} else {
item.setSelected && item.setSelected(false);
}
});
},
setNotSelectedValue: function (v) {
var self = this;
v = BI.isArray(v) ? v : [v];
BI.each(this.buttons, function (val, item) {
if (!BI.isFunction(item.setSelected)) {
item.setNotSelectedValue(v);
return;
}
if (v.contains(val)) {
item.setSelected && item.setSelected(false);
} else {
item.setSelected && item.setSelected(true);
}
});
},
populate: function (items) {
var self = this;
var args = [].slice.call(arguments);
var linkHashMap = new BI.LinkHashMap();
var val = function (item) {
return item.id || item.value;
};
if (!this.buttons) {
this.buttons = {};
}
//所有已存在的和新添加的
var willCreated = [];
BI.each(items, function (i, item) {
item = BI.stripEL(item);
if (self.buttons[val(item)]) {
var ob = self.buttons[val(item)];
args[0] = item.items;
args[2] = item;
ob.populate && ob.populate.apply(ob, args);
} else {
willCreated.push(item);
}
});
//创建新元素
args[0] = willCreated;
var newBtns = this._btnsCreator.apply(this, args);
//整理
var array = [];
BI.each(items, function (i, item) {
item = BI.stripEL(item);
var button = self.buttons[val(item)] || newBtns[val(item)];
linkHashMap.add(val(item), button);
array.push(button);
});
this.buttons = linkHashMap.map;
BI.DOM.hang(this.buttons);
this.empty();
var packages = this._packageItems(items, this._packageBtns(array));
BI.createWidget(BI.extend({element: this}, this._packageLayout(packages)));
},
getIndexByValue: function (value) {
throw new Error("不能使用getIndexByValue方法");
}
});
BI.ButtonMap.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut("bi.button_map", BI.ButtonMap);

2
src/base/farbtastic/farbtastic.js

@ -18,6 +18,8 @@ BI.Farbtastic = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.Farbtastic.superclass._init.apply(this, arguments); BI.Farbtastic.superclass._init.apply(this, arguments);
var self = this; var self = this;
FR.$defaultImport('/com/fr/bi/web/js/third/farbtastic.js', 'js');
FR.$defaultImport('/com/fr/bi/web/css/base/third/farbtastic/farbtastic.css', 'css');
this.farbtastic = $.farbtastic(this.element, function (v) { this.farbtastic = $.farbtastic(this.element, function (v) {
self.fireEvent(BI.Farbtastic.EVENT_CHANGE, self.getValue(), self); self.fireEvent(BI.Farbtastic.EVENT_CHANGE, self.getValue(), self);

88
src/base/formula/codemirror/addon/formula-hint.js vendored

@ -0,0 +1,88 @@
(function (mod) {
mod(CodeMirror);
})(function (CodeMirror) {
var Pos = CodeMirror.Pos;
function forEach(arr, f) {
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
}
function arrayContains(arr, item) {
if (!Array.prototype.indexOf) {
var i = arr.length;
while (i--) {
if (arr[i] === item) {
return true;
}
}
return false;
}
return arr.indexOf(item) != -1;
}
function scriptHint(editor, keywords, getToken, options) {
// Find the token at the cursor
var cur = editor.getCursor(), token = getToken(editor, cur);
if (/\b(?:string)\b/.test(token.type)) {
return;
}
token.state = CodeMirror.innerMode(editor.getMode(), token.state).state;
if (!/^[\w$_]*$/.test(token.string)) {
token = {
start: cur.ch, end: cur.ch, string: "", state: token.state,
type: token.string == "." ? "property" : null
};
} else if (token.end > cur.ch) {
token.end = cur.ch;
token.string = token.string.slice(0, cur.ch - token.start);
}
var tprop = token;
// If it is a property, find out what it is a property of.
while (tprop.type == "property") {
tprop = getToken(editor, Pos(cur.line, tprop.start));
if (tprop.string != ".") return;
tprop = getToken(editor, Pos(cur.line, tprop.start));
if (!context) var context = [];
context.push(tprop);
}
return {
list: getCompletions(token, context, keywords, options),
from: Pos(cur.line, token.start),
to: Pos(cur.line, token.end)
};
}
function getFormulaKeywords() {
return FormulaCollections;
}
function formulaHint(editor, options) {
return scriptHint(editor, getFormulaKeywords(),
function (e, cur) {
return e.getTokenAt(cur);
},
options);
};
CodeMirror.registerHelper("hint", "formula", formulaHint);
function getCompletions(token, context, keywords, options) {
var found = [], start = token.string;
if (!start) {
return found;
}
function maybeAdd(str) {
if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) {
found.push(str);
}
}
if (context && context.length) {
context.pop();
} else {
forEach(keywords, maybeAdd);
}
return found;
}
});

80
src/base/formula/codemirror/addon/formula-mode.js vendored

@ -0,0 +1,80 @@
(function (mod) {
mod(CodeMirror);
})(function (CodeMirror) {
"use strict";
CodeMirror.defineMode('formula', function () {
function wordObj(words) {
var o = {};
for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true;
return o;
}
var atoms = wordObj(['false', 'true']);
var keywords = wordObj(FormulaCollections);
function tokenBase(stream, state) {
if (stream.eatSpace()) {
return null;
}
var ch = stream.next();
if (ch === '"' || ch === '\'') {
nextUntilUnescaped(stream, ch);
return "string";
}
if (/[\[\],\(\)]/.test(ch)) {
return 'bracket';
}
// richie:暂时不需要解析操作符号
//if (/[+\-*\/=<>!&|]/.test(ch)) {
// return 'operator';
//}
//if (/\d|\d./.test(ch)) {
// stream.eatWhile(/\d|\./);
// if (stream.eol() || !/\w/.test(stream.peek())) {
// return 'number';
// }
//}
stream.eatWhile(/[\w-]/);
var word = stream.current();
if (atoms.hasOwnProperty(word)) {
return "atom";
}
if (keywords.hasOwnProperty(word)) {
return "keyword";
}
return null;
}
function nextUntilUnescaped(stream, end) {
var escaped = false, next;
while ((next = stream.next()) != null) {
if (next === end && !escaped) {
return false;
}
escaped = !escaped && next === "\\";
}
return escaped;
}
function tokenize(stream, state) {
return (state.tokens[0] || tokenBase)(stream, state);
}
return {
startState: function () {
return {tokens: []};
},
token: function (stream, state) {
return tokenize(stream, state);
},
fold: "brace"
};
});
CodeMirror.defineMIME("text/fx-formula", "formula");
});

432
src/base/formula/codemirror/addon/show-hint.js vendored

@ -0,0 +1,432 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function (mod) {
mod(CodeMirror);
})(function (CodeMirror) {
"use strict";
var HINT_ELEMENT_CLASS = "CodeMirror-hint";
var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active";
// This is the old interface, kept around for now to stay
// backwards-compatible.
CodeMirror.showHint = function (cm, getHints, options) {
if (!getHints) return cm.showHint(options);
if (options && options.async) getHints.async = true;
var newOpts = {hint: getHints};
if (options) for (var prop in options) newOpts[prop] = options[prop];
return cm.showHint(newOpts);
};
CodeMirror.defineExtension("showHint", function (options) {
// We want a single cursor position.
if (this.listSelections().length > 1 || this.somethingSelected()) return;
if (this.state.completionActive) this.state.completionActive.close();
var completion = this.state.completionActive = new Completion(this, options);
if (!completion.options.hint) return;
CodeMirror.signal(this, "startCompletion", this);
completion.update(true);
});
function Completion(cm, options) {
this.cm = cm;
this.options = this.buildOptions(options);
this.widget = null;
this.debounce = 0;
this.tick = 0;
this.startPos = this.cm.getCursor();
this.startLen = this.cm.getLine(this.startPos.line).length;
var self = this;
cm.on("cursorActivity", this.activityFunc = function () {
self.cursorActivity();
});
}
var requestAnimationFrame = window.requestAnimationFrame || function (fn) {
return setTimeout(fn, 1000 / 60);
};
var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
Completion.prototype = {
close: function () {
if (!this.active()) return;
this.cm.state.completionActive = null;
this.tick = null;
this.cm.off("cursorActivity", this.activityFunc);
if (this.widget && this.data) CodeMirror.signal(this.data, "close");
if (this.widget) this.widget.close();
CodeMirror.signal(this.cm, "endCompletion", this.cm);
},
active: function () {
return this.cm.state.completionActive == this;
},
pick: function (data, i) {
var completion = data.list[i];
if (completion.hint) completion.hint(this.cm, data, completion);
else {
this.cm.replaceRange(getText(completion), completion.from || data.from,
completion.to || data.to, "complete");
var to = this.cm.getCursor();
this.cm.markText(completion.from || data.from, to, {className: "#function", atomic: true});
this.cm.replaceSelection("() ");
to = this.cm.getCursor();
to.ch = to.ch - 2;
this.cm.setCursor(to);
this.cm.focus();
}
CodeMirror.signal(data, "pick", completion);
this.close();
},
cursorActivity: function () {
if (this.debounce) {
cancelAnimationFrame(this.debounce);
this.debounce = 0;
}
var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line);
if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch ||
pos.ch < this.startPos.ch || this.cm.somethingSelected() ||
(pos.ch && this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) {
this.close();
} else {
var self = this;
this.debounce = requestAnimationFrame(function () {
self.update();
});
if (this.widget) this.widget.disable();
}
},
update: function (first) {
if (this.tick == null) return;
if (this.data) CodeMirror.signal(this.data, "update");
if (!this.options.hint.async) {
this.finishUpdate(this.options.hint(this.cm, this.options), first);
} else {
var myTick = ++this.tick, self = this;
this.options.hint(this.cm, function (data) {
if (self.tick == myTick) self.finishUpdate(data, first);
}, this.options);
}
},
finishUpdate: function (data, first) {
this.data = data;
var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
if (this.widget) this.widget.close();
if (data && data.list.length) {
if (picked && data.list.length == 1) {
this.pick(data, 0);
} else {
this.widget = new Widget(this, data);
CodeMirror.signal(data, "shown");
}
}
},
buildOptions: function (options) {
var editor = this.cm.options.hintOptions;
var out = {};
for (var prop in defaultOptions) out[prop] = defaultOptions[prop];
if (editor) for (var prop in editor)
if (editor[prop] !== undefined) out[prop] = editor[prop];
if (options) for (var prop in options)
if (options[prop] !== undefined) out[prop] = options[prop];
return out;
}
};
function getText(completion) {
if (typeof completion == "string") return completion;
else return completion.text;
}
function buildKeyMap(completion, handle) {
var baseMap = {
Up: function () {
handle.moveFocus(-1);
},
Down: function () {
handle.moveFocus(1);
},
PageUp: function () {
handle.moveFocus(-handle.menuSize() + 1, true);
},
PageDown: function () {
handle.moveFocus(handle.menuSize() - 1, true);
},
Home: function () {
handle.setFocus(0);
},
End: function () {
handle.setFocus(handle.length - 1);
},
Enter: handle.pick,
Tab: handle.pick,
Esc: handle.close
};
var custom = completion.options.customKeys;
var ourMap = custom ? {} : baseMap;
function addBinding(key, val) {
var bound;
if (typeof val != "string")
bound = function (cm) {
return val(cm, handle);
};
// This mechanism is deprecated
else if (baseMap.hasOwnProperty(val))
bound = baseMap[val];
else
bound = val;
ourMap[key] = bound;
}
if (custom)
for (var key in custom) if (custom.hasOwnProperty(key))
addBinding(key, custom[key]);
var extra = completion.options.extraKeys;
if (extra)
for (var key in extra) if (extra.hasOwnProperty(key))
addBinding(key, extra[key]);
return ourMap;
}
function getHintElement(hintsElement, el) {
while (el && el != hintsElement) {
if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el;
el = el.parentNode;
}
}
function Widget(completion, data) {
this.completion = completion;
this.data = data;
this.picked = false;
var widget = this, cm = completion.cm;
var hints = this.hints = document.createElement("ul");
hints.className = "CodeMirror-hints";
this.selectedHint = data.selectedHint || 0;
var completions = data.list;
for (var i = 0; i < completions.length; ++i) {
var elt = hints.appendChild(document.createElement("li")), cur = completions[i];
var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS);
if (cur.className != null) className = cur.className + " " + className;
elt.className = className;
if (cur.render) cur.render(elt, data, cur);
else elt.appendChild(document.createTextNode(cur.displayText || getText(cur)));
elt.hintId = i;
}
var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null);
var left = pos.left, top = pos.bottom, below = true;
hints.style.left = left + "px";
hints.style.top = top + "px";
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);
(completion.options.container || document.body).appendChild(hints);
var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH;
if (overlapY > 0) {
var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top);
if (curTop - height > 0) { // Fits above cursor
hints.style.top = (top = pos.top - height) + "px";
below = false;
} else if (height > winH) {
hints.style.height = (winH - 5) + "px";
hints.style.top = (top = pos.bottom - box.top) + "px";
var cursor = cm.getCursor();
if (data.from.ch != cursor.ch) {
pos = cm.cursorCoords(cursor);
hints.style.left = (left = pos.left) + "px";
box = hints.getBoundingClientRect();
}
}
}
var overlapX = box.right - winW;
if (overlapX > 0) {
if (box.right - box.left > winW) {
hints.style.width = (winW - 5) + "px";
overlapX -= (box.right - box.left) - winW;
}
hints.style.left = (left = pos.left - overlapX) + "px";
}
cm.addKeyMap(this.keyMap = buildKeyMap(completion, {
moveFocus: function (n, avoidWrap) {
widget.changeActive(widget.selectedHint + n, avoidWrap);
},
setFocus: function (n) {
widget.changeActive(n);
},
menuSize: function () {
return widget.screenAmount();
},
length: completions.length,
close: function () {
completion.close();
},
pick: function () {
widget.pick();
},
data: data
}));
if (completion.options.closeOnUnfocus) {
var closingOnBlur;
cm.on("blur", this.onBlur = function () {
closingOnBlur = setTimeout(function () {
completion.close();
}, 100);
});
cm.on("focus", this.onFocus = function () {
clearTimeout(closingOnBlur);
});
}
var startScroll = cm.getScrollInfo();
cm.on("scroll", this.onScroll = function () {
var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
var newTop = top + startScroll.top - curScroll.top;
var point = newTop - (window.pageYOffset || (document.documentElement || document.body).scrollTop);
if (!below) point += hints.offsetHeight;
if (point <= editor.top || point >= editor.bottom) return completion.close();
hints.style.top = newTop + "px";
hints.style.left = (left + startScroll.left - curScroll.left) + "px";
});
CodeMirror.on(hints, "dblclick", function (e) {
var t = getHintElement(hints, e.target || e.srcElement);
if (t && t.hintId != null) {
widget.changeActive(t.hintId);
widget.pick();
}
});
CodeMirror.on(hints, "click", function (e) {
var t = getHintElement(hints, e.target || e.srcElement);
if (t && t.hintId != null) {
widget.changeActive(t.hintId);
if (completion.options.completeOnSingleClick) widget.pick();
}
});
CodeMirror.on(hints, "mousedown", function () {
setTimeout(function () {
cm.focus();
}, 20);
});
CodeMirror.signal(data, "select", completions[0], hints.firstChild);
return true;
}
Widget.prototype = {
close: function () {
if (this.completion.widget != this) return;
this.completion.widget = null;
this.hints.parentNode.removeChild(this.hints);
this.completion.cm.removeKeyMap(this.keyMap);
var cm = this.completion.cm;
if (this.completion.options.closeOnUnfocus) {
cm.off("blur", this.onBlur);
cm.off("focus", this.onFocus);
}
cm.off("scroll", this.onScroll);
},
disable: function () {
this.completion.cm.removeKeyMap(this.keyMap);
var widget = this;
this.keyMap = {
Enter: function () {
widget.picked = true;
}
};
this.completion.cm.addKeyMap(this.keyMap);
},
pick: function () {
this.completion.pick(this.data, this.selectedHint);
},
changeActive: function (i, avoidWrap) {
if (i >= this.data.list.length)
i = avoidWrap ? this.data.list.length - 1 : 0;
else if (i < 0)
i = avoidWrap ? 0 : this.data.list.length - 1;
if (this.selectedHint == i) return;
var node = this.hints.childNodes[this.selectedHint];
node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, "");
node = this.hints.childNodes[this.selectedHint = i];
node.className += " " + ACTIVE_HINT_ELEMENT_CLASS;
if (node.offsetTop < this.hints.scrollTop)
this.hints.scrollTop = node.offsetTop - 3;
else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight)
this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3;
CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node);
},
screenAmount: function () {
return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1;
}
};
CodeMirror.registerHelper("hint", "auto", function (cm, options) {
var helpers = cm.getHelpers(cm.getCursor(), "hint"), words;
if (helpers.length) {
for (var i = 0; i < helpers.length; i++) {
var cur = helpers[i](cm, options);
if (cur && cur.list.length) return cur;
}
} else if (words = cm.getHelper(cm.getCursor(), "hintWords")) {
if (words) return CodeMirror.hint.fromList(cm, {words: words});
} else if (CodeMirror.hint.anyword) {
return CodeMirror.hint.anyword(cm, options);
}
});
CodeMirror.registerHelper("hint", "fromList", function (cm, options) {
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
var found = [];
for (var i = 0; i < options.words.length; i++) {
var word = options.words[i];
if (word.slice(0, token.string.length) == token.string)
found.push(word);
}
if (found.length) return {
list: found,
from: CodeMirror.Pos(cur.line, token.start),
to: CodeMirror.Pos(cur.line, token.end)
};
});
CodeMirror.commands.autocomplete = CodeMirror.showHint;
var defaultOptions = {
hint: CodeMirror.hint.auto,
completeSingle: true,
alignWithWord: true,
closeCharacters: /[\s()\[\]{};:>,]/,
closeOnUnfocus: true,
completeOnSingleClick: true,
container: null,
customKeys: null,
extraKeys: null
};
CodeMirror.defineOption("hintOptions", null);
});

8736
src/base/formula/codemirror/codemirror.js

File diff suppressed because it is too large Load Diff

9
src/base/formula/formulaeditor.js

@ -11,7 +11,8 @@
baseCls: 'bi-formula-editor', baseCls: 'bi-formula-editor',
watermark: '', watermark: '',
value: '', value: '',
fieldTextValueMap: {} fieldTextValueMap: {},
showHint: true
}); });
}, },
_init: function () { _init: function () {
@ -25,7 +26,9 @@
}); });
this.editor.on("change", function (cm, change) { this.editor.on("change", function (cm, change) {
self._checkWaterMark(); self._checkWaterMark();
if(o.showHint){
CodeMirror.showHint(cm, CodeMirror.formulaHint, {completeSingle: false}); CodeMirror.showHint(cm, CodeMirror.formulaHint, {completeSingle: false});
}
BI.nextTick(function () { BI.nextTick(function () {
self.fireEvent(BI.FormulaEditor.EVENT_CHANGE) self.fireEvent(BI.FormulaEditor.EVENT_CHANGE)
}); });
@ -99,6 +102,10 @@
this._checkWaterMark(); this._checkWaterMark();
}, },
focus: function() {
this.editor.focus();
},
/** /**
* 添加字段 * 添加字段
* @param field * @param field

21
src/base/foundation/bi.message.js

@ -9,6 +9,15 @@ $.extend(BI, {
var messageShow, $mask, $pop; var messageShow, $mask, $pop;
return { return {
alert: function (title, message, callback) {
this._show(false, title, message, callback);
},
confirm: function (title, message, callback, min_width) {
this._show(true, title, message, callback);
},
prompt: function (title, message, value, callback, min_width) {
FR.Msg.prompt(title, message, value, callback, min_width);
},
toast: function (message, level, context) { toast: function (message, level, context) {
context = context || $("body"); context = context || $("body");
var toast = BI.createWidget({ var toast = BI.createWidget({
@ -41,16 +50,16 @@ $.extend(BI, {
_show: function (hasCancel, title, message, callback) { _show: function (hasCancel, title, message, callback) {
$mask = $('<div class="bi-message-mask">').css({ $mask = $('<div class="bi-message-mask">').css({
position: 'absolute', position: 'absolute',
'zIndex': 99999998, 'zIndex': BI.zIndex_tip - 2,
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 0,
bottom: 0, bottom: 0,
opacity: 0.1 opacity: 0.5
}).appendTo('body'); }).appendTo('body');
$pop = $('<div class="bi-message-depend">').css({ $pop = $('<div class="bi-message-depend">').css({
position: 'absolute', position: 'absolute',
'zIndex': 99999999, 'zIndex': BI.zIndex_tip - 1,
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 0,
@ -65,7 +74,7 @@ $.extend(BI, {
controlItems.push({ controlItems.push({
el: { el: {
type: 'bi.button', type: 'bi.button',
text: BI.i18nText("BI-Cancel"), text: BI.i18nText("BI-Basic_Cancel"),
height: 30, height: 30,
level: 'ignore', level: 'ignore',
handler: function () { handler: function () {
@ -80,7 +89,7 @@ $.extend(BI, {
controlItems.push({ controlItems.push({
el: { el: {
type: 'bi.button', type: 'bi.button',
text: BI.i18nText("BI-OK"), text: BI.i18nText("BI-Basic_OK"),
height: 30, height: 30,
handler: function () { handler: function () {
close(); close();
@ -106,7 +115,7 @@ $.extend(BI, {
center: { center: {
el: { el: {
type: 'bi.label', type: 'bi.label',
text: title || BI.i18nText("BI-Prompt"), text: title || BI.i18nText("BI-Basic_Prompt"),
textAlign: 'left', textAlign: 'left',
hgap: 20, hgap: 20,
height: 50 height: 50

10
src/base/grid/grid.js

@ -60,13 +60,11 @@ BI.Grid = BI.inherit(BI.Widget, {
if (o.items.length > 0) { if (o.items.length > 0) {
this._populate(); this._populate();
} }
},
mounted: function () {
var o = this.options;
if (o.scrollLeft !== 0 || o.scrollTop !== 0) { if (o.scrollLeft !== 0 || o.scrollTop !== 0) {
this.element.scrollTop(o.scrollTop); BI.nextTick(function () {
this.element.scrollLeft(o.scrollLeft); self.element.scrollTop(o.scrollTop);
self.element.scrollLeft(o.scrollLeft);
});
} }
}, },

19
src/base/layer/layer.popup.js

@ -53,7 +53,14 @@ BI.PopupView = BI.inherit(BI.Widget, {
"z-index": BI.zIndex_popup, "z-index": BI.zIndex_popup,
"min-width": o.minWidth + "px", "min-width": o.minWidth + "px",
"max-width": o.maxWidth + "px" "max-width": o.maxWidth + "px"
}).bind({"click": fn, "mousewheel": fn}); }).bind({"click": fn});
//FIXME IE8下 jquery.mousewheeel.js 第一次执行65行$elem["offsetParent"]()的时候报错:未指明的错误 但是第二次或者调试的时候展开一下$elem内容均能避免上述问题
try {
this.element.bind("mousewheel", fn);
} catch (e) {
this.element.bind("mousewheel", fn);
}
o.stopPropagation && this.element.bind({"mousedown": fn, "mouseup": fn, "mouseover": fn}); o.stopPropagation && this.element.bind({"mousedown": fn, "mouseup": fn, "mouseover": fn});
o.stopEvent && this.element.bind({"mousedown": stop, "mouseup": stop, "mouseover": stop}); o.stopEvent && this.element.bind({"mousedown": stop, "mouseup": stop, "mouseover": stop});
@ -135,6 +142,10 @@ BI.PopupView = BI.inherit(BI.Widget, {
}) })
}, },
getView: function () {
return this.button_group;
},
populate: function (items) { populate: function (items) {
this.button_group.populate.apply(this.button_group, arguments); this.button_group.populate.apply(this.button_group, arguments);
}, },
@ -145,9 +156,9 @@ BI.PopupView = BI.inherit(BI.Widget, {
}, },
resetHeight: function (h) { resetHeight: function (h) {
var tbHeight = 30 * (this.toolbar ? 1 : 0), var tbHeight = this.toolbar ? (this.toolbar.attr("height") || 30) : 0,
tabHeight = 25 * (this.tab ? 1 : 0), tabHeight = this.tab ? (this.tab.attr("height") || 25) : 0,
toolHeight = ((this.tool && this.tool.element.outerHeight()) || 25) * ((this.tool && this.tool.isVisible()) ? 1 : 0); toolHeight = ((this.tool && this.tool.attr("height")) || 25) * ((this.tool && this.tool.isVisible()) ? 1 : 0);
this.view.resetHeight ? this.view.resetHeight(h - tbHeight - tabHeight - toolHeight - 2) : this.view.resetHeight ? this.view.resetHeight(h - tbHeight - tabHeight - toolHeight - 2) :
this.view.element.css({"max-height": (h - tbHeight - tabHeight - toolHeight - 2) + "px"}) this.view.element.css({"max-height": (h - tbHeight - tabHeight - toolHeight - 2) + "px"})
}, },

20
src/base/pager/pager.js

@ -52,15 +52,6 @@ BI.Pager = BI.inherit(BI.Widget, {
this._populate(); this._populate();
}, },
populate: function () {
this.currPage = BI.result(this.options, "curr");
this._populate();
},
refresh: function () {
this._populate();
},
_populate: function () { _populate: function () {
var self = this, o = this.options, view = [], dict = {}; var self = this, o = this.options, view = [], dict = {};
this.empty(); this.empty();
@ -279,6 +270,17 @@ BI.Pager = BI.inherit(BI.Widget, {
default : default :
return val; return val;
} }
},
attr: function (key, value) {
BI.Pager.superclass.attr.apply(this, arguments);
if (key === "curr") {
this.currPage = BI.result(this.options, "curr");
}
},
populate: function () {
this._populate();
} }
}); });
BI.Pager.EVENT_CHANGE = "EVENT_CHANGE"; BI.Pager.EVENT_CHANGE = "EVENT_CHANGE";

2
src/base/pane.js

@ -56,7 +56,7 @@ BI.Pane = BI.inherit(BI.Widget, {
}); });
} }
BI.Maskers.show(self.getName()); BI.Maskers.show(self.getName());
} else { } else if (BI.isNull(this._loading)) {
this._loading = BI.createWidget({ this._loading = BI.createWidget({
type: "bi.layout", type: "bi.layout",
cls: "loading-background", cls: "loading-background",

192
src/base/reqloading/loading.request.js

@ -0,0 +1,192 @@
/**
* Created by Young's on 2016/8/17.
* 加载面板一般只用于 requestAsync
*/
BI.RequstLoading = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.RequstLoading.superclass._defaultConfig.apply(this, arguments), {});
},
_init: function () {
BI.RequstLoading.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var mask = BI.Maskers.create(BI.RequstLoading.MASK_ID);
this.callback = o.callback;
this.paneTab = BI.createWidget({
type: "bi.tab",
cardCreator: BI.bind(this._cardCreator, this),
defaultShowIndex: BI.RequstLoading.ERROR,
width: 400,
height: 300
});
var tempIcon = BI.createWidget({
type: "bi.icon_button",
cls: "data-link-test-fail-icon",
width: 0,
height: 0
});
BI.createWidget({
type: "bi.absolute",
element: $('body'),
items: [{
el: tempIcon,
bottom: 0
}]
});
BI.createWidget({
type: "bi.absolute",
element: mask,
cls: "bi-request-loading",
items: [{
el: {
type: "bi.layout",
cls: "mask-pane"
},
top: 0,
left: 0,
bottom: 0,
right: 0
}, {
el: {
type: "bi.center_adapt",
items: [this.paneTab]
},
top: 0,
left: 0,
right: 0,
bottom: 0
}]
});
},
_cardCreator: function (v) {
var self = this;
var cancel = BI.createWidget({
type: "bi.button",
text: BI.i18nText("BI-Basic_Cancel"),
title: BI.i18nText("BI-Basic_Cancel"),
level: "ignore",
height: 28,
width: 90,
handler: function () {
BI.Maskers.hide(BI.RequstLoading.MASK_ID);
}
});
var retry = BI.createWidget({
type: "bi.button",
text: BI.i18nText("BI-Basic_Retry"),
title: BI.i18nText("BI-Basic_Retry"),
level: "common",
height: 28,
width: 90,
handler: function () {
self.paneTab.setSelect(BI.RequstLoading.LOADING);
self.callback();
}
});
switch (v) {
case BI.RequstLoading.LOADING:
return BI.createWidget({
type: "bi.vertical",
items: [{
type: "bi.center_adapt",
cls: "loading-bar-icon",
items: [{
type: "bi.icon",
width: 208,
height: 15
}]
}, {
type: "bi.label",
cls: "loading-comment",
text: BI.i18nText("BI-Basic_Loading"),
height: 30
}],
width: 208,
height: 200,
vgap: 10
});
case BI.RequstLoading.LOADING_TIMEOUT:
return BI.createWidget({
type: "bi.vertical",
items: [{
type: "bi.center_adapt",
cls: "loading-bar-icon",
items: [{
type: "bi.icon",
width: 208,
height: 15
}]
}, {
type: "bi.label",
cls: "loading-comment",
text: BI.i18nText("BI-Basic_Loading"),
height: 30
}, {
type: "bi.label",
text: BI.i18nText("BI-Request_Time_Out_Toast_Tip"),
cls: "load-timeout-warning"
}, {
type: "bi.left_right_vertical_adapt",
items: {
left: [cancel],
right: [retry]
},
height: 30,
llgap: 100,
rrgap: 100
}],
vgap: 10
});
case BI.RequstLoading.ERROR:
return BI.createWidget({
type: "bi.vertical",
items: [{
type: "bi.center_adapt",
cls: "data-link-test-fail-icon",
items: [{
type: "bi.icon",
width: 126,
height: 126
}]
}, {
type: "bi.label",
text: BI.i18nText("BI-Connection_Lost"),
cls: "load-fail-comment"
}, {
type: "bi.left_right_vertical_adapt",
items: {
left: [cancel],
right: [retry]
},
height: 30,
llgap: 100,
rrgap: 100
}],
vgap: 20
});
}
},
showLoading: function () {
BI.Maskers.show(BI.RequstLoading.MASK_ID);
this.paneTab.setSelect(BI.RequstLoading.LOADING);
},
showError: function () {
BI.Maskers.show(BI.RequstLoading.MASK_ID);
this.paneTab.setSelect(BI.RequstLoading.ERROR);
},
setCallback: function (callback) {
this.callback = callback;
}
});
BI.extend(BI.RequstLoading, {
MASK_ID: "___request__loading___",
LOADING: 1,
LOADING_TIMEOUT: 2,
ERROR: 3
});
$.shortcut("bi.request_loading", BI.RequstLoading);

5
src/base/single/a/a.js

@ -13,13 +13,14 @@ BI.A = BI.inherit(BI.Text, {
baseCls: (conf.baseCls || "") + " bi-a display-block", baseCls: (conf.baseCls || "") + " bi-a display-block",
href: "", href: "",
target: "_blank", target: "_blank",
el: null el: null,
element: "<a/>"
}) })
}, },
_init: function () { _init: function () {
var o = this.options; var o = this.options;
this.options.element = $("<a href='" + o.href + "' target='" + o.target + "'>");
BI.A.superclass._init.apply(this, arguments); BI.A.superclass._init.apply(this, arguments);
this.element.attr({href: o.href, target: o.target});
if (o.el) { if (o.el) {
BI.createWidget(o.el, { BI.createWidget(o.el, {
element: this element: this

4
src/base/single/bar/bar.loading.js

@ -5,8 +5,8 @@
*/ */
BI.LoadingBar = BI.inherit(BI.Single, { BI.LoadingBar = BI.inherit(BI.Single, {
consts: { consts: {
loadedText: '加载更多', loadedText: BI.i18nText("BI-Load_More"),
endText: '无更多数据' endText: BI.i18nText("BI-No_More_Data")
}, },
_defaultConfig: function() { _defaultConfig: function() {
var conf = BI.LoadingBar.superclass._defaultConfig.apply(this, arguments); var conf = BI.LoadingBar.superclass._defaultConfig.apply(this, arguments);

37
src/base/single/button/button.basic.js

@ -9,7 +9,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.BasicButton.superclass._defaultConfig.apply(this, arguments); var conf = BI.BasicButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-basic-button cursor-pointer", baseCls: (conf.baseCls || "") + " bi-basic-button" + (conf.invalid ? "" : " cursor-pointer"),
value: "", value: "",
text: "", text: "",
stopEvent: false, stopEvent: false,
@ -122,6 +122,16 @@ BI.BasicButton = BI.inherit(BI.Single, {
var selected = false; var selected = false;
hand.mousedown(function (e) { hand.mousedown(function (e) {
// if (e.button === 0) { // if (e.button === 0) {
$(document).bind("mouseup." + self.getName(), function (e) {
// if (e.button === 0) {
if (BI.DOM.isExist(self) && !hand.__isMouseInBounds__(e) && mouseDown === true && !selected) {
self.setSelected(!self.isSelected());
self._trigger();
}
mouseDown = false;
$(document).unbind("mouseup." + self.getName());
// }
});
if (mouseDown === true) { if (mouseDown === true) {
return; return;
} }
@ -136,28 +146,12 @@ BI.BasicButton = BI.inherit(BI.Single, {
}); });
hand.mouseup(function (e) { hand.mouseup(function (e) {
// if (e.button === 0) { // if (e.button === 0) {
if (mouseDown === true && selected === true) { if (BI.DOM.isExist(self) && mouseDown === true && selected === true) {
clk(e); clk(e);
} }
mouseDown = false; mouseDown = false;
selected = false; selected = false;
// }
});
var checking = BI.debounce(function () {
if (!BI.DOM.isExist(self)) {
$(document).unbind("mouseup." + self.getName()); $(document).unbind("mouseup." + self.getName());
}
}, 3000);
$(document).bind("mouseup." + this.getName(), function (e) {
// if (e.button === 0) {
if (BI.DOM.isExist(self)) {
if (!hand.__isMouseInBounds__(e) && mouseDown === true && !selected) {
self.setSelected(!self.isSelected());
self._trigger();
}
mouseDown = false;
checking();
}
// } // }
}); });
break; break;
@ -284,8 +278,13 @@ BI.BasicButton = BI.inherit(BI.Single, {
} }
}, },
destroyed: function () { empty: function () {
$(document).unbind("mouseup." + this.getName()); $(document).unbind("mouseup." + this.getName());
BI.BasicButton.superclass.empty.apply(this, arguments);
},
destroy: function () {
BI.BasicButton.superclass.destroy.apply(this, arguments);
} }
}); });
BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE"; BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";

3
src/base/single/button/buttons/button.icon.js

@ -7,8 +7,7 @@ BI.IconButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.IconButton.superclass._defaultConfig.apply(this, arguments); var conf = BI.IconButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
tagName: "a", baseCls: (conf.baseCls || "") + " bi-icon-button horizon-center",
baseCls: (conf.baseCls || "") + " bi-icon-button horizon-center display-block",
iconWidth: null, iconWidth: null,
iconHeight: null iconHeight: null
}) })

3
src/base/single/button/buttons/button.image.js

@ -9,8 +9,7 @@ BI.ImageButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.ImageButton.superclass._defaultConfig.apply(this, arguments); var conf = BI.ImageButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
tagName: "a", baseCls: (conf.baseCls || "") + " bi-image-button",
baseCls: (conf.baseCls || "") + " bi-image-button display-block",
src: "", src: "",
iconWidth: "100%", iconWidth: "100%",
iconHeight: "100%" iconHeight: "100%"

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

@ -6,11 +6,10 @@
* 文字button * 文字button
*/ */
BI.TextButton = BI.inherit(BI.BasicButton, { BI.TextButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function() { _defaultConfig: function () {
var conf = BI.TextButton.superclass._defaultConfig.apply(this, arguments); var conf = BI.TextButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend( conf, { return BI.extend(conf, {
tagName: "a", baseCls: (conf.baseCls || "") + " bi-text-button",
baseCls: (conf.baseCls || "") + " bi-text-button display-block",
textAlign: "center", textAlign: "center",
whiteSpace: "nowrap", whiteSpace: "nowrap",
forceCenter: false, forceCenter: false,
@ -19,12 +18,12 @@ BI.TextButton = BI.inherit(BI.BasicButton, {
hgap: 0, hgap: 0,
lgap: 0, lgap: 0,
rgap: 0, rgap: 0,
text:"", text: "",
py: "" py: ""
}) })
}, },
_init:function() { _init: function () {
BI.TextButton.superclass._init.apply(this, arguments); BI.TextButton.superclass._init.apply(this, arguments);
var o = this.options; var o = this.options;
this.text = BI.createWidget({ this.text = BI.createWidget({
@ -46,18 +45,18 @@ BI.TextButton = BI.inherit(BI.BasicButton, {
}); });
}, },
doClick: function(){ doClick: function () {
BI.TextButton.superclass.doClick.apply(this, arguments); BI.TextButton.superclass.doClick.apply(this, arguments);
if(this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.TextButton.EVENT_CHANGE, this.getValue(), this); this.fireEvent(BI.TextButton.EVENT_CHANGE, this.getValue(), this);
} }
}, },
doRedMark: function(){ doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark.apply(this.text, arguments);
}, },
unRedMark: function(){ unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark.apply(this.text, arguments);
}, },
@ -69,15 +68,19 @@ BI.TextButton = BI.inherit(BI.BasicButton, {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight.apply(this.text, arguments);
}, },
setText: function(text){ setText: function (text) {
BI.TextButton.superclass.setText.apply(this, arguments); BI.TextButton.superclass.setText.apply(this, arguments);
text = BI.isArray(text) ? text.join(",") : text; text = BI.isArray(text) ? text.join(",") : text;
this.text.setText(text); this.text.setText(text);
}, },
setValue: function(text){ setStyle: function (style) {
this.text.setStyle(style);
},
setValue: function (text) {
BI.TextButton.superclass.setValue.apply(this, arguments); BI.TextButton.superclass.setValue.apply(this, arguments);
if(!this.isReadOnly()) { if (!this.isReadOnly()) {
text = BI.isArray(text) ? text.join(",") : text; text = BI.isArray(text) ? text.join(",") : text;
this.text.setValue(text); this.text.setValue(text);
} }

119
src/base/single/button/listitem/blankiconicontextitem.js

@ -0,0 +1,119 @@
/**
* 带有一个占位
*
* Created by GUY on 2015/9/11.
* @class BI.BlankIconIconTextItem
* @extends BI.BasicButton
*/
BI.BlankIconIconTextItem = BI.inherit(BI.BasicButton, {
_const: {
commonWidth: 25
},
_defaultConfig: function () {
var conf = BI.BlankIconIconTextItem.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-blank-icon-text-item",
logic: {
dynamic: false
},
iconCls1: "close-ha-font",
iconCls2: "close-ha-font",
blankWidth: 0,
iconHeight: null,
iconWidth: null,
textHgap: 0,
textVgap: 0,
textLgap: 0,
textRgap: 0
})
},
_init: function () {
BI.BlankIconIconTextItem.superclass._init.apply(this, arguments);
var o = this.options, c = this._const;
var blank = BI.createWidget({
type: "bi.layout",
width: o.blankWidth
})
this.text = BI.createWidget({
type: "bi.label",
cls: "list-item-text",
textAlign: "left",
hgap: o.textHgap,
vgap: o.textVgap,
lgap: o.textLgap,
rgap: o.textRgap,
text: o.text,
value: o.value,
keyword: o.keyword,
height: o.height
});
this.icon1 = BI.createWidget({
type: "bi.icon_button",
cls: o.iconCls1,
forceNotSelected: true,
width: c.commonWidth
});
this.icon2 = BI.createWidget({
type: "bi.icon_button",
cls: o.iconCls2,
forceNotSelected: true,
width: c.commonWidth
});
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection("left", blank, this.icon1, this.icon2, this.text)
}))));
},
doClick: function () {
BI.BlankIconIconTextItem.superclass.doClick.apply(this, arguments);
if (this.isValid()) {
this.fireEvent(BI.BlankIconIconTextItem.EVENT_CHANGE, this.getValue(), this);
}
},
setSelected: function (b) {
BI.BlankIconIconTextItem.superclass.setSelected.apply(this, arguments);
this.icon1.setSelected(b);
this.icon2.setSelected(b);
},
setValue: function () {
if (!this.isReadOnly()) {
this.text.setValue.apply(this.text, arguments);
}
},
getValue: function () {
return this.text.getValue();
},
setText: function () {
this.text.setText.apply(this.text, arguments);
},
getText: function () {
return this.text.getText();
},
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
},
doHighLight: function () {
this.text.doHighLight.apply(this.text, arguments);
},
unHighLight: function () {
this.text.unHighLight.apply(this.text, arguments);
}
});
BI.BlankIconIconTextItem.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut("bi.blank_icon_icon_text_item", BI.BlankIconIconTextItem);

4
src/base/single/editor/editor.code.js

@ -104,7 +104,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
case "param": case "param":
var fieldNameLength = i.to - i.from; var fieldNameLength = i.to - i.from;
value = value.substr(0, i.from + num) + "$\{" + value.substr(i.from + num, fieldNameLength) + "\}" + value.substr(i.to + num, value.length); value = value.substr(0, i.from + num) + "$\{" + value.substr(i.from + num, fieldNameLength) + "\}" + value.substr(i.to + num, value.length);
num += fieldNameLength + 3; num += 3;
break; break;
} }
}); });
@ -113,7 +113,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
}, },
_analyzeContent: function (v) { _analyzeContent: function (v) {
var regx = /\$[\{][^\}]*[\}]|\w*\w|\$\{[^\$\(\)\+\-\*\/)\$,]*\w\}|\$\{[^\$\(\)\+\-\*\/]*\w\}|\$\{[^\$\(\)\+\-\*\/]*[\u4e00-\u9fa5]\}|\w|(.)|\n/g; var regx = /\$[\{][^\}]*[\}]|(\s+)|\w*\w|\$\{[^\$\(\)\+\-\*\/)\$,]*\w\}|\$\{[^\$\(\)\+\-\*\/]*\w\}|\$\{[^\$\(\)\+\-\*\/]*[\u4e00-\u9fa5]\}|\w|(.)|\n/g;
return v.match(regx); return v.match(regx);
}, },

4
src/base/single/editor/editor.js

@ -50,7 +50,9 @@ BI.Editor = BI.inherit(BI.Single, {
type: "bi.label", type: "bi.label",
cls: "bi-water-mark", cls: "bi-water-mark",
text: this.options.watermark, text: this.options.watermark,
height: this.options.height,
forceCenter: true, forceCenter: true,
height: o.height - 2 * (o.vgap + o.tgap),
whiteSpace: "nowrap", whiteSpace: "nowrap",
textAlign: "left" textAlign: "left"
}); });
@ -275,7 +277,7 @@ BI.Editor = BI.inherit(BI.Single, {
}, },
getLastValidValue: function () { getLastValidValue: function () {
return BI.trim(this.editor.getLastValidValue()); return this.editor.getLastValidValue();
}, },
resetLastValidValue: function () { resetLastValidValue: function () {

81
src/base/single/editor/editor.textarea.js

@ -37,26 +37,96 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
}] }]
}); });
this.content.element.on("input propertychange", function (e) {
self._checkWaterMark();
self.fireEvent(BI.TextAreaEditor.EVENT_CHANGE);
});
this.content.element.focus(function () { this.content.element.focus(function () {
self.content.element.addClass("textarea-editor-focus"); if (self.isValid()) {
self._focus();
self.fireEvent(BI.TextAreaEditor.EVENT_FOCUS); self.fireEvent(BI.TextAreaEditor.EVENT_FOCUS);
}
$(document).bind("mousedown." + self.getName(), function (e) {
if (BI.DOM.isExist(self) && !self.element.__isMouseInBounds__(e)) {
$(document).unbind("mousedown." + self.getName());
self.content.element.blur();
}
});
}); });
this.content.element.blur(function () { this.content.element.blur(function () {
self.content.element.removeClass("textarea-editor-focus"); if (self.isValid()) {
self._blur();
self.fireEvent(BI.TextAreaEditor.EVENT_BLUR); self.fireEvent(BI.TextAreaEditor.EVENT_BLUR);
}
$(document).unbind("mousedown." + self.getName());
}); });
if (BI.isKey(o.value)) { if (BI.isKey(o.value)) {
self.setValue(o.value); self.setValue(o.value);
} }
if (BI.isNotNull(o.style)) {
self.setValue(o.style);
}
this._checkWaterMark();
}, },
focus: function () { _checkWaterMark: function () {
var self = this, o = this.options;
var val = this.getValue();
if (BI.isNotEmptyString(val)) {
this.watermark && this.watermark.destroy();
this.watermark = null;
} else {
if (BI.isNotEmptyString(o.watermark)) {
if (!this.watermark) {
this.watermark = BI.createWidget({
type: "bi.text_button",
cls: "bi-water-mark",
textAlign: "left",
height: 30,
text: o.watermark,
invalid: o.invalid,
disabled: o.disabled
});
this.watermark.on(BI.TextButton.EVENT_CHANGE, function () {
self.focus();
});
BI.createWidget({
type: 'bi.absolute',
element: this,
items: [{
el: this.watermark,
left: 0,
top: 0,
right: 0
}]
})
} else {
this.watermark.setText(o.watermark);
this.watermark.setValid(!o.invalid);
this.watermark.setEnable(!o.disabled);
}
}
}
},
_focus: function () {
this.content.element.addClass("textarea-editor-focus"); this.content.element.addClass("textarea-editor-focus");
this._checkWaterMark();
},
_blur: function () {
this.content.element.removeClass("textarea-editor-focus");
this._checkWaterMark();
},
focus: function () {
this._focus();
this.content.element.focus(); this.content.element.focus();
}, },
blur: function () { blur: function () {
this.content.element.removeClass("textarea-editor-focus"); this._blur();
this.content.element.blur(); this.content.element.blur();
}, },
@ -81,13 +151,16 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
setValid: function (b) { setValid: function (b) {
BI.TextAreaEditor.superclass.setValid.apply(this, arguments); BI.TextAreaEditor.superclass.setValid.apply(this, arguments);
this.content.setValid(b); this.content.setValid(b);
this.watermark && this.watermark.setValid(b);
}, },
setEnable: function (b) { setEnable: function (b) {
BI.TextAreaEditor.superclass.setEnable.apply(this, arguments); BI.TextAreaEditor.superclass.setEnable.apply(this, arguments);
this.content.setEnable(b); this.content.setEnable(b);
this.watermark && this.watermark.setEnable(b);
} }
}); });
BI.TextAreaEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.TextAreaEditor.EVENT_BLUR = "EVENT_BLUR"; BI.TextAreaEditor.EVENT_BLUR = "EVENT_BLUR";
BI.TextAreaEditor.EVENT_FOCUS = "EVENT_FOCUS"; BI.TextAreaEditor.EVENT_FOCUS = "EVENT_FOCUS";
$.shortcut("bi.textarea_editor", BI.TextAreaEditor); $.shortcut("bi.textarea_editor", BI.TextAreaEditor);

2
src/base/single/img/img.js

@ -10,7 +10,7 @@ BI.Img = BI.inherit(BI.Single, {
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.Img.superclass._defaultConfig.apply(this, arguments); var conf = BI.Img.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-img", baseCls: (conf.baseCls || "") + " bi-img display-block",
src: "", src: "",
width: "100%", width: "100%",
height: "100%" height: "100%"

1
src/base/single/input/checkbox.js

@ -7,7 +7,6 @@ BI.Checkbox = BI.inherit(BI.IconButton, {
_defaultConfig: function() { _defaultConfig: function() {
var conf = BI.Checkbox.superclass._defaultConfig.apply(this,arguments); var conf = BI.Checkbox.superclass._defaultConfig.apply(this,arguments);
return BI.extend(conf, { return BI.extend(conf, {
tagName: "a",
baseCls: (conf.baseCls || "") + " bi-checkbox check-box-icon", baseCls: (conf.baseCls || "") + " bi-checkbox check-box-icon",
selected: false, selected: false,
handler: BI.emptyFn, handler: BI.emptyFn,

70
src/base/single/input/file.js

@ -16,8 +16,9 @@
var F = (function (item) { var F = (function (item) {
return function (input) { return function (input) {
var files = input.files || [input]; var files = input.files || [input];
if (!files.item) if (!files.item) {
files.item = item; files.item = item;
}
return files; return files;
}; };
})(function (i) { })(function (i) {
@ -67,8 +68,9 @@
*/ */
stop: function (e) { stop: function (e) {
if (!e) { if (!e) {
if (self.event) if (self.event) {
event.returnValue = !(event.cancelBubble = true); event.returnValue = !(event.cancelBubble = true);
}
} else { } else {
e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true; e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;
e.preventDefault ? e.preventDefault() : e.returnValue = false; e.preventDefault ? e.preventDefault() : e.returnValue = false;
@ -82,7 +84,7 @@
var multipart = function (boundary, name, file) { var multipart = function (boundary, name, file) {
return "--".concat( return "--".concat(
boundary, CRLF, boundary, CRLF,
'Content-Disposition: form-data; name="', name, '"; filename="', BI.cjkEncode(file.fileName), '"', CRLF, 'Content-Disposition: form-data; name="', name, '"; filename="', FR.cjkEncode(file.fileName), '"', CRLF,
"Content-Type: application/octet-stream", CRLF, "Content-Type: application/octet-stream", CRLF,
CRLF, CRLF,
file.getAsBinary(), CRLF, file.getAsBinary(), CRLF,
@ -99,11 +101,12 @@
sendFile; sendFile;
// FireFox 3+, Safari 4 beta (Chrome 2 beta file is buggy and will not work) // FireFox 3+, Safari 4 beta (Chrome 2 beta file is buggy and will not work)
if (xhr.upload || xhr.sendAsBinary) if (xhr.upload || xhr.sendAsBinary) {
sendFile = function (handler, maxSize, width, height) { sendFile = function (handler, maxSize, width, height) {
if (-1 < maxSize && maxSize < handler.file.fileSize) { if (-1 < maxSize && maxSize < handler.file.fileSize) {
if (isFunction(handler.onerror)) if (isFunction(handler.onerror)) {
handler.onerror(); handler.onerror();
}
return; return;
} }
for (var for (var
@ -116,28 +119,32 @@
i = 0; i = 0;
i < length; i < length;
i++ i++
) ) {
upload.addEventListener( upload.addEventListener(
split[i].substring(2), split[i].substring(2),
(function (event) { (function (event) {
return function (rpe) { return function (rpe) {
if (isFunction(handler[event])) if (isFunction(handler[event])) {
handler[event](rpe, xhr); handler[event](rpe, xhr);
}
}; };
})(split[i]), })(split[i]),
false false
); );
}
upload.addEventListener( upload.addEventListener(
"load", "load",
function (rpe) { function (rpe) {
if (handler.onreadystatechange === false) { if (handler.onreadystatechange === false) {
if (isFunction(handler.onload)) if (isFunction(handler.onload)) {
handler.onload(rpe, xhr); handler.onload(rpe, xhr);
}
} else { } else {
setTimeout(function () { setTimeout(function () {
if (xhr.readyState === 4) { if (xhr.readyState === 4) {
if (isFunction(handler.onload)) if (isFunction(handler.onload)) {
handler.onload(rpe, xhr); handler.onload(rpe, xhr);
}
} else { } else {
setTimeout(arguments.callee, 15); setTimeout(arguments.callee, 15);
} }
@ -146,13 +153,14 @@
}, },
false false
); );
xhr.open("post", handler.url + '&filename=' + BI.cjkEncode(handler.file.fileName), true); xhr.open("post", handler.url + '&filename=' + FR.cjkEncode(handler.file.fileName), true);
if (!xhr.upload) { if (!xhr.upload) {
var rpe = {loaded: 0, total: handler.file.fileSize || handler.file.size, simulation: true}; var rpe = {loaded: 0, total: handler.file.fileSize || handler.file.size, simulation: true};
rpe.interval = setInterval(function () { rpe.interval = setInterval(function () {
rpe.loaded += 1024 / 4; rpe.loaded += 1024 / 4;
if (rpe.total <= rpe.loaded) if (rpe.total <= rpe.loaded) {
rpe.loaded = rpe.total; rpe.loaded = rpe.total;
}
upload.onprogress(rpe); upload.onprogress(rpe);
}, 100); }, 100);
xhr.onabort = function () { xhr.onabort = function () {
@ -176,8 +184,8 @@
upload.onprogress(rpe); upload.onprogress(rpe);
if (199 < xhr.status && xhr.status < 400) { if (199 < xhr.status && xhr.status < 400) {
upload["onload"]({}); upload["onload"]({});
var attachO = BI.jsonDecode(xhr.responseText); var attachO = FR.jsonDecode(xhr.responseText);
attachO.filename = BI.cjkDecode(handler.file.fileName); attachO.filename = FR.cjkDecode(handler.file.fileName);
if (handler.file.type.indexOf('image') != -1) { if (handler.file.type.indexOf('image') != -1) {
attachO.attach_type = "image"; attachO.attach_type = "image";
} }
@ -193,11 +201,11 @@
xhr.onreadystatechange = function () { xhr.onreadystatechange = function () {
switch (xhr.readyState) { switch (xhr.readyState) {
case 4: case 4:
var attachO = BI.jsonDecode(xhr.responseText); var attachO = FR.jsonDecode(xhr.responseText);
if (handler.file.type.indexOf('image') != -1) { if (handler.file.type.indexOf('image') != -1) {
attachO.attach_type = "image"; attachO.attach_type = "image";
} }
attachO.filename = BI.cjkDecode(handler.file.fileName); attachO.filename = handler.file.fileName;
if (handler.maxlength == 1) { if (handler.maxlength == 1) {
handler.attach_array[0] = attachO; handler.attach_array[0] = attachO;
// handler.attach_array.push(attachO); // handler.attach_array.push(attachO);
@ -222,8 +230,9 @@
} }
return handler; return handler;
}; };
}
// Internet Explorer, Opera, others // Internet Explorer, Opera, others
else else {
sendFile = function (handler, maxSize, width, height) { sendFile = function (handler, maxSize, width, height) {
var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"), var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"),
rpe = { rpe = {
@ -242,13 +251,13 @@
//rpe.loaded = rpe.total; //rpe.loaded = rpe.total;
try { try {
var responseText = (iframe.contentWindow.document || iframe.contentWindow.contentDocument).body.innerHTML; var responseText = (iframe.contentWindow.document || iframe.contentWindow.contentDocument).body.innerHTML;
var attachO = BI.jsonDecode(responseText); var attachO = FR.jsonDecode(responseText);
if (handler.file.type.indexOf('image') != -1) { if (handler.file.type.indexOf('image') != -1) {
attachO.attach_type = "image"; attachO.attach_type = "image";
} }
//attachO.fileSize = responseText.length; //attachO.fileSize = responseText.length;
attachO.filename = BI.cjkDecode(handler.file.fileName); attachO.filename = FR.cjkDecode(handler.file.fileName);
if (handler.maxlength == 1) { if (handler.maxlength == 1) {
handler.attach_array[0] = attachO; handler.attach_array[0] = attachO;
} else { } else {
@ -272,13 +281,13 @@
iframe.setAttribute("name", iframe.id = target); iframe.setAttribute("name", iframe.id = target);
iframe.setAttribute("src", url); iframe.setAttribute("src", url);
} }
;
iframe.style.position = "absolute"; iframe.style.position = "absolute";
iframe.style.left = iframe.style.top = "-10000px"; iframe.style.left = iframe.style.top = "-10000px";
iframe.onload = onload; iframe.onload = onload;
iframe.onerror = function (event) { iframe.onerror = function (event) {
if (isFunction(handler.onerror)) if (isFunction(handler.onerror)) {
handler.onerror(rpe, event || window.event); handler.onerror(rpe, event || window.event);
}
}; };
iframe.onreadystatechange = function () { iframe.onreadystatechange = function () {
if (/loaded|complete/i.test(iframe.readyState)) { if (/loaded|complete/i.test(iframe.readyState)) {
@ -287,8 +296,9 @@
//wei : todo,将附件信息放到handler.attach //wei : todo,将附件信息放到handler.attach
} }
else if (isFunction(handler.onloadprogress)) { else if (isFunction(handler.onloadprogress)) {
if (rpe.loaded < rpe.total) if (rpe.loaded < rpe.total) {
++rpe.loaded; ++rpe.loaded;
}
handler.onloadprogress(rpe, { handler.onloadprogress(rpe, {
readyState: { readyState: {
loading: 2, loading: 2,
@ -299,13 +309,14 @@
}); });
} }
}; };
form.setAttribute("action", handler.url + '&width=' + width + '&height=' + height); form.setAttribute("action", handler.url);
form.setAttribute("target", iframe.id); form.setAttribute("target", iframe.id);
form.setAttribute("method", "post"); form.setAttribute("method", "post");
form.appendChild(handler.file); form.appendChild(handler.file);
form.style.display = "none"; form.style.display = "none";
if (isFunction(handler.onloadstart)) if (isFunction(handler.onloadstart)) {
handler.onloadstart(rpe, {}); handler.onloadstart(rpe, {});
}
with (document.body || document.documentElement) { with (document.body || document.documentElement) {
appendChild(iframe); appendChild(iframe);
appendChild(form); appendChild(form);
@ -314,6 +325,7 @@
; ;
return handler; return handler;
}; };
}
xhr = null; xhr = null;
return sendFile; return sendFile;
})(Object.prototype.toString); })(Object.prototype.toString);
@ -359,7 +371,6 @@
handler.iframe.parentNode.removeChild(handler.iframe); handler.iframe.parentNode.removeChild(handler.iframe);
handler.iframe = null; handler.iframe = null;
} }
;
setTimeout(function () { setTimeout(function () {
handler.file = handler.files[handler.current]; handler.file = handler.files[handler.current];
sendFile(handler, maxSize, width, height).onload = callee; sendFile(handler, maxSize, width, height).onload = callee;
@ -463,7 +474,7 @@
// enable again the submit button/element // enable again the submit button/element
}, 1000); }, 1000);
}; };
_wrap.url = o.url ? o.url : BI.servletURL _wrap.url = o.url ? o.url : FR.servletURL
+ '?op=fr_attach&cmd=ah_upload'; + '?op=fr_attach&cmd=ah_upload';
_wrap.fileType = o.accept; //文件类型限制 _wrap.fileType = o.accept; //文件类型限制
_wrap.attach_array = []; _wrap.attach_array = [];
@ -484,14 +495,14 @@
size = item.fileSize || item.size; size = item.fileSize || item.size;
if (wrap.fileType && -1 === wrap.fileType.indexOf("*." + ext)) { if (wrap.fileType && -1 === wrap.fileType.indexOf("*." + ext)) {
//文件类型不支持 //文件类型不支持
BI.Msg.toast("文件类型不支持"); BI.Msg.toast(BI.i18nText("BI-Upload_File_Type_Error"));
self.fireEvent(BI.File.EVENT_ERROR, { self.fireEvent(BI.File.EVENT_ERROR, {
errorType: 0, errorType: 0,
file: item file: item
}); });
} else if (wrap.maxSize !== -1 && size && wrap.maxSize < size) { } else if (wrap.maxSize !== -1 && size && wrap.maxSize < size) {
//文件大小不支持 //文件大小不支持
BI.Msg.toast("文件大小不支持"); BI.Msg.toast(BI.i18nText("BI-Upload_File_Size_Error"));
self.fireEvent(BI.File.EVENT_ERROR, { self.fireEvent(BI.File.EVENT_ERROR, {
errorType: 1, errorType: 1,
file: item file: item
@ -516,7 +527,9 @@
var self = this, o = this.options; var self = this, o = this.options;
// be sure input accept multiple files // be sure input accept multiple files
var input = this.element[0]; var input = this.element[0];
if (o.multiple === true) {
this.element.attr("multiple", "multiple"); this.element.attr("multiple", "multiple");
}
input.value = ""; input.value = "";
// wrap Object // wrap Object
@ -542,9 +555,10 @@
// something like {onload:function(){alert("OK")},onerror:function(){alert("Error")}, etc ...} // something like {onload:function(){alert("OK")},onerror:function(){alert("Error")}, etc ...}
upload: function (handler) { upload: function (handler) {
if (handler) { if (handler) {
for (var key in handler) for (var key in handler) {
this[key] = handler[key]; this[key] = handler[key];
} }
}
sendFiles(this, this.maxSize); sendFiles(this, this.maxSize);
return this; return this;
}, },

46
src/base/single/input/input.js

@ -20,21 +20,28 @@ BI.Input = BI.inherit(BI.Single, {
_init: function () { _init: function () {
BI.Input.superclass._init.apply(this, arguments); BI.Input.superclass._init.apply(this, arguments);
var self = this; var self = this;
var ctrlKey = false;
var inputEventValid = false;
var _keydown = BI.debounce(function (keyCode) { var _keydown = BI.debounce(function (keyCode) {
self.onKeyDown(keyCode); self.onKeyDown(keyCode, ctrlKey);
self._keydown_ = false; self._keydown_ = false;
}, 300); }, 300);
var _clk = BI.debounce(BI.bind(this._click, this), BI.EVENT_RESPONSE_TIME, true); var _clk = BI.debounce(BI.bind(this._click, this), BI.EVENT_RESPONSE_TIME, true);
this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, true); this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, true);
this.element this.element
.keydown(function (e) { .keydown(function (e) {
inputEventValid = false;
ctrlKey = e.ctrlKey;
self.fireEvent(BI.Input.EVENT_QUICK_DOWN); self.fireEvent(BI.Input.EVENT_QUICK_DOWN);
}) })
.keyup(function (e) { .keyup(function (e) {
if (!(inputEventValid && e.keyCode === BI.KeyCode.ENTER)) {
self._keydown_ = true; self._keydown_ = true;
_keydown(e.keyCode); _keydown(e.keyCode);
}
}) })
.on("input propertychange", function (e) { .on("input propertychange", function (e) {
inputEventValid = true;
self._keydown_ = true; self._keydown_ = true;
_keydown(e.keyCode); _keydown(e.keyCode);
}) })
@ -97,11 +104,23 @@ BI.Input = BI.inherit(BI.Single, {
this._click(); this._click();
}, },
onKeyDown: function (keyCode) { onKeyDown: function (keyCode, ctrlKey) {
if (!this.isValid() || BI.trim(this._lastValidValue) !== BI.trim(this.getValue())) { if (!this.isValid() || BI.trim(this._lastValidValue) !== BI.trim(this.getValue())) {
this._checkValidationOnValueChange(); this._checkValidationOnValueChange();
} }
if (keyCode == BI.keyCode.ENTER) { if (this.isValid() && BI.trim(this.getValue()) !== "") {
if (BI.trim(this.getValue()) !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "")
|| (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) {
this._start = true;
this._pause = false;
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STARTEDIT, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_START);
}
}
if (ctrlKey === true && keyCode === 86) {//ctrlKey+V
this._valueChange();
} else {
if (keyCode == BI.KeyCode.ENTER) {
if (this.isValid() || this.options.quitChecker.apply(this, [BI.trim(this.getValue())]) !== false) { if (this.isValid() || this.options.quitChecker.apply(this, [BI.trim(this.getValue())]) !== false) {
this.blur(); this.blur();
this.fireEvent(BI.Input.EVENT_ENTER); this.fireEvent(BI.Input.EVENT_ENTER);
@ -109,33 +128,24 @@ BI.Input = BI.inherit(BI.Single, {
this.fireEvent(BI.Input.EVENT_RESTRICT); this.fireEvent(BI.Input.EVENT_RESTRICT);
} }
} }
if (keyCode == BI.keyCode.SPACE) { if (keyCode == BI.KeyCode.SPACE) {
this.fireEvent(BI.Input.EVENT_SPACE); this.fireEvent(BI.Input.EVENT_SPACE);
} }
if (keyCode == BI.keyCode.BACKSPACE && this._lastValue == "") { if (keyCode == BI.KeyCode.BACKSPACE && this._lastValue == "") {
this.fireEvent(BI.Input.EVENT_REMOVE); this.fireEvent(BI.Input.EVENT_REMOVE);
} }
if (keyCode == BI.keyCode.BACKSPACE || keyCode == BI.keyCode.DELETE) { if (keyCode == BI.KeyCode.BACKSPACE || keyCode == BI.KeyCode.DELETE) {
this.fireEvent(BI.Input.EVENT_BACKSPACE); this.fireEvent(BI.Input.EVENT_BACKSPACE);
} }
this.fireEvent(BI.Input.EVENT_KEY_DOWN);
if (this.isValid() && BI.trim(this.getValue()) !== "") {
if (BI.trim(this.getValue()) !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "")
|| (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) {
this._start = true;
this._pause = false;
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STARTEDIT, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_START);
}
} }
this.fireEvent(BI.Input.EVENT_KEY_DOWN);
if (/(\s|\u00A0)$/.test(this.getValue())) { if (BI.isEndWithBlank(this.getValue())) {
this._pause = true; this._pause = true;
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.PAUSE, "", this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.PAUSE, "", this);
this.fireEvent(BI.Input.EVENT_PAUSE); this.fireEvent(BI.Input.EVENT_PAUSE);
this._defaultState(); this._defaultState();
} else if ((keyCode === BI.keyCode.BACKSPACE || keyCode === BI.keyCode.DELETE) && } else if ((keyCode === BI.KeyCode.BACKSPACE || keyCode === BI.KeyCode.DELETE) &&
BI.trim(this.getValue()) === "" && (this._lastValue !== null && BI.trim(this._lastValue) !== "")) { BI.trim(this.getValue()) === "" && (this._lastValue !== null && BI.trim(this._lastValue) !== "")) {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT, this.getValue(), this);
this.fireEvent(BI.Input.EVENT_STOP); this.fireEvent(BI.Input.EVENT_STOP);

1
src/base/single/input/radio.js

@ -7,7 +7,6 @@ BI.Radio = BI.inherit(BI.IconButton, {
_defaultConfig: function() { _defaultConfig: function() {
var conf = BI.Radio.superclass._defaultConfig.apply(this,arguments); var conf = BI.Radio.superclass._defaultConfig.apply(this,arguments);
return BI.extend(conf, { return BI.extend(conf, {
tagName: "a",
baseCls: (conf.baseCls || "") + " bi-radio radio-icon", baseCls: (conf.baseCls || "") + " bi-radio radio-icon",
selected: false, selected: false,
handler: BI.emptyFn, handler: BI.emptyFn,

44
src/base/single/label/label.js

@ -58,7 +58,7 @@ BI.Label = BI.inherit(BI.Single, {
BI.createWidget({ BI.createWidget({
type: "bi.adaptive", type: "bi.adaptive",
height: o.height, height: o.height,
scrollable: true, scrollable: o.whiteSpace === "normal",
element: this, element: this,
items: [ items: [
{ {
@ -76,7 +76,7 @@ BI.Label = BI.inherit(BI.Single, {
json.width = o.textWidth; json.width = o.textWidth;
BI.createWidget({ BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
scrollable: true, scrollable: o.whiteSpace === "normal",
element: this, element: this,
items: [ items: [
{ {
@ -90,7 +90,7 @@ BI.Label = BI.inherit(BI.Single, {
this.text = BI.createWidget(json); this.text = BI.createWidget(json);
BI.createWidget({ BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
scrollable: true, scrollable: o.whiteSpace === "normal",
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
lgap: o.lgap, lgap: o.lgap,
@ -108,7 +108,7 @@ BI.Label = BI.inherit(BI.Single, {
}); });
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
scrollable: true, scrollable: o.whiteSpace === "normal",
element: this, element: this,
items: [{ items: [{
el: (this.text = BI.createWidget(json)), el: (this.text = BI.createWidget(json)),
@ -123,7 +123,7 @@ BI.Label = BI.inherit(BI.Single, {
json.width = o.width - 2 * o.hgap; json.width = o.width - 2 * o.hgap;
BI.createWidget({ BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
scrollable: true, scrollable: o.whiteSpace === "normal",
element: this, element: this,
items: [{ items: [{
el: (this.text = BI.createWidget(json)) el: (this.text = BI.createWidget(json))
@ -135,7 +135,7 @@ BI.Label = BI.inherit(BI.Single, {
json.width = o.textWidth; json.width = o.textWidth;
BI.createWidget({ BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
scrollable: true, scrollable: o.whiteSpace === "normal",
element: this, element: this,
items: [ items: [
{ {
@ -155,7 +155,7 @@ BI.Label = BI.inherit(BI.Single, {
rgap: o.rgap, rgap: o.rgap,
tgap: o.tgap, tgap: o.tgap,
bgap: o.bgap, bgap: o.bgap,
scrollable: true, scrollable: o.whiteSpace === "normal",
element: this, element: this,
items: [this.text] items: [this.text]
}); });
@ -169,7 +169,7 @@ BI.Label = BI.inherit(BI.Single, {
BI.createWidget({ BI.createWidget({
type: "bi.adaptive", type: "bi.adaptive",
height: o.height, height: o.height,
scrollable: true, scrollable: o.whiteSpace === "normal",
element: this, element: this,
items: [{ items: [{
el: (this.text = BI.createWidget(json)), el: (this.text = BI.createWidget(json)),
@ -198,7 +198,7 @@ BI.Label = BI.inherit(BI.Single, {
BI.createWidget({ BI.createWidget({
type: "bi.layout", type: "bi.layout",
element: this.text, element: this.text,
scrollable: true scrollable: o.whiteSpace === "normal"
}); });
return; return;
} }
@ -225,7 +225,7 @@ BI.Label = BI.inherit(BI.Single, {
BI.createWidget({ BI.createWidget({
type: "bi.layout", type: "bi.layout",
element: this.text, element: this.text,
scrollable: true scrollable: o.whiteSpace === "normal"
}) })
}, },
@ -238,7 +238,7 @@ BI.Label = BI.inherit(BI.Single, {
BI.createWidget({ BI.createWidget({
type: "bi.adaptive", type: "bi.adaptive",
height: o.height, height: o.height,
scrollable: true, scrollable: o.whiteSpace === "normal",
element: this, element: this,
items: [ items: [
{ {
@ -256,7 +256,7 @@ BI.Label = BI.inherit(BI.Single, {
json.width = o.textWidth; json.width = o.textWidth;
BI.createWidget({ BI.createWidget({
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
scrollable: true, scrollable: o.whiteSpace === "normal",
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
lgap: o.lgap, lgap: o.lgap,
@ -276,7 +276,7 @@ BI.Label = BI.inherit(BI.Single, {
this.text = BI.createWidget(json); this.text = BI.createWidget(json);
BI.createWidget({ BI.createWidget({
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
scrollable: true, scrollable: o.whiteSpace === "normal",
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
lgap: o.lgap, lgap: o.lgap,
@ -294,7 +294,7 @@ BI.Label = BI.inherit(BI.Single, {
}); });
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
scrollable: true, scrollable: o.whiteSpace === "normal",
element: this, element: this,
items: [{ items: [{
el: (this.text = BI.createWidget(json)), el: (this.text = BI.createWidget(json)),
@ -309,7 +309,7 @@ BI.Label = BI.inherit(BI.Single, {
json.width = o.width - 2 * o.hgap - o.lgap - o.rgap; json.width = o.width - 2 * o.hgap - o.lgap - o.rgap;
BI.createWidget({ BI.createWidget({
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
scrollable: true, scrollable: o.whiteSpace === "normal",
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
lgap: o.lgap, lgap: o.lgap,
@ -327,7 +327,7 @@ BI.Label = BI.inherit(BI.Single, {
json.width = o.textWidth; json.width = o.textWidth;
BI.createWidget({ BI.createWidget({
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
scrollable: true, scrollable: o.whiteSpace === "normal",
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
lgap: o.lgap, lgap: o.lgap,
@ -347,7 +347,7 @@ BI.Label = BI.inherit(BI.Single, {
this.text = BI.createWidget(json) this.text = BI.createWidget(json)
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
scrollable: true, scrollable: o.whiteSpace === "normal",
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
lgap: o.lgap, lgap: o.lgap,
@ -367,7 +367,7 @@ BI.Label = BI.inherit(BI.Single, {
BI.createWidget({ BI.createWidget({
type: "bi.adaptive", type: "bi.adaptive",
height: o.height, height: o.height,
scrollable: true, scrollable: o.whiteSpace === "normal",
element: this, element: this,
items: [{ items: [{
el: (this.text = BI.createWidget(json)), el: (this.text = BI.createWidget(json)),
@ -396,7 +396,7 @@ BI.Label = BI.inherit(BI.Single, {
BI.createWidget({ BI.createWidget({
type: "bi.layout", type: "bi.layout",
element: this.text, element: this.text,
scrollable: true scrollable: o.whiteSpace === "normal"
}); });
return; return;
} }
@ -423,7 +423,7 @@ BI.Label = BI.inherit(BI.Single, {
BI.createWidget({ BI.createWidget({
type: "bi.layout", type: "bi.layout",
element: this.text, element: this.text,
scrollable: true scrollable: o.whiteSpace === "normal"
}) })
}, },
@ -452,6 +452,10 @@ BI.Label = BI.inherit(BI.Single, {
return this.options.text; return this.options.text;
}, },
setStyle: function (css) {
this.text.setStyle(css)
},
setValue: function (v) { setValue: function (v) {
BI.Label.superclass.setValue.apply(this, arguments); BI.Label.superclass.setValue.apply(this, arguments);
if (!this.isReadOnly()) { if (!this.isReadOnly()) {

4
src/base/single/text.js

@ -99,6 +99,10 @@ BI.Text = BI.inherit(BI.Single, {
} }
}, },
setStyle: function (css) {
this.text.element.css(css)
},
setText: function (text) { setText: function (text) {
BI.Text.superclass.setText.apply(this, arguments); BI.Text.superclass.setText.apply(this, arguments);
this.options.text = text; this.options.text = text;

117
src/base/timeouttoast/widget.timeouttoast.js

@ -0,0 +1,117 @@
/**
* 组件请求数据超时提示
* Created by Young's on 2017/2/4.
*/
BI.TimeoutToast = BI.inherit(BI.Tip, {
_defaultConfig: function () {
return BI.extend(BI.TimeoutToast.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-timeout-toast"
});
},
_init: function () {
BI.TimeoutToast.superclass._init.apply(this, arguments);
var self = this;
this.requests = [];
this.toast = BI.createWidget({
type: "bi.vertical_adapt",
element: this,
items: [{
type: "bi.label",
text: BI.i18nText("BI-Request_Time_Out_Toast_Tip")
}, {
type: "bi.text_button",
cls: "cancel-button",
width: 60,
height: 22,
text: BI.i18nText("BI-Basic_Cancel"),
title: BI.i18nText("BI-Basic_Cancel"),
handler: function () {
self.cancelAllRequests();
}
}, {
type: "bi.text_button",
cls: "retry-button",
width: 60,
height: 22,
text: BI.i18nText("BI-Basic_Retry"),
title: BI.i18nText("BI-Basic_Retry"),
handler: function () {
self.toast.element.slideUp(500);
self._retryAll();
}
}, {
type: "bi.icon_button",
cls: "close-font",
width: 20,
height: 20,
title: BI.i18nText("BI-Basic_Close"),
handler: function () {
self.toast.element.slideUp(500);
}
}],
width: 520,
height: 30,
hgap: 2
});
BI.createWidget({
type: "bi.absolute",
element: $("body"),
items: [{
el: this.toast,
left: "50%",
top: 0
}]
});
this.toast.element.css({"margin-left": -1 * this.toast.element.outerWidth() / 2});
this.toast.setVisible(false);
},
_retryAll: function () {
var self = this;
var clonedRequests = BI.deepClone(this.requests);
this.requests = [];
BI.each(clonedRequests, function (i, options) {
BI.isFunction(self.callback) && self.callback(options);
});
},
cancelAllRequests: function () {
this.toast.element.slideUp(500);
BI.each(this.requests, function (i, reqArgs) {
if (BI.isNotNull(reqArgs) && BI.isFunction(reqArgs.complete)) {
reqArgs.complete();
}
});
this.requests = [];
},
setCallback: function (callback) {
this.callback = callback;
},
addReq: function (options) {
var self = this;
if (this.requests.length === 0) {
setTimeout(function () {
if (self.requests.contains(options)) {
self.toast.element.slideDown(500);
}
}, 5 * 60 * 1000); //5 min
}
this.requests.push(options);
},
removeReq: function (options) {
BI.remove(this.requests, options);
if (this.requests.length === 0) {
this.toast.element.slideUp(500);
}
},
hasReq: function (options) {
return this.requests.contains(options);
}
});
$.shortcut("bi.timeout_toast", BI.TimeoutToast);

0
src/base/tree/3parttree.js → src/base/tree/parttree.js

38
src/base/tree/2synctree.js → src/base/tree/synctree.js

@ -19,7 +19,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
var setting = { var setting = {
async: { async: {
enable: false, enable: false,
otherParam: BI.cjkEncodeDO(paras) otherParam: FR.cjkEncodeDO(paras)
}, },
check: { check: {
enable: true enable: true
@ -157,36 +157,24 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
} }
}, },
_joinTree: function (map, values, isLast) {
var cur = map;
BI.each(values, function (i, value) {
if (i > 0 && BI.isPlainObject(cur) && BI.isEmpty(cur)) {
return;
}
if (isLast === true && i === values.length - 1) {
cur[value] = {};
return;
}
if (cur[value] == null) {
cur[value] = {};
}
cur = cur[value];
})
},
_join: function (valueA, valueB) { _join: function (valueA, valueB) {
var self = this; var self = this;
var hashMap = valueA || {}; var map = {};
track([], valueB); track([], valueA, valueB);
function track(parent, node) { track([], valueB, valueA);
function track(parent, node, compare) {
BI.each(node, function (n, item) { BI.each(node, function (n, item) {
var next = parent.concat([n]); if (BI.isNull(compare[n])) {
self._joinTree(hashMap, next, BI.isPlainObject(item) && BI.isEmpty(item)); self._addTreeNode(map, parent, n, item);
track(next, item); } else if (BI.isEmpty(compare[n])) {
self._addTreeNode(map, parent, n, {});
} else {
track(parent.concat([n]), node[n], compare[n]);
}
}) })
} }
return hashMap; return map;
}, },
hasChecked: function () { hasChecked: function () {

21
src/base/tree/1treeview.js → src/base/tree/treeview.js

@ -14,6 +14,9 @@ BI.TreeView = BI.inherit(BI.Pane, {
}, },
_init: function () { _init: function () {
BI.TreeView.superclass._init.apply(this, arguments); BI.TreeView.superclass._init.apply(this, arguments);
FR.$defaultImport('/com/fr/bi/web/js/third/ztree/jquery.ztree.core-3.5.js', 'js');
FR.$defaultImport('/com/fr/bi/web/js/third/ztree/jquery.ztree.excheck-3.5.js', 'js');
FR.$defaultImport('/com/fr/bi/web/css/base/third/ztree/zTreeStyle.css', 'css');
this._stop = false; this._stop = false;
this.container = BI.createWidget(); this.container = BI.createWidget();
@ -68,7 +71,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
enable: true, enable: true,
url: getUrl, url: getUrl,
autoParam: ["id", "name"], autoParam: ["id", "name"],
otherParam: BI.cjkEncodeDO(paras) otherParam: FR.cjkEncodeDO(paras)
}, },
check: { check: {
enable: true enable: true
@ -110,10 +113,10 @@ BI.TreeView = BI.inherit(BI.Pane, {
treeNode.times = treeNode.times || 1; treeNode.times = treeNode.times || 1;
var param = "id=" + treeNode.id var param = "id=" + treeNode.id
+ "&times=" + (treeNode.times++) + "&times=" + (treeNode.times++)
+ "&parent_values= " + window.encodeURIComponent(BI.jsonEncode(parentNode)) + "&parent_values= " + window.encodeURIComponent(FR.jsonEncode(parentNode))
+ "&check_state=" + window.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus())); + "&check_state=" + window.encodeURIComponent(FR.jsonEncode(treeNode.getCheckStatus()));
return BI.servletURL + '?op=' + self.options.op + '&cmd=' + self.options.cmd + "&" + param; return FR.servletURL + '?op=' + self.options.op + '&cmd=' + self.options.cmd + "&" + param;
} }
function beforeExpand(treeId, treeNode) { function beforeExpand(treeId, treeNode) {
@ -310,7 +313,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
//处理标红 //处理标红
if (BI.isKey(o.paras.keyword)) { if (BI.isKey(o.paras.keyword)) {
var keyword = o.paras.keyword; var keyword = o.paras.keyword;
var ns = BI.Tree.transformToArrayFormat(nodes); var ns = BI.Tree.arrayFormat(nodes);
BI.each(ns, function (i, n) { BI.each(ns, function (i, n) {
n.text = $("<div>").__textKeywordMarked__(n.text, keyword, n.py).html(); n.text = $("<div>").__textKeywordMarked__(n.text, keyword, n.py).html();
}); });
@ -443,13 +446,17 @@ BI.TreeView = BI.inherit(BI.Pane, {
}, },
setValue: function (value, param) { setValue: function (value, param) {
this.options.paras.selected_values = value || {}; this.setSelectedValue(value);
this.selected_values = BI.deepClone(value) || {};
this.checkAll(false); this.checkAll(false);
this.updateValue(value, param); this.updateValue(value, param);
this.refresh(); this.refresh();
}, },
setSelectedValue: function (value) {
this.options.paras.selected_values = value || {};
this.selected_values = BI.deepClone(value) || {};
},
updateValue: function (values, param) { updateValue: function (values, param) {
if (!this.nodes) { if (!this.nodes) {
return; return;

284
src/core/base.js

@ -33,7 +33,7 @@ if (!window.BI) {
//Utility //Utility
_.extend(BI, { _.extend(BI, {
i18nText: function (key) { i18nText: function (key) {
var localeText = key; var localeText = FR.i18n[key];
if (!localeText) { if (!localeText) {
localeText = key; localeText = key;
} }
@ -50,7 +50,7 @@ if (!window.BI) {
assert: function (v, is) { assert: function (v, is) {
if (this.isFunction(is)) { if (this.isFunction(is)) {
if (!is(v)) { if (!is(v)) {
throw new Error(v + "值不合法"); throw new Error(v + " error");
} else { } else {
return true; return true;
} }
@ -59,7 +59,7 @@ if (!window.BI) {
is = [is]; is = [is];
} }
if (!this.deepContains(is, v)) { if (!this.deepContains(is, v)) {
throw new Error(v + "值不合法"); throw new Error(v + " error");
} }
}, },
@ -81,9 +81,33 @@ if (!window.BI) {
return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View); return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View);
}, },
createWidget: function (item, options) {
var el;
options || (options = {});
if (BI.isEmpty(item) && BI.isEmpty(options)) {
return BI.Plugin.getObject("bi.layout", BI.createWidget({
type: "bi.layout"
}));
}
if (BI.isWidget(item)) {
return item;
}
if (item && (item.type || options.type)) {
el = BI.extend({}, options, item);
return BI.Plugin.getObject(el.type, FR.createWidget(BI.Plugin.getWidget(el.type, el), true));
}
if (item && item.el && (item.el.type || options.type)) {
el = BI.extend({}, options, item.el);
return BI.Plugin.getObject(el.type, FR.createWidget(BI.Plugin.getWidget(el.type, el), true));
}
if (item && BI.isWidget(item.el)) {
return item.el;
}
},
createWidgets: function (items, options) { createWidgets: function (items, options) {
if (!BI.isArray(items)) { if (!BI.isArray(items)) {
throw new Error("无法根据items创建组件?") throw new Error("cannot create Widgets")
} }
return BI.map(BI.flatten(items), function (i, item) { return BI.map(BI.flatten(items), function (i, item) {
return BI.createWidget(item, BI.deepClone(options)); return BI.createWidget(item, BI.deepClone(options));
@ -254,7 +278,9 @@ if (!window.BI) {
backAny: function (obj, predicate, context) { backAny: function (obj, predicate, context) {
predicate = BI.iteratee(predicate, context); predicate = BI.iteratee(predicate, context);
for (var index = obj.length - 1; index >= 0; index--) { for (var index = obj.length - 1; index >= 0; index--) {
if (predicate(index, obj[index], obj)) return true; if (predicate(index, obj[index], obj)) {
return true;
}
} }
return false; return false;
}, },
@ -262,7 +288,9 @@ if (!window.BI) {
backEvery: function (obj, predicate, context) { backEvery: function (obj, predicate, context) {
predicate = BI.iteratee(predicate, context); predicate = BI.iteratee(predicate, context);
for (var index = obj.length - 1; index >= 0; index--) { for (var index = obj.length - 1; index >= 0; index--) {
if (!predicate(index, obj[index], obj)) return false; if (!predicate(index, obj[index], obj)) {
return false;
}
} }
return true; return true;
}, },
@ -388,7 +416,9 @@ if (!window.BI) {
}, },
uniq: function (array, isSorted, iteratee, context) { uniq: function (array, isSorted, iteratee, context) {
if (array == null) return []; if (array == null) {
return [];
}
if (!_.isBoolean(isSorted)) { if (!_.isBoolean(isSorted)) {
context = iteratee; context = iteratee;
iteratee = isSorted; iteratee = isSorted;
@ -455,11 +485,7 @@ if (!window.BI) {
}, },
isWidthOrHeight: function (w) { isWidthOrHeight: function (w) {
if (typeof w == 'number') { return FR.isWidthOrHeight(w);
return w >= 0;
} else if (typeof w == 'string') {
return /^\d{1,3}%$/.exec(w) || w == 'auto' || /^\d+px$/.exec(w);
}
}, },
isNotNull: function (obj) { isNotNull: function (obj) {
@ -550,11 +576,15 @@ if (!window.BI) {
isDeepMatch: function (object, attrs) { isDeepMatch: function (object, attrs) {
var keys = BI.keys(attrs), length = keys.length; var keys = BI.keys(attrs), length = keys.length;
if (object == null) return !length; if (object == null) {
return !length;
}
var obj = Object(object); var obj = Object(object);
for (var i = 0; i < length; i++) { for (var i = 0; i < length; i++) {
var key = keys[i]; var key = keys[i];
if (!BI.isEqual(attrs[key], obj[key]) || !(key in obj)) return false; if (!BI.isEqual(attrs[key], obj[key]) || !(key in obj)) {
return false;
}
} }
return true; return true;
}, },
@ -580,20 +610,24 @@ if (!window.BI) {
}, },
deepRemove: function (obj, target) { deepRemove: function (obj, target) {
var done = false;
var i; var i;
if (BI.isArray(obj)) { if (BI.isArray(obj)) {
for (i = 0; i < obj.length; i++) { for (i = 0; i < obj.length; i++) {
if (BI.isEqual(target, obj[i])) { if (BI.isEqual(target, obj[i])) {
obj.splice(i--, 1); obj.splice(i--, 1);
done = true;
} }
} }
} else { } else {
BI.each(obj, function (i, v) { BI.each(obj, function (i, v) {
if (BI.isEqual(target, obj[i])) { if (BI.isEqual(target, obj[i])) {
delete obj[i]; delete obj[i];
done = true;
} }
}); });
} }
return done;
}, },
deepWithout: function (obj, target) { deepWithout: function (obj, target) {
@ -616,8 +650,14 @@ if (!window.BI) {
} }
}, },
deepUniq: function () { deepUnique: function (array) {
var result = [];
BI.each(array, function (i, item) {
if (!BI.deepContains(result, item)) {
result.push(item);
}
});
return result;
}, },
//比较两个对象得出不一样的key值 //比较两个对象得出不一样的key值
@ -668,31 +708,54 @@ if (!window.BI) {
var copies = callbacks.slice(0); var copies = callbacks.slice(0);
callbacks = []; callbacks = [];
for (var i = 0; i < copies.length; i++) { for (var i = 0; i < copies.length; i++) {
copies[i].func.apply(null, copies[i].args); copies[i]();
} }
} }
if (typeof Promise !== 'undefined') {
var p = Promise.resolve();
timerFunc = function () {
p.then(nextTickHandler);
}
} else
/* istanbul ignore if */ /* istanbul ignore if */
if (typeof MutationObserver !== 'undefined') { if (typeof MutationObserver !== 'undefined') {
var counter = 1; var counter = 1;
var observer = new MutationObserver(nextTickHandler); var observer = new MutationObserver(nextTickHandler);
var textNode = document.createTextNode(counter); var textNode = document.createTextNode(counter + "");
observer.observe(textNode, { observer.observe(textNode, {
characterData: true characterData: true
}); });
timerFunc = function () { timerFunc = function () {
counter = (counter + 1) % 2; counter = (counter + 1) % 2;
textNode.data = counter; textNode.data = counter + "";
} }
} else { } else {
timerFunc = setTimeout timerFunc = function () {
setTimeout(nextTickHandler, 0)
}
} }
return function (cb) { return function queueNextTick(cb) {
var _resolve;
var args = [].slice.call(arguments, 1); var args = [].slice.call(arguments, 1);
callbacks.push({func: cb, args: args}); callbacks.push(function () {
if (pending) return; if (cb) {
cb.apply(null, args);
}
if (_resolve) {
_resolve.apply(null, args);
}
});
if (!pending) {
pending = true; pending = true;
timerFunc(nextTickHandler, 0); timerFunc();
}
if (!cb && typeof Promise !== 'undefined') {
return new Promise(function (resolve) {
_resolve = resolve
})
}
} }
})() })()
}); });
@ -726,7 +789,7 @@ if (!window.BI) {
try { try {
return parseInt(number, radix); return parseInt(number, radix);
} catch (e) { } catch (e) {
throw new Error("转成int类型失败"); throw new Error(number + "parse int error");
return NaN; return NaN;
} }
}, },
@ -735,7 +798,7 @@ if (!window.BI) {
try { try {
return parseFloat(number); return parseFloat(number);
} catch (e) { } catch (e) {
throw new Error("转成float类型失败"); throw new Error(number + "parse float error");
return NaN; return NaN;
} }
}, },
@ -797,9 +860,9 @@ if (!window.BI) {
var sum = 0; var sum = 0;
BI.each(array, function (i, item) { BI.each(array, function (i, item) {
if (iteratee) { if (iteratee) {
sum += new Number(iteratee.apply(context, [i, item])); sum += Number(iteratee.apply(context, [i, item]));
} else { } else {
sum += new Number(item); sum += Number(item);
} }
}); });
return sum; return sum;
@ -825,6 +888,10 @@ if (!window.BI) {
return (string + "").toLocaleLowerCase(); return (string + "").toLocaleLowerCase();
}, },
isEndWithBlank: function (string) {
return /(\s|\u00A0)$/.test(string);
},
isLiteral: function (exp) { isLiteral: function (exp) {
var literalValueRE = /^\s?(true|false|-?[\d\.]+|'[^']*'|"[^"]*")\s?$/ var literalValueRE = /^\s?(true|false|-?[\d\.]+|'[^']*'|"[^"]*")\s?$/
return literalValueRE.test(exp) return literalValueRE.test(exp)
@ -858,6 +925,10 @@ if (!window.BI) {
return BI.isString(str) && BI.isEmpty(str); return BI.isString(str) && BI.isEmpty(str);
}, },
contentFormat: function () {
return FR.contentFormat.apply(FR, arguments);
},
/** /**
* 对字符串进行加密 {@link #decrypt} * 对字符串进行加密 {@link #decrypt}
* @static * @static
@ -971,23 +1042,23 @@ if (!window.BI) {
//浏览器相关方法 //浏览器相关方法
_.extend(BI, { _.extend(BI, {
isIE: function () { isIE: function () {
return $.browser.msie; return /(msie|trident)/i.test(navigator.userAgent.toLowerCase());
}, },
isChrome: function () { isChrome: function () {
return $.browser.chrome; return /chrome/i.test(navigator.userAgent.toLowerCase());
}, },
isFireFox: function () { isFireFox: function () {
return $.browser.mozilla; return /firefox/i.test(navigator.userAgent.toLowerCase());
}, },
isOpera: function () { isOpera: function () {
return $.browser.opera; return /opera/i.test(navigator.userAgent.toLowerCase());
}, },
isSafari: function () { isSafari: function () {
return $.browser.safari; return /safari/i.test(navigator.userAgent.toLowerCase());
}, },
isKhtml: function () { isKhtml: function () {
@ -1021,6 +1092,124 @@ if (!window.BI) {
//BI请求 //BI请求
_.extend(BI, { _.extend(BI, {
ajax: (function () {
var loading, timeoutToast;
return function (option) {
option || (option = {});
option.data = BI.extend({}, Data.SharingPool.cat("urlParameters"), option.data);
//encode
encodeBIParam(option.data);
var async = true;
if (BI.isNotNull(option.async)) {
async = option.async;
}
if (BI.isNull(loading)) {
loading = BI.createWidget({
type: "bi.request_loading"
});
}
if (BI.isNull(timeoutToast)) {
timeoutToast = BI.createWidget({
type: "bi.timeout_toast"
});
timeoutToast.setCallback(function (op) {
decodeBIParam(op.data);
BI.ajax(op);
});
}
timeoutToast.addReq(option);
FR.ajax({
url: option.url,
type: "POST",
data: option.data,
async: async,
error: function () {
if (!timeoutToast.hasReq(option)) {
return;
}
timeoutToast.removeReq(option);
//失败 取消、重新加载
loading.setCallback(function () {
decodeBIParam(option.data);
BI.ajax(option);
});
loading.showError();
},
complete: function (res, status) {
if (!timeoutToast.hasReq(option)) {
return;
}
timeoutToast.removeReq(option);
//登录超时
if (BI.isNotNull(res.responseText) &&
res.responseText.indexOf("fs-login-content") > -1 &&
res.responseText.indexOf("fs-login-input-password-confirm") === -1) {
if (BI.Popovers.isVisible(BI.LoginTimeOut.POPOVER_ID)) {
return;
}
if (BI.isNotNull(BI.Popovers.get(BI.LoginTimeOut.POPOVER_ID))) {
BI.Popovers.open(BI.LoginTimeOut.POPOVER_ID);
return;
}
var loginTimeout = BI.createWidget({
type: "bi.login_timeout"
});
loginTimeout.on(BI.LoginTimeOut.EVENT_LOGIN, function () {
decodeBIParam(option.data);
BI.ajax(option);
BI.Popovers.remove(BI.LoginTimeOut.POPOVER_ID);
});
BI.Popovers.create(BI.LoginTimeOut.POPOVER_ID, loginTimeout, {
width: 600,
height: 400
}).open(BI.LoginTimeOut.POPOVER_ID);
} else if (BI.isNotNull(res.responseText) &&
res.responseText.indexOf("script") > -1 &&
res.responseText.indexOf("Session Timeout...") > -1) {
//登录失效
loading.setCallback(function () {
location.reload();
});
loading.showError();
} else if (status === "success" && BI.isFunction(option.success)) {
option.success(FR.jsonDecode(res.responseText));
}
if (BI.isFunction(option.complete)) {
option.complete(FR.jsonDecode(res.responseText), status);
}
}
});
return function cancel() {
timeoutToast.removeReq(option);
};
function encodeBIParam(data) {
for (var key in data) {
if (_.isObject(data[key])) {
data[key] = window.encodeURIComponent(FR.jsonEncode(data[key]));
} else {
data[key] = window.encodeURIComponent(data[key]);
}
}
}
function decodeBIParam(data) {
for (var key in data) {
data[key] = window.decodeURIComponent(data[key]);
if (_.isObject(data[key])) {
data[key] = FR.jsonDecode(data[key]);
}
}
}
}
})(),
/** /**
* 异步ajax请求 * 异步ajax请求
* @param {String} op op参数 * @param {String} op op参数
@ -1030,38 +1219,29 @@ if (!window.BI) {
* @param {Function} complete 回调 * @param {Function} complete 回调
*/ */
requestAsync: function (op, cmd, data, callback, complete) { requestAsync: function (op, cmd, data, callback, complete) {
// if (BI.isNull(BI.REQUEST_LOADING)) {
// BI.REQUEST_LOADING = BI.createWidget({
// type: "bi.request_loading"
// });
// }
data = data || {}; data = data || {};
if (!BI.isKey(op)) { if (!BI.isKey(op)) {
op = 'fr_bi_dezi'; op = 'fr_bi_dezi';
} }
if (op === "fr_bi_dezi") { if (op === "fr_bi_dezi" || op === "fr_bi_configure") {
data.sessionID = Data.SharingPool.get("sessionID"); data.sessionID = Data.SharingPool.get("sessionID");
} }
var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random(); var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random();
(BI.ajax || FR.ajax)({ return (BI.ajax)({
url: url, url: url,
type: 'POST', type: 'POST',
data: data, data: data,
error: function () { error: function () {
// BI.Msg.toast(BI.i18nText("BI-Ajax_Error")); // BI.Msg.toast(BI.i18nText("BI-Ajax_Error"));
//失败 取消、重新加载
// BI.REQUEST_LOADING.setCallback(function () {
// BI.requestAsync(op, cmd, data, callback, complete);
// });
// BI.REQUEST_LOADING.showError();
}, },
complete: function (res, status) { success: function (res) {
if (BI.isFunction(callback) && status === 'success') { if (BI.isFunction(callback)) {
callback(BI.jsonDecode(res.responseText)); callback(res);
BI.Maskers.hide(BI.RequstLoading.MASK_ID);
} }
},
complete: function (res, status) {
if (BI.isFunction(complete)) { if (BI.isFunction(complete)) {
complete(); complete(res);
} }
} }
}); });
@ -1084,7 +1264,7 @@ if (!window.BI) {
} }
var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random(); var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random();
var result = {}; var result = {};
(BI.ajax || FR.ajax)({ (BI.ajax)({
url: url, url: url,
type: 'POST', type: 'POST',
async: false, async: false,
@ -1094,7 +1274,7 @@ if (!window.BI) {
}, },
complete: function (res, status) { complete: function (res, status) {
if (status === 'success') { if (status === 'success') {
result = BI.jsonDecode(res.responseText); result = res;
} }
} }
}); });

2
src/core/controller.js

@ -3,7 +3,7 @@
* 控制器 * 控制器
* Controller层超类 * Controller层超类
* @class BI.Controller * @class BI.Controller
* @extends FR.OB * @extends BI.OB
* @abstract * @abstract
*/ */
BI.Controller = BI.inherit(BI.OB, { BI.Controller = BI.inherit(BI.OB, {

47
src/core/loader/loader.style.js

@ -0,0 +1,47 @@
/**
* style加载管理器
*
* Created by GUY on 2015/9/7.
* @class
*/
BI.StyleLoaderManager = BI.inherit(BI.OB, {
_defaultConfig: function () {
return BI.extend(BI.StyleLoaderManager.superclass._defaultConfig.apply(this, arguments), {});
},
_init: function () {
BI.StyleLoaderManager.superclass._init.apply(this, arguments);
this.stylesManager = {};
},
loadStyle: function (name, styleString) {
var d = document, styles = d.createElement('style');
d.getElementsByTagName('head')[0].appendChild(styles);
styles.setAttribute('type', 'text/css');
if (styles.styleSheet) {
styles.styleSheet.cssText = styleString;
} else {
styles.appendChild(document.createTextNode(styleString));
}
this.stylesManager[name] = styles;
return this;
},
get: function (name) {
return this.stylesManager[name];
},
has: function (name) {
return this.stylesManager[name] != null;
},
removeStyle: function (name) {
if (!this.has(name)) {
return this;
}
this.stylesManager[name].parentNode.removeChild(this.stylesManager[name]);
delete this.stylesManager[name];
return this;
}
});

2
src/core/var.js

@ -15,7 +15,7 @@ _.extend(BI, {
emptyFn: function () { emptyFn: function () {
}, },
empty: null, empty: null,
keyCode: { KeyCode: {
BACKSPACE: 8, BACKSPACE: 8,
COMMA: 188, COMMA: 188,
DELETE: 46, DELETE: 46,

6
src/core/wrapper/layout/layout.card.js

@ -83,7 +83,6 @@ BI.CardLayout = BI.inherit(BI.Layout, {
.appendTo(this.element); .appendTo(this.element);
widget.invisible(); widget.invisible();
this.addWidget(this._getCardName(cardName), widget); this.addWidget(this._getCardName(cardName), widget);
widget._mount();
return widget; return widget;
}, },
@ -101,7 +100,10 @@ BI.CardLayout = BI.inherit(BI.Layout, {
//动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了 //动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了
!flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.element.hide(); !flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.element.hide();
} else { } else {
(BI.Action && action instanceof BI.Action) ? action.actionPerformed(void 0, el, callback) : el.element.show(0, callback); (BI.Action && action instanceof BI.Action) ? action.actionPerformed(void 0, el, callback) : el.element.show(0, function () {
el._mount();
callback && callback();
});
} }
}); });
}, },

21
src/css/base/base.css

@ -0,0 +1,21 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
@font-face {
font-family: 'bbr';
src: url('/resources/fonts/iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('/resources/fonts/iconfont.woff') format('woff'), /* chrome、firefox */ url('/resources/fonts/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('/resources/fonts/iconfont.svg#svgFontName') format('svg');
/* iOS 4.1- */
}
.b-font {
font-family: "bi";
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.bi-base-request-fail-mask .mask-pane {
background: #ffffff;
opacity: 0.8;
filter: alpha(opacity=80);
}

11
src/css/base/chart/chart.combine.css

@ -0,0 +1,11 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-combine-chart .bi-linkage-list {
background-color: #ffffff;
border: 1px solid #eaeaea;
z-index: 1000000000;
}
.bi-combine-chart .bi-linkage-list .bi-linkage-list-item:hover {
background-color: #f4f4f4;
}

11
src/css/base/combo/popup.bubble.css

@ -0,0 +1,11 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-bubble-popup-view {
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
.bi-bubble-popup-view .bubble-popup-line {
background-color: #009de3;
}

9
src/css/base/dom.css

@ -0,0 +1,9 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
/************hing light*****************/
.bi-z-index-mask {
background-color: #1a1a1a;
opacity: 0.5;
filter: alpha(opacity=50);
}

32
src/css/base/logintimeout/login.timeout.css

@ -0,0 +1,32 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-login-timeout-center .input-wrapper {
border-bottom: 1px solid #eaeaea;
}
.bi-login-timeout-center .input-wrapper .login-input {
font-size: 16px;
}
.bi-login-timeout-center .input-wrapper .error-mask {
background: #1a1a1a;
opacity: 0.25;
filter: alpha(opacity=25);
color: #ffffff;
font-size: 16px;
}
.bi-login-timeout-center .login-button {
background: #009de3;
-webkit-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;
font-size: 22px;
color: #ffffff;
}
.bi-login-timeout-center .login-button:hover {
opacity: 0.8;
filter: alpha(opacity=80);
}
.bi-login-timeout-south .keep-state {
font-size: 14px;
color: #808080;
}

9
src/css/base/pager/pager.all.count.css

@ -0,0 +1,9 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-all-count-pager .all-pager-prev {
font-size: 16px;
}
.bi-all-count-pager .all-pager-next {
font-size: 16px;
}

2
src/css/base/pager/pager.direction.css

@ -3,9 +3,7 @@
/**** custom color(自定义颜色,用于特定场景) ****/ /**** custom color(自定义颜色,用于特定场景) ****/
.bi-direction-pager .direction-pager-prev { .bi-direction-pager .direction-pager-prev {
font-size: 16px; font-size: 16px;
background: #f4f4f4;
} }
.bi-direction-pager .direction-pager-next { .bi-direction-pager .direction-pager-next {
font-size: 16px; font-size: 16px;
background: #f4f4f4;
} }

10
src/css/base/reqloading/loading.request.css

@ -7,8 +7,14 @@
filter: alpha(opacity=80); filter: alpha(opacity=80);
} }
.bi-request-loading .loading-comment { .bi-request-loading .loading-comment {
font-size: 14px; font-size: 20px;
color: #808080;
} }
.bi-request-loading .load-fail-comment { .bi-request-loading .load-fail-comment {
font-size: 14px; font-size: 20px;
color: #808080;
}
.bi-request-loading .load-timeout-warning {
font-size: 16px;
color: #e85050;
} }

6
src/css/base/single/editor/editor.state.css

@ -1,10 +1,6 @@
/****添加计算宽度的--运算符直接需要space****/ /****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/ /****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/ /**** custom color(自定义颜色,用于特定场景) ****/
.bi-state-editor {
font-size: 12px;
}
.bi-state-editor .state-editor-infinite-text { .bi-state-editor .state-editor-infinite-text {
font-size: 12px; color: #cccccc;
color: #1a1a1a;
} }

6
src/css/base/single/editor/editor.state.simple.css

@ -1,10 +1,6 @@
/****添加计算宽度的--运算符直接需要space****/ /****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/ /****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/ /**** custom color(自定义颜色,用于特定场景) ****/
.bi-simple-state-editor {
font-size: 12px;
}
.bi-simple-state-editor .state-editor-infinite-text { .bi-simple-state-editor .state-editor-infinite-text {
font-size: 12px; color: #cccccc;
color: #1a1a1a;
} }

2
src/css/base/single/text.css

@ -5,5 +5,5 @@
text-overflow: ellipsis; text-overflow: ellipsis;
overflow-x: hidden; overflow-x: hidden;
white-space: nowrap; white-space: nowrap;
word-break: break-word; word-break: break-all;
} }

44
src/css/base/third/ztree/zTreeStyle.css

@ -10,13 +10,10 @@ website: http://code.google.com/p/jquerytree/
.ztree * { .ztree * {
padding: 0; padding: 0;
margin: 0; margin: 0;
font-size: 12px;
font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif;
} }
.ztree { .ztree {
margin: 0; margin: 0;
padding: 5px; padding: 5px;
color: #333333;
} }
.ztree li { .ztree li {
padding: 0; padding: 0;
@ -32,14 +29,13 @@ website: http://code.google.com/p/jquerytree/
padding: 0 0 0 18px; padding: 0 0 0 18px;
} }
.ztree li ul.line { .ztree li ul.line {
background: url(icon/tree-vertical-line-1.png) 0 0 repeat-y; background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-1.png) 0 0 repeat-y;
} }
.ztree li a { .ztree li a {
padding: 1px 3px 0 0; padding: 1px 3px 0 0;
margin: 0; margin: 0;
cursor: pointer; cursor: pointer;
height: 24px; height: 24px;
color: #333;
background-color: transparent; background-color: transparent;
text-decoration: none; text-decoration: none;
vertical-align: top; vertical-align: top;
@ -98,31 +94,31 @@ website: http://code.google.com/p/jquerytree/
cursor: auto; cursor: auto;
} }
.ztree li span.button.chk.checkbox_false_full { .ztree li span.button.chk.checkbox_false_full {
background-image: url("icon/check-box-normal.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-normal.png");
} }
.ztree li span.button.chk.checkbox_false_full_focus { .ztree li span.button.chk.checkbox_false_full_focus {
background-image: url("icon/check-box-normal.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-normal.png");
} }
.ztree li span.button.chk.checkbox_false_part { .ztree li span.button.chk.checkbox_false_part {
background-image: url("icon/half_selected.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
} }
.ztree li span.button.chk.checkbox_false_part_focus { .ztree li span.button.chk.checkbox_false_part_focus {
background-image: url("icon/half_selected.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
} }
.ztree li span.button.chk.checkbox_false_disable { .ztree li span.button.chk.checkbox_false_disable {
background-position: 0 -56px; background-position: 0 -56px;
} }
.ztree li span.button.chk.checkbox_true_full { .ztree li span.button.chk.checkbox_true_full {
background-image: url("icon/check-box-active.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-active.png");
} }
.ztree li span.button.chk.checkbox_true_full_focus { .ztree li span.button.chk.checkbox_true_full_focus {
background-image: url("icon/check-box-active.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-active.png");
} }
.ztree li span.button.chk.checkbox_true_part { .ztree li span.button.chk.checkbox_true_part {
background-image: url("icon/half_selected.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
} }
.ztree li span.button.chk.checkbox_true_part_focus { .ztree li span.button.chk.checkbox_true_part_focus {
background-image: url("icon/half_selected.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
} }
.ztree li span.button.chk.checkbox_true_disable { .ztree li span.button.chk.checkbox_true_disable {
background-position: -14px -56px; background-position: -14px -56px;
@ -162,28 +158,28 @@ website: http://code.google.com/p/jquerytree/
height: 25px; height: 25px;
} }
.ztree li span.button.root_open { .ztree li span.button.root_open {
background-image: url("icon/tree-expand-1.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-1.png");
} }
.ztree li span.button.root_close { .ztree li span.button.root_close {
background-image: url("icon/tree-collapse-1.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-1.png");
} }
.ztree li span.button.roots_open { .ztree li span.button.roots_open {
background-image: url("icon/tree-expand-2.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-2.png");
} }
.ztree li span.button.roots_close { .ztree li span.button.roots_close {
background-image: url("icon/tree-collapse-2.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-2.png");
} }
.ztree li span.button.center_open { .ztree li span.button.center_open {
background-image: url("icon/tree-expand-3.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-3.png");
} }
.ztree li span.button.center_close { .ztree li span.button.center_close {
background-image: url("icon/tree-collapse-3.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-3.png");
} }
.ztree li span.button.bottom_open { .ztree li span.button.bottom_open {
background-image: url("icon/tree-expand-4.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-4.png");
} }
.ztree li span.button.bottom_close { .ztree li span.button.bottom_close {
background-image: url("icon/tree-collapse-4.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-4.png");
} }
.ztree li span.button.noline_open { .ztree li span.button.noline_open {
background-position: -92px -72px; background-position: -92px -72px;
@ -195,13 +191,13 @@ website: http://code.google.com/p/jquerytree/
background: none; background: none;
} }
.ztree li span.button.roots_docu { .ztree li span.button.roots_docu {
background-image: url("icon/tree-vertical-line-2.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-2.png");
} }
.ztree li span.button.center_docu { .ztree li span.button.center_docu {
background-image: url("icon/tree-vertical-line-3.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-3.png");
} }
.ztree li span.button.bottom_docu { .ztree li span.button.bottom_docu {
background-image: url("icon/tree-vertical-line-4.png"); background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-4.png");
} }
.ztree li span.button.noline_docu { .ztree li span.button.noline_docu {
background: none; background: none;

34
src/css/base/timeouttoast/widget.timeouttoast.css

@ -0,0 +1,34 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-timeout-toast {
font-size: 14px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
background: #fddddd;
color: #e85050;
}
.bi-timeout-toast .cancel-button {
background: #ffffff;
border: 1px solid #d4dadd;
color: #1a1a1a;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
}
.bi-timeout-toast .cancel-button:hover {
opacity: 0.8;
filter: alpha(opacity=80);
}
.bi-timeout-toast .retry-button {
background: #009de3;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
color: #ffffff;
}
.bi-timeout-toast .retry-button:hover {
opacity: 0.8;
filter: alpha(opacity=80);
}

1
src/css/base/view/popupview.css

@ -14,6 +14,7 @@
-webkit-border-radius: 2px; -webkit-border-radius: 2px;
-moz-border-radius: 2px; -moz-border-radius: 2px;
border-radius: 2px; border-radius: 2px;
color: #1a1a1a;
background: #ffffff; background: #ffffff;
} }
.bi-list-view .list-view-toolbar { .bi-list-view .list-view-toolbar {

38
src/css/base/wrapper/flex.center.css

@ -0,0 +1,38 @@
.bi-flex-center-layout {
display: box;
/* OLD - Android 4.4- */
display: -webkit-box;
/* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box;
/* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox;
/* TWEENER - IE 10 */
display: -webkit-flex;
/* NEW - Chrome */
display: flex;
/* NEW, Spec - Opera 12.1, Firefox 20+ */
/* 09版 */
-webkit-box-orient: horizontal;
/* 12版 */
-webkit-flex-direction: row;
-moz-flex-direction: row;
-ms-flex-direction: row;
-o-flex-direction: row;
flex-direction: row;
/* 09版 */
-webkit-box-pack: center;
/* 12版 */
-webkit-justify-content: center;
-moz-justify-content: center;
-ms-justify-content: center;
-o-justify-content: center;
justify-content: center;
/* 09版 */
-webkit-box-align: center;
/* 12版 */
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
-o-align-items: center;
align-items: center;
}

66
src/css/base/wrapper/flex.horizontal.css

@ -0,0 +1,66 @@
.bi-flex-horizontal-layout {
display: box;
/* OLD - Android 4.4- */
display: -webkit-box;
/* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box;
/* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox;
/* TWEENER - IE 10 */
display: -webkit-flex;
/* NEW - Chrome */
display: flex;
/* NEW, Spec - Opera 12.1, Firefox 20+ */
/* 09版 */
-webkit-box-orient: horizontal;
/* 12版 */
-webkit-flex-direction: row;
-moz-flex-direction: row;
-ms-flex-direction: row;
-o-flex-direction: row;
flex-direction: row;
/* 09版 */
-webkit-box-pack: flex-start;
/* 12版 */
-webkit-justify-content: flex-start;
-moz-justify-content: flex-start;
-ms-justify-content: flex-start;
-o-justify-content: flex-start;
justify-content: flex-start;
/* 09版 */
-webkit-box-align: flex-start;
/* 12版 */
-webkit-align-items: flex-start;
-moz-align-items: flex-start;
-ms-align-items: flex-start;
-o-align-items: flex-start;
align-items: flex-start;
/* 09版 */
/*-webkit-box-lines: multiple;*/
/* 12版 */
-webkit-flex-wrap: nowrap;
-moz-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
-o-flex-wrap: nowrap;
flex-wrap: nowrap;
}
.bi-flex-horizontal-layout.middle {
/* 09版 */
-webkit-box-align: center;
/* 12版 */
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
-o-align-items: center;
align-items: center;
}
.bi-flex-horizontal-layout.bottom {
/* 09版 */
-webkit-box-align: flex-end;
/* 12版 */
-webkit-align-items: flex-end;
-moz-align-items: flex-end;
-ms-align-items: flex-end;
-o-align-items: flex-end;
align-items: flex-end;
}

46
src/css/base/wrapper/flex.vertical.center.css

@ -0,0 +1,46 @@
.bi-flex-vertical-center {
display: box;
/* OLD - Android 4.4- */
display: -webkit-box;
/* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box;
/* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox;
/* TWEENER - IE 10 */
display: -webkit-flex;
/* NEW - Chrome */
display: flex;
/* NEW, Spec - Opera 12.1, Firefox 20+ */
/* 09版 */
-webkit-box-orient: horizontal;
/* 12版 */
-webkit-flex-direction: row;
-moz-flex-direction: row;
-ms-flex-direction: row;
-o-flex-direction: row;
flex-direction: row;
/* 09版 */
-webkit-box-pack: flex-start;
/* 12版 */
-webkit-justify-content: flex-start;
-moz-justify-content: flex-start;
-ms-justify-content: flex-start;
-o-justify-content: flex-start;
justify-content: flex-start;
/* 09版 */
-webkit-box-align: center;
/* 12版 */
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
-o-align-items: center;
align-items: center;
/* 09版 */
/*-webkit-box-lines: multiple;*/
/* 12版 */
-webkit-flex-wrap: nowrap;
-moz-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
-o-flex-wrap: nowrap;
flex-wrap: nowrap;
}

41
src/css/base/wrapper/flex.wrapper.center.css

@ -0,0 +1,41 @@
.bi-flex-wrapper-center-layout .flex-wrapper-center-layout-wrapper {
display: box;
/* OLD - Android 4.4- */
display: -webkit-box;
/* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box;
/* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox;
/* TWEENER - IE 10 */
display: -webkit-flex;
/* NEW - Chrome */
display: flex;
/* NEW, Spec - Opera 12.1, Firefox 20+ */
/* 09版 */
-webkit-box-orient: horizontal;
/* 12版 */
-webkit-flex-direction: row;
-moz-flex-direction: row;
-ms-flex-direction: row;
-o-flex-direction: row;
flex-direction: row;
/* 09版 */
-webkit-box-pack: center;
/* 12版 */
-webkit-justify-content: center;
-moz-justify-content: center;
-ms-justify-content: center;
-o-justify-content: center;
justify-content: center;
/* 09版 */
-webkit-box-align: center;
/* 12版 */
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
-o-align-items: center;
align-items: center;
min-width: 100%;
min-height: 100%;
float: left;
}

67
src/css/base/wrapper/flex.wrapper.horizontal.css

@ -0,0 +1,67 @@
.bi-flex-wrapper-horizontal-layout .flex-wrapper-horizontal-layout-wrapper {
display: box;
/* OLD - Android 4.4- */
display: -webkit-box;
/* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box;
/* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox;
/* TWEENER - IE 10 */
display: -webkit-flex;
/* NEW - Chrome */
display: flex;
/* NEW, Spec - Opera 12.1, Firefox 20+ */
/* 09版 */
-webkit-box-orient: horizontal;
/* 12版 */
-webkit-flex-direction: row;
-moz-flex-direction: row;
-ms-flex-direction: row;
-o-flex-direction: row;
flex-direction: row;
/* 09版 */
-webkit-box-pack: flex-start;
/* 12版 */
-webkit-justify-content: flex-start;
-moz-justify-content: flex-start;
-ms-justify-content: flex-start;
-o-justify-content: flex-start;
justify-content: flex-start;
/* 09版 */
-webkit-box-align: flex-start;
/* 12版 */
-webkit-align-items: flex-start;
-moz-align-items: flex-start;
-ms-align-items: flex-start;
-o-align-items: flex-start;
align-items: flex-start;
/* 09版 */
/*-webkit-box-lines: multiple;*/
/* 12版 */
-webkit-flex-wrap: nowrap;
-moz-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
-o-flex-wrap: nowrap;
flex-wrap: nowrap;
min-height: 100%;
}
.bi-flex-wrapper-horizontal-layout .flex-wrapper-horizontal-layout-wrapper.middle {
/* 09版 */
-webkit-box-align: center;
/* 12版 */
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
-o-align-items: center;
align-items: center;
}
.bi-flex-wrapper-horizontal-layout .flex-wrapper-horizontal-layout-wrapper.bottom {
/* 09版 */
-webkit-box-align: flex-end;
/* 12版 */
-webkit-align-items: flex-end;
-moz-align-items: flex-end;
-ms-align-items: flex-end;
-o-align-items: flex-end;
align-items: flex-end;
}

48
src/css/base/wrapper/flex.wrapper.vertical.center.css

@ -0,0 +1,48 @@
.bi-flex-wrapper-vertical-center .flex-wrapper-vertical-center-wrapper {
display: box;
/* OLD - Android 4.4- */
display: -webkit-box;
/* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box;
/* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox;
/* TWEENER - IE 10 */
display: -webkit-flex;
/* NEW - Chrome */
display: flex;
/* NEW, Spec - Opera 12.1, Firefox 20+ */
/* 09版 */
-webkit-box-orient: horizontal;
/* 12版 */
-webkit-flex-direction: row;
-moz-flex-direction: row;
-ms-flex-direction: row;
-o-flex-direction: row;
flex-direction: row;
/* 09版 */
-webkit-box-pack: flex-start;
/* 12版 */
-webkit-justify-content: flex-start;
-moz-justify-content: flex-start;
-ms-justify-content: flex-start;
-o-justify-content: flex-start;
justify-content: flex-start;
/* 09版 */
-webkit-box-align: center;
/* 12版 */
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
-o-align-items: center;
align-items: center;
/* 09版 */
/*-webkit-box-lines: multiple;*/
/* 12版 */
-webkit-flex-wrap: nowrap;
-moz-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
-o-flex-wrap: nowrap;
flex-wrap: nowrap;
min-height: 100%;
float: left;
}

24
src/less/base/base.less

@ -0,0 +1,24 @@
@import "../bibase";
@font-face {
font-family: 'bbr';
src: url('@{webUrl}/resources/fonts/iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('@{webUrl}/resources/fonts/iconfont.woff') format('woff'), /* chrome、firefox */
url('@{webUrl}/resources/fonts/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
url('@{webUrl}/resources/fonts/iconfont.svg#svgFontName') format('svg'); /* iOS 4.1- */
}
.b-font {
font-family: "bi";
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.bi-base-request-fail-mask{
& .mask-pane{
background: @color-bi-background-default;
.opacity(0.8);
}
}

13
src/less/base/chart/chart.combine.less

@ -0,0 +1,13 @@
@import "../../bibase";
.bi-combine-chart {
& .bi-linkage-list {
background-color: @background-color-default;
border: 1px solid @border-color-line;
z-index: @zIndex-tip;
& .bi-linkage-list-item {
&:hover {
background-color: @color-bi-background-gray;
}
}
}
}

16
src/less/base/combo/combo.bubble.less

@ -0,0 +1,16 @@
@import "../../bibase";
.bi-bubble-combo {
& .bubble-combo-triangle-left {
.solid-triangle-right(@color-bi-background-highlight);
}
& .bubble-combo-triangle-right {
.solid-triangle-left(@color-bi-background-highlight);
}
& .bubble-combo-triangle-top {
.solid-triangle-down(@color-bi-background-highlight);
}
& .bubble-combo-triangle-bottom {
.solid-triangle-up(@color-bi-background-highlight);
}
}

8
src/less/base/combo/popup.bubble.less

@ -0,0 +1,8 @@
@import "../../bibase";
.bi-bubble-popup-view {
& .bubble-popup-line {
background-color: @color-bi-background-highlight;
}
.box-shadow(0 0 10px, rgba(0, 0, 0, 0.2));
}

7
src/less/base/dom.less

@ -0,0 +1,7 @@
@import "../bibase";
@import "../lib/colors";
/************hing light*****************/
.bi-z-index-mask{
background-color: @color-bi-background-black;
.opacity(0.5);
}

30
src/less/base/logintimeout/login.timeout.less

@ -0,0 +1,30 @@
@import "../../bibase";
.bi-login-timeout-center{
& .input-wrapper{
border-bottom: 1px solid @color-bi-border-line;
& .login-input{
font-size: @font-size-16;
}
& .error-mask{
background: @color-bi-background-black;
.opacity(0.25);
color: @color-bi-text;
font-size: @font-size-16;
}
}
& .login-button{
background: @color-bi-background-highlight;
.border-radius(25px);
font-size: @font-size-22;
color: @color-bi-text;
&:hover{
.opacity(0.8);
}
}
}
.bi-login-timeout-south{
& .keep-state{
font-size: @font-size-14;
color: @color-bi-text-gray;
}
}

5
src/less/base/pager/pager.all.less → src/less/base/pager/pager.all.count.less

@ -1,15 +1,12 @@
@import "../../bibase"; @import "../../bibase";
.bi-all-pager { .bi-all-count-pager {
& .pager-editor { & .pager-editor {
background-color: @color-bi-background-default;
} }
& .all-pager-prev { & .all-pager-prev {
font-size: @font-size-16; font-size: @font-size-16;
background: @color-bi-background-gray;
} }
& .all-pager-next { & .all-pager-next {
font-size: @font-size-16; font-size: @font-size-16;
background: @color-bi-background-gray;
} }
} }

2
src/less/base/pager/pager.direction.less

@ -3,10 +3,8 @@
.bi-direction-pager { .bi-direction-pager {
& .direction-pager-prev { & .direction-pager-prev {
font-size: @font-size-16; font-size: @font-size-16;
background: @color-bi-background-gray;
} }
& .direction-pager-next { & .direction-pager-next {
font-size: @font-size-16; font-size: @font-size-16;
background: @color-bi-background-gray;
} }
} }

12
src/less/base/pager/pager.number.less

@ -1,12 +0,0 @@
@import "../../bibase";
.bi-number-pager {
& .number-pager-prev {
font-size: @font-size-16;
background: @color-bi-background-gray;
}
& .number-pager-next {
font-size: @font-size-16;
background: @color-bi-background-gray;
}
}

12
src/less/base/pager/pager.skip.less

@ -1,12 +0,0 @@
@import "../../bibase";
.bi-skip-pager {
& .skip-pager-prev {
font-size: @font-size-16;
background: @color-bi-background-gray;
}
& .skip-pager-next {
font-size: @font-size-16;
background: @color-bi-background-gray;
}
}

19
src/less/base/reqloading/loading.request.less

@ -1,13 +1,20 @@
@import "../../bibase"; @import "../../bibase";
.bi-request-loading{
& .mask-pane{ .bi-request-loading {
& .mask-pane {
background: @color-bi-background-default; background: @color-bi-background-default;
.opacity(0.8); .opacity(0.8);
} }
& .loading-comment{ & .loading-comment {
font-size: @font-size-14; font-size: 20px;
color: @color-bi-text-gray;
} }
& .load-fail-comment{ & .load-fail-comment {
font-size: @font-size-14; font-size: 20px;
color: @color-bi-text-gray;
}
& .load-timeout-warning {
font-size: @font-size-16;
color: @color-bi-text-warning;
} }
} }

4
src/less/base/single/editor/editor.state.less

@ -2,9 +2,7 @@
.bi-state-editor{ .bi-state-editor{
font-size: @font-size-12;
& .state-editor-infinite-text{ & .state-editor-infinite-text{
font-size: @font-size-12; color: @water-mark-color;
color: @font-color-normal;
} }
} }

4
src/less/base/single/editor/editor.state.simple.less

@ -2,9 +2,7 @@
.bi-simple-state-editor{ .bi-simple-state-editor{
font-size: @font-size-12;
& .state-editor-infinite-text{ & .state-editor-infinite-text{
font-size: @font-size-12; color: @water-mark-color;
color: @font-color-normal;
} }
} }

2
src/less/base/single/text.less

@ -2,5 +2,5 @@
.bi-text{ .bi-text{
.overflow-dot(); .overflow-dot();
word-break: break-word; word-break: break-all;
} }

8
src/less/base/table/table.grid.scrollbar.less

@ -7,15 +7,14 @@
transition-timing-function: ease; transition-timing-function: ease;
user-select: none; user-select: none;
background-color: rgba(0, 0, 0, 0.1); background-color: rgba(0, 0, 0, 0.1);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#19000000, endColorstr=#19000000); border-radius:5px;
border-radius: 5px;
} }
.scrollbar-layout-main-vertical { .scrollbar-layout-main-vertical {
bottom: 0; bottom: 0;
right: 0; right: 0;
top: 0; top: 0;
transition-property: background-color; transition-property: background-color ;
width: 10px; width: 10px;
} }
@ -28,9 +27,8 @@
bottom: 0; bottom: 0;
height: 10px; height: 10px;
left: 0; left: 0;
transition-property: background-color; transition-property: background-color ;
background-color: rgba(0, 0, 0, 0.1); background-color: rgba(0, 0, 0, 0.1);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#19000000, endColorstr=#19000000);
} }
/* Touching the scroll-track directly makes the scroll-track bolder */ /* Touching the scroll-track directly makes the scroll-track bolder */

1796
src/less/base/third/jquery.mCustomScrollbar.less

File diff suppressed because it is too large Load Diff

BIN
src/less/base/third/ztree/img/line_conn.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 B

BIN
src/less/base/third/ztree/img/loading.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

BIN
src/less/base/third/ztree/img/zTreeStandard.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
src/less/base/third/ztree/img/zTreeStandard.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

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

Loading…
Cancel
Save