Browse Source

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

es6
NieShichao 7 years ago
parent
commit
1b45050f0b
  1. 157
      .eslintrc
  2. 14
      Gruntfile.js
  3. 12
      bi/base.css
  4. 335
      bi/base.js
  5. 281
      bi/case.js
  6. 126
      bi/core.js
  7. 2538
      bi/widget.js
  8. 2
      demo/app.js
  9. 3004
      demo/config.js
  10. 132
      demo/js/base/button/demo.button.js
  11. 4
      demo/js/base/button/demo.icon_button.js
  12. 4
      demo/js/base/button/demo.image_button.js
  13. 6
      demo/js/base/button/demo.text_button.js
  14. 8
      demo/js/base/demo.canvas.js
  15. 2
      demo/js/base/demo.label.js
  16. 16
      demo/js/base/demo.message.js
  17. 2
      demo/js/base/demo.pager.js
  18. 2
      demo/js/base/demo.svg.js
  19. 2
      demo/js/base/editor/demo.code_editor.js
  20. 2
      demo/js/base/editor/demo.editor.js
  21. 10
      demo/js/base/editor/demo.formula_editor.js
  22. 2
      demo/js/base/editor/demo.multifile_editor.js
  23. 6
      demo/js/base/editor/demo.rich_editor.js
  24. 2
      demo/js/base/editor/demo.textarea_editor.js
  25. 6
      demo/js/base/table/demo.collection_table.js
  26. 6
      demo/js/base/table/demo.grid_table.js
  27. 6
      demo/js/base/table/demo.resizable_table.js
  28. 206
      demo/js/base/table/demo.table_view.js
  29. 14
      demo/js/base/tip/demo.bubble.js
  30. 2
      demo/js/base/tip/demo.title.js
  31. 42
      demo/js/base/tip/demo.toast.js
  32. 22
      demo/js/base/tree/demo.tree_view.js
  33. 6
      demo/js/case/combo/demo.bubble_combo.js
  34. 10
      demo/js/case/combo/demo.editor_icon_check_combo.js
  35. 10
      demo/js/case/combo/demo.icon_combo.js
  36. 35
      demo/js/case/combo/demo.icon_text_value_combo.js
  37. 4
      demo/js/case/combo/demo.static_combo.js
  38. 9
      demo/js/case/combo/demo.text_value_combo.js
  39. 4
      demo/js/case/combo/demo.text_value_down_list_combo.js
  40. 4
      demo/js/case/combo/demo.text_vlaue_check_combo.js
  41. 4
      demo/js/case/demo.calendar.js
  42. 6
      demo/js/case/demo.clipboard.js
  43. 2
      demo/js/case/demo.color_chooser.js
  44. 2
      demo/js/case/demo.color_chooser_popup.js
  45. 2
      demo/js/case/demo.complex_canvas.js
  46. 2
      demo/js/case/demo.segment.js
  47. 4
      demo/js/case/editor/demo.clear_editor.js
  48. 8
      demo/js/case/editor/demo.shelter_editor.js
  49. 6
      demo/js/case/editor/demo.sign_editor.js
  50. 6
      demo/js/case/editor/demo.sign_initial_editor.js
  51. 6
      demo/js/case/editor/demo.simple_state_editor.js
  52. 6
      demo/js/case/editor/demo.state_editor.js
  53. 2
      demo/js/case/item/demo.multi_select_item.js
  54. 2
      demo/js/case/item/demo.single_select_item.js
  55. 2
      demo/js/case/item/demo.single_select_radio_item.js
  56. 2
      demo/js/case/list/demo.lazy_loader.js
  57. 2
      demo/js/case/list/demo.select_list.js
  58. 2
      demo/js/case/pager/demo.all_count_pager.js
  59. 2
      demo/js/case/pager/demo.direction_pager.js
  60. 6
      demo/js/case/pane/demo.list_pane.js
  61. 2
      demo/js/case/pane/demo.multi_popup_view.js
  62. 2
      demo/js/case/pane/demo.panel.js
  63. 2
      demo/js/case/pane/demo.popup_panel.js
  64. 2
      demo/js/case/table/demo.adaptive_table.js
  65. 2
      demo/js/case/table/demo.layer_tree_table.js
  66. 2
      demo/js/case/table/demo.tree_table.js
  67. 2
      demo/js/case/tree/demo.branch_relation.js
  68. 6
      demo/js/case/tree/demo.branch_tree.js
  69. 2
      demo/js/case/tree/demo.handstand_branch_tree.js
  70. 4
      demo/js/case/tree/demo.level_tree.js
  71. 6
      demo/js/case/tree/demo.simple_tree.js
  72. 2
      demo/js/case/triggers/demo.editor_trigger.js
  73. 2
      demo/js/case/triggers/demo.icon_trigger.js
  74. 2
      demo/js/case/triggers/demo.select_text_trigger.js
  75. 2
      demo/js/case/triggers/demo.text_trigger.js
  76. 90
      demo/js/category/customATree/demo.multilayerselecttree.leveltree.js
  77. 6
      demo/js/category/largeTable/cell.js
  78. 4
      demo/js/category/largeTable/header.js
  79. 6
      demo/js/category/largeTable/largeTable.js
  80. 2
      demo/js/category/largeTable/sequenceheadercell.normal.js
  81. 4
      demo/js/category/largeTable/table.js
  82. 112
      demo/js/category/sortTree/demo.sortTree.js
  83. 2
      demo/js/center.js
  84. 48
      demo/js/chart/demo.axis_chart.js
  85. 4
      demo/js/config/case.js
  86. 4
      demo/js/config/core.js
  87. 35
      demo/js/config/fix.js
  88. 14
      demo/js/config/widget.js
  89. 18
      demo/js/core/abstract/combination/demo.combo.js
  90. 16
      demo/js/core/abstract/combination/demo.combo2.js
  91. 4
      demo/js/core/abstract/combination/demo.combo_group.js
  92. 2
      demo/js/core/abstract/combination/demo.expander.js
  93. 6
      demo/js/core/abstract/combination/demo.loader.js
  94. 4
      demo/js/core/abstract/combination/demo.navigation.js
  95. 4
      demo/js/core/abstract/combination/demo.sercher.js
  96. 2
      demo/js/core/abstract/combination/demo.switcher.js
  97. 6
      demo/js/core/abstract/combination/demo.tab.js
  98. 4
      demo/js/core/abstract/demo.button_group.js
  99. 2
      demo/js/core/abstract/demo.button_tree.js
  100. 4
      demo/js/core/abstract/demo.collection_view.js
  101. Some files were not shown because too many files have changed in this diff Show More

157
.eslintrc

@ -0,0 +1,157 @@
{
"extends": "eslint:recommended",
"rules": {
// 声明
"no-use-before-define": "error",
//禁止定义前使用
// 对象
"no-dupe-keys": "error",
// 禁止在对象字面量中出现重复的键
"quote-props": [
"error",
"as-needed"
],
// 对象属性只在需要的时候加引号
// 字符串
"quotes": [
"error",
"double",
{
"allowTemplateLiterals": true
}
],
// 字符串开头和结束使用双引号
"no-useless-concat": "error",
// 禁止没有必要的字符拼接
"no-useless-escape": "error",
// 禁用不必要的转义
// 函数
"no-dupe-args": "error",
// 禁止在 function 定义中出现重复的参数
"space-before-function-paren": "error",
// 函数括号前必须要有空格
// 变量
"no-undef": "error",
// 禁止使用未声明的变量
// 比较运算符 & 相等运算符
"eqeqeq": "error",
// 使用 === 和 !== 代替 == 和 !=
"no-unneeded-ternary": "error",
//禁止可以在有更简单的可替代的表达式时使用三元操作符
// 条件
"default-case": "error",
// 要求 Switch 语句中有 Default 分支
"no-else-return": "error",
// 如果 if 块中包含了一个 return 语句,else 块就成了多余的了。可以将其内容移至块外
// 代码块
"brace-style": [
"error",
"1tbs",
{
"allowSingleLine": true
}
],
// 代码块左括号紧跟上一行结束
"curly": [
"error",
"multi-line"
],
// if、else if、else、for、while强制使用大括号,但允许在单行中省略大括号
// 注释
"spaced-comment": "error",
// 注释前有空格
// 空白
"indent": [
"error",
4,
{
"SwitchCase": 1
}
],
// 缩进控制4空格
"no-mixed-spaces-and-tabs": "error",
// 禁止使用 空格 和 tab 混合缩进
"space-before-blocks": [
"error",
"always"
],
// 语句块之前的需要有空格
"space-infix-ops": ["error", {
"int32Hint": false
}], // 要求中缀操作符周围有空格,设置 int32Hint 选项为 true (默认 false) 允许 a|0 不带空格
"no-trailing-spaces": ["error", {
"skipBlankLines": true
}], // 禁用行尾空格
"key-spacing": ["error", {
"afterColon": true
}], // 要求在对象字面量的冒号和值之间存在至少有一个空格
// 逗号
"comma-style": "error",
// 逗号必须放在行末
"comma-dangle": [
"error",
"never"
],
// 多行对象字面量中要求不要拖尾逗号
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
//在变量声明、数组字面量、对象字面量、函数参数 和 序列中禁止在逗号前使用空格,要求在逗号后使用一个或多个空格
// 分号
"semi": "error",
//不得省略语句结束的分号
"semi-spacing": [
"error",
{
"before": false,
"after": true
}
],
//禁止分号周围的空格
"no-extra-semi": "error",
// 禁用不必要的分号
// 类型转换
"no-extra-boolean-cast": "error",
// 禁止不必要的布尔类型转换
// 其他最佳实践或规范
"no-unexpected-multiline": "error",
// 禁止使用令人困惑的多行表达式
"no-unreachable": "error",
// 禁止在 return、throw、continue 和 break 语句后出现不可达代码
"valid-typeof": "error",
// 强制 typeof 表达式与有效的字符串进行比较
"no-new-wrappers": "error"
// 禁止通过 new 操作符使用 String、Number 和 Boolean
},
"globals": {
"window": true,
"$": true,
"WebUI": true,
"BI": true,
"BICst": true,
"Data": true,
"Fix": true,
"module": true
}
}

14
Gruntfile.js

@ -90,6 +90,10 @@ module.exports = function (grunt) {
src: ['src/css/core/**/*.css', 'src/css/theme/**/*.css'], src: ['src/css/core/**/*.css', 'src/css/theme/**/*.css'],
dest: 'dist/core.css' dest: 'dist/core.css'
}, },
coreWithoutNormalizeCss: {
src: ['src/css/core/**/*.css', 'src/css/theme/**/*.css', '!src/css/core/normalize.css','!src/css/core/normalize2.css'],
dest: 'dist/core_without_normalize.css'
},
baseCss: { baseCss: {
src: ['src/css/base/**/*.css'], src: ['src/css/base/**/*.css'],
dest: 'dist/base.css' dest: 'dist/base.css'
@ -103,11 +107,21 @@ module.exports = function (grunt) {
dest: 'dist/resource.css' dest: 'dist/resource.css'
}, },
publicBundleJs: {
src: ['public/js/**/*.js', 'public/js/index.js'],
dest: 'public/bundle.js'
},
bundleJs: { bundleJs: {
src: ['dist/core.js', 'dist/base.js', 'dist/case.js', 'dist/widget.js', 'dist/router.js', 'public/js/**/*.js', 'public/js/index.js'], src: ['dist/core.js', 'dist/base.js', 'dist/case.js', 'dist/widget.js', 'dist/router.js', 'public/js/**/*.js', 'public/js/index.js'],
dest: 'dist/bundle.js' dest: 'dist/bundle.js'
}, },
publicBundleCss: {
src: ['public/css/app.css', 'public/css/**/*.css'],
dest: 'public/bundle.css'
},
bundleCss: { bundleCss: {
src: ['dist/core.css', 'dist/base.css', 'dist/widget.css', 'public/css/app.css', 'public/css/**/*.css'], src: ['dist/core.css', 'dist/base.css', 'dist/widget.css', 'public/css/app.css', 'public/css/**/*.css'],
dest: 'dist/bundle.css' dest: 'dist/bundle.css'

12
bi/base.css

@ -2,9 +2,9 @@
-webkit-border-radius: 2px; -webkit-border-radius: 2px;
-moz-border-radius: 2px; -moz-border-radius: 2px;
border-radius: 2px; border-radius: 2px;
box-shadow: 0px 0px 2px 1px #232e40 inset; box-shadow: 0px 0px 2px 1px #d4dadd inset;
-webkit-box-shadow: 0px 0px 2px 1px #232e40 inset; -webkit-box-shadow: 0px 0px 2px 1px #d4dadd inset;
-moz-box-shadow: 0px 0px 2px 1px #232e40 inset; -moz-box-shadow: 0px 0px 2px 1px #d4dadd inset;
} }
.bi-color-picker-button .color-picker-button-mask { .bi-color-picker-button .color-picker-button-mask {
border: 1px solid #1a1a1a; border: 1px solid #1a1a1a;
@ -16,9 +16,9 @@
-webkit-border-radius: 2px; -webkit-border-radius: 2px;
-moz-border-radius: 2px; -moz-border-radius: 2px;
border-radius: 2px; border-radius: 2px;
box-shadow: 0px 0px 2px 1px #232e40 inset; box-shadow: 0px 0px 2px 1px #d4dadd inset;
-webkit-box-shadow: 0px 0px 2px 1px #232e40 inset; -webkit-box-shadow: 0px 0px 2px 1px #d4dadd inset;
-moz-box-shadow: 0px 0px 2px 1px #232e40 inset; -moz-box-shadow: 0px 0px 2px 1px #d4dadd inset;
} }
.farbtastic { .farbtastic {
position: relative; position: relative;

335
bi/base.js

@ -581,7 +581,7 @@ BI.Text = BI.inherit(BI.Single, {
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;
this.text.element.html((text + "").replaceAll(" ", " ")); this.text.element.html(BI.Func.formatSpecialCharInHtml(text));
} }
}); });
@ -2023,13 +2023,13 @@ BI.shortcut("bi.tree_view", BI.TreeView);/**
*/ */
BI.AsyncTree = BI.inherit(BI.TreeView, { BI.AsyncTree = BI.inherit(BI.TreeView, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.AsyncTree.superclass._defaultConfig.apply(this, arguments), {}) return BI.extend(BI.AsyncTree.superclass._defaultConfig.apply(this, arguments), {});
}, },
_init: function () { _init: function () {
BI.AsyncTree.superclass._init.apply(this, arguments); BI.AsyncTree.superclass._init.apply(this, arguments);
}, },
//配置属性 // 配置属性
_configSetting: function () { _configSetting: function () {
var paras = this.options.paras; var paras = this.options.paras;
var self = this; var self = this;
@ -2066,23 +2066,23 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
} }
}; };
function onClick(event, treeId, treeNode) { function onClick (event, treeId, treeNode) {
var zTree = $.fn.zTree.getZTreeObj(treeId); var zTree = $.fn.zTree.getZTreeObj(treeId);
zTree.checkNode(treeNode, !treeNode.checked, true, true); zTree.checkNode(treeNode, !treeNode.checked, true, true);
} }
function beforeCheck(treeId, treeNode) { function beforeCheck (treeId, treeNode) {
treeNode.halfCheck = false; treeNode.halfCheck = false;
if (treeNode.checked === true) { if (treeNode.checked === true) {
//将展开的节点halfCheck设为false,解决展开节点存在halfCheck=true的情况 guy // 将展开的节点halfCheck设为false,解决展开节点存在halfCheck=true的情况 guy
//所有的半选状态都需要取消halfCheck=true的情况 // 所有的半选状态都需要取消halfCheck=true的情况
function track(children) { function track (children) {
BI.each(children, function (i, ch) { BI.each(children, function (i, ch) {
if (ch.halfCheck === true) { if (ch.halfCheck === true) {
ch.halfCheck = false; ch.halfCheck = false;
track(ch.children); track(ch.children);
} }
}) });
} }
track(treeNode.children); track(treeNode.children);
@ -2091,23 +2091,23 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
var nodes = treeObj.getSelectedNodes(); var nodes = treeObj.getSelectedNodes();
BI.each(nodes, function (index, node) { BI.each(nodes, function (index, node) {
node.halfCheck = false; node.halfCheck = false;
}) });
} }
} }
function beforeExpand(treeId, treeNode) { function beforeExpand (treeId, treeNode) {
self._beforeExpandNode(treeId, treeNode); self._beforeExpandNode(treeId, treeNode);
} }
function onCheck(event, treeId, treeNode) { function onCheck (event, treeId, treeNode) {
self._selectTreeNode(treeId, treeNode); self._selectTreeNode(treeId, treeNode);
} }
function onExpand(event, treeId, treeNode) { function onExpand (event, treeId, treeNode) {
treeNode.halfCheck = false; treeNode.halfCheck = false;
} }
function onCollapse(event, treeId, treeNode) { function onCollapse (event, treeId, treeNode) {
treeNode.halfCheck = false; treeNode.halfCheck = false;
} }
@ -2118,7 +2118,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
var self = this, o = this.options; var self = this, o = this.options;
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode)); var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode); var name = this._getNodeValue(treeNode);
// var values = parentValues.concat([name]); // var values = parentValues.concat([name]);
if (treeNode.checked === true) { if (treeNode.checked === true) {
} else { } else {
var tNode = treeNode; var tNode = treeNode;
@ -2139,7 +2139,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
}, },
//展开节点 // 展开节点
_beforeExpandNode: function (treeId, treeNode) { _beforeExpandNode: function (treeId, treeNode) {
var self = this, o = this.options; var self = this, o = this.options;
var parentValues = treeNode.parentValues || self._getParentValues(treeNode); var parentValues = treeNode.parentValues || self._getParentValues(treeNode);
@ -2157,7 +2157,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
}; };
var times = 1; var times = 1;
function callback(nodes, hasNext) { function callback (nodes, hasNext) {
self.nodes.addNodes(treeNode, nodes); self.nodes.addNodes(treeNode, nodes);
if (hasNext === true) { if (hasNext === true) {
@ -2170,7 +2170,9 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
} }
if (!treeNode.children) { if (!treeNode.children) {
o.itemsCreator(op, complete) setTimeout(function () {
o.itemsCreator(op, complete);
}, 17);
} }
}, },
@ -2179,7 +2181,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
var map = {}; var map = {};
track([], valueA, valueB); track([], valueA, valueB);
track([], valueB, valueA); track([], valueB, valueA);
function track(parent, node, compare) { function track (parent, node, compare) {
BI.each(node, function (n, item) { BI.each(node, function (n, item) {
if (BI.isNull(compare[n])) { if (BI.isNull(compare[n])) {
self._addTreeNode(map, parent, n, item); self._addTreeNode(map, parent, n, item);
@ -2188,7 +2190,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
} else { } else {
track(parent.concat([n]), node[n], compare[n]); track(parent.concat([n]), node[n], compare[n]);
} }
}) });
} }
return map; return map;
@ -2212,7 +2214,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
return this._join(checkedValues, this.options.paras.selectedValues); return this._join(checkedValues, this.options.paras.selectedValues);
}, },
//生成树方法 // 生成树方法
stroke: function (config) { stroke: function (config) {
delete this.options.keyword; delete this.options.keyword;
BI.extend(this.options.paras, config); BI.extend(this.options.paras, config);
@ -3035,18 +3037,20 @@ BI.Combo = BI.inherit(BI.Widget, {
} }
}); });
self.element.on("mouseleave." + self.getName(), function (e) { self.element.on("mouseleave." + self.getName(), function (e) {
self.popupView.element.on("mouseenter." + self.getName(), function (e) { if (self.popupView) {
enterPopup = true; self.popupView.element.on("mouseenter." + self.getName(), function (e) {
self.popupView.element.on("mouseleave." + self.getName(), function (e) { enterPopup = true;
hide(); self.popupView.element.on("mouseleave." + self.getName(), function (e) {
hide();
});
self.popupView.element.off("mouseenter." + self.getName());
}); });
self.popupView.element.off("mouseenter." + self.getName()); BI.defer(function () {
}); if (!enterPopup) {
BI.defer(function () { hide();
if (!enterPopup) { }
hide(); }, 50);
} }
}, 50);
}); });
break; break;
case "click": case "click":
@ -3092,18 +3096,20 @@ BI.Combo = BI.inherit(BI.Widget, {
st(e); st(e);
}); });
self.element.on("mouseleave." + self.getName(), function (e) { self.element.on("mouseleave." + self.getName(), function (e) {
self.popupView.element.on("mouseenter." + self.getName(), function (e) { if (self.popupView) {
enterPopup = true; self.popupView.element.on("mouseenter." + self.getName(), function (e) {
self.popupView.element.on("mouseleave." + self.getName(), function (e) { enterPopup = true;
hide(); self.popupView.element.on("mouseleave." + self.getName(), function (e) {
hide();
});
self.popupView.element.off("mouseenter." + self.getName());
}); });
self.popupView.element.off("mouseenter." + self.getName()); BI.defer(function () {
}); if (!enterPopup) {
BI.defer(function () { hide();
if (!enterPopup) { }
hide(); }, 50);
} }
}, 50);
}); });
break; break;
} }
@ -14357,7 +14363,9 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
textWrapping: true, textWrapping: true,
lineWrapping: true, lineWrapping: true,
lineNumbers: false, lineNumbers: false,
mode: 'formula' mode: 'formula',
//解决插入字段由括号或其他特殊字符包围时分裂的bug
specialChars: /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/
}); });
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height"); o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height");
this.editor.on("change", function (cm, change) { this.editor.on("change", function (cm, change) {
@ -14448,7 +14456,8 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
*/ */
insertField: function (field) { insertField: function (field) {
var from = this.editor.getCursor(); var from = this.editor.getCursor();
this.editor.replaceSelection(field); //解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下
this.editor.replaceSelection('\u200b' + field + '\u200b');
var to = this.editor.getCursor(); var to = this.editor.getCursor();
this.editor.markText(from, to, {className: 'fieldName', atomic: true, startStyle: "start", endStyle: "end"}); this.editor.markText(from, to, {className: 'fieldName', atomic: true, startStyle: "start", endStyle: "end"});
this.editor.replaceSelection(" "); this.editor.replaceSelection(" ");
@ -14499,7 +14508,8 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
_.forEach(line.markedSpans, function (i, ms) { _.forEach(line.markedSpans, function (i, ms) {
switch (i.marker.className) { switch (i.marker.className) {
case "fieldName": case "fieldName":
var dId = fieldMap[value.substr(i.from, i.to - i.from)]; //因为插入字段的时候首尾加了不可见字符,所以首尾缩进一个字符
var dId = fieldMap[value.substr(i.from + 1, i.to - i.from - 2)];
if (!fields.contains(dId)) { if (!fields.contains(dId)) {
fields.push(dId); fields.push(dId);
} }
@ -14538,8 +14548,10 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
switch (i.marker.className) { switch (i.marker.className) {
case "fieldName": case "fieldName":
var fieldNameLength = i.to - i.from; var fieldNameLength = i.to - i.from;
var fieldId = fieldMap[value.substr(i.from + num, fieldNameLength)]; var start = i.from + num + 1;
value = value.substr(0, i.from + num) + "$\{" + fieldMap[value.substr(i.from + num, fieldNameLength)] + "\}" + value.substr(i.to + num, value.length); var end = fieldNameLength - 2;
var fieldId = fieldMap[value.substr(start, end)];
value = value.substr(0, i.from + num) + "$\{" + fieldId + "\}" + value.substr(i.to + num, value.length);
num += fieldId.length - fieldNameLength + 3; num += fieldId.length - fieldNameLength + 3;
break; break;
} }
@ -15669,7 +15681,7 @@ BI.ListView = BI.inherit(BI.Widget, {
if (items && this.options.items !== items) { if (items && this.options.items !== items) {
this.restore(); this.restore();
} }
this._populate(); this._populate(items);
}, },
destroyed: function () { destroyed: function () {
@ -16181,10 +16193,6 @@ BI.shortcut("bi.a", BI.A);/**
* @type {*|void|Object} * @type {*|void|Object}
*/ */
BI.LoadingBar = BI.inherit(BI.Single, { BI.LoadingBar = BI.inherit(BI.Single, {
consts: {
loadedText: BI.i18nText("BI-Load_More"),
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);
return BI.extend( conf, { return BI.extend( conf, {
@ -16199,7 +16207,7 @@ BI.LoadingBar = BI.inherit(BI.Single, {
this.loaded = BI.createWidget({ this.loaded = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "loading-text bi-list-item-simple", cls: "loading-text bi-list-item-simple",
text: this.consts.loadedText, text: BI.i18nText("BI-Load_More"),
width: 120, width: 120,
handler: this.options.handler handler: this.options.handler
}) })
@ -16237,7 +16245,7 @@ BI.LoadingBar = BI.inherit(BI.Single, {
_reset: function(){ _reset: function(){
this.visible(); this.visible();
this.loaded.setText(this.consts.loadedText); this.loaded.setText(BI.i18nText("BI-Load_More"));
this.loaded.enable(); this.loaded.enable();
}, },
@ -16248,7 +16256,7 @@ BI.LoadingBar = BI.inherit(BI.Single, {
setEnd: function(){ setEnd: function(){
this.setLoaded(); this.setLoaded();
this.loaded.setText(this.consts.endText); this.loaded.setText(BI.i18nText("BI-No_More_Data"));
this.loaded.disable(); this.loaded.disable();
}, },
@ -18809,7 +18817,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
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;
} }
;
return false; return false;
} }
}; };
@ -18818,7 +18826,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
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=\"", BI.cjkEncode(file.fileName), "\"", CRLF,
"Content-Type: application/octet-stream", CRLF, "Content-Type: application/octet-stream", CRLF,
CRLF, CRLF,
file.getAsBinary(), CRLF, file.getAsBinary(), CRLF,
@ -18844,15 +18852,15 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
return; return;
} }
for (var for (var
xhr = new XMLHttpRequest, xhr = new XMLHttpRequest,
upload = xhr.upload || { upload = xhr.upload || {
addEventListener: function (event, callback) { addEventListener: function (event, callback) {
this["on" + event] = callback this["on" + event] = callback;
} }
}, },
i = 0; i = 0;
i < length; i < length;
i++ i++
) { ) {
upload.addEventListener( upload.addEventListener(
split[i].substring(2), split[i].substring(2),
@ -18887,7 +18895,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
}, },
false false
); );
xhr.open("post", handler.url + '&filename=' + window.encodeURIComponent(handler.file.fileName), true); xhr.open("post", handler.url + "&filename=" + window.encodeURIComponent(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 () {
@ -18907,8 +18915,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
switch (xhr.readyState) { switch (xhr.readyState) {
case 2: case 2:
case 3: case 3:
if (rpe.total <= rpe.loaded) if (rpe.total <= rpe.loaded) {rpe.loaded = rpe.total;}
rpe.loaded = rpe.total;
upload.onprogress(rpe); upload.onprogress(rpe);
break; break;
case 4: case 4:
@ -18920,7 +18927,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
upload["onload"]({}); upload["onload"]({});
var attachO = BI.jsonDecode(xhr.responseText); var attachO = BI.jsonDecode(xhr.responseText);
attachO.filename = handler.file.fileName; attachO.filename = 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";
} }
handler.attach_array.push(attachO); handler.attach_array.push(attachO);
@ -18936,7 +18943,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
switch (xhr.readyState) { switch (xhr.readyState) {
case 4: case 4:
var attachO = BI.jsonDecode(xhr.responseText); var attachO = BI.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 = handler.file.fileName; attachO.filename = handler.file.fileName;
@ -18948,7 +18955,8 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
} }
break; break;
} }
} };
upload.onloadstart();
} }
var boundary = "AjaxUploadBoundary" + (new Date).getTime(); var boundary = "AjaxUploadBoundary" + (new Date).getTime();
xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + boundary); xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + boundary);
@ -18956,8 +18964,8 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
xhr[xhr.sendAsBinary ? "sendAsBinary" : "send"](multipart(boundary, handler.name, handler.file)); xhr[xhr.sendAsBinary ? "sendAsBinary" : "send"](multipart(boundary, handler.name, handler.file));
} else { } else {
xhr.setRequestHeader("Content-Type", "multipart/form-data"); xhr.setRequestHeader("Content-Type", "multipart/form-data");
// xhr.setRequestHeader("X-Name", handler.name); // xhr.setRequestHeader("X-Name", handler.name);
// xhr.setRequestHeader("X-File-Name", handler.file.fileName); // xhr.setRequestHeader("X-File-Name", handler.file.fileName);
var form = new FormData(); var form = new FormData();
form.append("FileData", handler.file); form.append("FileData", handler.file);
xhr.send(form); xhr.send(form);
@ -18971,10 +18979,8 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"), var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"),
rpe = { rpe = {
loaded: 1, total: 100, simulation: true, interval: setInterval(function () { loaded: 1, total: 100, simulation: true, interval: setInterval(function () {
if (rpe.loaded < rpe.total) if (rpe.loaded < rpe.total) {++rpe.loaded;}
++rpe.loaded; if (isFunction(handler.onprogress)) {handler.onprogress(rpe, {});}
if (isFunction(handler.onprogress))
handler.onprogress(rpe, {});
}, 100) }, 100)
}, },
onload = function () { onload = function () {
@ -18982,15 +18988,15 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
form.parentNode.removeChild(form); form.parentNode.removeChild(form);
form = null; form = null;
clearInterval(rpe.interval); clearInterval(rpe.interval);
//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 = BI.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 = BI.cjkDecode(handler.file.fileName);
if (handler.maxlength == 1) { if (handler.maxlength == 1) {
handler.attach_array[0] = attachO; handler.attach_array[0] = attachO;
@ -18998,18 +19004,16 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
handler.attach_array.push(attachO); handler.attach_array.push(attachO);
} }
} catch (e) { } catch (e) {
if (isFunction(handler.onerror)) if (isFunction(handler.onerror)) {handler.onerror(rpe, event || window.event);}
handler.onerror(rpe, event || window.event);
} }
if (isFunction(handler.onload)) if (isFunction(handler.onload)) {handler.onload(rpe, {responseText: responseText});}
handler.onload(rpe, {responseText: responseText});
}, },
target = ["AjaxUpload", (new Date).getTime(), String(Math.random()).substring(2)].join("_"); target = ["AjaxUpload", (new Date).getTime(), String(Math.random()).substring(2)].join("_");
try { // IE < 8 does not accept enctype attribute ... try { // IE < 8 does not accept enctype attribute ...
var form = document.createElement('<form enctype="multipart/form-data"></form>'), var form = document.createElement("<form enctype=\"multipart/form-data\"></form>"),
iframe = handler.iframe || (handler.iframe = document.createElement('<iframe id="' + target + '" name="' + target + '" src="' + url + '"></iframe>')); iframe = handler.iframe || (handler.iframe = document.createElement("<iframe id=\"" + target + "\" name=\"" + target + "\" src=\"" + url + "\"></iframe>"));
} catch (e) { } catch (e) {
var form = document.createElement('form'), var form = document.createElement("form"),
iframe = handler.iframe || (handler.iframe = document.createElement("iframe")); iframe = handler.iframe || (handler.iframe = document.createElement("iframe"));
form.setAttribute("enctype", "multipart/form-data"); form.setAttribute("enctype", "multipart/form-data");
iframe.setAttribute("name", iframe.id = target); iframe.setAttribute("name", iframe.id = target);
@ -19027,9 +19031,8 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
if (/loaded|complete/i.test(iframe.readyState)) { if (/loaded|complete/i.test(iframe.readyState)) {
onload(); onload();
//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;
} }
@ -19056,7 +19059,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
appendChild(form); appendChild(form);
form.submit(); form.submit();
} }
;
return handler; return handler;
}; };
} }
@ -19132,9 +19135,9 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
name: "", name: "",
url: "", url: "",
multiple: true, multiple: true,
accept: "", /**'*.jpg; *.zip'**/ accept: "", /** '*.jpg; *.zip'**/
maxSize: -1 //1024 * 1024 maxSize: -1 // 1024 * 1024
}) });
}, },
_init: function () { _init: function () {
@ -19144,77 +19147,78 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
this.element.attr("multiple", "multiple"); this.element.attr("multiple", "multiple");
} }
this.element.attr("name", o.name || this.getName()); this.element.attr("name", o.name || this.getName());
},
BI.nextTick(function () { mounted: function () {
// create the noswfupload.wrap Object var self = this, o = this.options;
// wrap.maxSize 文件大小限制 // create the noswfupload.wrap Object
// wrap.maxlength 文件个数限制 // wrap.maxSize 文件大小限制
var _wrap = self.wrap = self._wrap(self.element[0], o.maxSize); // wrap.maxlength 文件个数限制
// fileType could contain whatever text but filter checks *.{extension} var _wrap = this.wrap = this._wrap(this.element[0], o.maxSize);
// if present // fileType could contain whatever text but filter checks *.{extension}
// if present
// handlers
// handlers
_wrap.onloadstart = function (rpe, xhr) {
//BI.Msg.toast("loadstart"); _wrap.onloadstart = function (rpe, xhr) {
self.fireEvent(BI.File.EVENT_UPLOADSTART); // BI.Msg.toast("loadstart");
}; self.fireEvent(BI.File.EVENT_UPLOADSTART, arguments);
};
_wrap.onprogress = function (rpe, xhr) {
//BI.Msg.toast("onprogress");
// percent for each bar
// fileSize is -1 only if browser does not support file info access _wrap.onprogress = function (rpe, xhr) {
// this if splits recent browsers from others // BI.Msg.toast("onprogress");
if (this.file.fileSize !== -1) { // percent for each bar
// simulation property indicates when the progress event is fake
if (rpe.simulation) {
} else { // fileSize is -1 only if browser does not support file info access
// this if splits recent browsers from others
if (this.file.fileSize !== -1) {
// simulation property indicates when the progress event is fake
if (rpe.simulation) {
}
} else { } else {
// if fileSIze is -1 browser is using an iframe because it does
// not support
// files sent via Ajax (XMLHttpRequest)
// We can still show some information
}
self.fireEvent(BI.File.EVENT_PROGRESS, {
file: this.file,
total: rpe.total,
loaded: rpe.loaded,
simulation: rpe.simulation
});
};
// generated if there is something wrong during upload }
_wrap.onerror = function () { } else {
// just inform the user something was wrong // if fileSIze is -1 browser is using an iframe because it does
self.fireEvent(BI.File.EVENT_ERROR); // not support
}; // files sent via Ajax (XMLHttpRequest)
// We can still show some information
}
self.fireEvent(BI.File.EVENT_PROGRESS, {
file: this.file,
total: rpe.total,
loaded: rpe.loaded,
simulation: rpe.simulation
});
};
// generated when every file has been sent (one or more, it does not // generated if there is something wrong during upload
// matter) _wrap.onerror = function () {
_wrap.onload = function (rpe, xhr) { // just inform the user something was wrong
var self_ = this; self.fireEvent(BI.File.EVENT_ERROR);
// just show everything is fine ... };
// ... and after a second reset the component
setTimeout(function () {
self_.clean(); // remove files from list
self_.hide(); // hide progress bars and enable input file
//BI.Msg.toast("onload"); // generated when every file has been sent (one or more, it does not
self.fireEvent(BI.File.EVENT_UPLOADED); // matter)
// enable again the submit button/element _wrap.onload = function (rpe, xhr) {
}, 1000); var self_ = this;
}; // just show everything is fine ...
_wrap.url = o.url ? o.url : BI.servletURL // ... and after a second reset the component
+ '?op=fr_attach&cmd=ah_upload'; setTimeout(function () {
_wrap.fileType = o.accept; //文件类型限制 self_.clean(); // remove files from list
_wrap.attach_array = []; self_.hide(); // hide progress bars and enable input file
_wrap.attach_names = [];
_wrap.attachNum = 0; // BI.Msg.toast("onload");
}); self.fireEvent(BI.File.EVENT_UPLOADED);
// enable again the submit button/element
}, 1000);
};
_wrap.url = o.url ? o.url : BI.servletURL
+ "?op=fr_attach&cmd=ah_upload";
_wrap.fileType = o.accept; // 文件类型限制
_wrap.attach_array = [];
_wrap.attach_names = [];
_wrap.attachNum = 0;
}, },
_events: function (wrap) { _events: function (wrap) {
@ -19228,14 +19232,14 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
ext = -1 !== value.indexOf(".") ? value.split(".").pop().toLowerCase() : "unknown", ext = -1 !== value.indexOf(".") ? value.split(".").pop().toLowerCase() : "unknown",
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.i18nText("BI-Upload_File_Type_Error")); 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.i18nText("BI-Upload_File_Size_Error")); 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,
@ -19243,7 +19247,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
}); });
} else { } else {
wrap.files.unshift(item); wrap.files.unshift(item);
//BI.Msg.toast(value); // BI.Msg.toast(value);
self.fireEvent(BI.File.EVENT_CHANGE, { self.fireEvent(BI.File.EVENT_CHANGE, {
file: item file: item
}); });
@ -19275,7 +19279,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
disabled: false // internal use, checks input file state disabled: false // internal use, checks input file state
}, },
name: input.name, // name to send for each file ($_FILES[{name}] in the server) name: input.name, // name to send for each file ($_FILES[{name}] in the server)
// maxSize is the maximum amount of bytes for each file // maxSize is the maximum amount of bytes for each file
maxSize: o.maxSize ? o.maxSize >> 0 : -1, maxSize: o.maxSize ? o.maxSize >> 0 : -1,
files: [], // file list files: [], // file list
@ -30511,6 +30515,11 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0); this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.bottomRightGrid.setEstimatedRowSize(o.rowSize); this.bottomRightGrid.setEstimatedRowSize(o.rowSize);
this.topLeftGrid.setColumnCount(freezeColLength);
this.topRightGrid.setColumnCount(o.columnSize.length - freezeColLength);
this.bottomLeftGrid.setColumnCount(freezeColLength);
this.bottomRightGrid.setColumnCount(o.columnSize.length - freezeColLength);
var items = this.contextLayout.attr("items"); var items = this.contextLayout.attr("items");
items[1].left = regionSize; items[1].left = regionSize;
items[2].top = this._getFreezeHeaderHeight(); items[2].top = this._getFreezeHeaderHeight();

281
bi/case.js

@ -344,9 +344,6 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
type: "bi.radio" type: "bi.radio"
}); });
this.radio.on(BI.Controller.EVENT_CHANGE, function (type) { this.radio.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
self.setSelected(!self.isSelected());
}
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
@ -1643,7 +1640,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
}, },
_dateCreator: function (Y, M, D) { _dateCreator: function (Y, M, D) {
var self = this, o = this.options, log = {}, De = new Date(); var self = this, o = this.options, log = {}, De = Date.getDate();
var mins = o.min.match(/\d+/g); var mins = o.min.match(/\d+/g);
var maxs = o.max.match(/\d+/g); var maxs = o.max.match(/\d+/g);
Y < (mins[0] | 0) && (Y = (mins[0] | 0)); Y < (mins[0] | 0) && (Y = (mins[0] | 0));
@ -1753,7 +1750,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
isFrontDate: function () { isFrontDate: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
var Y = o.year, M = o.month, De = new Date(), day = De.getDay(); var Y = o.year, M = o.month, De = Date.getDate(), day = De.getDay();
Y = Y | 0; Y = Y | 0;
De.setFullYear(Y, M, 1); De.setFullYear(Y, M, 1);
var newDate = De.getOffsetDate(-1 * (day + 1)); var newDate = De.getOffsetDate(-1 * (day + 1));
@ -1762,7 +1759,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
isFinalDate: function () { isFinalDate: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
var Y = o.year, M = o.month, De = new Date(), day = De.getDay(); var Y = o.year, M = o.month, De = Date.getDate(), day = De.getDay();
Y = Y | 0; Y = Y | 0;
De.setFullYear(Y, M, 1); De.setFullYear(Y, M, 1);
var newDate = De.getOffsetDate(42 - day); var newDate = De.getOffsetDate(42 - day);
@ -1785,14 +1782,14 @@ BI.Calendar = BI.inherit(BI.Widget, {
BI.extend(BI.Calendar, { BI.extend(BI.Calendar, {
getPageByDateJSON: function (json) { getPageByDateJSON: function (json) {
var year = new Date().getFullYear(); var year = Date.getDate().getFullYear();
var month = new Date().getMonth(); var month = Date.getDate().getMonth();
var page = (json.year - year) * 12; var page = (json.year - year) * 12;
page += json.month - month; page += json.month - month;
return page; return page;
}, },
getDateJSONByPage: function(v){ getDateJSONByPage: function(v){
var months = new Date().getMonth(); var months = Date.getDate().getMonth();
var page = v; var page = v;
//对当前page做偏移,使到当前年初 //对当前page做偏移,使到当前年初
@ -1804,7 +1801,7 @@ BI.extend(BI.Calendar, {
} }
var month = page >= 0 ? (page % 12) : ((12 + page % 12) % 12); var month = page >= 0 ? (page % 12) : ((12 + page % 12) % 12);
return { return {
year: new Date().getFullYear() + year, year: Date.getDate().getFullYear() + year,
month: month month: month
} }
} }
@ -1850,7 +1847,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.YearCalendar.superclass._init.apply(this, arguments); BI.YearCalendar.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.currentYear = new Date().getFullYear(); this.currentYear = Date.getDate().getFullYear();
var years = this._yearCreator(o.year || this.currentYear); var years = this._yearCreator(o.year || this.currentYear);
//纵向排列年 //纵向排列年
@ -1937,7 +1934,7 @@ BI.extend(BI.YearCalendar, {
//获取显示的第一年 //获取显示的第一年
getStartYear: function (year) { getStartYear: function (year) {
var cur = new Date().getFullYear(); var cur = Date.getDate().getFullYear();
return year - ((year - cur + 3) % BI.YearCalendar.INTERVAL + 12) % BI.YearCalendar.INTERVAL; return year - ((year - cur + 3) % BI.YearCalendar.INTERVAL + 12) % BI.YearCalendar.INTERVAL;
}, },
@ -1946,7 +1943,7 @@ BI.extend(BI.YearCalendar, {
}, },
getPageByYear: function (year) { getPageByYear: function (year) {
var cur = new Date().getFullYear(); var cur = Date.getDate().getFullYear();
year = BI.YearCalendar.getStartYear(year); year = BI.YearCalendar.getStartYear(year);
return (year - cur + 3) / BI.YearCalendar.INTERVAL; return (year - cur + 3) / BI.YearCalendar.INTERVAL;
} }
@ -3607,8 +3604,7 @@ BI.CustomColorChooser = BI.inherit(BI.Widget, {
BI.CustomColorChooser.superclass._init.apply(this, arguments); BI.CustomColorChooser.superclass._init.apply(this, arguments);
var self = this; var self = this;
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.color_picker_editor", type: "bi.color_picker_editor"
width: 195
}); });
this.editor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () { this.editor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () {
self.setValue(this.getValue()); self.setValue(this.getValue());
@ -3627,9 +3623,9 @@ BI.CustomColorChooser = BI.inherit(BI.Widget, {
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
el: this.editor, el: this.editor,
left: 15, left: 10,
top: 10, top: 10,
right: 15 right: 10
}], }],
height: 30 height: 30
}, { }, {
@ -4261,7 +4257,7 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.ColorPickerEditor.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.ColorPickerEditor.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-color-picker-editor", baseCls: "bi-color-picker-editor",
width: 200, // width: 200,
height: 20 height: 20
}) })
}, },
@ -5458,6 +5454,125 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
}); });
BI.IconComboTrigger.EVENT_CHANGE = "EVENT_CHANGE"; BI.IconComboTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.icon_combo_trigger", BI.IconComboTrigger);/** BI.shortcut("bi.icon_combo_trigger", BI.IconComboTrigger);/**
* Created by Windy on 2017/12/12.
* combo : icon + text + icon, popup : icon + text
*/
BI.IconTextValueCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.IconTextValueCombo.superclass._defaultConfig.apply(this, arguments), {
baseClass: "bi-icon-text-value-combo",
height: 30,
text: "",
el: {}
})
},
_init: function () {
BI.IconTextValueCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget(o.el, {
type: "bi.select_icon_text_trigger",
items: o.items,
height: o.height,
text: o.text
});
this.popup = BI.createWidget({
type: "bi.icon_text_value_combo_popup",
items: o.items
});
this.popup.on(BI.IconTextValueComboPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.textIconCombo.hideView();
self.fireEvent(BI.IconTextValueCombo.EVENT_CHANGE, arguments);
});
this.popup.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.textIconCombo = BI.createWidget({
type: "bi.combo",
element: this,
adjustLength: 2,
el: this.trigger,
popup: {
el: this.popup,
maxHeight: 300
}
});
},
setValue: function (v) {
this.textIconCombo.setValue(v);
},
getValue: function () {
return this.textIconCombo.getValue();
},
populate: function (items) {
this.options.items = items;
this.textIconCombo.populate(items);
}
});
BI.IconTextValueCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.icon_text_value_combo", BI.IconTextValueCombo);/**
* Created by Windy on 2017/12/12.
*/
BI.IconTextValueComboPopup = BI.inherit(BI.Pane, {
_defaultConfig: function () {
return BI.extend(BI.IconTextValueComboPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-icon-text-icon-popup"
});
},
_init: function () {
BI.IconTextValueComboPopup.superclass._init.apply(this, arguments);
var o = this.options, self = this;
this.popup = BI.createWidget({
type: "bi.button_group",
items: BI.createItems(o.items, {
type: "bi.single_select_icon_text_item",
height: 30
}),
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
layouts: [{
type: "bi.vertical"
}]
});
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
self.fireEvent(BI.IconTextValueComboPopup.EVENT_CHANGE, val, obj);
}
});
BI.createWidget({
type: "bi.vertical",
element: this,
items: [this.popup]
});
},
populate: function (items) {
BI.IconTextValueComboPopup.superclass.populate.apply(this, arguments);
items = BI.createItems(items, {
type: "bi.single_select_icon_text_item",
height: 30
});
this.popup.populate(items);
},
getValue: function () {
return this.popup.getValue();
},
setValue: function (v) {
this.popup.setValue(v);
}
});
BI.IconTextValueComboPopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.icon_text_value_combo_popup", BI.IconTextValueComboPopup);/**
* 单选combo * 单选combo
* *
* @class BI.StaticCombo * @class BI.StaticCombo
@ -7555,7 +7670,7 @@ BI.BarPopoverSection = BI.inherit(BI.PopoverSection, {
BI.createWidget({ BI.createWidget({
type: 'bi.right_vertical_adapt', type: 'bi.right_vertical_adapt',
element: south, element: south,
hgap: 5, lgap: 10,
items: [this.cancel, this.sure] items: [this.cancel, this.sure]
}); });
}, },
@ -9419,6 +9534,10 @@ BI.RichEditorAction = BI.inherit(BI.Widget, {
keydown: function () { keydown: function () {
}, },
hideIf: function (e) {
},
activate: function () { activate: function () {
}, },
@ -9552,7 +9671,7 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
{type: "bi.rich_editor_align_left_button"}, {type: "bi.rich_editor_align_left_button"},
{type: "bi.rich_editor_align_center_button"}, {type: "bi.rich_editor_align_center_button"},
{type: "bi.rich_editor_align_right_button"}, {type: "bi.rich_editor_align_right_button"},
{type: "bi.rich_editor_param_button"}, {type: "bi.rich_editor_param_button"}
], ],
height: 28 height: 28
}); });
@ -9561,22 +9680,28 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.RichEditorTextToolbar.superclass._init.apply(this, arguments); BI.RichEditorTextToolbar.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var buttons = BI.createWidgets(BI.map(o.buttons, function (i, btn) {
return BI.extend(btn, {
editor: o.editor
});
}));
this.element.mousedown(function (e) {
BI.each(buttons, function (i, btn) {
btn.hideIf(e);
});
});
BI.createWidget({ BI.createWidget({
type: "bi.left", type: "bi.left",
element: this, element: this,
items: BI.map(o.buttons, function (i, btn) { items: buttons,
return BI.extend(btn, {
editor: o.editor
});
}),
hgap: 3, hgap: 3,
vgap: 3 vgap: 3
}) });
}, },
mounted: function () { mounted: function () {
var self = this; var self = this;
if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框 if (BI.isIE9Below()) {// IE8下必须要设置unselectable才能不blur输入框
this.element.mousedown(function () { this.element.mousedown(function () {
self._noSelect(self.element[0]); self._noSelect(self.element[0]);
}); });
@ -9585,15 +9710,15 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
}, },
_noSelect: function (element) { _noSelect: function (element) {
if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') { if (element.setAttribute && element.nodeName.toLowerCase() != "input" && element.nodeName.toLowerCase() != "textarea") {
element.setAttribute('unselectable', 'on'); element.setAttribute("unselectable", "on");
} }
for (var i = 0; i < element.childNodes.length; i++) { for (var i = 0; i < element.childNodes.length; i++) {
this._noSelect(element.childNodes[i]); this._noSelect(element.childNodes[i]);
} }
} }
}); });
BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
* 富文本编辑器 * 富文本编辑器
* *
* Created by GUY on 2017/9/15. * Created by GUY on 2017/9/15.
@ -10281,10 +10406,16 @@ BI.RichEditorBackgroundColorChooser = BI.inherit(BI.RichEditorAction, {
}); });
}, },
hideIf: function (e) {
if(!this.colorchooser.element.find(e.target).length > 0) {
this.colorchooser.hideView();
}
},
deactivate: function () { deactivate: function () {
} }
}); });
BI.shortcut('bi.rich_editor_background_color_chooser', BI.RichEditorBackgroundColorChooser);/** BI.shortcut("bi.rich_editor_background_color_chooser", BI.RichEditorBackgroundColorChooser);/**
* 颜色选择 * 颜色选择
* *
* Created by GUY on 2015/11/26. * Created by GUY on 2015/11/26.
@ -10320,6 +10451,12 @@ BI.RichEditorColorChooser = BI.inherit(BI.RichEditorAction, {
}, },
hideIf: function (e) {
if(!this.colorchooser.element.find(e.target).length > 0) {
this.colorchooser.hideView();
}
},
deactivate: function () { deactivate: function () {
this.colorchooser.setValue(""); this.colorchooser.setValue("");
} }
@ -10396,10 +10533,16 @@ BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, {
self.doCommand(val); self.doCommand(val);
this.hideView(); this.hideView();
this.setValue([]); this.setValue([]);
}) });
},
hideIf: function (e) {
if(!this.combo.element.find(e.target).length > 0) {
this.combo.hideView();
}
} }
}); });
BI.shortcut('bi.rich_editor_size_chooser', BI.RichEditorSizeChooser);/** BI.shortcut("bi.rich_editor_size_chooser", BI.RichEditorSizeChooser);/**
* 富文本编辑器 * 富文本编辑器
* *
* Created by GUY on 2017/9/15. * Created by GUY on 2017/9/15.
@ -10430,7 +10573,7 @@ BI.RichEditor = BI.inherit(BI.Widget, {
type: "bi.combo", type: "bi.combo",
element: this, element: this,
toggle: false, toggle: false,
direction: "top", direction: "top,left",
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
isNeedAdjustHeight: false, isNeedAdjustHeight: false,
adjustLength: 1, adjustLength: 1,
@ -13508,6 +13651,9 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
BI.createWidget({ BI.createWidget({
element: this, element: this,
type: 'bi.htape', type: 'bi.htape',
ref: function (_ref) {
self.wrapper = _ref;
},
items: [{ items: [{
el: { el: {
type: "bi.icon_change_button", type: "bi.icon_change_button",
@ -13535,7 +13681,20 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
}, },
setIcon: function (iconCls) { setIcon: function (iconCls) {
var o = this.options;
this.icon.setIcon(iconCls); this.icon.setIcon(iconCls);
var iconItem = this.wrapper.attr("items")[0];
if(BI.isNull(iconCls) || BI.isEmptyString(iconCls)){
if(iconItem.width !== 0){
iconItem.width = 0;
this.wrapper.resize();
}
}else{
if(iconItem.width !== (o.triggerWidth || o.height)){
iconItem.width = (o.triggerWidth || o.height);
this.wrapper.resize();
}
}
}, },
setText: function (text) { setText: function (text) {
@ -13544,6 +13703,60 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
} }
}); });
BI.shortcut("bi.icon_text_trigger", BI.IconTextTrigger);/** BI.shortcut("bi.icon_text_trigger", BI.IconTextTrigger);/**
* Created by Windy on 2017/12/12.
*/
BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function () {
return BI.extend(BI.SelectIconTextTrigger.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-text-trigger bi-border",
height: 24
});
},
_init: function () {
this.options.height -= 2;
BI.SelectIconTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.icon_text_trigger",
element: this,
height: o.height
});
if (BI.isKey(o.text)) {
this.setValue(o.text);
}
},
setValue: function (vals) {
var o = this.options;
vals = BI.isArray(vals) ? vals : [vals];
var result;
var items = BI.Tree.transformToArrayFormat(this.options.items);
BI.any(items, function (i, item) {
if (BI.deepContains(vals, item.value)) {
result = {
text: item.text || item.value,
iconClass: item.iconClass
};
return true;
}
});
if (BI.isNotNull(result)) {
this.trigger.setText(result.text);
this.trigger.setIcon(result.iconClass);
} else {
this.trigger.setText(o.text);
this.trigger.setIcon("");
}
},
populate: function (items) {
this.options.items = items;
}
});
BI.shortcut("bi.select_icon_text_trigger", BI.SelectIconTextTrigger);/**
* 文字trigger * 文字trigger
* *
* Created by GUY on 2015/9/15. * Created by GUY on 2015/9/15.

126
bi/core.js

@ -11695,7 +11695,7 @@ if (!window.BI) {
// Date // Date
if (type === '[object Date]') { if (type === '[object Date]') {
return new Date(obj.getTime()); return Date.getDate(obj.getTime());
} }
var i, clone, key; var i, clone, key;
@ -11925,7 +11925,7 @@ if (!window.BI) {
if (Date.now) { if (Date.now) {
return Date.now(); return Date.now();
} else { } else {
return new Date().getTime(); return Date.getDate().getTime();
} }
} }
} }
@ -18776,9 +18776,9 @@ BI.TooltipsController = BI.inherit(BI.Controller, {
tooltip.visible(); tooltip.visible();
tooltip.element.height(tooltip.element[0].scrollHeight); tooltip.element.height(tooltip.element[0].scrollHeight);
this.showingTips[name] = true; this.showingTips[name] = true;
var x = e.pageX || e.clientX, y = (e.pageY || e.clientY) + 15; var x = (e.pageX || e.clientX) + 15, y = (e.pageY || e.clientY) + 15;
if (x + tooltip.element.outerWidth() > $("body").outerWidth()) { if (x + tooltip.element.outerWidth() > $("body").outerWidth()) {
x -= tooltip.element.outerWidth(); x -= tooltip.element.outerWidth() + 15;
} }
if (y + tooltip.element.outerHeight() > $("body").outerHeight()) { if (y + tooltip.element.outerHeight() > $("body").outerHeight()) {
y -= tooltip.element.outerHeight() + 15; y -= tooltip.element.outerHeight() + 15;
@ -19278,7 +19278,7 @@ BI.extend(jQuery.fn, {
*/ */
__textKeywordMarked__: function (text, keyword, py) { __textKeywordMarked__: function (text, keyword, py) {
if (!BI.isKey(keyword) || (text + "").length > 100) { if (!BI.isKey(keyword) || (text + "").length > 100) {
return this.html((text + "").replaceAll(" ", "&nbsp;")); return this.html(BI.Func.formatSpecialCharInHtml(text));
} }
keyword = keyword + ""; keyword = keyword + "";
keyword = BI.toUpperCase(keyword); keyword = BI.toUpperCase(keyword);
@ -19301,7 +19301,7 @@ BI.extend(jQuery.fn, {
if (tidx >= 0) { if (tidx >= 0) {
this.append(textLeft.substr(0, tidx)); this.append(textLeft.substr(0, tidx));
this.append($("<span>").addClass("bi-keyword-red-mark") this.append($("<span>").addClass("bi-keyword-red-mark")
.html(textLeft.substr(tidx, keyword.length).replaceAll(" ", "&nbsp;"))); .html(BI.Func.formatSpecialCharInHtml(textLeft.substr(tidx, keyword.length))));
textLeft = textLeft.substr(tidx + keyword.length); textLeft = textLeft.substr(tidx + keyword.length);
if (py != null) { if (py != null) {
@ -19310,7 +19310,7 @@ BI.extend(jQuery.fn, {
} else if (pidx != null && pidx >= 0 && Math.floor(pidx / text.length) === Math.floor((pidx + keyword.length - 1) / text.length)) { } else if (pidx != null && pidx >= 0 && Math.floor(pidx / text.length) === Math.floor((pidx + keyword.length - 1) / text.length)) {
this.append(textLeft.substr(0, pidx)); this.append(textLeft.substr(0, pidx));
this.append($("<span>").addClass("bi-keyword-red-mark") this.append($("<span>").addClass("bi-keyword-red-mark")
.html(textLeft.substr(pidx, keyword.length).replaceAll(" ", "&nbsp;"))); .html(BI.Func.formatSpecialCharInHtml(textLeft.substr(pidx, keyword.length))));
if (py != null) { if (py != null) {
py = py.substr(pidx + keyword.length); py = py.substr(pidx + keyword.length);
} }
@ -19915,6 +19915,27 @@ BI.extend(BI.Func, {
matched: matched, matched: matched,
finded: finded finded: finded
} }
},
/**
* 将字符串中的尖括号等字符encode成html能解析的形式
* @param str
*/
formatSpecialCharInHtml: function (str) {
return (str + "").replaceAll("\\s|<=?|>=?", function (str) {
switch (str) {
case "<":
return "&lt;";
case "<=":
return "&le;";
case ">":
return "&gt;";
case ">=":
return "&ge;";
default:
return "&nbsp;";
}
});
} }
}); });
@ -20172,6 +20193,14 @@ BI.extend(BI.DOM, {
storeInjection[xtype] = cls; storeInjection[xtype] = cls;
}; };
var serviceInjection = {};
BI.service = function (xtype, cls) {
if (serviceInjection[xtype] != null) {
throw ("service:[" + xtype + "] has been registed");
}
serviceInjection[xtype] = cls;
};
var providerInjection = {}; var providerInjection = {};
BI.provider = function (xtype, cls) { BI.provider = function (xtype, cls) {
if (providerInjection[xtype] != null) { if (providerInjection[xtype] != null) {
@ -20232,6 +20261,20 @@ BI.extend(BI.DOM, {
} }
} }
var services = {};
BI.Services = {
getService: function (type, config) {
if (services[type]) {
return services[type];
}
return services[type] = new serviceInjection[type](config);
},
releaseService: function (type) {
delete services[type];
}
}
var providers = {}, providerInstance = {} var providers = {}, providerInstance = {}
BI.Providers = { BI.Providers = {
@ -20832,20 +20875,21 @@ Date.prototype.getMonthDays = function (month) {
* @returns {Date} * @returns {Date}
*/ */
Date.prototype.getLastDateOfMonth = function () { Date.prototype.getLastDateOfMonth = function () {
return new Date(this.getFullYear(), this.getMonth(), this.getMonthDays()); return Date.getDate(this.getFullYear(), this.getMonth(), this.getMonthDays());
}; };
/** Returns the number of day in the year. */ /** Returns the number of day in the year. */
Date.prototype.getDayOfYear = function () { Date.prototype.getDayOfYear = function () {
var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var now = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); var then = Date.getDate(this.getFullYear(), 0, 0, 0, 0, 0);
var time = now - then; var time = now - then;
return Math.floor(time / Date.DAY); return Math.floor(time / Date.DAY);
}; };
/** Returns the number of the week in year, as defined in ISO 8601. */ /** Returns the number of the week in year, as defined in ISO 8601. */
Date.prototype.getWeekNumber = function () { Date.prototype.getWeekNumber = function () {
var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var d = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
//周一是一周第一天
var week = d.getDay(); var week = d.getDay();
if (this.getMonth() === 0 && this.getDate() <= week) { if (this.getMonth() === 0 && this.getDate() <= week) {
return 1; return 1;
@ -20861,19 +20905,23 @@ Date.prototype.getWeekNumber = function () {
return offset; return offset;
}; };
Date.prototype.getQuarter = function () {
return Math.floor(this.getMonth() / 3) + 1;
};
//离当前时间多少天的时间 //离当前时间多少天的时间
Date.prototype.getOffsetDate = function (offset) { Date.prototype.getOffsetDate = function (offset) {
return new Date(this.getTime() + offset * 864e5); return Date.getDate(this.getTime() + offset * 864e5);
}; };
Date.prototype.getAfterMulQuarter = function (n) { Date.prototype.getAfterMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n * 3); dt.setMonth(dt.getMonth() + n * 3);
return dt; return dt;
}; };
//获得n个季度前的日期 //获得n个季度前的日期
Date.prototype.getBeforeMulQuarter = function (n) { Date.prototype.getBeforeMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n * 3); dt.setMonth(dt.getMonth() - n * 3);
return dt; return dt;
}; };
@ -20897,32 +20945,32 @@ Date.prototype.getQuarterStartMonth = function () {
}; };
//获得本季度的起始日期 //获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () { Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); return Date.getDate(this.getFullYear(), this.getQuarterStartMonth(), 1);
}; };
//得到本季度的结束日期 //得到本季度的结束日期
Date.prototype.getQuarterEndDate = function () { Date.prototype.getQuarterEndDate = function () {
var quarterEndMonth = this.getQuarterStartMonth() + 2; var quarterEndMonth = this.getQuarterStartMonth() + 2;
return new Date(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); return Date.getDate(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth));
}; };
Date.prototype.getAfterMultiMonth = function (n) { Date.prototype.getAfterMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n | 0); dt.setMonth(dt.getMonth() + n | 0);
return dt; return dt;
}; };
Date.prototype.getBeforeMultiMonth = function (n) { Date.prototype.getBeforeMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n | 0); dt.setMonth(dt.getMonth() - n | 0);
return dt; return dt;
}; };
Date.prototype.getAfterMulQuarter = function (n) { Date.prototype.getAfterMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n * 3); dt.setMonth(dt.getMonth() + n * 3);
return dt; return dt;
}; };
//获得n个季度前的日期 //获得n个季度前的日期
Date.prototype.getBeforeMulQuarter = function (n) { Date.prototype.getBeforeMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n * 3); dt.setMonth(dt.getMonth() - n * 3);
return dt; return dt;
}; };
@ -20947,9 +20995,9 @@ Date.prototype.getQuarterStartMonth = function () {
//指定日期n个月之前或之后的日期 //指定日期n个月之前或之后的日期
Date.prototype.getOffsetMonth = function (n) { Date.prototype.getOffsetMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
var day = dt.getDate(); var day = dt.getDate();
var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays(); var monthDay = Date.getDate(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays();
if (day > monthDay) { if (day > monthDay) {
day = monthDay; day = monthDay;
} }
@ -20972,31 +21020,31 @@ Date.prototype.getWeekEndDate = function () {
//获得本季度的起始日期 //获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () { Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); return Date.getDate(this.getFullYear(), this.getQuarterStartMonth(), 1);
}; };
//得到本季度的结束日期 //得到本季度的结束日期
Date.prototype.getQuarterEndDate = function () { Date.prototype.getQuarterEndDate = function () {
var quarterEndMonth = this.getQuarterStartMonth() + 2; var quarterEndMonth = this.getQuarterStartMonth() + 2;
return new Date(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); return Date.getDate(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth));
}; };
Date.prototype.getAfterMultiMonth = function (n) { Date.prototype.getAfterMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n | 0); dt.setMonth(dt.getMonth() + n | 0);
return dt; return dt;
}; };
Date.prototype.getBeforeMultiMonth = function (n) { Date.prototype.getBeforeMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n | 0); dt.setMonth(dt.getMonth() - n | 0);
return dt; return dt;
}; };
//获得当前时区对应指定时区的时间 //获得当前时区对应指定时区的时间
Date.prototype.getTimeZoneTimeByTimezoneOffset = function (offset) { Date.prototype.getTimeZoneTimeByTimezoneOffset = function (offset) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
var localTime = dt.getTime(); var localTime = dt.getTime();
var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数 var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数
var utc = localTime + localOffset; //utc即GMT时间标准时区 var utc = localTime + localOffset; //utc即GMT时间标准时区
return new Date(utc + offset); return Date.getDate(utc + offset);
}; };
/** Checks date and time equality */ /** Checks date and time equality */
@ -21011,7 +21059,7 @@ Date.prototype.equalsTo = function (date) {
/** Set only the year, month, date parts (keep existing time) */ /** Set only the year, month, date parts (keep existing time) */
Date.prototype.setDateOnly = function (date) { Date.prototype.setDateOnly = function (date) {
var tmp = new Date(date); var tmp = Date.getDate(date);
this.setDate(1); this.setDate(1);
this.setFullYear(tmp.getFullYear()); this.setFullYear(tmp.getFullYear());
this.setMonth(tmp.getMonth()); this.setMonth(tmp.getMonth());
@ -21023,6 +21071,7 @@ Date.prototype.print = function (str) {
var d = this.getDate(); var d = this.getDate();
var y = this.getFullYear(); var y = this.getFullYear();
var wn = this.getWeekNumber(); var wn = this.getWeekNumber();
var qr = this.getQuarter();
var w = this.getDay(); var w = this.getDay();
var s = {}; var s = {};
var hr = this.getHours(); var hr = this.getHours();
@ -21069,6 +21118,7 @@ Date.prototype.print = function (str) {
s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
s["%Y"] = y; // year with the century s["%Y"] = y; // year with the century
s["%%"] = "%"; // a literal '%' character s["%%"] = "%"; // a literal '%' character
s["%Q"] = qr;
var re = /%./g; var re = /%./g;
if (!BI.isKhtml()) { if (!BI.isKhtml()) {
@ -21157,7 +21207,7 @@ Date.checkLegal = function (str) {
}; };
Date.parseDateTime = function (str, fmt) { Date.parseDateTime = function (str, fmt) {
var today = new Date(); var today = Date.getDate();
var y = 0; var y = 0;
var m = 0; var m = 0;
var d = 1; var d = 1;
@ -21250,7 +21300,7 @@ Date.parseDateTime = function (str, fmt) {
sec = today.getSeconds(); sec = today.getSeconds();
} }
if (y != 0) { if (y != 0) {
return new Date(y, m, d, hr, min, sec); return Date.getDate(y, m, d, hr, min, sec);
} }
y = 0; y = 0;
m = -1; m = -1;
@ -21283,10 +21333,22 @@ Date.parseDateTime = function (str, fmt) {
y = today.getFullYear(); y = today.getFullYear();
} }
if (m != -1 && d != 0) { if (m != -1 && d != 0) {
return new Date(y, m, d, hr, min, sec); return Date.getDate(y, m, d, hr, min, sec);
} }
return today; return today;
}; };
Date.getDate = function () {
var dt = new (Function.prototype.bind.apply(Date, BI.concat([null], [].slice.apply(arguments))))();
if(BI.isNotNull(Date.timeZone) && (arguments.length === 0 || (arguments.length === 1 && BI.isNumber(arguments[0])))){
var localTime = dt.getTime();
var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数
var utc = localTime + localOffset; //utc即GMT时间标准时区
return new Date(utc + Date.timeZone);//+ Pool.timeZone.offset);
}else{
return dt;
}
};
/* /*
* 给jQuery.Event对象添加的工具方法 * 给jQuery.Event对象添加的工具方法
*/ */

2538
bi/widget.js

File diff suppressed because it is too large Load Diff

2
demo/app.js

@ -11,7 +11,7 @@ $(function () {
console.log(_ref); console.log(_ref);
ref = _ref; ref = _ref;
}, },
element: '#wrapper' element: "#wrapper"
}); });
} }
}); });

3004
demo/config.js

File diff suppressed because one or more lines are too long

132
demo/js/base/button/demo.button.js

@ -6,174 +6,174 @@ Demo.Button = BI.inherit(BI.Widget, {
var items = [ var items = [
{ {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '一般按钮', text: "一般按钮",
level: 'common', level: "common",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '表示成功状态按钮', text: "表示成功状态按钮",
level: 'success', level: "success",
height: 30 height: 30
} }
}, },
{ {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '表示警告状态的按钮', text: "表示警告状态的按钮",
level: 'warning', level: "warning",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '表示忽略状态的按钮', text: "表示忽略状态的按钮",
level: 'ignore', level: "ignore",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '普通灰化按钮', text: "普通灰化按钮",
disabled: true, disabled: true,
level: 'success', level: "success",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '忽略状态灰化按钮', text: "忽略状态灰化按钮",
disabled: true, disabled: true,
level: 'ignore', level: "ignore",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '带图标的按钮', text: "带图标的按钮",
//level: 'ignore', // level: 'ignore',
iconClass: "close-font", iconClass: "close-font",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '一般按钮', text: "一般按钮",
block: true, block: true,
level: 'common', level: "common",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '表示成功状态按钮', text: "表示成功状态按钮",
block: true, block: true,
level: 'success', level: "success",
height: 30 height: 30
} }
}, },
{ {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '表示警告状态的按钮', text: "表示警告状态的按钮",
block: true, block: true,
level: 'warning', level: "warning",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '表示忽略状态的按钮', text: "表示忽略状态的按钮",
block: true, block: true,
level: 'ignore', level: "ignore",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '普通灰化按钮', text: "普通灰化按钮",
block: true, block: true,
disabled: true, disabled: true,
level: 'success', level: "success",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '忽略状态灰化按钮', text: "忽略状态灰化按钮",
block: true, block: true,
disabled: true, disabled: true,
level: 'ignore', level: "ignore",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '带图标的按钮', text: "带图标的按钮",
block: true, block: true,
//level: 'ignore', // level: 'ignore',
iconClass: "close-font", iconClass: "close-font",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '一般按钮', text: "一般按钮",
clear: true, clear: true,
level: 'common', level: "common",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '表示成功状态按钮', text: "表示成功状态按钮",
clear: true, clear: true,
level: 'success', level: "success",
height: 30 height: 30
} }
}, },
{ {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '表示警告状态的按钮', text: "表示警告状态的按钮",
clear: true, clear: true,
level: 'warning', level: "warning",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '表示忽略状态的按钮', text: "表示忽略状态的按钮",
clear: true, clear: true,
level: 'ignore', level: "ignore",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '普通灰化按钮', text: "普通灰化按钮",
clear: true, clear: true,
disabled: true, disabled: true,
level: 'success', level: "success",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '忽略状态灰化按钮', text: "忽略状态灰化按钮",
clear: true, clear: true,
disabled: true, disabled: true,
level: 'ignore', level: "ignore",
height: 30 height: 30
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '带图标的按钮', text: "带图标的按钮",
clear: true, clear: true,
//level: 'ignore', // level: 'ignore',
iconClass: "close-font", iconClass: "close-font",
height: 30 height: 30
} }
@ -181,15 +181,15 @@ Demo.Button = BI.inherit(BI.Widget, {
]; ];
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
item.el.handler = function () { item.el.handler = function () {
BI.Msg.alert('按钮', this.options.text); BI.Msg.alert("按钮", this.options.text);
} };
}); });
return { return {
type: "bi.left", type: "bi.left",
vgap: 100, vgap: 100,
hgap: 20, hgap: 20,
items: items items: items
} };
} }
}); });
BI.shortcut("demo.button", Demo.Button); BI.shortcut("demo.button", Demo.Button);

4
demo/js/base/button/demo.icon_button.js

@ -6,7 +6,7 @@ Demo.Button = BI.inherit(BI.Widget, {
var items = [ var items = [
{ {
el: { el: {
type: 'bi.icon_button', type: "bi.icon_button",
cls: "close-ha-font", cls: "close-ha-font",
width: 20, width: 20,
height: 20 height: 20
@ -18,7 +18,7 @@ Demo.Button = BI.inherit(BI.Widget, {
vgap: 200, vgap: 200,
hgap: 20, hgap: 20,
items: items items: items
} };
} }
}); });
BI.shortcut("demo.icon_button", Demo.Button); BI.shortcut("demo.icon_button", Demo.Button);

4
demo/js/base/button/demo.image_button.js

@ -6,7 +6,7 @@ Demo.Button = BI.inherit(BI.Widget, {
var items = [ var items = [
{ {
el: { el: {
type: 'bi.image_button', type: "bi.image_button",
src: "http://www.easyicon.net/api/resizeApi.php?id=1206741&size=128", src: "http://www.easyicon.net/api/resizeApi.php?id=1206741&size=128",
width: 100, width: 100,
height: 100 height: 100
@ -18,7 +18,7 @@ Demo.Button = BI.inherit(BI.Widget, {
vgap: 200, vgap: 200,
hgap: 20, hgap: 20,
items: items items: items
} };
} }
}); });
BI.shortcut("demo.image_button", Demo.Button); BI.shortcut("demo.image_button", Demo.Button);

6
demo/js/base/button/demo.text_button.js

@ -6,8 +6,8 @@ Demo.Button = BI.inherit(BI.Widget, {
var items = [ var items = [
{ {
el: { el: {
type: 'bi.text_button', type: "bi.text_button",
text: '文字按钮', text: "文字按钮",
height: 30 height: 30
} }
} }
@ -17,7 +17,7 @@ Demo.Button = BI.inherit(BI.Widget, {
vgap: 200, vgap: 200,
hgap: 20, hgap: 20,
items: items items: items
} };
} }
}); });
BI.shortcut("demo.text_button", Demo.Button); BI.shortcut("demo.text_button", Demo.Button);

8
demo/js/base/demo.canvas.js

@ -18,15 +18,15 @@ Demo.Func = BI.inherit(BI.Widget, {
canvas.circle(150, 50, 20, "green"); canvas.circle(150, 50, 20, "green");
//渐变矩形 // 渐变矩形
canvas.rect(0, 120, 80, 100, canvas.gradient(0, 120, 80, 220, "#FF0000", "#00FF00")); canvas.rect(0, 120, 80, 100, canvas.gradient(0, 120, 80, 220, "#FF0000", "#00FF00"));
//空心图形 // 空心图形
canvas.hollow(100, 120, 100, 220, 200, 120, { canvas.hollow(100, 120, 100, 220, 200, 120, {
strokeStyle: "blue" strokeStyle: "blue"
}); });
//实心图形 // 实心图形
canvas.solid(100, 240, 200, 240, 150, 280, 200, 320, 100, 320, { canvas.solid(100, 240, 200, 240, 150, 280, 200, 320, 100, 320, {
strokeStyle: "yellow", strokeStyle: "yellow",
fillStyle: "pink" fillStyle: "pink"
@ -42,7 +42,7 @@ Demo.Func = BI.inherit(BI.Widget, {
left: 100, left: 100,
top: 50 top: 50
}] }]
}) });
} }
}); });
BI.shortcut("demo.canvas", Demo.Func); BI.shortcut("demo.canvas", Demo.Func);

2
demo/js/base/demo.label.js

@ -132,7 +132,7 @@ Demo.Label = BI.inherit(BI.Widget, {
}], }],
hgap: 300, hgap: 300,
vgap: 20 vgap: 20
} };
} }
}); });
BI.shortcut("demo.label", Demo.Label); BI.shortcut("demo.label", Demo.Label);

16
demo/js/base/demo.message.js

@ -5,19 +5,19 @@ Demo.Message = BI.inherit(BI.Widget, {
render: function () { render: function () {
return { return {
type: "bi.center_adapt", type: "bi.center_adapt",
items : [ items: [
{ {
el : { el: {
type : 'bi.button', type: "bi.button",
text : '点击我弹出一个消息框', text: "点击我弹出一个消息框",
height : 30, height: 30,
handler : function() { handler: function () {
BI.Msg.alert('测试消息框', '我是测试消息框的内容'); BI.Msg.alert("测试消息框", "我是测试消息框的内容");
} }
} }
} }
] ]
} };
} }
}); });
BI.shortcut("demo.message", Demo.Message); BI.shortcut("demo.message", Demo.Message);

2
demo/js/base/demo.pager.js

@ -114,7 +114,7 @@ Demo.Func = BI.inherit(BI.Widget, {
return v < 3; return v < 3;
} }
}] }]
} };
} }
}); });
BI.shortcut("demo.pager", Demo.Func); BI.shortcut("demo.pager", Demo.Func);

2
demo/js/base/demo.svg.js

@ -26,7 +26,7 @@ Demo.Func = BI.inherit(BI.Widget, {
left: 100, left: 100,
top: 50 top: 50
}] }]
}) });
} }
}); });
BI.shortcut("demo.svg", Demo.Func); BI.shortcut("demo.svg", Demo.Func);

2
demo/js/base/editor/demo.code_editor.js

@ -27,7 +27,7 @@ Demo.CodeEditor = BI.inherit(BI.Widget, {
editor.setValue("测试数据"); editor.setValue("测试数据");
} }
}] }]
}) });
} }
}); });
BI.shortcut("demo.code_editor", Demo.CodeEditor); BI.shortcut("demo.code_editor", Demo.CodeEditor);

2
demo/js/base/editor/demo.editor.js

@ -90,7 +90,7 @@ Demo.Editor = BI.inherit(BI.Widget, {
left: 200, left: 200,
bottom: 60 bottom: 60
}] }]
}) });
} }
}); });
BI.shortcut("demo.editor", Demo.Editor); BI.shortcut("demo.editor", Demo.Editor);

10
demo/js/base/editor/demo.formula_editor.js

@ -4,10 +4,10 @@ Demo.CodeEditor = BI.inherit(BI.Widget, {
}, },
render: function () { render: function () {
this.formula = BI.createWidget({ this.formula = BI.createWidget({
type : 'bi.formula_editor', type: "bi.formula_editor",
width : 300, width: 300,
height : 200, height: 200,
value : 'SUM(C5, 16, 26)' value: "SUM(C5, 16, 26)"
}); });
BI.createWidget({ BI.createWidget({
type: "bi.left", type: "bi.left",
@ -15,7 +15,7 @@ Demo.CodeEditor = BI.inherit(BI.Widget, {
items: [this.formula], items: [this.formula],
hgap: 20, hgap: 20,
vgap: 20 vgap: 20
}) });
} }
}); });
BI.shortcut("demo.formula_editor", Demo.CodeEditor); BI.shortcut("demo.formula_editor", Demo.CodeEditor);

2
demo/js/base/editor/demo.multifile_editor.js

@ -20,7 +20,7 @@ Demo.CodeEditor = BI.inherit(BI.Widget, {
top: 50, top: 50,
left: 50 left: 50
}] }]
} };
} }
}); });
BI.shortcut("demo.multifile_editor", Demo.CodeEditor); BI.shortcut("demo.multifile_editor", Demo.CodeEditor);

6
demo/js/base/editor/demo.rich_editor.js

@ -15,11 +15,11 @@ Demo.RichEditor = BI.inherit(BI.Widget, {
hgap: 30, hgap: 30,
vgap: 50, vgap: 50,
items: [this.editor] items: [this.editor]
}) });
}, },
mounted: function(){ mounted: function () {
this.editor.setValue('这是一条<font size="4" color="#009de3">测试</font>数据') this.editor.setValue("这是一条<font size=\"4\" color=\"#009de3\">测试</font>数据");
} }
}); });
BI.shortcut("demo.rich_editor", Demo.RichEditor); BI.shortcut("demo.rich_editor", Demo.RichEditor);

2
demo/js/base/editor/demo.textarea_editor.js

@ -33,7 +33,7 @@ Demo.CodeEditor = BI.inherit(BI.Widget, {
editor.setValue("测试数据"); editor.setValue("测试数据");
} }
}] }]
}) });
} }
}); });
BI.shortcut("demo.textarea_editor", Demo.CodeEditor); BI.shortcut("demo.textarea_editor", Demo.CodeEditor);

6
demo/js/base/table/demo.collection_table.js

@ -12,7 +12,7 @@ Demo.Func = BI.inherit(BI.Widget, {
header[i][j] = { header[i][j] = {
type: "bi.label", type: "bi.label",
text: "表头" + i + "-" + j text: "表头" + i + "-" + j
} };
columnSize[j] = 100; columnSize[j] = 100;
} }
} }
@ -22,7 +22,7 @@ Demo.Func = BI.inherit(BI.Widget, {
items[i][j] = { items[i][j] = {
type: "bi.label", type: "bi.label",
text: (i < 3 ? 0 : i) + "-" + j text: (i < 3 ? 0 : i) + "-" + j
} };
} }
} }
@ -56,7 +56,7 @@ Demo.Func = BI.inherit(BI.Widget, {
top: 10, top: 10,
bottom: 10 bottom: 10
}] }]
}) });
} }
}); });
BI.shortcut("demo.collection_table", Demo.Func); BI.shortcut("demo.collection_table", Demo.Func);

6
demo/js/base/table/demo.grid_table.js

@ -12,7 +12,7 @@ Demo.Func = BI.inherit(BI.Widget, {
header[i][j] = { header[i][j] = {
type: "bi.label", type: "bi.label",
text: "表头" + i + "-" + j text: "表头" + i + "-" + j
} };
columnSize[j] = 100; columnSize[j] = 100;
} }
} }
@ -22,7 +22,7 @@ Demo.Func = BI.inherit(BI.Widget, {
items[i][j] = { items[i][j] = {
type: "bi.label", type: "bi.label",
text: (i < 3 ? 0 : i) + "-" + j text: (i < 3 ? 0 : i) + "-" + j
} };
} }
} }
@ -51,7 +51,7 @@ Demo.Func = BI.inherit(BI.Widget, {
top: 10, top: 10,
bottom: 10 bottom: 10
}] }]
}) });
} }
}); });
BI.shortcut("demo.grid_table", Demo.Func); BI.shortcut("demo.grid_table", Demo.Func);

6
demo/js/base/table/demo.resizable_table.js

@ -12,7 +12,7 @@ Demo.Func = BI.inherit(BI.Widget, {
header[i][j] = { header[i][j] = {
type: "bi.label", type: "bi.label",
text: "表头" + i + "-" + j text: "表头" + i + "-" + j
} };
columnSize[j] = 100; columnSize[j] = 100;
} }
} }
@ -22,7 +22,7 @@ Demo.Func = BI.inherit(BI.Widget, {
items[i][j] = { items[i][j] = {
type: "bi.label", type: "bi.label",
text: (i < 3 ? 0 : i) + "-" + j text: (i < 3 ? 0 : i) + "-" + j
} };
} }
} }
@ -51,7 +51,7 @@ Demo.Func = BI.inherit(BI.Widget, {
top: 10, top: 10,
bottom: 10 bottom: 10
}] }]
}) });
} }
}); });
BI.shortcut("demo.resizable_table", Demo.Func); BI.shortcut("demo.resizable_table", Demo.Func);

206
demo/js/base/table/demo.table_view.js

@ -154,110 +154,110 @@ Demo.Func = BI.inherit(BI.Widget, {
text: "第四行第四列" text: "第四行第四列"
}, { }, {
text: "第四行第五列" text: "第四行第五列"
}] }],
, [{ [{
text: "第五行第一列" text: "第五行第一列"
}, { }, {
text: "第五行第一列" text: "第五行第一列"
}, { }, {
text: "第五行第三列" text: "第五行第三列"
}, { }, {
text: "第五行第四列" text: "第五行第四列"
}, { }, {
text: "第五行第五列" text: "第五行第五列"
}], [{ }], [{
text: "第六行第一列" text: "第六行第一列"
}, { }, {
text: "第六行第一列" text: "第六行第一列"
}, { }, {
text: "第六行第三列" text: "第六行第三列"
}, { }, {
text: "第六行第四列" text: "第六行第四列"
}, { }, {
text: "第六行第五列" text: "第六行第五列"
}], [{ }], [{
text: "第七行第一列" text: "第七行第一列"
}, { }, {
text: "第七行第二列" text: "第七行第二列"
}, { }, {
text: "第七行第三列" text: "第七行第三列"
}, { }, {
text: "第七行第四列" text: "第七行第四列"
}, { }, {
text: "第七行第五列" text: "第七行第五列"
}], [{ }], [{
text: "第八行第一列" text: "第八行第一列"
}, { }, {
text: "第八行第二列" text: "第八行第二列"
}, { }, {
text: "第八行第三列" text: "第八行第三列"
}, { }, {
text: "第八行第四列" text: "第八行第四列"
}, { }, {
text: "第八行第五列" text: "第八行第五列"
}], [{ }], [{
text: "第九行第一列" text: "第九行第一列"
}, { }, {
text: "第九行第二列" text: "第九行第二列"
}, { }, {
text: "第九行第三列" text: "第九行第三列"
}, { }, {
text: "第九行第四列" text: "第九行第四列"
}, { }, {
text: "第九行第五列" text: "第九行第五列"
}], [{ }], [{
text: "第十行第一列" text: "第十行第一列"
}, { }, {
text: "第十行第二列" text: "第十行第二列"
}, { }, {
text: "第十行第三列" text: "第十行第三列"
}, { }, {
text: "第十行第四列" text: "第十行第四列"
}, { }, {
text: "第十行第五列" text: "第十行第五列"
}], [{ }], [{
text: "第十一行第一列" text: "第十一行第一列"
}, { }, {
text: "第十一行第二列" text: "第十一行第二列"
}, { }, {
text: "第十一行第三列" text: "第十一行第三列"
}, { }, {
text: "第十一行第四列" text: "第十一行第四列"
}, { }, {
text: "第十一行第五列" text: "第十一行第五列"
}], [{ }], [{
text: "第十二行第一列" text: "第十二行第一列"
}, { }, {
text: "第十二行第二列" text: "第十二行第二列"
}, { }, {
text: "第十二行第三列" text: "第十二行第三列"
}, { }, {
text: "第十二行第四列" text: "第十二行第四列"
}, { }, {
text: "第十二行第五列" text: "第十二行第五列"
}], [{ }], [{
text: "第十三行第一列" text: "第十三行第一列"
}, { }, {
text: "第十三行第二列" text: "第十三行第二列"
}, { }, {
text: "第十三行第三列" text: "第十三行第三列"
}, { }, {
text: "第十三行第四列" text: "第十三行第四列"
}, { }, {
text: "第十三行第五列" text: "第十三行第五列"
}], [{ }], [{
text: "第十四行第一列" text: "第十四行第一列"
}, { }, {
text: "第十四行第二列" text: "第十四行第二列"
}, { }, {
text: "第十四行第三列" text: "第十四行第三列"
}, { }, {
text: "第十四行第四列" text: "第十四行第四列"
}, { }, {
text: "第十四行第五列" text: "第十四行第五列"
}]]; }]];
var header = [[{ var header = [[{
text: "表头1" text: "表头1"
@ -361,7 +361,7 @@ Demo.Func = BI.inherit(BI.Widget, {
top: 10, top: 10,
bottom: 10 bottom: 10
}] }]
}) });
} }
}); });
BI.shortcut("demo.table_view", Demo.Func); BI.shortcut("demo.table_view", Demo.Func);

14
demo/js/base/tip/demo.bubble.js

@ -10,8 +10,8 @@ Demo.Bubble = BI.inherit(BI.Widget, {
ref: function (_ref) { ref: function (_ref) {
btns.push(_ref); btns.push(_ref);
}, },
type: 'bi.button', type: "bi.button",
text: 'bubble测试', text: "bubble测试",
height: 30, height: 30,
handler: function () { handler: function () {
BI.Bubbles.show("singleBubble1", "bubble测试", this); BI.Bubbles.show("singleBubble1", "bubble测试", this);
@ -22,8 +22,8 @@ Demo.Bubble = BI.inherit(BI.Widget, {
ref: function (_ref) { ref: function (_ref) {
btns.push(_ref); btns.push(_ref);
}, },
type: 'bi.button', type: "bi.button",
text: 'bubble测试(居中显示)', text: "bubble测试(居中显示)",
height: 30, height: 30,
handler: function () { handler: function () {
BI.Bubbles.show("singleBubble2", "bubble测试", this, { BI.Bubbles.show("singleBubble2", "bubble测试", this, {
@ -36,8 +36,8 @@ Demo.Bubble = BI.inherit(BI.Widget, {
ref: function (_ref) { ref: function (_ref) {
btns.push(_ref); btns.push(_ref);
}, },
type: 'bi.button', type: "bi.button",
text: 'bubble测试(右边显示)', text: "bubble测试(右边显示)",
height: 30, height: 30,
handler: function () { handler: function () {
BI.Bubbles.show("singleBubble3", "bubble测试", this, { BI.Bubbles.show("singleBubble3", "bubble测试", this, {
@ -52,7 +52,7 @@ Demo.Bubble = BI.inherit(BI.Widget, {
vgap: 200, vgap: 200,
hgap: 20, hgap: 20,
items: items items: items
} };
} }
}); });
BI.shortcut("demo.bubble", Demo.Bubble); BI.shortcut("demo.bubble", Demo.Bubble);

2
demo/js/base/tip/demo.title.js

@ -33,7 +33,7 @@ Demo.Title = BI.inherit(BI.Widget, {
}], }],
hgap: 300, hgap: 300,
vgap: 20 vgap: 20
} };
} }
}); });
BI.shortcut("demo.title", Demo.Title); BI.shortcut("demo.title", Demo.Title);

42
demo/js/base/tip/demo.toast.js

@ -6,38 +6,38 @@ Demo.Toast = BI.inherit(BI.Widget, {
var items = [ var items = [
{ {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '简单Toast测试', text: "简单Toast测试",
height : 30, height: 30,
handler: function(){ handler: function () {
BI.Msg.toast("这是一条简单的数据"); BI.Msg.toast("这是一条简单的数据");
} }
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '很长的Toast测试', text: "很长的Toast测试",
height : 30, height: 30,
handler: function(){ handler: function () {
BI.Msg.toast("这是一条很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长的数据") BI.Msg.toast("这是一条很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长的数据");
} }
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '非常长的Toast测试', text: "非常长的Toast测试",
height : 30, height: 30,
handler: function(){ handler: function () {
BI.Msg.toast("这是一条非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长的数据") BI.Msg.toast("这是一条非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长非常长的数据");
} }
} }
}, { }, {
el: { el: {
type: 'bi.button', type: "bi.button",
text: '错误提示Toast测试', text: "错误提示Toast测试",
level: "warning", level: "warning",
height : 30, height: 30,
handler: function(){ handler: function () {
BI.Msg.toast("错误提示Toast测试", "warning"); BI.Msg.toast("错误提示Toast测试", "warning");
} }
} }
@ -46,10 +46,10 @@ Demo.Toast = BI.inherit(BI.Widget, {
BI.createWidget({ BI.createWidget({
type: "bi.left", type: "bi.left",
element: this, element: this,
vgap : 200, vgap: 200,
hgap : 20, hgap: 20,
items: items items: items
}) });
} }
}); });
BI.shortcut("demo.toast", Demo.Toast); BI.shortcut("demo.toast", Demo.Toast);

22
demo/js/base/tree/demo.tree_view.js

@ -3,19 +3,19 @@ Demo.Func = BI.inherit(BI.Widget, {
baseCls: "demo-func" baseCls: "demo-func"
}, },
_createDefaultTree: function(){ _createDefaultTree: function () {
var tree = BI.createWidget({ var tree = BI.createWidget({
type: "bi.tree_view" type: "bi.tree_view"
}); });
tree.initTree([ tree.initTree([
{"id":1, "pId":0, "text":"test1", open:true}, {id: 1, pId: 0, text: "test1", open: true},
{"id":11, "pId":1, "text":"test11"}, {id: 11, pId: 1, text: "test11"},
{"id":12, "pId":1, "text":"test12"}, {id: 12, pId: 1, text: "test12"},
{"id":111, "pId":11, "text":"test111"}, {id: 111, pId: 11, text: "test111"},
{"id":2, "pId":0, "text":"test2", open:true}, {id: 2, pId: 0, text: "test2", open: true},
{"id":21, "pId":2, "text":"test21"}, {id: 21, pId: 2, text: "test21"},
{"id":22, "pId":2, "text":"test22"} {id: 22, pId: 2, text: "test22"}
]) ]);
return tree; return tree;
}, },
@ -38,7 +38,7 @@ Demo.Func = BI.inherit(BI.Widget, {
{ {
el: { el: {
type: "bi.label", type: "bi.label",
text: 'tree.initTree([{"id":1, "pId":0, "text":"test1", open:true},{"id":11, "pId":1, "text":"test11"},{"id":12, "pId":1, "text":"test12"},{"id":111, "pId":11, "text":"test111"}])', text: "tree.initTree([{\"id\":1, \"pId\":0, \"text\":\"test1\", open:true},{\"id\":11, \"pId\":1, \"text\":\"test11\"},{\"id\":12, \"pId\":1, \"text\":\"test12\"},{\"id\":111, \"pId\":11, \"text\":\"test111\"}])",
whiteSpace: "normal" whiteSpace: "normal"
}, },
height: 50 height: 50
@ -46,7 +46,7 @@ Demo.Func = BI.inherit(BI.Widget, {
] ]
} }
}] }]
}) });
} }
}); });
BI.shortcut("demo.tree_view", Demo.Func); BI.shortcut("demo.tree_view", Demo.Func);

6
demo/js/case/combo/demo.bubble_combo.js

@ -27,7 +27,7 @@ Demo.Func = BI.inherit(BI.Widget, {
}, },
maxHeight: 200 maxHeight: 200
} }
}) });
var combo2 = BI.createWidget({ var combo2 = BI.createWidget({
type: "bi.bubble_combo", type: "bi.bubble_combo",
el: { el: {
@ -51,7 +51,7 @@ Demo.Func = BI.inherit(BI.Widget, {
maxHeight: 200, maxHeight: 200,
minWidth: 600 minWidth: 600
} }
}) });
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
@ -64,7 +64,7 @@ Demo.Func = BI.inherit(BI.Widget, {
left: 100, left: 100,
bottom: 100 bottom: 100
}] }]
}) });
} }
}); });
BI.shortcut("demo.bubble_combo", Demo.Func); BI.shortcut("demo.bubble_combo", Demo.Func);

10
demo/js/case/combo/demo.editor_icon_check_combo.js

@ -15,19 +15,19 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
width: 200, width: 200,
height: 30, height: 30,
items: [{ items: [{
//text: "MVC-1", // text: "MVC-1",
value: "1" value: "1"
}, { }, {
//text: "MVC-2", // text: "MVC-2",
value: "2" value: "2"
}, { }, {
//text: "MVC-3", // text: "MVC-3",
value: "3" value: "3"
}] }]
}], }],
vgap: 20 vgap: 20
} };
} }
}) });
BI.shortcut("demo.editor_icon_check_combo", Demo.TextValueCombo); BI.shortcut("demo.editor_icon_check_combo", Demo.TextValueCombo);

10
demo/js/case/combo/demo.icon_combo.js

@ -17,10 +17,10 @@ Demo.IconCombo = BI.inherit(BI.Widget, {
type: "bi.icon_combo", type: "bi.icon_combo",
trigger: "click-hover", trigger: "click-hover",
container: "body", container: "body",
ref:function(_ref){ ref: function (_ref) {
self.refs=_ref; self.refs = _ref;
}, },
iconClass: "search-font", iconClass: "search-font",
items: [{ items: [{
value: "第一项", value: "第一项",
iconClass: "close-font" iconClass: "close-font"
@ -33,8 +33,8 @@ Demo.IconCombo = BI.inherit(BI.Widget, {
}] }]
}], }],
vgap: 20 vgap: 20
} };
} }
}) });
BI.shortcut("demo.icon_combo", Demo.IconCombo); BI.shortcut("demo.icon_combo", Demo.IconCombo);

35
demo/js/case/combo/demo.icon_text_value_combo.js

@ -0,0 +1,35 @@
/**
* Created by Windy on 2017/12/13.
*/
Demo.IconTextValueCombo = BI.inherit(BI.Widget, {
props: {
baseCls: ""
},
render: function () {
return {
type: "bi.horizontal_auto",
items: [{
type: "bi.icon_text_value_combo",
text: "默认值",
width: 300,
items: [{
text: "MVC-1",
iconClass: "close-font",
value: 1
}, {
text: "MVC-2",
iconClass: "date-font",
value: 2
}, {
text: "MVC-3",
iconClass: "search-close-h-font",
value: 3
}]
}],
vgap: 20
};
}
});
BI.shortcut("demo.icon_text_value_combo", Demo.IconTextValueCombo);

4
demo/js/case/combo/demo.static_combo.js

@ -38,8 +38,8 @@ Demo.StaticCombo = BI.inherit(BI.Widget, {
] ]
}], }],
vgap: 20 vgap: 20
} };
} }
}) });
BI.shortcut("demo.static_combo", Demo.StaticCombo); BI.shortcut("demo.static_combo", Demo.StaticCombo);

9
demo/js/case/combo/demo.text_value_combo.js

@ -10,23 +10,26 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
return { return {
type: "bi.horizontal_auto", type: "bi.horizontal_auto",
items: [{ items: [{
type: "bi.text_value_combo", type: "bi.icon_text_value_combo",
text: "默认值", text: "默认值",
width: 300, width: 300,
items: [{ items: [{
text: "MVC-1", text: "MVC-1",
iconClass: "date-font",
value: 1 value: 1
}, { }, {
text: "MVC-2", text: "MVC-2",
iconClass: "search-font",
value: 2 value: 2
}, { }, {
text: "MVC-3", text: "MVC-3",
iconClass: "pull-right-font",
value: 3 value: 3
}] }]
}], }],
vgap: 20 vgap: 20
} };
} }
}) });
BI.shortcut("demo.text_value_combo", Demo.TextValueCombo); BI.shortcut("demo.text_value_combo", Demo.TextValueCombo);

4
demo/js/case/combo/demo.text_value_down_list_combo.js

@ -37,12 +37,12 @@ Demo.TextValueDownListCombo = BI.inherit(BI.Widget, {
] ]
}], }],
vgap: 20 vgap: 20
} };
}, },
mounted: function () { mounted: function () {
this.refs.setValue(2); this.refs.setValue(2);
} }
}) });
BI.shortcut("demo.text_value_down_list_combo", Demo.TextValueDownListCombo); BI.shortcut("demo.text_value_down_list_combo", Demo.TextValueDownListCombo);

4
demo/js/case/combo/demo.text_vlaue_check_combo.js

@ -25,8 +25,8 @@ Demo.TextValueCheckCombo = BI.inherit(BI.Widget, {
}] }]
}], }],
vgap: 20 vgap: 20
} };
} }
}) });
BI.shortcut("demo.text_value_check_combo", Demo.TextValueCheckCombo); BI.shortcut("demo.text_value_check_combo", Demo.TextValueCheckCombo);

4
demo/js/case/demo.calendar.js

@ -17,7 +17,7 @@ Demo.Func = BI.inherit(BI.Widget, {
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),
day: date.getDate() day: date.getDate()
} };
}, },
mounted: function () { mounted: function () {
@ -26,7 +26,7 @@ Demo.Func = BI.inherit(BI.Widget, {
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),
day: date.getDate() day: date.getDate()
}) });
} }
}); });
BI.shortcut("demo.calendar", Demo.Func); BI.shortcut("demo.calendar", Demo.Func);

6
demo/js/case/demo.clipboard.js

@ -11,10 +11,10 @@ Demo.Func = BI.inherit(BI.Widget, {
value: "这是复制的内容" value: "这是复制的内容"
}); });
var clipboard = BI.createWidget({ var clipboard = BI.createWidget({
type: 'bi.clipboard', type: "bi.clipboard",
width: 100, width: 100,
height: 100, height: 100,
cls: 'layout-bg1', cls: "layout-bg1",
copy: function () { copy: function () {
return editor.getValue(); return editor.getValue();
}, },
@ -36,7 +36,7 @@ Demo.Func = BI.inherit(BI.Widget, {
left: 100, left: 100,
top: 100 top: 100
}] }]
}) });
} }
}); });
BI.shortcut("demo.clipboard", Demo.Func); BI.shortcut("demo.clipboard", Demo.Func);

2
demo/js/case/demo.color_chooser.js

@ -15,7 +15,7 @@ Demo.Func = BI.inherit(BI.Widget, {
left: 100, left: 100,
top: 250 top: 250
}] }]
} };
} }
}); });
BI.shortcut("demo.color_chooser", Demo.Func); BI.shortcut("demo.color_chooser", Demo.Func);

2
demo/js/case/demo.color_chooser_popup.js

@ -14,7 +14,7 @@ Demo.Func = BI.inherit(BI.Widget, {
left: 100, left: 100,
top: 250 top: 250
}] }]
} };
} }
}); });
BI.shortcut("demo.color_chooser_popup", Demo.Func); BI.shortcut("demo.color_chooser_popup", Demo.Func);

2
demo/js/case/demo.complex_canvas.js

@ -29,7 +29,7 @@ Demo.Func = BI.inherit(BI.Widget, {
left: 100, left: 100,
top: 50 top: 50
}] }]
}) });
} }
}); });
BI.shortcut("demo.complex_canvas", Demo.Func); BI.shortcut("demo.complex_canvas", Demo.Func);

2
demo/js/case/demo.segment.js

@ -22,7 +22,7 @@ Demo.Func = BI.inherit(BI.Widget, {
value: 3 value: 3
}] }]
}] }]
}) });
} }
}); });
BI.shortcut("demo.segment", Demo.Func); BI.shortcut("demo.segment", Demo.Func);

4
demo/js/case/editor/demo.clear_editor.js

@ -15,8 +15,8 @@ Demo.ClearEditor = BI.inherit(BI.Widget, {
watermark: "这个是带清除按钮的" watermark: "这个是带清除按钮的"
}], }],
vgap: 20 vgap: 20
} };
} }
}) });
BI.shortcut("demo.clear_editor", Demo.ClearEditor); BI.shortcut("demo.clear_editor", Demo.ClearEditor);

8
demo/js/case/editor/demo.shelter_editor.js

@ -14,7 +14,7 @@ Demo.ClearEditor = BI.inherit(BI.Widget, {
}, },
watermark: "可以设置标记的输入框", watermark: "可以设置标记的输入框",
text: "这是一个遮罩" text: "这是一个遮罩"
}) });
BI.createWidget({ BI.createWidget({
type: "bi.vertical", type: "bi.vertical",
element: this, element: this,
@ -22,7 +22,7 @@ Demo.ClearEditor = BI.inherit(BI.Widget, {
vgap: 20, vgap: 20,
bgap: 50, bgap: 50,
items: [editor] items: [editor]
}) });
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
@ -39,8 +39,8 @@ Demo.ClearEditor = BI.inherit(BI.Widget, {
left: 10, left: 10,
bottom: 10 bottom: 10
}] }]
}) });
} }
}) });
BI.shortcut("demo.shelter_editor", Demo.ClearEditor); BI.shortcut("demo.shelter_editor", Demo.ClearEditor);

6
demo/js/case/editor/demo.sign_editor.js

@ -14,7 +14,7 @@ Demo.SignEditor = BI.inherit(BI.Widget, {
}, },
watermark: "可以设置标记的输入框", watermark: "可以设置标记的输入框",
text: "这是一个标记,点击它即可进行输入" text: "这是一个标记,点击它即可进行输入"
}) });
editor.setValue(2); editor.setValue(2);
BI.createWidget({ BI.createWidget({
type: "bi.vertical", type: "bi.vertical",
@ -22,8 +22,8 @@ Demo.SignEditor = BI.inherit(BI.Widget, {
hgap: 30, hgap: 30,
vgap: 20, vgap: 20,
items: [editor] items: [editor]
}) });
} }
}) });
BI.shortcut("demo.sign_editor", Demo.SignEditor); BI.shortcut("demo.sign_editor", Demo.SignEditor);

6
demo/js/case/editor/demo.sign_initial_editor.js

@ -9,7 +9,7 @@ Demo.SignInitialEditor = BI.inherit(BI.Widget, {
this.editor.setValue({ this.editor.setValue({
value: "123", value: "123",
text: "sdga" text: "sdga"
}) });
}, },
render: function () { render: function () {
var self = this; var self = this;
@ -26,8 +26,8 @@ Demo.SignInitialEditor = BI.inherit(BI.Widget, {
}], }],
vgap: 20 vgap: 20
} };
} }
}) });
BI.shortcut("demo.sign_initial_editor", Demo.SignInitialEditor); BI.shortcut("demo.sign_initial_editor", Demo.SignInitialEditor);

6
demo/js/case/editor/demo.simple_state_editor.js

@ -19,15 +19,15 @@ Demo.SimpleStateEditor = BI.inherit(BI.Widget, {
}], }],
vgap: 20 vgap: 20
} };
}, },
mounted: function () { mounted: function () {
var self = this; var self = this;
setTimeout(function () { setTimeout(function () {
self.editor.setState(["*", "*"]); self.editor.setState(["*", "*"]);
}, 1000) }, 1000);
} }
}) });
BI.shortcut("demo.simple_state_editor", Demo.SimpleStateEditor); BI.shortcut("demo.simple_state_editor", Demo.SimpleStateEditor);

6
demo/js/case/editor/demo.state_editor.js

@ -19,7 +19,7 @@ Demo.StateEditor = BI.inherit(BI.Widget, {
}], }],
vgap: 20 vgap: 20
} };
}, },
@ -27,8 +27,8 @@ Demo.StateEditor = BI.inherit(BI.Widget, {
var self = this; var self = this;
setTimeout(function () { setTimeout(function () {
self.editor.setState(["*", "*"]); self.editor.setState(["*", "*"]);
}, 1000) }, 1000);
} }
}) });
BI.shortcut("demo.state_editor", Demo.StateEditor); BI.shortcut("demo.state_editor", Demo.StateEditor);

2
demo/js/case/item/demo.multi_select_item.js

@ -16,7 +16,7 @@ Demo.Func = BI.inherit(BI.Widget, {
text: "复选项" text: "复选项"
}], }],
hgap: 300 hgap: 300
} };
} }
}); });
BI.shortcut("demo.multi_select_item", Demo.Func); BI.shortcut("demo.multi_select_item", Demo.Func);

2
demo/js/case/item/demo.single_select_item.js

@ -17,7 +17,7 @@ Demo.Items = BI.inherit(BI.Widget, {
text: "单选项" text: "单选项"
}], }],
hgap: 300 hgap: 300
} };
} }
}); });

2
demo/js/case/item/demo.single_select_radio_item.js

@ -17,7 +17,7 @@ Demo.Items = BI.inherit(BI.Widget, {
text: "单选项" text: "单选项"
}], }],
hgap: 300 hgap: 300
} };
} }
}); });

2
demo/js/case/list/demo.lazy_loader.js

@ -17,7 +17,7 @@ Demo.Func = BI.inherit(BI.Widget, {
items: BI.createItems(BI.deepClone(Demo.CONSTANTS.ITEMS), { items: BI.createItems(BI.deepClone(Demo.CONSTANTS.ITEMS), {
type: "bi.button" type: "bi.button"
}) })
}) });
} }
}); });
BI.shortcut("demo.lazy_loader", Demo.Func); BI.shortcut("demo.lazy_loader", Demo.Func);

2
demo/js/case/list/demo.select_list.js

@ -16,7 +16,7 @@ Demo.Func = BI.inherit(BI.Widget, {
items: BI.createItems(BI.deepClone(Demo.CONSTANTS.SIMPLE_ITEMS), { items: BI.createItems(BI.deepClone(Demo.CONSTANTS.SIMPLE_ITEMS), {
type: "bi.multi_select_item" type: "bi.multi_select_item"
}) })
}) });
} }
}); });
BI.shortcut("demo.select_list", Demo.Func); BI.shortcut("demo.select_list", Demo.Func);

2
demo/js/case/pager/demo.all_count_pager.js

@ -19,7 +19,7 @@ Demo.Func = BI.inherit(BI.Widget, {
curr: 1, curr: 1,
count: 1000 count: 1000
}] }]
}) });
} }
}); });
BI.shortcut("demo.all_count_pager", Demo.Func); BI.shortcut("demo.all_count_pager", Demo.Func);

2
demo/js/case/pager/demo.direction_pager.js

@ -12,7 +12,7 @@ Demo.Func = BI.inherit(BI.Widget, {
items: [{ items: [{
type: "bi.direction_pager" type: "bi.direction_pager"
}] }]
}) });
} }
}); });
BI.shortcut("demo.direction_pager", Demo.Func); BI.shortcut("demo.direction_pager", Demo.Func);

6
demo/js/case/pane/demo.list_pane.js

@ -15,8 +15,8 @@ Demo.Func = BI.inherit(BI.Widget, {
callback(BI.createItems(BI.deepClone(Demo.CONSTANTS.ITEMS), { callback(BI.createItems(BI.deepClone(Demo.CONSTANTS.ITEMS), {
type: "bi.multi_select_item", type: "bi.multi_select_item",
height: 25 height: 25
})) }));
}, 2000) }, 2000);
}, },
el: { el: {
type: "bi.button_group", type: "bi.button_group",
@ -24,7 +24,7 @@ Demo.Func = BI.inherit(BI.Widget, {
type: "bi.vertical" type: "bi.vertical"
}] }]
} }
} };
}, },
mounted: function () { mounted: function () {

2
demo/js/case/pane/demo.multi_popup_view.js

@ -33,7 +33,7 @@ Demo.Func = BI.inherit(BI.Widget, {
} }
} }
}] }]
} };
} }
}); });
BI.shortcut("demo.multi_popup_view", Demo.Func); BI.shortcut("demo.multi_popup_view", Demo.Func);

2
demo/js/case/pane/demo.panel.js

@ -22,7 +22,7 @@ Demo.Func = BI.inherit(BI.Widget, {
height: 25 height: 25
}) })
} }
} };
} }
}); });
BI.shortcut("demo.panel", Demo.Func); BI.shortcut("demo.panel", Demo.Func);

2
demo/js/case/pane/demo.popup_panel.js

@ -33,7 +33,7 @@ Demo.Func = BI.inherit(BI.Widget, {
} }
} }
}] }]
} };
} }
}); });
BI.shortcut("demo.popup_panel", Demo.Func); BI.shortcut("demo.popup_panel", Demo.Func);

2
demo/js/case/table/demo.adaptive_table.js

@ -154,7 +154,7 @@ Demo.Func = BI.inherit(BI.Widget, {
top: 10, top: 10,
bottom: 10 bottom: 10
}] }]
}) });
} }
}); });
BI.shortcut("demo.adaptive_table", Demo.Func); BI.shortcut("demo.adaptive_table", Demo.Func);

2
demo/js/case/table/demo.layer_tree_table.js

@ -143,7 +143,7 @@ Demo.Func = BI.inherit(BI.Widget, {
top: 10, top: 10,
bottom: 10 bottom: 10
}] }]
}) });
} }
}); });
BI.shortcut("demo.layer_tree_table", Demo.Func); BI.shortcut("demo.layer_tree_table", Demo.Func);

2
demo/js/case/table/demo.tree_table.js

@ -143,7 +143,7 @@ Demo.Func = BI.inherit(BI.Widget, {
top: 10, top: 10,
bottom: 10 bottom: 10
}] }]
}) });
} }
}); });
BI.shortcut("demo.tree_table", Demo.Func); BI.shortcut("demo.tree_table", Demo.Func);

2
demo/js/case/tree/demo.branch_relation.js

@ -143,7 +143,7 @@ Demo.Func = BI.inherit(BI.Widget, {
type: "bi.adaptive", type: "bi.adaptive",
element: this, element: this,
items: [relation] items: [relation]
}) });
} }
}); });
BI.shortcut("demo.branch_relation", Demo.Func); BI.shortcut("demo.branch_relation", Demo.Func);

6
demo/js/case/tree/demo.branch_tree.js

@ -134,7 +134,7 @@ Demo.Func = BI.inherit(BI.Widget, {
var tree = this._createBranchTree(); var tree = this._createBranchTree();
var mapTree = this._createBranchMapTree(); var mapTree = this._createBranchMapTree();
function getItems() { function getItems () {
return [{ return [{
text: "且", text: "且",
value: "且", value: "且",
@ -159,7 +159,7 @@ Demo.Func = BI.inherit(BI.Widget, {
type: "bi.label", type: "bi.label",
height: 30, height: 30,
textAlign: "left", textAlign: "left",
text: "这里是一段文字" , text: "这里是一段文字",
value: "这里是一段文字" value: "这里是一段文字"
}, { }, {
text: "且", text: "且",
@ -227,7 +227,7 @@ Demo.Func = BI.inherit(BI.Widget, {
} }
}] }]
}] }]
}) });
} }
}); });
BI.shortcut("demo.branch_tree", Demo.Func); BI.shortcut("demo.branch_tree", Demo.Func);

2
demo/js/case/tree/demo.handstand_branch_tree.js

@ -97,7 +97,7 @@ Demo.Func = BI.inherit(BI.Widget, {
} }
}] }]
}] }]
}) });
} }
}); });
BI.shortcut("demo.handstand_branch_tree", Demo.Func); BI.shortcut("demo.handstand_branch_tree", Demo.Func);

4
demo/js/case/tree/demo.level_tree.js

@ -63,7 +63,7 @@ Demo.Func = BI.inherit(BI.Widget, {
text: "子项3", text: "子项3",
value: 33 value: 33
}] }]
}) });
BI.createWidget({ BI.createWidget({
type: "bi.vtape", type: "bi.vtape",
@ -81,7 +81,7 @@ Demo.Func = BI.inherit(BI.Widget, {
} }
} }
}] }]
}) });
} }
}); });
BI.shortcut("demo.level_tree", Demo.Func); BI.shortcut("demo.level_tree", Demo.Func);

6
demo/js/case/tree/demo.simple_tree.js

@ -4,7 +4,7 @@ Demo.Func = BI.inherit(BI.Widget, {
}, },
render: function () { render: function () {
//value值一定要是字符串 // value值一定要是字符串
var tree = BI.createWidget({ var tree = BI.createWidget({
type: "bi.simple_tree", type: "bi.simple_tree",
items: [] items: []
@ -66,7 +66,7 @@ Demo.Func = BI.inherit(BI.Widget, {
height: 30, height: 30,
text: "setValue(['31', '32', '33'])", text: "setValue(['31', '32', '33'])",
handler: function () { handler: function () {
tree.setValue(['31', '32', '33']); tree.setValue(["31", "32", "33"]);
} }
} }
}, { }, {
@ -80,7 +80,7 @@ Demo.Func = BI.inherit(BI.Widget, {
} }
} }
}] }]
}) });
} }
}); });
BI.shortcut("demo.simple_tree", Demo.Func); BI.shortcut("demo.simple_tree", Demo.Func);

2
demo/js/case/triggers/demo.editor_trigger.js

@ -18,7 +18,7 @@ Demo.Func = BI.inherit(BI.Widget, {
}], }],
hgap: 20, hgap: 20,
vgap: 20 vgap: 20
}) });
} }
}); });
BI.shortcut("demo.editor_trigger", Demo.Func); BI.shortcut("demo.editor_trigger", Demo.Func);

2
demo/js/case/triggers/demo.icon_trigger.js

@ -18,7 +18,7 @@ Demo.Func = BI.inherit(BI.Widget, {
}], }],
hgap: 20, hgap: 20,
vgap: 20 vgap: 20
}) });
} }
}); });
BI.shortcut("demo.icon_trigger", Demo.Func); BI.shortcut("demo.icon_trigger", Demo.Func);

2
demo/js/case/triggers/demo.select_text_trigger.js

@ -19,7 +19,7 @@ Demo.Func = BI.inherit(BI.Widget, {
}], }],
hgap: 20, hgap: 20,
vgap: 20 vgap: 20
}) });
} }
}); });
BI.shortcut("demo.select_text_trigger", Demo.Func); BI.shortcut("demo.select_text_trigger", Demo.Func);

2
demo/js/case/triggers/demo.text_trigger.js

@ -19,7 +19,7 @@ Demo.Func = BI.inherit(BI.Widget, {
}], }],
hgap: 20, hgap: 20,
vgap: 20 vgap: 20
}) });
} }
}); });
BI.shortcut("demo.text_trigger", Demo.Func); BI.shortcut("demo.text_trigger", Demo.Func);

90
demo/js/category/customATree/demo.multilayerselecttree.leveltree.js

@ -26,8 +26,8 @@ BI.PlatformLevelTree = BI.inherit(BI.Widget, {
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) { o.itemsCreator(op, function (items) {
callback(self._formatItems(items)) callback(self._formatItems(items));
}) });
}, },
el: { el: {
@ -44,7 +44,7 @@ BI.PlatformLevelTree = BI.inherit(BI.Widget, {
}); });
this.tree.on(BI.CustomTree.EVENT_CHANGE, function () { this.tree.on(BI.CustomTree.EVENT_CHANGE, function () {
self.fireEvent(BI.PlatformLevelTree.EVENT_CHANGE, arguments); self.fireEvent(BI.PlatformLevelTree.EVENT_CHANGE, arguments);
}) });
}, },
_formatItems: function (nodes) { _formatItems: function (nodes) {
@ -103,93 +103,93 @@ BI.DemoLevelTree = BI.inherit(BI.Widget, {
self.tree = this; self.tree = this;
}, },
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
if (!op.node) {//根节点 if (!op.node) {// 根节点
callback([{ callback([{
"id": 1, id: 1,
"pId": 0, pId: 0,
text: "A", text: "A",
value: 1, value: 1,
isParent: true isParent: true
}, { }, {
"id": 2, id: 2,
"pId": 0, pId: 0,
"text": "B", text: "B",
value: 2, value: 2,
isParent: true, isParent: true,
open: true open: true
}]) }]);
} else { } else {
if (op.node.id == 1) { if (op.node.id == 1) {
callback([ callback([
{ {
"id": 11, id: 11,
"pId": 1, pId: 1,
"text": "test11", text: "test11",
value: 11, value: 11,
layer: 1, layer: 1,
isParent: true isParent: true
}, },
{ {
"id": 12, id: 12,
"pId": 1, pId: 1,
"text": "test12", text: "test12",
value: 12, value: 12,
layer: 1 layer: 1
}, },
{ {
"id": 13, id: 13,
"pId": 1, pId: 1,
"text": "test13", text: "test13",
value: 13, value: 13,
layer: 1 layer: 1
}, },
{ {
"id": 14, id: 14,
"pId": 1, pId: 1,
"text": "test14", text: "test14",
value: 14, value: 14,
layer: 1, layer: 1,
height: 35 height: 35
}, },
{ {
"id": 15, id: 15,
"pId": 1, pId: 1,
"text": "test15", text: "test15",
value: 15, value: 15,
layer: 1 layer: 1
}, },
{ {
"id": 16, id: 16,
"pId": 1, pId: 1,
"text": "test16", text: "test16",
value: 16, value: 16,
layer: 1 layer: 1
}, },
{"id": 17, "pId": 1, "text": "test17", layer: 1, value: 17} {id: 17, pId: 1, text: "test17", layer: 1, value: 17}
]) ]);
} else if (op.node.id == 2) { } else if (op.node.id == 2) {
callback([{ callback([{
"id": 21, id: 21,
"pId": 2, pId: 2,
"text": "test21", text: "test21",
value: 21, value: 21,
layer: 1 layer: 1
}, },
{ {
"id": 22, id: 22,
"pId": 2, pId: 2,
"text": "test22", text: "test22",
value: 22, value: 22,
layer: 1 layer: 1
}]) }]);
} else if (op.node.id == 11) { } else if (op.node.id == 11) {
callback([{ callback([{
"id": 111, id: 111,
"pId": 11, pId: 11,
"text": "test111", text: "test111",
value: 111, value: 111,
layer: 2 layer: 2
}]) }]);
} }
} }
} }
@ -205,7 +205,7 @@ BI.DemoLevelTree = BI.inherit(BI.Widget, {
height: 25 height: 25
}] }]
} };
}, },
mounted: function () { mounted: function () {

6
demo/js/category/largeTable/cell.js

@ -8,7 +8,7 @@ BI.DetailTableCell = BI.inherit(BI.Widget, {
baseCls: "bi-detail-table-cell", baseCls: "bi-detail-table-cell",
dId: "", dId: "",
text: "" text: ""
}) });
}, },
_init: function () { _init: function () {
@ -36,9 +36,9 @@ BI.DetailTableCell = BI.inherit(BI.Widget, {
type: "bi.vertical", type: "bi.vertical",
element: this, element: this,
items: [item] items: [item]
}) });
//表格样式 // 表格样式
if (BI.isNotNull(o.styles) && BI.isObject(o.styles)) { if (BI.isNotNull(o.styles) && BI.isObject(o.styles)) {
this.element.css(o.styles); this.element.css(o.styles);
} }

4
demo/js/category/largeTable/header.js

@ -5,7 +5,7 @@ BI.DetailTableHeader = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.DetailTableHeader.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.DetailTableHeader.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-detail-table-header" baseCls: "bi-detail-table-header"
}) });
}, },
_init: function () { _init: function () {
@ -29,7 +29,7 @@ BI.DetailTableHeader = BI.inherit(BI.Widget, {
}] }]
}); });
//表格样式 // 表格样式
if (BI.isNotNull(o.styles) && BI.isObject(o.styles)) { if (BI.isNotNull(o.styles) && BI.isObject(o.styles)) {
this.element.css(o.styles); this.element.css(o.styles);
} }

6
demo/js/category/largeTable/largeTable.js

@ -67,7 +67,7 @@ Demo.Face = BI.inherit(BI.Widget, {
top: 0, top: 0,
bottom: 0 bottom: 0
}] }]
} };
}, },
mounted: function () { mounted: function () {
@ -114,7 +114,7 @@ Demo.Face = BI.inherit(BI.Widget, {
for (var m = 0; m < times - 1; m++) { for (var m = 0; m < times - 1; m++) {
BI.each(items[n % 100], function (j, item) { BI.each(items[n % 100], function (j, item) {
copy[n].push(item); copy[n].push(item);
}) });
} }
} }
return copy; return copy;
@ -126,7 +126,7 @@ Demo.Face = BI.inherit(BI.Widget, {
for (var m = 0; m < times - 1; m++) { for (var m = 0; m < times - 1; m++) {
BI.each(items[n], function (j, item) { BI.each(items[n], function (j, item) {
copy[n].push(item); copy[n].push(item);
}) });
} }
} }
return copy; return copy;

2
demo/js/category/largeTable/sequenceheadercell.normal.js

@ -6,7 +6,7 @@ BI.NormalSequenceHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.NormalSequenceHeaderCell.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.NormalSequenceHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-normal-sequence-header-cell" baseCls: "bi-normal-sequence-header-cell"
}) });
}, },
_init: function () { _init: function () {

4
demo/js/category/largeTable/table.js

File diff suppressed because one or more lines are too long

112
demo/js/category/sortTree/demo.sortTree.js

@ -8,7 +8,7 @@ Demo.Expander = BI.inherit(BI.Widget, {
}, },
el: o.el, el: o.el,
popup: o.popup popup: o.popup
} };
}, },
update: function (opt) { update: function (opt) {
@ -16,7 +16,7 @@ Demo.Expander = BI.inherit(BI.Widget, {
return true; return true;
} }
}); });
BI.shortcut("demo.sort_tree_expander", Demo.Expander) BI.shortcut("demo.sort_tree_expander", Demo.Expander);
/** /**
* guy * guy
@ -27,6 +27,7 @@ BI.shortcut("demo.sort_tree_expander", Demo.Expander)
Demo.SortTree = BI.inherit(BI.Widget, { Demo.SortTree = BI.inherit(BI.Widget, {
render: function () { render: function () {
BI.$import("https://coding.net/u/fanruan/p/bi-components/git/raw/master/dist/jqueryui.js");
var self = this, o = this.options; var self = this, o = this.options;
var tree = new BI.Tree(); var tree = new BI.Tree();
tree.initTree(BI.Tree.transformToTreeFormat(Demo.CONSTANTS.TREEITEMS)); tree.initTree(BI.Tree.transformToTreeFormat(Demo.CONSTANTS.TREEITEMS));
@ -47,64 +48,65 @@ Demo.SortTree = BI.inherit(BI.Widget, {
}] }]
} }
}); });
BI.delay(function () {
self.tree.element.sortable({
items: ".sort-item",
placeholder: {
element: function ($currentItem) {
var holder = BI.createWidget({
type: "bi.layout",
cls: "bi-sortable-holder",
height: $currentItem.outerHeight()
});
holder.element.css({
"margin-left": $currentItem.css("margin-left"),
"margin-right": $currentItem.css("margin-right"),
"margin-top": $currentItem.css("margin-top"),
"margin-bottom": $currentItem.css("margin-bottom"),
margin: $currentItem.css("margin")
});
return holder.element;
},
update: function () {
this.tree.element.sortable({ }
items: ".sort-item",
placeholder: {
element: function ($currentItem) {
var holder = BI.createWidget({
type: "bi.layout",
cls: "bi-sortable-holder",
height: $currentItem.outerHeight()
});
holder.element.css({
"margin-left": $currentItem.css("margin-left"),
"margin-right": $currentItem.css("margin-right"),
"margin-top": $currentItem.css("margin-top"),
"margin-bottom": $currentItem.css("margin-bottom"),
"margin": $currentItem.css("margin")
});
return holder.element;
}, },
update: function () { update: function (event, ui) {
var node = ui.item.data("node");
} var findTheNode = tree.search(node.id);
}, // 这里简单处理下找到它的父节点
update: function (event, ui) { var currentIndex = 0, parentNode;
var node = ui.item.data("node"); if (ui.item.next().length > 0) {
var findTheNode = tree.search(node.id); var n = ui.item.next().data("node");
//这里简单处理下找到它的父节点 var nextId = n.id;
var currentIndex = 0, parentNode; var nextNode = tree.search(nextId);
if (ui.item.next().length > 0) { parentNode = nextNode.getParent();
var n = ui.item.next().data("node"); var nextIndex = parentNode.getChildIndex(nextId);
var nextId = n.id; currentIndex = nextIndex > 0 && (nextIndex - 1);
var nextNode = tree.search(nextId)
parentNode = nextNode.getParent();
var nextIndex = parentNode.getChildIndex(nextId);
currentIndex = nextIndex > 0 && (nextIndex - 1);
} else if (ui.item.prev().length > 0) { } else if (ui.item.prev().length > 0) {
var n = ui.item.prev().data("node"); var n = ui.item.prev().data("node");
var prevId = n.id; var prevId = n.id;
var prevNode = tree.search(prevId) var prevNode = tree.search(prevId);
parentNode = prevNode.getParent(); parentNode = prevNode.getParent();
var prevIndex = parentNode.getChildIndex(prevId); var prevIndex = parentNode.getChildIndex(prevId);
currentIndex = prevIndex + 1; currentIndex = prevIndex + 1;
} }
findTheNode.getParent().removeChild(node.id); findTheNode.getParent().removeChild(node.id);
parentNode.addChild(findTheNode, currentIndex); parentNode.addChild(findTheNode, currentIndex);
console.log(tree.toJSON()); console.log(tree.toJSON());
self.tree.populate(self._formatItems(0, tree.toJSON())); self.tree.populate(self._formatItems(0, tree.toJSON()));
}, },
start: function (event, ui) { start: function (event, ui) {
}, },
stop: function (event, ui) { stop: function (event, ui) {
}, },
over: function (event, ui) { over: function (event, ui) {
} }
}); });
}, 2000);
}, },
_formatItems: function (layer, nodes) { _formatItems: function (layer, nodes) {

2
demo/js/center.js

@ -16,7 +16,7 @@ Demo.Center = BI.inherit(BI.Widget, {
type: v type: v
}); });
} }
} };
}, },
setValue: function (v) { setValue: function (v) {

48
demo/js/chart/demo.axis_chart.js

@ -13,7 +13,7 @@ Demo.Func = BI.inherit(BI.Widget, {
cardCreator: function (v) { cardCreator: function (v) {
return { return {
type: v type: v
} };
} }
}; };
}, },
@ -21,32 +21,32 @@ Demo.Func = BI.inherit(BI.Widget, {
mounted: function () { mounted: function () {
var self = this; var self = this;
var items = [[{ var items = [[{
"data": [ data: [
{"x": "孙林", "y": 789}, {x: "孙林", y: 789},
{"x": "金士鹏", "y": 156}, {x: "金士鹏", y: 156},
{"x": "张珊", "y": 289}, {x: "张珊", y: 289},
{"x": "孙阳", "y": 562}, {x: "孙阳", y: 562},
{"x": "袁成洁", "y": 546}, {x: "袁成洁", y: 546},
{"x": "张颖", "y": 218}, {x: "张颖", y: 218},
{"x": "王伟", "y": 541}, {x: "王伟", y: 541},
{"x": "张武", "y": 219}, {x: "张武", y: 219},
{"x": "韩文", "y": 345} {x: "韩文", y: 345}
], ],
"name": "测试1", name: "测试1",
stack: 1 stack: 1
}, { }, {
"data": [ data: [
{"x": "孙林", "y": 789}, {x: "孙林", y: 789},
{"x": "金士鹏", "y": 156}, {x: "金士鹏", y: 156},
{"x": "张珊", "y": 289}, {x: "张珊", y: 289},
{"x": "孙阳", "y": 562}, {x: "孙阳", y: 562},
{"x": "袁成洁", "y": 546}, {x: "袁成洁", y: 546},
{"x": "张颖", "y": 218}, {x: "张颖", y: 218},
{"x": "王伟", "y": 541}, {x: "王伟", y: 541},
{"x": "张武", "y": 219}, {x: "张武", y: 219},
{"x": "韩文", "y": 345} {x: "韩文", y: 345}
], ],
"name": "测试2", name: "测试2",
stack: 1 stack: 1
}]]; }]];
var types = ["bi.axis_chart", "bi.line_chart", "bi.bar_chart"]; var types = ["bi.axis_chart", "bi.line_chart", "bi.bar_chart"];
@ -60,7 +60,7 @@ Demo.Func = BI.inherit(BI.Widget, {
} }
self.tab.setSelect(types[index]); self.tab.setSelect(types[index]);
self.tab.populate(BI.deepClone(items)); self.tab.populate(BI.deepClone(items));
}, 2000) }, 2000);
}, },
destroyed: function () { destroyed: function () {

4
demo/js/config/case.js

@ -130,6 +130,10 @@ Demo.CASE_CONFIG = [{
pId: 306, pId: 306,
text: "bi.text_value_combo", text: "bi.text_value_combo",
value: "demo.text_value_combo" value: "demo.text_value_combo"
}, {
pId: 306,
text: "bi.icon_text_value_combo",
value: "demo.icon_text_value_combo"
}, { }, {
pId: 306, pId: 306,
text: "bi.text_value_check_combo", text: "bi.text_value_check_combo",

4
demo/js/config/core.js

@ -162,8 +162,8 @@ Demo.CORE_CONFIG = [{
text: "弹出层" text: "弹出层"
}, { }, {
pId: 10202, pId: 10202,
text: "bi.float_box", text: "bi.popover",
value: "demo.float_box" value: "demo.popover"
}, { }, {
pId: 10202, pId: 10202,
text: "bi.popup_view", text: "bi.popup_view",

35
demo/js/config/fix.js

@ -1,4 +1,4 @@
//定义Model路由 // 定义Model路由
var modelRouter = new (BI.inherit(BI.WRouter, { var modelRouter = new (BI.inherit(BI.WRouter, {
routes: { routes: {
"": "index" "": "index"
@ -8,7 +8,7 @@ var modelRouter = new (BI.inherit(BI.WRouter, {
return {}; return {};
} }
})); }));
//定义View路由 // 定义View路由
var viewRouter = new (BI.inherit(BI.WRouter, { var viewRouter = new (BI.inherit(BI.WRouter, {
routes: { routes: {
"": "TestView", "": "TestView",
@ -49,7 +49,7 @@ var viewRouter = new (BI.inherit(BI.WRouter, {
} }
})); }));
//注册路由 // 注册路由
BI.View.registerVMRouter(viewRouter, modelRouter); BI.View.registerVMRouter(viewRouter, modelRouter);
@ -87,39 +87,44 @@ Demo.FIX_CONFIG = [{
id: 71, id: 71,
pId: 7, pId: 7,
text: "定义响应式数据", text: "定义响应式数据",
value: "demo.fix1" value: "demo.fix_define"
}, { }, {
id: 72, id: 72,
pId: 7, pId: 7,
text: "state属性", text: "state属性",
value: "demo.fix6" value: "demo.fix_state"
}, { }, {
id: 78, id: 73,
pId: 7, pId: 7,
text: "计算属性", text: "计算属性",
value: "demo.fix2" value: "demo.fix_computed"
}, { }, {
id: 73, id: 74,
pId: 7, pId: 7,
text: "store", text: "store",
value: "demo.fix3" value: "demo.fix_store"
}, { }, {
id: 74, id: 75,
pId: 7, pId: 7,
text: "watcher且或表达式", text: "watcher且或表达式",
value: "demo.fix4" value: "demo.fix_watcher"
}, { }, {
id: 75, id: 76,
pId: 7, pId: 7,
text: "watcher星号表达式", text: "watcher星号表达式",
value: "demo.fix5" value: "demo.fix_global_watcher"
}, { }, {
id: 76, id: 77,
pId: 7,
text: "context",
value: "demo.fix_context"
}, {
id: 78,
pId: 7, pId: 7,
text: "一个混合的例子", text: "一个混合的例子",
value: "demo.fix" value: "demo.fix"
}, { }, {
id: 77, id: 79,
pId: 7, pId: 7,
text: "场景", text: "场景",
value: "demo.fix_scene" value: "demo.fix_scene"

14
demo/js/config/widget.js

@ -5,7 +5,7 @@ Demo.WIDGET_CONFIG = [{
}, { }, {
pId: 4, pId: 4,
id: 401, id: 401,
text: '各种小控件' text: "各种小控件"
}, { }, {
pId: 401, pId: 401,
text: "各种通用按钮", text: "各种通用按钮",
@ -180,8 +180,8 @@ Demo.WIDGET_CONFIG = [{
value: "demo.date_time" value: "demo.date_time"
}, { }, {
pId: 412, pId: 412,
text: 'bi.time_interval', text: "bi.time_interval",
value: 'demo.time_interval' value: "demo.time_interval"
}, { }, {
pId: 4, pId: 4,
id: 413, id: 413,
@ -238,4 +238,12 @@ Demo.WIDGET_CONFIG = [{
id: 420, id: 420,
text: "滚动sliders", text: "滚动sliders",
value: "demo.slider" value: "demo.slider"
}, {
pId: 4,
id: 421,
text: "单选下拉框"
}, {
pId: 421,
text: "bi.single_select_combo",
value: "demo.single_select_combo"
}]; }];

18
demo/js/core/abstract/combination/demo.combo.js

@ -204,8 +204,8 @@ Demo.Func = BI.inherit(BI.Widget, {
}, },
isAllCheckedBySelectedValue: function (selectedValue) { isAllCheckedBySelectedValue: function (selectedValue) {
return selectedValue.length == self.years.length return selectedValue.length == self.years.length;
// return true; // return true;
} }
}], }],
buttons: [{ buttons: [{
@ -294,7 +294,7 @@ Demo.Func = BI.inherit(BI.Widget, {
text: val, text: val,
value: val, value: val,
height: 25 height: 25
} };
}); });
popuplate(map); popuplate(map);
@ -302,7 +302,7 @@ Demo.Func = BI.inherit(BI.Widget, {
}, },
hasNext: function (options) { hasNext: function (options) {
return options.times < 3 return options.times < 3;
} }
}, },
buttons: [{ buttons: [{
@ -327,7 +327,7 @@ Demo.Func = BI.inherit(BI.Widget, {
items: [yearCombo, multiCombo, dynamicPopupCombo, dynamicCombo], items: [yearCombo, multiCombo, dynamicPopupCombo, dynamicCombo],
hgap: 20, hgap: 20,
vgap: 20 vgap: 20
}) });
}, },
_createBottom: function () { _createBottom: function () {
@ -408,7 +408,7 @@ Demo.Func = BI.inherit(BI.Widget, {
type: "bi.table", type: "bi.table",
columns: 2, columns: 2,
rows: 6, rows: 6,
columnSize: [0.5, 'fill'], columnSize: [0.5, "fill"],
rowSize: 30 rowSize: 30
}, },
left: 4, left: 4,
@ -458,7 +458,7 @@ Demo.Func = BI.inherit(BI.Widget, {
type: "bi.text_button", type: "bi.text_button",
whiteSpace: "normal", whiteSpace: "normal",
text: new Date().getFullYear() + v text: new Date().getFullYear() + v
}) });
} }
} }
}, },
@ -470,7 +470,7 @@ Demo.Func = BI.inherit(BI.Widget, {
items: [combo, childCombo, monthCombo, yearCombo], items: [combo, childCombo, monthCombo, yearCombo],
hgap: 20, hgap: 20,
vgap: 20 vgap: 20
}) });
}, },
render: function () { render: function () {
@ -487,7 +487,7 @@ Demo.Func = BI.inherit(BI.Widget, {
row: 1, row: 1,
el: this._createBottom() el: this._createBottom()
}] }]
} };
} }
}); });
BI.shortcut("demo.combo", Demo.Func); BI.shortcut("demo.combo", Demo.Func);

16
demo/js/core/abstract/combination/demo.combo2.js

@ -8,7 +8,7 @@ Demo.Func = BI.inherit(BI.Widget, {
type: "bi.button", type: "bi.button",
height: 25, height: 25,
text: "点击" text: "点击"
} };
}, },
oneCombo: function () { oneCombo: function () {
@ -71,7 +71,7 @@ Demo.Func = BI.inherit(BI.Widget, {
height: 1200 height: 1200
} }
} }
}) });
}, },
fiveCombo: function () { fiveCombo: function () {
@ -89,7 +89,7 @@ Demo.Func = BI.inherit(BI.Widget, {
}, },
maxHeight: 2000 maxHeight: 2000
} }
}) });
}, },
sixCombo: function () { sixCombo: function () {
@ -106,7 +106,7 @@ Demo.Func = BI.inherit(BI.Widget, {
height: 1200 height: 1200
} }
} }
}) });
}, },
sevenCombo: function () { sevenCombo: function () {
@ -116,7 +116,7 @@ Demo.Func = BI.inherit(BI.Widget, {
adjustYOffset: 5, adjustYOffset: 5,
direction: "bottom", direction: "bottom",
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
//isNeedAdjustHeight: false, // isNeedAdjustHeight: false,
offsetStyle: "center", offsetStyle: "center",
el: this._createEl(), el: this._createEl(),
popup: { popup: {
@ -126,7 +126,7 @@ Demo.Func = BI.inherit(BI.Widget, {
height: 1200 height: 1200
} }
} }
}) });
}, },
eightCombo: function () { eightCombo: function () {
@ -136,7 +136,7 @@ Demo.Func = BI.inherit(BI.Widget, {
adjustYOffset: 5, adjustYOffset: 5,
direction: "right", direction: "right",
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
//isNeedAdjustHeight: false, // isNeedAdjustHeight: false,
offsetStyle: "middle", offsetStyle: "middle",
el: this._createEl(), el: this._createEl(),
popup: { popup: {
@ -146,7 +146,7 @@ Demo.Func = BI.inherit(BI.Widget, {
height: 200 height: 200
} }
} }
}) });
}, },
render: function () { render: function () {

4
demo/js/core/abstract/combination/demo.combo_group.js

@ -68,7 +68,7 @@ Demo.Func = BI.inherit(BI.Widget, {
items: [childCombo], items: [childCombo],
hgap: 20, hgap: 20,
vgap: 20 vgap: 20
}) });
}, },
render: function () { render: function () {
@ -81,7 +81,7 @@ Demo.Func = BI.inherit(BI.Widget, {
row: 0, row: 0,
el: this._createBottom() el: this._createBottom()
}] }]
} };
} }
}); });
BI.shortcut("demo.combo_group", Demo.Func); BI.shortcut("demo.combo_group", Demo.Func);

2
demo/js/core/abstract/combination/demo.expander.js

@ -35,7 +35,7 @@ Demo.Func = BI.inherit(BI.Widget, {
}) })
} }
}] }]
} };
} }
}); });
BI.shortcut("demo.expander", Demo.Func); BI.shortcut("demo.expander", Demo.Func);

6
demo/js/core/abstract/combination/demo.loader.js

@ -14,14 +14,14 @@ Demo.Func = BI.inherit(BI.Widget, {
return BI.extend(v, { return BI.extend(v, {
type: "bi.single_select_item", type: "bi.single_select_item",
height: 25 height: 25
}) });
})) }));
}, 1000); }, 1000);
}, },
hasNext: function (options) { hasNext: function (options) {
return options.times * 10 < items.length; return options.times * 10 < items.length;
} }
} };
} }
}); });
BI.shortcut("demo.loader", Demo.Func); BI.shortcut("demo.loader", Demo.Func);

4
demo/js/core/abstract/combination/demo.navigation.js

@ -7,7 +7,7 @@ Demo.Func = BI.inherit(BI.Widget, {
type: "bi.label", type: "bi.label",
cls: "layout-bg" + BI.random(1, 8), cls: "layout-bg" + BI.random(1, 8),
text: "第" + v + "页" text: "第" + v + "页"
}) });
}, },
render: function () { render: function () {
@ -29,7 +29,7 @@ Demo.Func = BI.inherit(BI.Widget, {
}] }]
}, },
cardCreator: BI.bind(this._createNav, this) cardCreator: BI.bind(this._createNav, this)
} };
} }
}); });
BI.shortcut("demo.navigation", Demo.Func); BI.shortcut("demo.navigation", Demo.Func);

4
demo/js/core/abstract/combination/demo.sercher.js

@ -10,7 +10,7 @@ Demo.Func = BI.inherit(BI.Widget, {
handler: function (v) { handler: function (v) {
} }
}) });
}, },
render: function () { render: function () {
@ -78,7 +78,7 @@ Demo.Func = BI.inherit(BI.Widget, {
top: 100, top: 100,
left: 300 left: 300
}] }]
}) });
} }
}); });
BI.shortcut("demo.searcher", Demo.Func); BI.shortcut("demo.searcher", Demo.Func);

2
demo/js/core/abstract/combination/demo.switcher.js

@ -53,7 +53,7 @@ Demo.Func = BI.inherit(BI.Widget, {
}, },
adapter: adapter adapter: adapter
}] }]
}) });
} }
}); });
BI.shortcut("demo.switcher", Demo.Func); BI.shortcut("demo.switcher", Demo.Func);

6
demo/js/core/abstract/combination/demo.tab.js

@ -10,13 +10,13 @@ Demo.Func = BI.inherit(BI.Widget, {
type: "bi.label", type: "bi.label",
cls: "layout-bg1", cls: "layout-bg1",
text: "面板1" text: "面板1"
}) });
case 2: case 2:
return BI.createWidget({ return BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "layout-bg2", cls: "layout-bg2",
text: "面板2" text: "面板2"
}) });
} }
}, },
@ -61,7 +61,7 @@ Demo.Func = BI.inherit(BI.Widget, {
left: 200, left: 200,
top: 200 top: 200
}] }]
}) });
tab.setSelect(2); tab.setSelect(2);
} }

4
demo/js/core/abstract/demo.button_group.js

@ -52,11 +52,11 @@ Demo.Func = BI.inherit(BI.Widget, {
type: "bi.label", type: "bi.label",
text: "3" text: "3"
} }
}]) }]);
} }
}] }]
} };
} }
}); });
BI.shortcut("demo.button_group", Demo.Func); BI.shortcut("demo.button_group", Demo.Func);

2
demo/js/core/abstract/demo.button_tree.js

@ -20,7 +20,7 @@ Demo.Func = BI.inherit(BI.Widget, {
text: "1", text: "1",
value: 1 value: 1
}] }]
} };
} }
}); });
BI.shortcut("demo.button_tree", Demo.Func); BI.shortcut("demo.button_tree", Demo.Func);

4
demo/js/core/abstract/demo.collection_view.js

@ -22,7 +22,7 @@ Demo.Func = BI.inherit(BI.Widget, {
y: Math.floor(index / 10) * 50, y: Math.floor(index / 10) * 50,
width: 50, width: 50,
height: 50 height: 50
} };
} }
}); });
BI.createWidget({ BI.createWidget({
@ -35,7 +35,7 @@ Demo.Func = BI.inherit(BI.Widget, {
top: 10, top: 10,
bottom: 10 bottom: 10
}] }]
}) });
} }
}); });
BI.shortcut("demo.collection_view", Demo.Func); BI.shortcut("demo.collection_view", Demo.Func);

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

Loading…
Cancel
Save