Browse Source

Merge pull request #603 in VISUAL/fineui from ~GUY/fineui:master to master

* commit '919c2080760a940eb67cb1206e0793b1845bad15':
  update
  update
  update
  node环境
  update
  add
  update
  update
  added
  multiselect loader
es6
Young 6 years ago
parent
commit
6fcbfe1cf9
  1. 55
      Gruntfile.js
  2. 72
      demo/js/base/tree/demo.part_tree.js
  3. 6
      demo/js/base/tree/demo.sync_tree.js
  4. 137
      demo/js/category/largeTable/largeTable.js
  5. 4
      demo/js/config/category.js
  6. 14
      demo/js/face.js
  7. 39
      dist/_fineui.min.js
  8. 299
      dist/base.js
  9. 695
      dist/bundle.js
  10. 78
      dist/bundle.min.js
  11. 365
      dist/core.js
  12. 234
      dist/demo.js
  13. 701
      dist/fineui.js
  14. 78
      dist/fineui.min.js
  15. 65375
      dist/fineui_without_jquery_polyfill.js
  16. 4
      dist/fix/fix.compact.js
  17. 6
      dist/fix/fix.js
  18. 6
      dist/polyfill.js
  19. 8
      dist/router.js
  20. 138
      dist/utils.js
  21. 10
      dist/utils.min.js
  22. 13
      dist/widget.js
  23. 742
      package-lock.json
  24. 280
      src/base/single/button/buttons/button.js
  25. 12
      src/base/single/input/file.js
  26. 4
      src/base/tree/treeview.js
  27. 20
      src/core/alias.js
  28. 58
      src/core/base.js
  29. 6
      src/core/config.js
  30. 2
      src/core/controller/controller.resizer.js
  31. 14
      src/core/foundation.js
  32. 4
      src/core/func/dom.js
  33. 18
      src/core/inject.js
  34. 2
      src/core/ob.js
  35. 2
      src/core/proto/date.i18n.js
  36. 2
      src/core/shortcut.js
  37. 12
      src/core/utils/detectElementResize.js
  38. 14
      src/core/utils/events/mousemovetracker.js
  39. 2
      src/core/utils/events/wheelhandler.js
  40. 2
      src/core/utils/prefixIntervalTree.js
  41. 50
      src/core/widget.js
  42. 6
      src/core/wrapper/layout.js
  43. 17
      src/core/wrapper/layout/adapt/adapt.center.js
  44. 17
      src/core/wrapper/layout/adapt/adapt.horizontal.js
  45. 17
      src/core/wrapper/layout/adapt/adapt.vertical.js
  46. 17
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js
  47. 17
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
  48. 17
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js
  49. 18
      src/core/wrapper/layout/layout.horizontal.js
  50. 17
      src/core/wrapper/layout/layout.td.js
  51. 2
      src/polyfill/console.js
  52. 2
      src/polyfill/localStorage.js
  53. 2
      src/polyfill/sort.js
  54. 8
      src/router/router.js
  55. 2
      src/third/jquery.mousewheel.js
  56. 13
      src/widget/multiselect/multiselect.loader.js

55
Gruntfile.js

@ -13,9 +13,9 @@ module.exports = function (grunt) {
}, },
coreJs: { coreJs: {
src: [ src: [
"src/core/foundation.js",
"src/core/jquery.js", "src/core/jquery.js",
"src/core/lodash.js", "src/core/lodash.js",
"src/core/foundation.js",
// 'src/core/mvc/**/*.js', // 'src/core/mvc/**/*.js',
"src/core/base.js", "src/core/base.js",
"src/core/ob.js", "src/core/ob.js",
@ -128,6 +128,52 @@ module.exports = function (grunt) {
dest: "dist/fineui.js" dest: "dist/fineui.js"
}, },
fineuiWithoutJqueryAndPolyfillJs: {
src: ["src/core/foundation.js",
"src/core/lodash.js",
// 'src/core/mvc/**/*.js',
"src/core/base.js",
"src/core/ob.js",
"src/core/widget.js",
// 'src/core/model.js',
// 'src/core/view.js',
"src/core/shortcut.js",
"src/core/utils/*.js",
"src/core/behavior/behavior.js",
"src/core/wrapper/layout.js",
"src/core/plugin.js",
"src/core/**/*.js",
"!src/core/jquery.js",
"!src/core/func/dom.js",
"!src/core/proto/jquery.js",
"!src/core/proto/event.js",
"src/data/data.js",
"src/data/**/*.js",
"dist/fix/fix.js",
"src/base/pane.js",
"src/base/single/single.js",
"src/base/single/text.js",
"src/base/single/button/button.basic.js",
"src/base/single/button/button.node.js",
"src/base/single/tip/tip.js",
"src/base/combination/group.button.js",
"src/base/combination/tree.button.js",
"src/base/combination/map.button.js",
"src/base/**/*.js",
"!src/base/tree/**/*.js",
"!src/base/single/input/file.js",
"src/case/combo/popup.bubble.js",
"src/case/**/*.js",
"!src/case/colorchooser/**/*.js",
"!src/case/tree/tree.display.js",
"dist/widget.js", "dist/fix/fix.compact.js", "ui/js/**/*.js", "!ui/js/fineui.i18n.js"],
dest: "dist/fineui_without_jquery_polyfill.js"
},
fineuiCss: { fineuiCss: {
src: ["dist/core.css", "dist/base.css", "dist/widget.css", "ui/css/app.css", "ui/css/**/*.css"], src: ["dist/core.css", "dist/base.css", "dist/widget.css", "ui/css/app.css", "ui/css/**/*.css"],
dest: "dist/fineui.css" dest: "dist/fineui.css"
@ -147,8 +193,8 @@ module.exports = function (grunt) {
}, },
utilsJs: { utilsJs: {
src: [ src: [
"src/core/lodash.js",
"src/core/foundation.js", "src/core/foundation.js",
"src/core/lodash.js",
"src/core/var.js", "src/core/var.js",
"src/core/proto/array.js", "src/core/proto/array.js",
"src/core/proto/number.js", "src/core/proto/number.js",
@ -250,7 +296,7 @@ module.exports = function (grunt) {
}, },
watch: { watch: {
scripts: { scripts: {
files: ["src/**/*", "demo/js/**/*.js", "demo/version.js", "demo/config.js", "demo/less/**/*.less"], files: ["src/**/*.js", "src/**/*.less", "demo/js/**/*.js", "demo/version.js", "demo/config.js", "demo/less/**/*.less"],
tasks: ["less", "concat"], tasks: ["less", "concat"],
options: { options: {
spanw: true, spanw: true,
@ -291,12 +337,11 @@ module.exports = function (grunt) {
grunt.loadNpmTasks("grunt-contrib-connect"); grunt.loadNpmTasks("grunt-contrib-connect");
grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-clean');
var defaultTask = ["clean", "less", "concat", "connect", "watch"]; var defaultTask = ["less", "concat", "connect", "watch"];
grunt.registerTask("default", defaultTask); grunt.registerTask("default", defaultTask);
grunt.registerTask("compile", function () { grunt.registerTask("compile", function () {
grunt.config.set("connect.options.open", false); grunt.config.set("connect.options.open", false);
grunt.task.run(defaultTask); grunt.task.run(defaultTask);
}); });
grunt.registerTask("min", ["clean", "less", "concat", "uglify", "cssmin"]);
grunt.registerTask("build", ["clean", "less", "cssmin", "concat", "uglify"]); grunt.registerTask("build", ["clean", "less", "cssmin", "concat", "uglify"]);
}; };

72
demo/js/base/tree/demo.part_tree.js

@ -3,7 +3,79 @@ Demo.Func = BI.inherit(BI.Widget, {
baseCls: "demo-func" baseCls: "demo-func"
}, },
mounted: function () {
this.partTree.stroke({
keyword: "1"
});
},
render: function () { render: function () {
var self = this;
return {
type: "bi.vtape",
items: [{
type: "bi.label",
height: 50,
text: "先初始化一份数据,然后再异步获取数据的树"
}, {
type: "bi.part_tree",
ref: function (_ref) {
self.partTree = _ref;
},
paras: {
selectedValues: {"1": {}, "2": {"1": {}}}
},
itemsCreator: function (op, callback) {
if (op.type === BI.TreeView.REQ_TYPE_INIT_DATA) {
callback({
items: [{
id: "1",
text: 1,
isParent: true,
open: true
}, {
id: "11",
pId: "1",
text: 11,
isParent: true,
open: true
}, {
id: "111",
pId: "11",
text: 111,
isParent: true
}, {
id: "2",
text: 2
}, {
id: "3",
text: 3
}],
hasNext: BI.isNull(op.id)
});
return;
}
callback({
items: [{
id: (op.id || "") + "1",
pId: op.id,
text: 1,
isParent: true
}, {
id: (op.id || "") + "2",
pId: op.id,
text: 2
}, {
id: (op.id || "") + "3",
pId: op.id,
text: 3
}],
hasNext: BI.isNull(op.id)
});
}
}]
};
} }
}); });
BI.shortcut("demo.part_tree", Demo.Func); BI.shortcut("demo.part_tree", Demo.Func);

6
demo/js/base/tree/demo.sync_tree.js

@ -4,7 +4,9 @@ Demo.Func = BI.inherit(BI.Widget, {
}, },
mounted: function () { mounted: function () {
this.syncTree.stroke(); this.syncTree.stroke({
keyword: "1"
});
}, },
render: function () { render: function () {
@ -21,7 +23,7 @@ Demo.Func = BI.inherit(BI.Widget, {
self.syncTree = _ref; self.syncTree = _ref;
}, },
paras: { paras: {
selectedValues: {"_0": {}, "_5": {"_5_0": {}}} selectedValues: {"1": {}, "2": {"1": {}}}
}, },
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
callback({ callback({

137
demo/js/category/largeTable/largeTable.js

@ -1,137 +0,0 @@
Demo.Face = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-face"
},
render: function () {
var self = this;
return {
type: "bi.absolute",
items: [{
el: {
type: "bi.sequence_table",
ref: function () {
self.table = this;
},
isNeedFreeze: null,
isNeedMerge: false,
summaryCellStyleGetter: function (isLast) {
return {
background: "rgb(4, 177, 194)",
color: "#ffffff",
fontWeight: "bold"
};
},
sequenceCellStyleGetter: function (index) {
return {
background: "rgb(4, 177, 194)",
color: "#ffffff",
fontWeight: "bold"
};
},
headerCellStyleGetter: function () {
return {
background: "rgb(4, 177, 194)",
color: "#ffffff",
fontWeight: "bold"
};
},
el: {
type: "bi.adaptive_table",
el: {
type: "bi.resizable_table",
el: {
type: "bi.grid_table"
}
}
},
sequence: {
type: "bi.sequence_table_list_number",
pageSize: 100,
sequenceHeaderCreator: function () {
return {
type: "bi.normal_sequence_header_cell",
styleGetter: function () {
return {
background: "rgb(4, 177, 194)",
color: "#ffffff",
fontWeight: "bold"
};
}
};
}
},
itemsCreator: function (op, populate) {
}
},
left: 0,
right: 0,
top: 0,
bottom: 0
}]
};
},
mounted: function () {
var self = this;
if (BI.isNull(BI.isExpanded)) {
BI.isExpanded = false;
} else if (!BI.isExpanded) {
TABLE_ITEMS = this._expandData(TABLE_ITEMS, 3);
TABLE_HEADER = this._expandHeadData(TABLE_HEADER, 3);
BI.isExpanded = true;
}
this._resizeHandler = BI.debounce(function () {
var width = self.element.width(), height = self.element.height();
if (self.table.getWidth() !== width || self.table.getHeight() !== height) {
self.table.setWidth(width);
self.table.setHeight(height);
self.table.populate();
}
}, 0);
BI.ResizeDetector.addResizeListener(this, function () {
self._resizeHandler();
});
this.table.setWidth(this.element.width());
this.table.setHeight(this.element.height());
this.table.attr("columnSize", BI.makeArray(TABLE_HEADER[0].length, ""));
this.table.attr("minColumnSize", BI.makeArray(TABLE_HEADER[0].length, 60));
this.table.attr("isNeedFreeze", true);
this.table.attr("freezeCols", []);
this.table.attr("showSequence", true);
this.table.attr("headerRowSize", 15);
this.table.attr("rowSize", 15);
this.table.populate(TABLE_ITEMS, TABLE_HEADER);
},
_expandData: function (items, times) {
var copy = BI.deepClone(items);
for (var m = 0; m < times - 1; m++) {
BI.each(items, function (i, row) {
copy.push(row);
});
}
for (var n = 0; n < copy.length; n++) {
for (var m = 0; m < times - 1; m++) {
BI.each(items[n % 100], function (j, item) {
copy[n].push(item);
});
}
}
return copy;
},
_expandHeadData: function (items, times) {
var copy = BI.deepClone(items);
for (var n = 0; n < copy.length; n++) {
for (var m = 0; m < times - 1; m++) {
BI.each(items[n], function (j, item) {
copy[n].push(item);
});
}
}
return copy;
}
});
BI.shortcut("demo.large_table", Demo.Face);

4
demo/js/config/category.js

@ -5,10 +5,6 @@ Demo.CATEGORY_CONFIG = [{
pId: 100000, pId: 100000,
text: "自定义一棵树", text: "自定义一棵树",
value: "demo.platform_level_tree" value: "demo.platform_level_tree"
}, {
pId: 100000,
text: "大表格",
value: "demo.large_table"
}, { }, {
pId: 100000, pId: 100000,
text: "可以排序的树", text: "可以排序的树",

14
demo/js/face.js

@ -548,20 +548,16 @@ Demo.Face = BI.inherit(BI.Widget, {
return { return {
type: "bi.grid", type: "bi.grid",
items: [[{ items: [[{
column: 0,
row: 0,
el: {
type: "bi.layout"
}
}, {
column: 1,
row: 0,
el: { el: {
type: "bi.vertical", type: "bi.vertical",
cls: "face-config bi-border-left", cls: "face-config bi-border-right",
items: [this._createBaseConfig(), items: [this._createBaseConfig(),
this._createCommonConfig()] this._createCommonConfig()]
} }
}, {
el: {
type: "bi.layout"
}
}]] }]]
}; };
}, },

39
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

299
dist/base.js vendored

@ -72,7 +72,7 @@
function handler (event) { function handler (event) {
var orgEvent = event || window.event, var orgEvent = event || _global.event,
args = slice.call(arguments, 1), args = slice.call(arguments, 1),
delta = 0, delta = 0,
deltaX = 0, deltaX = 0,
@ -1720,8 +1720,8 @@ BI.TreeView = BI.inherit(BI.Pane, {
treeNode.times = treeNode.times || 1; treeNode.times = treeNode.times || 1;
var param = "id=" + treeNode.id var param = "id=" + treeNode.id
+ "&times=" + (treeNode.times++) + "&times=" + (treeNode.times++)
+ "&parentValues= " + window.encodeURIComponent(BI.jsonEncode(parentNode)) + "&parentValues= " + _global.encodeURIComponent(BI.jsonEncode(parentNode))
+ "&checkState=" + window.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus())); + "&checkState=" + _global.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus()));
return "&" + param; return "&" + param;
} }
@ -6983,158 +6983,157 @@ BI.ImageButton = BI.inherit(BI.BasicButton, {
} }
}); });
BI.ImageButton.EVENT_CHANGE = "ImageButton.EVENT_CHANGE"; BI.ImageButton.EVENT_CHANGE = "ImageButton.EVENT_CHANGE";
BI.shortcut("bi.image_button", BI.ImageButton);(function ($) { BI.shortcut("bi.image_button", BI.ImageButton);
/**
* 文字类型的按钮
* @class BI.Button
* @extends BI.BasicButton
*
* @cfg {JSON} options 配置属性
* @cfg {'common'/'success'/'warning'/'ignore'} [options.level='common'] 按钮类型用不同颜色强调不同的场景
*/
BI.Button = BI.inherit(BI.BasicButton, {
/** _defaultConfig: function (props) {
* 文字类型的按钮 var conf = BI.Button.superclass._defaultConfig.apply(this, arguments);
* @class BI.Button return BI.extend(conf, {
* @extends BI.BasicButton baseCls: (conf.baseCls || "") + " bi-button",
* minWidth: (props.block === true || props.clear === true) ? 0 : 80,
* @cfg {JSON} options 配置属性 height: 24,
* @cfg {'common'/'success'/'warning'/'ignore'} [options.level='common'] 按钮类型用不同颜色强调不同的场景 shadow: props.clear !== true,
*/ isShadowShowingOnSelected: true,
BI.Button = BI.inherit(BI.BasicButton, { readonly: true,
iconCls: "",
level: "common",
block: false, // 是否块状显示,即不显示边框,没有最小宽度的限制
clear: false, // 是否去掉边框和背景
ghost: false, // 是否幽灵显示, 即正常状态无背景
textAlign: "center",
whiteSpace: "nowrap",
forceCenter: false,
textWidth: null,
textHeight: null,
hgap: props.clear ? 0 : 10,
vgap: 0,
tgap: 0,
bgap: 0,
lgap: 0,
rgap: 0
});
},
_defaultConfig: function (props) { _init: function () {
var conf = BI.Button.superclass._defaultConfig.apply(this, arguments); BI.Button.superclass._init.apply(this, arguments);
return BI.extend(conf, { var o = this.options, self = this;
baseCls: (conf.baseCls || "") + " bi-button", if (BI.isNumber(o.height) && !o.clear && !o.block) {
minWidth: (props.block === true || props.clear === true) ? 0 : 80, this.element.css({height: o.height + "px", lineHeight: (o.height - 2) + "px"});
height: 24, } else if (o.clear || o.block) {
shadow: props.clear !== true, this.element.css({lineHeight: o.height + "px"});
isShadowShowingOnSelected: true, } else {
readonly: true, this.element.css({lineHeight: (o.height - 2) + "px"});
iconCls: "", }
level: "common", if (BI.isKey(o.iconCls)) {
block: false, // 是否块状显示,即不显示边框,没有最小宽度的限制 this.icon = BI.createWidget({
clear: false, // 是否去掉边框和背景 type: "bi.icon",
ghost: false, // 是否幽灵显示, 即正常状态无背景 width: 18,
textAlign: "center", height: o.height - 2
whiteSpace: "nowrap",
forceCenter: false,
textWidth: null,
textHeight: null,
hgap: props.clear ? 0 : 10,
vgap: 0,
tgap: 0,
bgap: 0,
lgap: 0,
rgap: 0
}); });
}, this.text = BI.createWidget({
type: "bi.label",
_init: function () { text: o.text,
BI.Button.superclass._init.apply(this, arguments); value: o.value,
var o = this.options, self = this; height: o.height - 2
if (BI.isNumber(o.height) && !o.clear && !o.block) { });
this.element.css({height: o.height + "px", lineHeight: (o.height - 2) + "px"}); BI.createWidget({
} else if (o.clear || o.block) { type: "bi.horizontal_auto",
this.element.css({lineHeight: o.height + "px"}); cls: o.iconCls,
} else { element: this,
this.element.css({lineHeight: (o.height - 2) + "px"}); hgap: o.hgap,
} vgap: o.vgap,
if (BI.isKey(o.iconCls)) { tgap: o.tgap,
this.icon = BI.createWidget({ bgap: o.bgap,
type: "bi.icon", lgap: o.lgap,
width: 18, rgap: o.rgap,
height: o.height - 2 items: [{
}); type: "bi.horizontal",
this.text = BI.createWidget({ items: [this.icon, this.text]
type: "bi.label", }]
text: o.text, });
value: o.value, } else {
height: o.height - 2 this.text = BI.createWidget({
}); type: "bi.label",
BI.createWidget({ textAlign: o.textAlign,
type: "bi.horizontal_auto", whiteSpace: o.whiteSpace,
cls: o.iconCls, forceCenter: o.forceCenter,
element: this, textWidth: o.textWidth,
hgap: o.hgap, textHeight: o.textHeight,
vgap: o.vgap, hgap: o.hgap,
tgap: o.tgap, vgap: o.vgap,
bgap: o.bgap, tgap: o.tgap,
lgap: o.lgap, bgap: o.bgap,
rgap: o.rgap, lgap: o.lgap,
items: [{ rgap: o.rgap,
type: "bi.horizontal", element: this,
items: [this.icon, this.text] text: o.text,
}] value: o.value
}); });
} else { }
this.text = BI.createWidget({ if (o.block === true) {
type: "bi.label", this.element.addClass("block");
textAlign: o.textAlign, }
whiteSpace: o.whiteSpace, if (o.clear === true) {
forceCenter: o.forceCenter, this.element.addClass("clear");
textWidth: o.textWidth, }
textHeight: o.textHeight, if (o.ghost === true) {
hgap: o.hgap, this.element.addClass("ghost");
vgap: o.vgap, }
tgap: o.tgap, if (o.minWidth > 0) {
bgap: o.bgap, this.element.css({"min-width": o.minWidth + "px"});
lgap: o.lgap, }
rgap: o.rgap, },
element: this,
text: o.text,
value: o.value
});
}
if (o.block === true) {
this.element.addClass("block");
}
if (o.clear === true) {
this.element.addClass("clear");
}
if (o.ghost === true) {
this.element.addClass("ghost");
}
if (o.minWidth > 0) {
this.element.css({"min-width": o.minWidth + "px"});
}
},
doClick: function () { doClick: function () {
BI.Button.superclass.doClick.apply(this, arguments); BI.Button.superclass.doClick.apply(this, arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.Button.EVENT_CHANGE, this); this.fireEvent(BI.Button.EVENT_CHANGE, this);
} }
}, },
setText: function (text) { setText: function (text) {
BI.Button.superclass.setText.apply(this, arguments); BI.Button.superclass.setText.apply(this, arguments);
this.text.setText(text); this.text.setText(text);
}, },
setValue: function (text) { setValue: function (text) {
BI.Button.superclass.setValue.apply(this, arguments); BI.Button.superclass.setValue.apply(this, arguments);
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.text.setValue(text); this.text.setValue(text);
} }
}, },
doRedMark: function () { doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark.apply(this.text, arguments);
}, },
unRedMark: function () { unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark.apply(this.text, arguments);
}, },
doHighLight: function () { doHighLight: function () {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight.apply(this.text, arguments);
}, },
unHighLight: function () { unHighLight: function () {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight.apply(this.text, arguments);
}, },
destroy: function () { destroy: function () {
BI.Button.superclass.destroy.apply(this, arguments); BI.Button.superclass.destroy.apply(this, arguments);
} }
}); });
BI.shortcut("bi.button", BI.Button); BI.shortcut("bi.button", BI.Button);
BI.Button.EVENT_CHANGE = "EVENT_CHANGE"; BI.Button.EVENT_CHANGE = "EVENT_CHANGE";
})(jQuery);/** /**
* guy * guy
* 可以点击的一行文字 * 可以点击的一行文字
* @class BI.TextButton * @class BI.TextButton
@ -9064,7 +9063,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
* @extends BI.Single * @extends BI.Single
* @abstract * @abstract
*/ */
(function () { (function (document) {
/** /**
* @description normalize input.files. create if not present, add item method if not present * @description normalize input.files. create if not present, add item method if not present
@ -9211,7 +9210,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=" + _global.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 () {
@ -9322,7 +9321,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
handler.attach_array.push(attachO); handler.attach_array.push(attachO);
} }
} catch (e) { } catch (e) {
if (isFunction(handler.onerror)) {handler.onerror(rpe, event || window.event);} if (isFunction(handler.onerror)) {handler.onerror(rpe, event || _global.event);}
} }
if (isFunction(handler.onload)) {handler.onload(rpe, {responseText: responseText});} if (isFunction(handler.onload)) {handler.onload(rpe, {responseText: responseText});}
}, },
@ -9342,7 +9341,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
iframe.onload = onload; iframe.onload = onload;
iframe.onerror = function (event) { iframe.onerror = function (event) {
if (isFunction(handler.onerror)) { if (isFunction(handler.onerror)) {
handler.onerror(rpe, event || window.event); handler.onerror(rpe, event || _global.event);
} }
}; };
iframe.onreadystatechange = function () { iframe.onreadystatechange = function () {
@ -9364,7 +9363,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
}); });
} }
}; };
form.setAttribute("action", handler.url + "&filename=" + window.encodeURIComponent(handler.file.fileName)); form.setAttribute("action", handler.url + "&filename=" + _global.encodeURIComponent(handler.file.fileName));
form.setAttribute("target", iframe.id); form.setAttribute("target", iframe.id);
form.setAttribute("method", "post"); form.setAttribute("method", "post");
form.appendChild(handler.file); form.appendChild(handler.file);
@ -9672,7 +9671,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
BI.File.EVENT_PROGRESS = "EVENT_PROGRESS"; BI.File.EVENT_PROGRESS = "EVENT_PROGRESS";
BI.File.EVENT_UPLOADED = "EVENT_UPLOADED"; BI.File.EVENT_UPLOADED = "EVENT_UPLOADED";
BI.shortcut("bi.file", BI.File); BI.shortcut("bi.file", BI.File);
})();/** })(_global.document || {});/**
* guy * guy
* @class BI.Input 一个button和一行数 组成的一行listitem * @class BI.Input 一个button和一行数 组成的一行listitem
* @extends BI.Single * @extends BI.Single

695
dist/bundle.js vendored

File diff suppressed because it is too large Load Diff

78
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

365
dist/core.js vendored

@ -1,4 +1,22 @@
/*! /**
* Created by richie on 15/7/8.
*/
/**
* 初始化BI对象
*/
var _global;
if (typeof window !== "undefined") {
_global = window;
} else if (typeof global !== "undefined") {
_global = global;
} else if (typeof self !== "undefined") {
_global = self;
} else {
_global = this;
}
if (_global.BI == null) {
_global.BI = {};
}/*!
* jQuery JavaScript Library v1.9.1 * jQuery JavaScript Library v1.9.1
* http://jquery.com/ * http://jquery.com/
* *
@ -19704,21 +19722,22 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
} }
}.call(this)); }.call(this));
/** /**
* Created by richie on 15/7/8.
*/
/**
* 初始化BI对象
*/
if (window.BI == null) {
window.BI = {};
}/**
* 基本函数 * 基本函数
* Create By GUY 2014\11\17 * Create By GUY 2014\11\17
* *
*/ */
var _global;
if (!window.BI) { if (typeof window !== "undefined") {
window.BI = {}; _global = window;
} else if (typeof global !== "undefined") {
_global = global;
} else if (typeof self !== "undefined") {
_global = self;
} else {
_global = this;
}
if (!_global.BI) {
_global.BI = {};
} }
!(function (undefined) { !(function (undefined) {
@ -20160,7 +20179,7 @@ if (!window.BI) {
}; };
} }
var F = function () { var F = function () {
}, spp = sp.prototype; }, spp = sp.prototype;
F.prototype = spp; F.prototype = spp;
sb.prototype = new F(); sb.prototype = new F();
sb.superclass = spp; sb.superclass = spp;
@ -20446,11 +20465,11 @@ if (!window.BI) {
}); });
_.extend(BI, { _.extend(BI, {
getTime: function () { getTime: function () {
if (window.performance && window.performance.now) { if (_global.performance && _global.performance.now) {
return window.performance.now(); return _global.performance.now();
} }
if (window.performance && window.performance.webkitNow) { if (_global.performance && _global.performance.webkitNow) {
return window.performance.webkitNow(); return _global.performance.webkitNow();
} }
if (Date.now) { if (Date.now) {
return Date.now(); return Date.now();
@ -21075,6 +21094,9 @@ if (!window.BI) {
// 浏览器相关方法 // 浏览器相关方法
_.extend(BI, { _.extend(BI, {
isIE: function () { isIE: function () {
if(!_global.navigator) {
return false;
}
if (this.__isIE == null) { if (this.__isIE == null) {
this.__isIE = /(msie|trident)/i.test(navigator.userAgent.toLowerCase()); this.__isIE = /(msie|trident)/i.test(navigator.userAgent.toLowerCase());
} }
@ -21082,6 +21104,9 @@ if (!window.BI) {
}, },
getIEVersion: function () { getIEVersion: function () {
if(!_global.navigator) {
return 0;
}
if (this.__IEVersion != null) { if (this.__IEVersion != null) {
return this.__IEVersion; return this.__IEVersion;
} }
@ -21109,38 +21134,65 @@ if (!window.BI) {
}, },
isEdge: function () { isEdge: function () {
if(!_global.navigator) {
return false;
}
return /edge/i.test(navigator.userAgent.toLowerCase()); return /edge/i.test(navigator.userAgent.toLowerCase());
}, },
isChrome: function () { isChrome: function () {
if(!_global.navigator) {
return false;
}
return /chrome/i.test(navigator.userAgent.toLowerCase()); return /chrome/i.test(navigator.userAgent.toLowerCase());
}, },
isFireFox: function () { isFireFox: function () {
if(!_global.navigator) {
return false;
}
return /firefox/i.test(navigator.userAgent.toLowerCase()); return /firefox/i.test(navigator.userAgent.toLowerCase());
}, },
isOpera: function () { isOpera: function () {
if(!_global.navigator) {
return false;
}
return /opera/i.test(navigator.userAgent.toLowerCase()); return /opera/i.test(navigator.userAgent.toLowerCase());
}, },
isSafari: function () { isSafari: function () {
if(!_global.navigator) {
return false;
}
return /safari/i.test(navigator.userAgent.toLowerCase()); return /safari/i.test(navigator.userAgent.toLowerCase());
}, },
isKhtml: function () { isKhtml: function () {
if(!_global.navigator) {
return false;
}
return /Konqueror|Safari|KHTML/i.test(navigator.userAgent); return /Konqueror|Safari|KHTML/i.test(navigator.userAgent);
}, },
isMac: function () { isMac: function () {
if(!_global.navigator) {
return false;
}
return /macintosh|mac os x/i.test(navigator.userAgent); return /macintosh|mac os x/i.test(navigator.userAgent);
}, },
isWindows: function () { isWindows: function () {
if(!_global.navigator) {
return false;
}
return /windows|win32/i.test(navigator.userAgent); return /windows|win32/i.test(navigator.userAgent);
}, },
isSupportCss3: function (style) { isSupportCss3: function (style) {
if(!_global.document) {
return false;
}
var prefix = ["webkit", "Moz", "ms", "o"], var prefix = ["webkit", "Moz", "ms", "o"],
i, len, i, len,
humpString = [], humpString = [],
@ -21196,7 +21248,7 @@ BI.OB = function (config) {
if (BI.isFunction(this.props)) { if (BI.isFunction(this.props)) {
props = this.props(config); props = this.props(config);
} }
this.options = (window.$ || window._).extend(this._defaultConfig(config), props, config); this.options = (_global.$ || _global._).extend(this._defaultConfig(config), props, config);
this._init(); this._init();
this._initRef(); this._initRef();
}; };
@ -21346,11 +21398,12 @@ _.extend(BI.OB.prototype, {
*/ */
!(function () { !(function () {
var lazy = (typeof document !== 'undefined' && var lazy = (typeof document !== "undefined" &&
typeof document.documentMode === 'number') || typeof document.documentMode === "number") ||
(typeof navigator !== 'undefined' && (typeof navigator !== "undefined" &&
typeof navigator.userAgent === 'string' && typeof navigator.userAgent === "string" &&
/\bEdge\/\d/.test(navigator.userAgent)); /\bEdge\/\d/.test(navigator.userAgent));
BI.Widget = BI.inherit(BI.OB, { BI.Widget = BI.inherit(BI.OB, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.Widget.superclass._defaultConfig.apply(this), { return BI.extend(BI.Widget.superclass._defaultConfig.apply(this), {
@ -21398,20 +21451,14 @@ _.extend(BI.OB.prototype, {
this._initElementHeight(); this._initElementHeight();
this._initVisual(); this._initVisual();
this._initState(); this._initState();
if (this.isVisible()) { if (this.beforeInit) {
if (this.beforeInit) { this.__asking = true;
this.__asking = true; this.beforeInit(BI.bind(this._render, this));
this.beforeInit(BI.bind(this._render, this)); if (this.__asking === true) {
if (this.__asking === true) { this.__async = true;
this.__async = true;
}
} else {
this._render();
} }
this.rendered = true } else {
} this._render();
if (this._isRoot) {
this._mount()
} }
}, },
@ -21524,7 +21571,7 @@ _.extend(BI.OB.prototype, {
_mount: function () { _mount: function () {
var self = this; var self = this;
var isMounted = this._isMounted; var isMounted = this._isMounted;
if (this._isMounting || isMounted || !this.isVisible() || this.__asking === true) { if (isMounted || this.__asking === true) {
return; return;
} }
if (this._isRoot === true) { if (this._isRoot === true) {
@ -21535,30 +21582,17 @@ _.extend(BI.OB.prototype, {
if (!isMounted) { if (!isMounted) {
return; return;
} }
this._isMounting = true
if (!this.rendered) {
if (this.beforeInit) {
this.__asking = true;
this.beforeInit(BI.bind(this._render, this));
if (this.__asking === true) {
this.__async = true;
}
} else {
this._render();
}
}
this.beforeMount && this.beforeMount(); this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
lazy && this._mountChildren && this._mountChildren(); !lazy && this._mountChildren && this._mountChildren();
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false); !self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false); !self.isValid() && widget._setValid(false);
widget._mount && widget._mount(); widget._mount && widget._mount();
}); });
!lazy && this._mountChildren && this._mountChildren(); lazy && this._mountChildren && this._mountChildren();
this.mounted && this.mounted(); this.mounted && this.mounted();
this._isMounting = false return true;
}, },
_mountChildren: null, _mountChildren: null,
@ -21839,7 +21873,7 @@ _.extend(BI.OB.prototype, {
var kv = {}; var kv = {};
BI.shortcut = function (xtype, cls) { BI.shortcut = function (xtype, cls) {
if (kv[xtype] != null) { if (kv[xtype] != null) {
console.error("shortcut:[" + xtype + "] has been registed"); _global.console && console.error("shortcut:[" + xtype + "] has been registed");
} }
kv[xtype] = cls; kv[xtype] = cls;
}; };
@ -22863,19 +22897,19 @@ BI.ScalingCellSizeAndPositionManager.prototype = {
* version: 0.5.3 * version: 0.5.3
**/ **/
!(function () { !(function () {
var attachEvent = document.attachEvent, var attachEvent = _global.document && _global.document.attachEvent,
stylesCreated = false; stylesCreated = false;
if (!attachEvent) { if (_global.document && !attachEvent) {
var requestFrame = (function () { var requestFrame = (function () {
var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame ||
function (fn) { return window.setTimeout(fn, 20); }; function (fn) { return _global.setTimeout(fn, 20); };
return function (fn) { return raf(fn); }; return function (fn) { return raf(fn); };
})(); })();
var cancelFrame = (function () { var cancelFrame = (function () {
var cancel = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame ||
window.clearTimeout; _global.clearTimeout;
return function (id) { return cancel(id); }; return function (id) { return cancel(id); };
})(); })();
@ -23343,7 +23377,7 @@ BI.ScalingCellSizeAndPositionManager.prototype = {
return Math.floor(node / 2); return Math.floor(node / 2);
}; };
var Int32Array = window.Int32Array || function (size) { var Int32Array = _global.Int32Array || function (size) {
var xs = []; var xs = [];
for (var i = size - 1; i >= 0; --i) { for (var i = size - 1; i >= 0; --i) {
xs[i] = 0; xs[i] = 0;
@ -24368,6 +24402,10 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}, },
appendFragment: function (frag) {
this.element.append(frag);
},
_mountChildren: function () { _mountChildren: function () {
var self = this; var self = this;
var frag = document.createDocumentFragment(); var frag = document.createDocumentFragment();
@ -24379,7 +24417,7 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}); });
if (hasChild === true) { if (hasChild === true) {
this.element.append(frag); this.appendFragment(frag);
} }
}, },
@ -25021,8 +25059,18 @@ BI.ShowAction = BI.inherit(BI.Action, {
callback && callback(); callback && callback();
} }
});(function () { });(function () {
if (!window.BI) { var _global;
window.BI = {}; if (typeof window !== "undefined") {
_global = window;
} else if (typeof global !== "undefined") {
_global = global;
} else if (typeof self !== "undefined") {
_global = self;
} else {
_global = this;
}
if (!_global.BI) {
_global.BI = {};
} }
function isEmpty (value) { function isEmpty (value) {
@ -25550,7 +25598,7 @@ BI.ShowAction = BI.inherit(BI.Action, {
try { try {
// 注意0啊 // 注意0啊
// var jo = $.parseJSON(text) || {}; // var jo = $.parseJSON(text) || {};
var jo = $ ? $.parseJSON(text) : window.JSON.parse(text); var jo = $ ? $.parseJSON(text) : _global.JSON.parse(text);
if (jo == null) { if (jo == null) {
jo = {}; jo = {};
} }
@ -25603,7 +25651,7 @@ BI.ShowAction = BI.inherit(BI.Action, {
url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) { url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) {
return BI.specialCharsMap[str] || str; return BI.specialCharsMap[str] || str;
}); });
return window.encodeURIComponent(url); return _global.encodeURIComponent(url);
}; };
BI.decodeURIComponent = function (url) { BI.decodeURIComponent = function (url) {
@ -25615,7 +25663,7 @@ BI.ShowAction = BI.inherit(BI.Action, {
url = url.replaceAll(BI.keys(reserveSpecialCharsMap || []).join("|"), function (str) { url = url.replaceAll(BI.keys(reserveSpecialCharsMap || []).join("|"), function (str) {
return reserveSpecialCharsMap[str] || str; return reserveSpecialCharsMap[str] || str;
}); });
return window.decodeURIComponent(url); return _global.decodeURIComponent(url);
}; };
BI.contentFormat = function (cv, fmt) { BI.contentFormat = function (cv, fmt) {
@ -26055,12 +26103,6 @@ BI.RedMarkBehavior = BI.inherit(BI.Behavior, {
return ob; return ob;
}); });
// IE8下滚动条用原生的
$(function () {
if (BI.isIE9Below()) {
BI.GridTableScrollbar.SIZE = 18;
}
});
}());/** }());/**
* guy * guy
* 控制器 * 控制器
@ -26687,7 +26729,7 @@ BI.ResizeController = BI.inherit(BI.Controller, {
self._resize(ev); self._resize(ev);
// } // }
}, 30); }, 30);
$(window).resize(fn); _global.$ && $(window).resize(fn);
}, },
_resize: function (ev) { _resize: function (ev) {
@ -27396,9 +27438,9 @@ BI.extend(jQuery.fn, {
var computedStyle = void 0; var computedStyle = void 0;
// W3C Standard // W3C Standard
if (window.getComputedStyle) { if (_global.getComputedStyle) {
// In certain cases such as within an iframe in FF3, this returns null. // In certain cases such as within an iframe in FF3, this returns null.
computedStyle = window.getComputedStyle(node, null); computedStyle = _global.getComputedStyle(node, null);
if (computedStyle) { if (computedStyle) {
return computedStyle.getPropertyValue(BI.hyphenate(name)); return computedStyle.getPropertyValue(BI.hyphenate(name));
} }
@ -28231,7 +28273,7 @@ BI.extend(BI.DOM, {
var constantInjection = {}; var constantInjection = {};
BI.constant = function (xtype, cls) { BI.constant = function (xtype, cls) {
if (constantInjection[xtype] != null) { if (constantInjection[xtype] != null) {
console.error("constant:[" + xtype + "] has been registed"); _global.console && console.error("constant:[" + xtype + "] has been registed");
} }
constantInjection[xtype] = cls; constantInjection[xtype] = cls;
}; };
@ -28239,7 +28281,7 @@ BI.extend(BI.DOM, {
var modelInjection = {}; var modelInjection = {};
BI.model = function (xtype, cls) { BI.model = function (xtype, cls) {
if (modelInjection[xtype] != null) { if (modelInjection[xtype] != null) {
console.error("model:[" + xtype + "] has been registed"); _global.console && console.error("model:[" + xtype + "] has been registed");
} }
modelInjection[xtype] = cls; modelInjection[xtype] = cls;
}; };
@ -28247,7 +28289,7 @@ BI.extend(BI.DOM, {
var storeInjection = {}; var storeInjection = {};
BI.store = function (xtype, cls) { BI.store = function (xtype, cls) {
if (storeInjection[xtype] != null) { if (storeInjection[xtype] != null) {
console.error("store:[" + xtype + "] has been registed"); _global.console && console.error("store:[" + xtype + "] has been registed");
} }
storeInjection[xtype] = cls; storeInjection[xtype] = cls;
}; };
@ -28255,7 +28297,7 @@ BI.extend(BI.DOM, {
var serviceInjection = {}; var serviceInjection = {};
BI.service = function (xtype, cls) { BI.service = function (xtype, cls) {
if (serviceInjection[xtype] != null) { if (serviceInjection[xtype] != null) {
console.error("service:[" + xtype + "] has been registed"); _global.console && console.error("service:[" + xtype + "] has been registed");
} }
serviceInjection[xtype] = cls; serviceInjection[xtype] = cls;
}; };
@ -28263,7 +28305,7 @@ BI.extend(BI.DOM, {
var providerInjection = {}; var providerInjection = {};
BI.provider = function (xtype, cls) { BI.provider = function (xtype, cls) {
if (providerInjection[xtype] != null) { if (providerInjection[xtype] != null) {
console.error("provider:[" + xtype + "] has been registed"); _global.console && console.error("provider:[" + xtype + "] has been registed");
} }
providerInjection[xtype] = cls; providerInjection[xtype] = cls;
}; };
@ -28333,7 +28375,7 @@ BI.extend(BI.DOM, {
try { try {
bfns[i].apply(inst, arguments); bfns[i].apply(inst, arguments);
} catch (e) { } catch (e) {
console.error(e); _global.console && console.error(e);
} }
} }
}; };
@ -28347,7 +28389,7 @@ BI.extend(BI.DOM, {
try { try {
afns[i].apply(inst, arguments); afns[i].apply(inst, arguments);
} catch (e) { } catch (e) {
console.error(e); _global.console && console.error(e);
} }
} }
}; };
@ -28411,7 +28453,7 @@ BI.extend(BI.DOM, {
try { try {
act(event, config); act(event, config);
} catch (e) { } catch (e) {
console.error(e); _global.console && console.error(e);
} }
}); });
}, },
@ -28421,7 +28463,7 @@ BI.extend(BI.DOM, {
try { try {
act.apply(null, args); act.apply(null, args);
} catch (e) { } catch (e) {
console.error(e); _global.console && console.error(e);
} }
}); });
} }
@ -28848,7 +28890,7 @@ _.extend(Array.prototype, {
} }
} }
}); });
$(function () { _global.$ && $(function () {
// 牵扯到国际化这些常量在页面加载后再生效 // 牵扯到国际化这些常量在页面加载后再生效
// full day names // full day names
Date._DN = [BI.i18nText("BI-Basic_Sunday"), Date._DN = [BI.i18nText("BI-Basic_Sunday"),
@ -29680,14 +29722,14 @@ _.extend(String.prototype, {
} }
};!(function () { };!(function () {
var cancelAnimationFrame = var cancelAnimationFrame =
window.cancelAnimationFrame || _global.cancelAnimationFrame ||
window.webkitCancelAnimationFrame || _global.webkitCancelAnimationFrame ||
window.mozCancelAnimationFrame || _global.mozCancelAnimationFrame ||
window.oCancelAnimationFrame || _global.oCancelAnimationFrame ||
window.msCancelAnimationFrame || _global.msCancelAnimationFrame ||
window.clearTimeout; _global.clearTimeout;
var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || window.setTimeout; var requestAnimationFrame = _global.requestAnimationFrame || _global.webkitRequestAnimationFrame || _global.mozRequestAnimationFrame || _global.oRequestAnimationFrame || _global.msRequestAnimationFrame || _global.setTimeout;
BI.MouseMoveTracker = function (onMove, onMoveEnd, domNode) { BI.MouseMoveTracker = function (onMove, onMoveEnd, domNode) {
@ -29788,7 +29830,7 @@ _.extend(String.prototype, {
var PIXEL_STEP = 10; var PIXEL_STEP = 10;
var LINE_HEIGHT = 40; var LINE_HEIGHT = 40;
var PAGE_HEIGHT = 800; var PAGE_HEIGHT = 800;
var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || window.setTimeout; var requestAnimationFrame = _global.requestAnimationFrame || _global.webkitRequestAnimationFrame || _global.mozRequestAnimationFrame || _global.oRequestAnimationFrame || _global.msRequestAnimationFrame || _global.setTimeout;
function normalizeWheel (/* object*/event) /* object*/ { function normalizeWheel (/* object*/event) /* object*/ {
var sX = 0, var sX = 0,
@ -30305,20 +30347,9 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$tr.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$table);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag);
this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
@ -30422,20 +30453,9 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$tr.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$table);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag);
this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
@ -30712,20 +30732,9 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$tr.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$table);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag);
this.element.append(this.$table);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -31306,20 +31315,9 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$wrapper.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$wrapper);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag);
this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -31391,20 +31389,9 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$wrapper.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$wrapper);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag);
this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -31476,20 +31463,9 @@ BI.FlexVerticalCenter = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$wrapper.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$wrapper);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag);
this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {
@ -32619,23 +32595,11 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$tr.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$table);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag);
this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
// console.log("horizontal layout do not need to resize"); // console.log("horizontal layout do not need to resize");
}, },
@ -33302,20 +33266,9 @@ BI.TdLayout = BI.inherit(BI.Layout, {
return tr; return tr;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$table.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$table);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$table.append(frag);
this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {

234
dist/demo.js vendored

@ -965,7 +965,79 @@ BI.shortcut("demo.toast", Demo.Toast);Demo.Func = BI.inherit(BI.Widget, {
baseCls: "demo-func" baseCls: "demo-func"
}, },
mounted: function () {
this.partTree.stroke({
keyword: "1"
});
},
render: function () { render: function () {
var self = this;
return {
type: "bi.vtape",
items: [{
type: "bi.label",
height: 50,
text: "先初始化一份数据,然后再异步获取数据的树"
}, {
type: "bi.part_tree",
ref: function (_ref) {
self.partTree = _ref;
},
paras: {
selectedValues: {"1": {}, "2": {"1": {}}}
},
itemsCreator: function (op, callback) {
if (op.type === BI.TreeView.REQ_TYPE_INIT_DATA) {
callback({
items: [{
id: "1",
text: 1,
isParent: true,
open: true
}, {
id: "11",
pId: "1",
text: 11,
isParent: true,
open: true
}, {
id: "111",
pId: "11",
text: 111,
isParent: true
}, {
id: "2",
text: 2
}, {
id: "3",
text: 3
}],
hasNext: BI.isNull(op.id)
});
return;
}
callback({
items: [{
id: (op.id || "") + "1",
pId: op.id,
text: 1,
isParent: true
}, {
id: (op.id || "") + "2",
pId: op.id,
text: 2
}, {
id: (op.id || "") + "3",
pId: op.id,
text: 3
}],
hasNext: BI.isNull(op.id)
});
}
}]
};
} }
}); });
BI.shortcut("demo.part_tree", Demo.Func);Demo.Func = BI.inherit(BI.Widget, { BI.shortcut("demo.part_tree", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
@ -974,7 +1046,9 @@ BI.shortcut("demo.part_tree", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
}, },
mounted: function () { mounted: function () {
this.syncTree.stroke(); this.syncTree.stroke({
keyword: "1"
});
}, },
render: function () { render: function () {
@ -991,7 +1065,7 @@ BI.shortcut("demo.part_tree", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
self.syncTree = _ref; self.syncTree = _ref;
}, },
paras: { paras: {
selectedValues: {"_0": {}, "_5": {"_5_0": {}}} selectedValues: {"1": {}, "2": {"1": {}}}
}, },
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
callback({ callback({
@ -2867,143 +2941,7 @@ BI.DetailTableHeader = BI.inherit(BI.Widget, {
} }
} }
}); });
BI.shortcut("bi.detail_table_header", BI.DetailTableHeader);Demo.Face = BI.inherit(BI.Widget, { BI.shortcut("bi.detail_table_header", BI.DetailTableHeader);/**
props: {
baseCls: "demo-face"
},
render: function () {
var self = this;
return {
type: "bi.absolute",
items: [{
el: {
type: "bi.sequence_table",
ref: function () {
self.table = this;
},
isNeedFreeze: null,
isNeedMerge: false,
summaryCellStyleGetter: function (isLast) {
return {
background: "rgb(4, 177, 194)",
color: "#ffffff",
fontWeight: "bold"
};
},
sequenceCellStyleGetter: function (index) {
return {
background: "rgb(4, 177, 194)",
color: "#ffffff",
fontWeight: "bold"
};
},
headerCellStyleGetter: function () {
return {
background: "rgb(4, 177, 194)",
color: "#ffffff",
fontWeight: "bold"
};
},
el: {
type: "bi.adaptive_table",
el: {
type: "bi.resizable_table",
el: {
type: "bi.grid_table"
}
}
},
sequence: {
type: "bi.sequence_table_list_number",
pageSize: 100,
sequenceHeaderCreator: function () {
return {
type: "bi.normal_sequence_header_cell",
styleGetter: function () {
return {
background: "rgb(4, 177, 194)",
color: "#ffffff",
fontWeight: "bold"
};
}
};
}
},
itemsCreator: function (op, populate) {
}
},
left: 0,
right: 0,
top: 0,
bottom: 0
}]
};
},
mounted: function () {
var self = this;
if (BI.isNull(BI.isExpanded)) {
BI.isExpanded = false;
} else if (!BI.isExpanded) {
TABLE_ITEMS = this._expandData(TABLE_ITEMS, 3);
TABLE_HEADER = this._expandHeadData(TABLE_HEADER, 3);
BI.isExpanded = true;
}
this._resizeHandler = BI.debounce(function () {
var width = self.element.width(), height = self.element.height();
if (self.table.getWidth() !== width || self.table.getHeight() !== height) {
self.table.setWidth(width);
self.table.setHeight(height);
self.table.populate();
}
}, 0);
BI.ResizeDetector.addResizeListener(this, function () {
self._resizeHandler();
});
this.table.setWidth(this.element.width());
this.table.setHeight(this.element.height());
this.table.attr("columnSize", BI.makeArray(TABLE_HEADER[0].length, ""));
this.table.attr("minColumnSize", BI.makeArray(TABLE_HEADER[0].length, 60));
this.table.attr("isNeedFreeze", true);
this.table.attr("freezeCols", []);
this.table.attr("showSequence", true);
this.table.attr("headerRowSize", 15);
this.table.attr("rowSize", 15);
this.table.populate(TABLE_ITEMS, TABLE_HEADER);
},
_expandData: function (items, times) {
var copy = BI.deepClone(items);
for (var m = 0; m < times - 1; m++) {
BI.each(items, function (i, row) {
copy.push(row);
});
}
for (var n = 0; n < copy.length; n++) {
for (var m = 0; m < times - 1; m++) {
BI.each(items[n % 100], function (j, item) {
copy[n].push(item);
});
}
}
return copy;
},
_expandHeadData: function (items, times) {
var copy = BI.deepClone(items);
for (var n = 0; n < copy.length; n++) {
for (var m = 0; m < times - 1; m++) {
BI.each(items[n], function (j, item) {
copy[n].push(item);
});
}
}
return copy;
}
});
BI.shortcut("demo.large_table", Demo.Face);/**
* created by young * created by young
* 默认风格表格表头 * 默认风格表格表头
*/ */
@ -3553,10 +3491,6 @@ BI.shortcut("demo.value_chooser_pane", Demo.ValueChooserPane);Demo.BASE_CONFIG =
pId: 100000, pId: 100000,
text: "自定义一棵树", text: "自定义一棵树",
value: "demo.platform_level_tree" value: "demo.platform_level_tree"
}, {
pId: 100000,
text: "大表格",
value: "demo.large_table"
}, { }, {
pId: 100000, pId: 100000,
text: "可以排序的树", text: "可以排序的树",
@ -7495,20 +7429,16 @@ BI.shortcut("demo.searcher_view", Demo.Func);Demo.Face = BI.inherit(BI.Widget, {
return { return {
type: "bi.grid", type: "bi.grid",
items: [[{ items: [[{
column: 0,
row: 0,
el: {
type: "bi.layout"
}
}, {
column: 1,
row: 0,
el: { el: {
type: "bi.vertical", type: "bi.vertical",
cls: "face-config bi-border-left", cls: "face-config bi-border-right",
items: [this._createBaseConfig(), items: [this._createBaseConfig(),
this._createCommonConfig()] this._createCommonConfig()]
} }
}, {
el: {
type: "bi.layout"
}
}]] }]]
}; };
}, },

701
dist/fineui.js vendored

File diff suppressed because it is too large Load Diff

78
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

65375
dist/fineui_without_jquery_polyfill.js vendored

File diff suppressed because one or more lines are too long

4
dist/fix/fix.compact.js vendored

@ -108,9 +108,8 @@
function createStore() { function createStore() {
var needPop = false; var needPop = false;
if (!this._storeCreated && window.Fix && this._store && this.isVisible()) { if (window.Fix && this._store) {
var store = findStore(this.options.context || this.options.element); var store = findStore(this.options.context || this.options.element);
this._storeCreated = true;
if (store) { if (store) {
pushTarget(store); pushTarget(store);
needPop = true; needPop = true;
@ -172,7 +171,6 @@
_.each(["_mount"], function (name) { _.each(["_mount"], function (name) {
var old = BI.Widget.prototype[name]; var old = BI.Widget.prototype[name];
old && (BI.Widget.prototype[name] = function () { old && (BI.Widget.prototype[name] = function () {
createStore.call(this);
this.store && pushTarget(this.store); this.store && pushTarget(this.store);
var res = old.apply(this, arguments); var res = old.apply(this, arguments);
this.store && popTarget(); this.store && popTarget();

6
dist/fix/fix.js vendored

@ -24,12 +24,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var hasProto = '__proto__' in {}; var hasProto = '__proto__' in {};
var isIE = function isIE() { var isIE = function isIE() {
if (typeof navigator === "undefined") {
return false;
}
return (/(msie|trident)/i.test(navigator.userAgent.toLowerCase()) return (/(msie|trident)/i.test(navigator.userAgent.toLowerCase())
); );
}; };
var getIEVersion = function getIEVersion() { var getIEVersion = function getIEVersion() {
var version = 0; var version = 0;
if (typeof navigator === "undefined") {
return false;
}
var agent = navigator.userAgent.toLowerCase(); var agent = navigator.userAgent.toLowerCase();
var v1 = agent.match(/(?:msie\s([\w.]+))/); var v1 = agent.match(/(?:msie\s([\w.]+))/);
var v2 = agent.match(/(?:trident.*rv:([\w.]+))/); var v2 = agent.match(/(?:trident.*rv:([\w.]+))/);

6
dist/polyfill.js vendored

@ -99,7 +99,7 @@ if (!Array.prototype.lastIndexOf) {
* Created by wang on 15/6/23. * Created by wang on 15/6/23.
*/ */
// 解决console未定义问题 guy // 解决console未定义问题 guy
window.console = window.console || (function () { _global.console = _global.console || (function () {
var c = {}; var c = {};
c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
= c.clear = c.exception = c.trace = c.assert = function () { = c.clear = c.exception = c.trace = c.assert = function () {
@ -109,7 +109,7 @@ window.console = window.console || (function () {
/* /*
* 前端缓存 * 前端缓存
*/ */
window.localStorage || (window.localStorage = { _global.localStorage || (_global.localStorage = {
items: {}, items: {},
setItem: function (k, v) { setItem: function (k, v) {
BI.Cache.addCookie(k, v); BI.Cache.addCookie(k, v);
@ -216,7 +216,7 @@ if(!Date.now) {
return this; return this;
} }
return _sort.call(this); return _sort.call(this);
}; };
} }
}(window); }(window);

8
dist/router.js vendored

@ -318,8 +318,8 @@
// Ensure that `History` can be used outside of the browser. // Ensure that `History` can be used outside of the browser.
if (typeof window !== "undefined") { if (typeof window !== "undefined") {
this.location = window.location; this.location = _global.location;
this.history = window.history; this.history = _global.history;
} }
}; };
@ -437,7 +437,7 @@
} }
// Add a cross-platform `addEventListener` shim for older browsers. // Add a cross-platform `addEventListener` shim for older browsers.
var addEventListener = window.addEventListener || function (eventName, listener) { var addEventListener = _global.addEventListener || function (eventName, listener) {
return attachEvent("on" + eventName, listener); return attachEvent("on" + eventName, listener);
}; };
@ -458,7 +458,7 @@
// but possibly useful for unit testing Routers. // but possibly useful for unit testing Routers.
stop: function () { stop: function () {
// Add a cross-platform `removeEventListener` shim for older browsers. // Add a cross-platform `removeEventListener` shim for older browsers.
var removeEventListener = window.removeEventListener || function (eventName, listener) { var removeEventListener = _global.removeEventListener || function (eventName, listener) {
return detachEvent("on" + eventName, listener); return detachEvent("on" + eventName, listener);
}; };

138
dist/utils.js vendored

@ -1,4 +1,22 @@
/** /**
* Created by richie on 15/7/8.
*/
/**
* 初始化BI对象
*/
var _global;
if (typeof window !== "undefined") {
_global = window;
} else if (typeof global !== "undefined") {
_global = global;
} else if (typeof self !== "undefined") {
_global = self;
} else {
_global = this;
}
if (_global.BI == null) {
_global.BI = {};
}/**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim"`
@ -10089,14 +10107,6 @@
} }
}.call(this)); }.call(this));
/** /**
* Created by richie on 15/7/8.
*/
/**
* 初始化BI对象
*/
if (window.BI == null) {
window.BI = {};
}/**
* 常量 * 常量
*/ */
@ -10938,9 +10948,18 @@ Function.prototype.after = function (func) {
* Create By GUY 2014\11\17 * Create By GUY 2014\11\17
* *
*/ */
var _global;
if (!window.BI) { if (typeof window !== "undefined") {
window.BI = {}; _global = window;
} else if (typeof global !== "undefined") {
_global = global;
} else if (typeof self !== "undefined") {
_global = self;
} else {
_global = this;
}
if (!_global.BI) {
_global.BI = {};
} }
!(function (undefined) { !(function (undefined) {
@ -11382,7 +11401,7 @@ if (!window.BI) {
}; };
} }
var F = function () { var F = function () {
}, spp = sp.prototype; }, spp = sp.prototype;
F.prototype = spp; F.prototype = spp;
sb.prototype = new F(); sb.prototype = new F();
sb.superclass = spp; sb.superclass = spp;
@ -11668,11 +11687,11 @@ if (!window.BI) {
}); });
_.extend(BI, { _.extend(BI, {
getTime: function () { getTime: function () {
if (window.performance && window.performance.now) { if (_global.performance && _global.performance.now) {
return window.performance.now(); return _global.performance.now();
} }
if (window.performance && window.performance.webkitNow) { if (_global.performance && _global.performance.webkitNow) {
return window.performance.webkitNow(); return _global.performance.webkitNow();
} }
if (Date.now) { if (Date.now) {
return Date.now(); return Date.now();
@ -12297,6 +12316,9 @@ if (!window.BI) {
// 浏览器相关方法 // 浏览器相关方法
_.extend(BI, { _.extend(BI, {
isIE: function () { isIE: function () {
if(!_global.navigator) {
return false;
}
if (this.__isIE == null) { if (this.__isIE == null) {
this.__isIE = /(msie|trident)/i.test(navigator.userAgent.toLowerCase()); this.__isIE = /(msie|trident)/i.test(navigator.userAgent.toLowerCase());
} }
@ -12304,6 +12326,9 @@ if (!window.BI) {
}, },
getIEVersion: function () { getIEVersion: function () {
if(!_global.navigator) {
return 0;
}
if (this.__IEVersion != null) { if (this.__IEVersion != null) {
return this.__IEVersion; return this.__IEVersion;
} }
@ -12331,38 +12356,65 @@ if (!window.BI) {
}, },
isEdge: function () { isEdge: function () {
if(!_global.navigator) {
return false;
}
return /edge/i.test(navigator.userAgent.toLowerCase()); return /edge/i.test(navigator.userAgent.toLowerCase());
}, },
isChrome: function () { isChrome: function () {
if(!_global.navigator) {
return false;
}
return /chrome/i.test(navigator.userAgent.toLowerCase()); return /chrome/i.test(navigator.userAgent.toLowerCase());
}, },
isFireFox: function () { isFireFox: function () {
if(!_global.navigator) {
return false;
}
return /firefox/i.test(navigator.userAgent.toLowerCase()); return /firefox/i.test(navigator.userAgent.toLowerCase());
}, },
isOpera: function () { isOpera: function () {
if(!_global.navigator) {
return false;
}
return /opera/i.test(navigator.userAgent.toLowerCase()); return /opera/i.test(navigator.userAgent.toLowerCase());
}, },
isSafari: function () { isSafari: function () {
if(!_global.navigator) {
return false;
}
return /safari/i.test(navigator.userAgent.toLowerCase()); return /safari/i.test(navigator.userAgent.toLowerCase());
}, },
isKhtml: function () { isKhtml: function () {
if(!_global.navigator) {
return false;
}
return /Konqueror|Safari|KHTML/i.test(navigator.userAgent); return /Konqueror|Safari|KHTML/i.test(navigator.userAgent);
}, },
isMac: function () { isMac: function () {
if(!_global.navigator) {
return false;
}
return /macintosh|mac os x/i.test(navigator.userAgent); return /macintosh|mac os x/i.test(navigator.userAgent);
}, },
isWindows: function () { isWindows: function () {
if(!_global.navigator) {
return false;
}
return /windows|win32/i.test(navigator.userAgent); return /windows|win32/i.test(navigator.userAgent);
}, },
isSupportCss3: function (style) { isSupportCss3: function (style) {
if(!_global.document) {
return false;
}
var prefix = ["webkit", "Moz", "ms", "o"], var prefix = ["webkit", "Moz", "ms", "o"],
i, len, i, len,
humpString = [], humpString = [],
@ -12418,7 +12470,7 @@ BI.OB = function (config) {
if (BI.isFunction(this.props)) { if (BI.isFunction(this.props)) {
props = this.props(config); props = this.props(config);
} }
this.options = (window.$ || window._).extend(this._defaultConfig(config), props, config); this.options = (_global.$ || _global._).extend(this._defaultConfig(config), props, config);
this._init(); this._init();
this._initRef(); this._initRef();
}; };
@ -12560,8 +12612,18 @@ _.extend(BI.OB.prototype, {
this.purgeListeners(); this.purgeListeners();
} }
});(function () { });(function () {
if (!window.BI) { var _global;
window.BI = {}; if (typeof window !== "undefined") {
_global = window;
} else if (typeof global !== "undefined") {
_global = global;
} else if (typeof self !== "undefined") {
_global = self;
} else {
_global = this;
}
if (!_global.BI) {
_global.BI = {};
} }
function isEmpty (value) { function isEmpty (value) {
@ -13089,7 +13151,7 @@ _.extend(BI.OB.prototype, {
try { try {
// 注意0啊 // 注意0啊
// var jo = $.parseJSON(text) || {}; // var jo = $.parseJSON(text) || {};
var jo = $ ? $.parseJSON(text) : window.JSON.parse(text); var jo = $ ? $.parseJSON(text) : _global.JSON.parse(text);
if (jo == null) { if (jo == null) {
jo = {}; jo = {};
} }
@ -13142,7 +13204,7 @@ _.extend(BI.OB.prototype, {
url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) { url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) {
return BI.specialCharsMap[str] || str; return BI.specialCharsMap[str] || str;
}); });
return window.encodeURIComponent(url); return _global.encodeURIComponent(url);
}; };
BI.decodeURIComponent = function (url) { BI.decodeURIComponent = function (url) {
@ -13154,7 +13216,7 @@ _.extend(BI.OB.prototype, {
url = url.replaceAll(BI.keys(reserveSpecialCharsMap || []).join("|"), function (str) { url = url.replaceAll(BI.keys(reserveSpecialCharsMap || []).join("|"), function (str) {
return reserveSpecialCharsMap[str] || str; return reserveSpecialCharsMap[str] || str;
}); });
return window.decodeURIComponent(url); return _global.decodeURIComponent(url);
}; };
BI.contentFormat = function (cv, fmt) { BI.contentFormat = function (cv, fmt) {
@ -13444,7 +13506,7 @@ _.extend(BI.OB.prototype, {
var constantInjection = {}; var constantInjection = {};
BI.constant = function (xtype, cls) { BI.constant = function (xtype, cls) {
if (constantInjection[xtype] != null) { if (constantInjection[xtype] != null) {
console.error("constant:[" + xtype + "] has been registed"); _global.console && console.error("constant:[" + xtype + "] has been registed");
} }
constantInjection[xtype] = cls; constantInjection[xtype] = cls;
}; };
@ -13452,7 +13514,7 @@ _.extend(BI.OB.prototype, {
var modelInjection = {}; var modelInjection = {};
BI.model = function (xtype, cls) { BI.model = function (xtype, cls) {
if (modelInjection[xtype] != null) { if (modelInjection[xtype] != null) {
console.error("model:[" + xtype + "] has been registed"); _global.console && console.error("model:[" + xtype + "] has been registed");
} }
modelInjection[xtype] = cls; modelInjection[xtype] = cls;
}; };
@ -13460,7 +13522,7 @@ _.extend(BI.OB.prototype, {
var storeInjection = {}; var storeInjection = {};
BI.store = function (xtype, cls) { BI.store = function (xtype, cls) {
if (storeInjection[xtype] != null) { if (storeInjection[xtype] != null) {
console.error("store:[" + xtype + "] has been registed"); _global.console && console.error("store:[" + xtype + "] has been registed");
} }
storeInjection[xtype] = cls; storeInjection[xtype] = cls;
}; };
@ -13468,7 +13530,7 @@ _.extend(BI.OB.prototype, {
var serviceInjection = {}; var serviceInjection = {};
BI.service = function (xtype, cls) { BI.service = function (xtype, cls) {
if (serviceInjection[xtype] != null) { if (serviceInjection[xtype] != null) {
console.error("service:[" + xtype + "] has been registed"); _global.console && console.error("service:[" + xtype + "] has been registed");
} }
serviceInjection[xtype] = cls; serviceInjection[xtype] = cls;
}; };
@ -13476,7 +13538,7 @@ _.extend(BI.OB.prototype, {
var providerInjection = {}; var providerInjection = {};
BI.provider = function (xtype, cls) { BI.provider = function (xtype, cls) {
if (providerInjection[xtype] != null) { if (providerInjection[xtype] != null) {
console.error("provider:[" + xtype + "] has been registed"); _global.console && console.error("provider:[" + xtype + "] has been registed");
} }
providerInjection[xtype] = cls; providerInjection[xtype] = cls;
}; };
@ -13546,7 +13608,7 @@ _.extend(BI.OB.prototype, {
try { try {
bfns[i].apply(inst, arguments); bfns[i].apply(inst, arguments);
} catch (e) { } catch (e) {
console.error(e); _global.console && console.error(e);
} }
} }
}; };
@ -13560,7 +13622,7 @@ _.extend(BI.OB.prototype, {
try { try {
afns[i].apply(inst, arguments); afns[i].apply(inst, arguments);
} catch (e) { } catch (e) {
console.error(e); _global.console && console.error(e);
} }
} }
}; };
@ -13624,7 +13686,7 @@ _.extend(BI.OB.prototype, {
try { try {
act(event, config); act(event, config);
} catch (e) { } catch (e) {
console.error(e); _global.console && console.error(e);
} }
}); });
}, },
@ -13634,7 +13696,7 @@ _.extend(BI.OB.prototype, {
try { try {
act.apply(null, args); act.apply(null, args);
} catch (e) { } catch (e) {
console.error(e); _global.console && console.error(e);
} }
}); });
} }
@ -14616,19 +14678,19 @@ BI.ScalingCellSizeAndPositionManager.prototype = {
* version: 0.5.3 * version: 0.5.3
**/ **/
!(function () { !(function () {
var attachEvent = document.attachEvent, var attachEvent = _global.document && _global.document.attachEvent,
stylesCreated = false; stylesCreated = false;
if (!attachEvent) { if (_global.document && !attachEvent) {
var requestFrame = (function () { var requestFrame = (function () {
var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame ||
function (fn) { return window.setTimeout(fn, 20); }; function (fn) { return _global.setTimeout(fn, 20); };
return function (fn) { return raf(fn); }; return function (fn) { return raf(fn); };
})(); })();
var cancelFrame = (function () { var cancelFrame = (function () {
var cancel = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame ||
window.clearTimeout; _global.clearTimeout;
return function (id) { return cancel(id); }; return function (id) { return cancel(id); };
})(); })();
@ -15096,7 +15158,7 @@ BI.ScalingCellSizeAndPositionManager.prototype = {
return Math.floor(node / 2); return Math.floor(node / 2);
}; };
var Int32Array = window.Int32Array || function (size) { var Int32Array = _global.Int32Array || function (size) {
var xs = []; var xs = [];
for (var i = size - 1; i >= 0; --i) { for (var i = size - 1; i >= 0; --i) {
xs[i] = 0; xs[i] = 0;

10
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

13
dist/widget.js vendored

@ -9558,12 +9558,15 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
}, },
value: this.storeValue value: this.storeValue
}); });
BI.createWidget({
type: "bi.vertical", BI.createWidget(BI.extend({
element: this, element: this
items: [this.button_group], }, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Top), BI.extend({
scrolly: true,
vgap: 5 vgap: 5
}); }, opts.logic, {
items: BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Top, this.button_group)
}))));
this.button_group.on(BI.Controller.EVENT_CHANGE, function () { this.button_group.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}); });

742
package-lock.json generated

File diff suppressed because it is too large Load Diff

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

@ -1,152 +1,150 @@
(function ($) {
/** /**
* 文字类型的按钮 * 文字类型的按钮
* @class BI.Button * @class BI.Button
* @extends BI.BasicButton * @extends BI.BasicButton
* *
* @cfg {JSON} options 配置属性 * @cfg {JSON} options 配置属性
* @cfg {'common'/'success'/'warning'/'ignore'} [options.level='common'] 按钮类型用不同颜色强调不同的场景 * @cfg {'common'/'success'/'warning'/'ignore'} [options.level='common'] 按钮类型用不同颜色强调不同的场景
*/ */
BI.Button = BI.inherit(BI.BasicButton, { BI.Button = BI.inherit(BI.BasicButton, {
_defaultConfig: function (props) { _defaultConfig: function (props) {
var conf = BI.Button.superclass._defaultConfig.apply(this, arguments); var conf = BI.Button.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-button", baseCls: (conf.baseCls || "") + " bi-button",
minWidth: (props.block === true || props.clear === true) ? 0 : 80, minWidth: (props.block === true || props.clear === true) ? 0 : 80,
height: 24, height: 24,
shadow: props.clear !== true, shadow: props.clear !== true,
isShadowShowingOnSelected: true, isShadowShowingOnSelected: true,
readonly: true, readonly: true,
iconCls: "", iconCls: "",
level: "common", level: "common",
block: false, // 是否块状显示,即不显示边框,没有最小宽度的限制 block: false, // 是否块状显示,即不显示边框,没有最小宽度的限制
clear: false, // 是否去掉边框和背景 clear: false, // 是否去掉边框和背景
ghost: false, // 是否幽灵显示, 即正常状态无背景 ghost: false, // 是否幽灵显示, 即正常状态无背景
textAlign: "center", textAlign: "center",
whiteSpace: "nowrap", whiteSpace: "nowrap",
forceCenter: false, forceCenter: false,
textWidth: null, textWidth: null,
textHeight: null, textHeight: null,
hgap: props.clear ? 0 : 10, hgap: props.clear ? 0 : 10,
vgap: 0, vgap: 0,
tgap: 0, tgap: 0,
bgap: 0, bgap: 0,
lgap: 0, lgap: 0,
rgap: 0 rgap: 0
}); });
}, },
_init: function () { _init: function () {
BI.Button.superclass._init.apply(this, arguments); BI.Button.superclass._init.apply(this, arguments);
var o = this.options, self = this; var o = this.options, self = this;
if (BI.isNumber(o.height) && !o.clear && !o.block) { if (BI.isNumber(o.height) && !o.clear && !o.block) {
this.element.css({height: o.height + "px", lineHeight: (o.height - 2) + "px"}); this.element.css({height: o.height + "px", lineHeight: (o.height - 2) + "px"});
} else if (o.clear || o.block) { } else if (o.clear || o.block) {
this.element.css({lineHeight: o.height + "px"}); this.element.css({lineHeight: o.height + "px"});
} else { } else {
this.element.css({lineHeight: (o.height - 2) + "px"}); this.element.css({lineHeight: (o.height - 2) + "px"});
} }
if (BI.isKey(o.iconCls)) { if (BI.isKey(o.iconCls)) {
this.icon = BI.createWidget({ this.icon = BI.createWidget({
type: "bi.icon", type: "bi.icon",
width: 18, width: 18,
height: o.height - 2 height: o.height - 2
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
text: o.text, text: o.text,
value: o.value, value: o.value,
height: o.height - 2 height: o.height - 2
}); });
BI.createWidget({ BI.createWidget({
type: "bi.horizontal_auto", type: "bi.horizontal_auto",
cls: o.iconCls, cls: o.iconCls,
element: this, element: this,
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
tgap: o.tgap, tgap: o.tgap,
bgap: o.bgap, bgap: o.bgap,
lgap: o.lgap, lgap: o.lgap,
rgap: o.rgap, rgap: o.rgap,
items: [{ items: [{
type: "bi.horizontal", type: "bi.horizontal",
items: [this.icon, this.text] items: [this.icon, this.text]
}] }]
}); });
} else { } else {
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
textAlign: o.textAlign, textAlign: o.textAlign,
whiteSpace: o.whiteSpace, whiteSpace: o.whiteSpace,
forceCenter: o.forceCenter, forceCenter: o.forceCenter,
textWidth: o.textWidth, textWidth: o.textWidth,
textHeight: o.textHeight, textHeight: o.textHeight,
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
tgap: o.tgap, tgap: o.tgap,
bgap: o.bgap, bgap: o.bgap,
lgap: o.lgap, lgap: o.lgap,
rgap: o.rgap, rgap: o.rgap,
element: this, element: this,
text: o.text, text: o.text,
value: o.value value: o.value
}); });
} }
if (o.block === true) { if (o.block === true) {
this.element.addClass("block"); this.element.addClass("block");
} }
if (o.clear === true) { if (o.clear === true) {
this.element.addClass("clear"); this.element.addClass("clear");
} }
if (o.ghost === true) { if (o.ghost === true) {
this.element.addClass("ghost"); this.element.addClass("ghost");
} }
if (o.minWidth > 0) { if (o.minWidth > 0) {
this.element.css({"min-width": o.minWidth + "px"}); this.element.css({"min-width": o.minWidth + "px"});
} }
}, },
doClick: function () { doClick: function () {
BI.Button.superclass.doClick.apply(this, arguments); BI.Button.superclass.doClick.apply(this, arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.Button.EVENT_CHANGE, this); this.fireEvent(BI.Button.EVENT_CHANGE, this);
} }
}, },
setText: function (text) { setText: function (text) {
BI.Button.superclass.setText.apply(this, arguments); BI.Button.superclass.setText.apply(this, arguments);
this.text.setText(text); this.text.setText(text);
}, },
setValue: function (text) { setValue: function (text) {
BI.Button.superclass.setValue.apply(this, arguments); BI.Button.superclass.setValue.apply(this, arguments);
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.text.setValue(text); this.text.setValue(text);
} }
}, },
doRedMark: function () { doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark.apply(this.text, arguments);
}, },
unRedMark: function () { unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark.apply(this.text, arguments);
}, },
doHighLight: function () { doHighLight: function () {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight.apply(this.text, arguments);
}, },
unHighLight: function () { unHighLight: function () {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight.apply(this.text, arguments);
}, },
destroy: function () { destroy: function () {
BI.Button.superclass.destroy.apply(this, arguments); BI.Button.superclass.destroy.apply(this, arguments);
} }
}); });
BI.shortcut("bi.button", BI.Button); BI.shortcut("bi.button", BI.Button);
BI.Button.EVENT_CHANGE = "EVENT_CHANGE"; BI.Button.EVENT_CHANGE = "EVENT_CHANGE";
})(jQuery);

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

@ -6,7 +6,7 @@
* @extends BI.Single * @extends BI.Single
* @abstract * @abstract
*/ */
(function () { (function (document) {
/** /**
* @description normalize input.files. create if not present, add item method if not present * @description normalize input.files. create if not present, add item method if not present
@ -153,7 +153,7 @@
}, },
false false
); );
xhr.open("post", handler.url + "&filename=" + window.encodeURIComponent(handler.file.fileName), true); xhr.open("post", handler.url + "&filename=" + _global.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 () {
@ -264,7 +264,7 @@
handler.attach_array.push(attachO); handler.attach_array.push(attachO);
} }
} catch (e) { } catch (e) {
if (isFunction(handler.onerror)) {handler.onerror(rpe, event || window.event);} if (isFunction(handler.onerror)) {handler.onerror(rpe, event || _global.event);}
} }
if (isFunction(handler.onload)) {handler.onload(rpe, {responseText: responseText});} if (isFunction(handler.onload)) {handler.onload(rpe, {responseText: responseText});}
}, },
@ -284,7 +284,7 @@
iframe.onload = onload; iframe.onload = onload;
iframe.onerror = function (event) { iframe.onerror = function (event) {
if (isFunction(handler.onerror)) { if (isFunction(handler.onerror)) {
handler.onerror(rpe, event || window.event); handler.onerror(rpe, event || _global.event);
} }
}; };
iframe.onreadystatechange = function () { iframe.onreadystatechange = function () {
@ -306,7 +306,7 @@
}); });
} }
}; };
form.setAttribute("action", handler.url + "&filename=" + window.encodeURIComponent(handler.file.fileName)); form.setAttribute("action", handler.url + "&filename=" + _global.encodeURIComponent(handler.file.fileName));
form.setAttribute("target", iframe.id); form.setAttribute("target", iframe.id);
form.setAttribute("method", "post"); form.setAttribute("method", "post");
form.appendChild(handler.file); form.appendChild(handler.file);
@ -614,4 +614,4 @@
BI.File.EVENT_PROGRESS = "EVENT_PROGRESS"; BI.File.EVENT_PROGRESS = "EVENT_PROGRESS";
BI.File.EVENT_UPLOADED = "EVENT_UPLOADED"; BI.File.EVENT_UPLOADED = "EVENT_UPLOADED";
BI.shortcut("bi.file", BI.File); BI.shortcut("bi.file", BI.File);
})(); })(_global.document || {});

4
src/base/tree/treeview.js

@ -114,8 +114,8 @@ BI.TreeView = BI.inherit(BI.Pane, {
treeNode.times = treeNode.times || 1; treeNode.times = treeNode.times || 1;
var param = "id=" + treeNode.id var param = "id=" + treeNode.id
+ "&times=" + (treeNode.times++) + "&times=" + (treeNode.times++)
+ "&parentValues= " + window.encodeURIComponent(BI.jsonEncode(parentNode)) + "&parentValues= " + _global.encodeURIComponent(BI.jsonEncode(parentNode))
+ "&checkState=" + window.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus())); + "&checkState=" + _global.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus()));
return "&" + param; return "&" + param;
} }

20
src/core/alias.js

@ -1,6 +1,16 @@
(function () { (function () {
if (!window.BI) { var _global;
window.BI = {}; if (typeof window !== "undefined") {
_global = window;
} else if (typeof global !== "undefined") {
_global = global;
} else if (typeof self !== "undefined") {
_global = self;
} else {
_global = this;
}
if (!_global.BI) {
_global.BI = {};
} }
function isEmpty (value) { function isEmpty (value) {
@ -528,7 +538,7 @@
try { try {
// 注意0啊 // 注意0啊
// var jo = $.parseJSON(text) || {}; // var jo = $.parseJSON(text) || {};
var jo = $ ? $.parseJSON(text) : window.JSON.parse(text); var jo = $ ? $.parseJSON(text) : _global.JSON.parse(text);
if (jo == null) { if (jo == null) {
jo = {}; jo = {};
} }
@ -581,7 +591,7 @@
url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) { url = url.replaceAll(BI.keys(BI.specialCharsMap || []).join("|"), function (str) {
return BI.specialCharsMap[str] || str; return BI.specialCharsMap[str] || str;
}); });
return window.encodeURIComponent(url); return _global.encodeURIComponent(url);
}; };
BI.decodeURIComponent = function (url) { BI.decodeURIComponent = function (url) {
@ -593,7 +603,7 @@
url = url.replaceAll(BI.keys(reserveSpecialCharsMap || []).join("|"), function (str) { url = url.replaceAll(BI.keys(reserveSpecialCharsMap || []).join("|"), function (str) {
return reserveSpecialCharsMap[str] || str; return reserveSpecialCharsMap[str] || str;
}); });
return window.decodeURIComponent(url); return _global.decodeURIComponent(url);
}; };
BI.contentFormat = function (cv, fmt) { BI.contentFormat = function (cv, fmt) {

58
src/core/base.js

@ -3,9 +3,18 @@
* Create By GUY 2014\11\17 * Create By GUY 2014\11\17
* *
*/ */
var _global;
if (!window.BI) { if (typeof window !== "undefined") {
window.BI = {}; _global = window;
} else if (typeof global !== "undefined") {
_global = global;
} else if (typeof self !== "undefined") {
_global = self;
} else {
_global = this;
}
if (!_global.BI) {
_global.BI = {};
} }
!(function (undefined) { !(function (undefined) {
@ -447,7 +456,7 @@ if (!window.BI) {
}; };
} }
var F = function () { var F = function () {
}, spp = sp.prototype; }, spp = sp.prototype;
F.prototype = spp; F.prototype = spp;
sb.prototype = new F(); sb.prototype = new F();
sb.superclass = spp; sb.superclass = spp;
@ -733,11 +742,11 @@ if (!window.BI) {
}); });
_.extend(BI, { _.extend(BI, {
getTime: function () { getTime: function () {
if (window.performance && window.performance.now) { if (_global.performance && _global.performance.now) {
return window.performance.now(); return _global.performance.now();
} }
if (window.performance && window.performance.webkitNow) { if (_global.performance && _global.performance.webkitNow) {
return window.performance.webkitNow(); return _global.performance.webkitNow();
} }
if (Date.now) { if (Date.now) {
return Date.now(); return Date.now();
@ -1362,6 +1371,9 @@ if (!window.BI) {
// 浏览器相关方法 // 浏览器相关方法
_.extend(BI, { _.extend(BI, {
isIE: function () { isIE: function () {
if(!_global.navigator) {
return false;
}
if (this.__isIE == null) { if (this.__isIE == null) {
this.__isIE = /(msie|trident)/i.test(navigator.userAgent.toLowerCase()); this.__isIE = /(msie|trident)/i.test(navigator.userAgent.toLowerCase());
} }
@ -1369,6 +1381,9 @@ if (!window.BI) {
}, },
getIEVersion: function () { getIEVersion: function () {
if(!_global.navigator) {
return 0;
}
if (this.__IEVersion != null) { if (this.__IEVersion != null) {
return this.__IEVersion; return this.__IEVersion;
} }
@ -1396,38 +1411,65 @@ if (!window.BI) {
}, },
isEdge: function () { isEdge: function () {
if(!_global.navigator) {
return false;
}
return /edge/i.test(navigator.userAgent.toLowerCase()); return /edge/i.test(navigator.userAgent.toLowerCase());
}, },
isChrome: function () { isChrome: function () {
if(!_global.navigator) {
return false;
}
return /chrome/i.test(navigator.userAgent.toLowerCase()); return /chrome/i.test(navigator.userAgent.toLowerCase());
}, },
isFireFox: function () { isFireFox: function () {
if(!_global.navigator) {
return false;
}
return /firefox/i.test(navigator.userAgent.toLowerCase()); return /firefox/i.test(navigator.userAgent.toLowerCase());
}, },
isOpera: function () { isOpera: function () {
if(!_global.navigator) {
return false;
}
return /opera/i.test(navigator.userAgent.toLowerCase()); return /opera/i.test(navigator.userAgent.toLowerCase());
}, },
isSafari: function () { isSafari: function () {
if(!_global.navigator) {
return false;
}
return /safari/i.test(navigator.userAgent.toLowerCase()); return /safari/i.test(navigator.userAgent.toLowerCase());
}, },
isKhtml: function () { isKhtml: function () {
if(!_global.navigator) {
return false;
}
return /Konqueror|Safari|KHTML/i.test(navigator.userAgent); return /Konqueror|Safari|KHTML/i.test(navigator.userAgent);
}, },
isMac: function () { isMac: function () {
if(!_global.navigator) {
return false;
}
return /macintosh|mac os x/i.test(navigator.userAgent); return /macintosh|mac os x/i.test(navigator.userAgent);
}, },
isWindows: function () { isWindows: function () {
if(!_global.navigator) {
return false;
}
return /windows|win32/i.test(navigator.userAgent); return /windows|win32/i.test(navigator.userAgent);
}, },
isSupportCss3: function (style) { isSupportCss3: function (style) {
if(!_global.document) {
return false;
}
var prefix = ["webkit", "Moz", "ms", "o"], var prefix = ["webkit", "Moz", "ms", "o"],
i, len, i, len,
humpString = [], humpString = [],

6
src/core/config.js

@ -78,10 +78,4 @@
return ob; return ob;
}); });
// IE8下滚动条用原生的
$(function () {
if (BI.isIE9Below()) {
BI.GridTableScrollbar.SIZE = 18;
}
});
}()); }());

2
src/core/controller/controller.resizer.js

@ -18,7 +18,7 @@ BI.ResizeController = BI.inherit(BI.Controller, {
self._resize(ev); self._resize(ev);
// } // }
}, 30); }, 30);
$(window).resize(fn); _global.$ && $(window).resize(fn);
}, },
_resize: function (ev) { _resize: function (ev) {

14
src/core/foundation.js vendored

@ -4,6 +4,16 @@
/** /**
* 初始化BI对象 * 初始化BI对象
*/ */
if (window.BI == null) { var _global;
window.BI = {}; if (typeof window !== "undefined") {
_global = window;
} else if (typeof global !== "undefined") {
_global = global;
} else if (typeof self !== "undefined") {
_global = self;
} else {
_global = this;
}
if (_global.BI == null) {
_global.BI = {};
} }

4
src/core/func/dom.js

@ -90,9 +90,9 @@ BI.extend(jQuery.fn, {
var computedStyle = void 0; var computedStyle = void 0;
// W3C Standard // W3C Standard
if (window.getComputedStyle) { if (_global.getComputedStyle) {
// In certain cases such as within an iframe in FF3, this returns null. // In certain cases such as within an iframe in FF3, this returns null.
computedStyle = window.getComputedStyle(node, null); computedStyle = _global.getComputedStyle(node, null);
if (computedStyle) { if (computedStyle) {
return computedStyle.getPropertyValue(BI.hyphenate(name)); return computedStyle.getPropertyValue(BI.hyphenate(name));
} }

18
src/core/inject.js

@ -2,7 +2,7 @@
var constantInjection = {}; var constantInjection = {};
BI.constant = function (xtype, cls) { BI.constant = function (xtype, cls) {
if (constantInjection[xtype] != null) { if (constantInjection[xtype] != null) {
console.error("constant:[" + xtype + "] has been registed"); _global.console && console.error("constant:[" + xtype + "] has been registed");
} }
constantInjection[xtype] = cls; constantInjection[xtype] = cls;
}; };
@ -10,7 +10,7 @@
var modelInjection = {}; var modelInjection = {};
BI.model = function (xtype, cls) { BI.model = function (xtype, cls) {
if (modelInjection[xtype] != null) { if (modelInjection[xtype] != null) {
console.error("model:[" + xtype + "] has been registed"); _global.console && console.error("model:[" + xtype + "] has been registed");
} }
modelInjection[xtype] = cls; modelInjection[xtype] = cls;
}; };
@ -18,7 +18,7 @@
var storeInjection = {}; var storeInjection = {};
BI.store = function (xtype, cls) { BI.store = function (xtype, cls) {
if (storeInjection[xtype] != null) { if (storeInjection[xtype] != null) {
console.error("store:[" + xtype + "] has been registed"); _global.console && console.error("store:[" + xtype + "] has been registed");
} }
storeInjection[xtype] = cls; storeInjection[xtype] = cls;
}; };
@ -26,7 +26,7 @@
var serviceInjection = {}; var serviceInjection = {};
BI.service = function (xtype, cls) { BI.service = function (xtype, cls) {
if (serviceInjection[xtype] != null) { if (serviceInjection[xtype] != null) {
console.error("service:[" + xtype + "] has been registed"); _global.console && console.error("service:[" + xtype + "] has been registed");
} }
serviceInjection[xtype] = cls; serviceInjection[xtype] = cls;
}; };
@ -34,7 +34,7 @@
var providerInjection = {}; var providerInjection = {};
BI.provider = function (xtype, cls) { BI.provider = function (xtype, cls) {
if (providerInjection[xtype] != null) { if (providerInjection[xtype] != null) {
console.error("provider:[" + xtype + "] has been registed"); _global.console && console.error("provider:[" + xtype + "] has been registed");
} }
providerInjection[xtype] = cls; providerInjection[xtype] = cls;
}; };
@ -104,7 +104,7 @@
try { try {
bfns[i].apply(inst, arguments); bfns[i].apply(inst, arguments);
} catch (e) { } catch (e) {
console.error(e); _global.console && console.error(e);
} }
} }
}; };
@ -118,7 +118,7 @@
try { try {
afns[i].apply(inst, arguments); afns[i].apply(inst, arguments);
} catch (e) { } catch (e) {
console.error(e); _global.console && console.error(e);
} }
} }
}; };
@ -182,7 +182,7 @@
try { try {
act(event, config); act(event, config);
} catch (e) { } catch (e) {
console.error(e); _global.console && console.error(e);
} }
}); });
}, },
@ -192,7 +192,7 @@
try { try {
act.apply(null, args); act.apply(null, args);
} catch (e) { } catch (e) {
console.error(e); _global.console && console.error(e);
} }
}); });
} }

2
src/core/ob.js

@ -8,7 +8,7 @@ BI.OB = function (config) {
if (BI.isFunction(this.props)) { if (BI.isFunction(this.props)) {
props = this.props(config); props = this.props(config);
} }
this.options = (window.$ || window._).extend(this._defaultConfig(config), props, config); this.options = (_global.$ || _global._).extend(this._defaultConfig(config), props, config);
this._init(); this._init();
this._initRef(); this._initRef();
}; };

2
src/core/proto/date.i18n.js

@ -1,4 +1,4 @@
$(function () { _global.$ && $(function () {
// 牵扯到国际化这些常量在页面加载后再生效 // 牵扯到国际化这些常量在页面加载后再生效
// full day names // full day names
Date._DN = [BI.i18nText("BI-Basic_Sunday"), Date._DN = [BI.i18nText("BI-Basic_Sunday"),

2
src/core/shortcut.js

@ -2,7 +2,7 @@
var kv = {}; var kv = {};
BI.shortcut = function (xtype, cls) { BI.shortcut = function (xtype, cls) {
if (kv[xtype] != null) { if (kv[xtype] != null) {
console.error("shortcut:[" + xtype + "] has been registed"); _global.console && console.error("shortcut:[" + xtype + "] has been registed");
} }
kv[xtype] = cls; kv[xtype] = cls;
}; };

12
src/core/utils/detectElementResize.js

@ -8,19 +8,19 @@
* version: 0.5.3 * version: 0.5.3
**/ **/
!(function () { !(function () {
var attachEvent = document.attachEvent, var attachEvent = _global.document && _global.document.attachEvent,
stylesCreated = false; stylesCreated = false;
if (!attachEvent) { if (_global.document && !attachEvent) {
var requestFrame = (function () { var requestFrame = (function () {
var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame ||
function (fn) { return window.setTimeout(fn, 20); }; function (fn) { return _global.setTimeout(fn, 20); };
return function (fn) { return raf(fn); }; return function (fn) { return raf(fn); };
})(); })();
var cancelFrame = (function () { var cancelFrame = (function () {
var cancel = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame ||
window.clearTimeout; _global.clearTimeout;
return function (id) { return cancel(id); }; return function (id) { return cancel(id); };
})(); })();

14
src/core/utils/events/mousemovetracker.js

@ -1,13 +1,13 @@
!(function () { !(function () {
var cancelAnimationFrame = var cancelAnimationFrame =
window.cancelAnimationFrame || _global.cancelAnimationFrame ||
window.webkitCancelAnimationFrame || _global.webkitCancelAnimationFrame ||
window.mozCancelAnimationFrame || _global.mozCancelAnimationFrame ||
window.oCancelAnimationFrame || _global.oCancelAnimationFrame ||
window.msCancelAnimationFrame || _global.msCancelAnimationFrame ||
window.clearTimeout; _global.clearTimeout;
var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || window.setTimeout; var requestAnimationFrame = _global.requestAnimationFrame || _global.webkitRequestAnimationFrame || _global.mozRequestAnimationFrame || _global.oRequestAnimationFrame || _global.msRequestAnimationFrame || _global.setTimeout;
BI.MouseMoveTracker = function (onMove, onMoveEnd, domNode) { BI.MouseMoveTracker = function (onMove, onMoveEnd, domNode) {

2
src/core/utils/events/wheelhandler.js

@ -2,7 +2,7 @@
var PIXEL_STEP = 10; var PIXEL_STEP = 10;
var LINE_HEIGHT = 40; var LINE_HEIGHT = 40;
var PAGE_HEIGHT = 800; var PAGE_HEIGHT = 800;
var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || window.setTimeout; var requestAnimationFrame = _global.requestAnimationFrame || _global.webkitRequestAnimationFrame || _global.mozRequestAnimationFrame || _global.oRequestAnimationFrame || _global.msRequestAnimationFrame || _global.setTimeout;
function normalizeWheel (/* object*/event) /* object*/ { function normalizeWheel (/* object*/event) /* object*/ {
var sX = 0, var sX = 0,

2
src/core/utils/prefixIntervalTree.js

@ -4,7 +4,7 @@
return Math.floor(node / 2); return Math.floor(node / 2);
}; };
var Int32Array = window.Int32Array || function (size) { var Int32Array = _global.Int32Array || function (size) {
var xs = []; var xs = [];
for (var i = size - 1; i >= 0; --i) { for (var i = size - 1; i >= 0; --i) {
xs[i] = 0; xs[i] = 0;

50
src/core/widget.js

@ -7,11 +7,12 @@
*/ */
!(function () { !(function () {
var lazy = (typeof document !== 'undefined' && var lazy = (typeof document !== "undefined" &&
typeof document.documentMode === 'number') || typeof document.documentMode === "number") ||
(typeof navigator !== 'undefined' && (typeof navigator !== "undefined" &&
typeof navigator.userAgent === 'string' && typeof navigator.userAgent === "string" &&
/\bEdge\/\d/.test(navigator.userAgent)); /\bEdge\/\d/.test(navigator.userAgent));
BI.Widget = BI.inherit(BI.OB, { BI.Widget = BI.inherit(BI.OB, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.Widget.superclass._defaultConfig.apply(this), { return BI.extend(BI.Widget.superclass._defaultConfig.apply(this), {
@ -59,20 +60,14 @@
this._initElementHeight(); this._initElementHeight();
this._initVisual(); this._initVisual();
this._initState(); this._initState();
if (this.isVisible()) { if (this.beforeInit) {
if (this.beforeInit) { this.__asking = true;
this.__asking = true; this.beforeInit(BI.bind(this._render, this));
this.beforeInit(BI.bind(this._render, this)); if (this.__asking === true) {
if (this.__asking === true) { this.__async = true;
this.__async = true;
}
} else {
this._render();
} }
this.rendered = true } else {
} this._render();
if (this._isRoot) {
this._mount()
} }
}, },
@ -185,7 +180,7 @@
_mount: function () { _mount: function () {
var self = this; var self = this;
var isMounted = this._isMounted; var isMounted = this._isMounted;
if (this._isMounting || isMounted || !this.isVisible() || this.__asking === true) { if (isMounted || this.__asking === true) {
return; return;
} }
if (this._isRoot === true) { if (this._isRoot === true) {
@ -196,30 +191,17 @@
if (!isMounted) { if (!isMounted) {
return; return;
} }
this._isMounting = true
if (!this.rendered) {
if (this.beforeInit) {
this.__asking = true;
this.beforeInit(BI.bind(this._render, this));
if (this.__asking === true) {
this.__async = true;
}
} else {
this._render();
}
}
this.beforeMount && this.beforeMount(); this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
lazy && this._mountChildren && this._mountChildren(); !lazy && this._mountChildren && this._mountChildren();
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false); !self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false); !self.isValid() && widget._setValid(false);
widget._mount && widget._mount(); widget._mount && widget._mount();
}); });
!lazy && this._mountChildren && this._mountChildren(); lazy && this._mountChildren && this._mountChildren();
this.mounted && this.mounted(); this.mounted && this.mounted();
this._isMounting = false return true;
}, },
_mountChildren: null, _mountChildren: null,

6
src/core/wrapper/layout.js

@ -63,6 +63,10 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}, },
appendFragment: function (frag) {
this.element.append(frag);
},
_mountChildren: function () { _mountChildren: function () {
var self = this; var self = this;
var frag = document.createDocumentFragment(); var frag = document.createDocumentFragment();
@ -74,7 +78,7 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}); });
if (hasChild === true) { if (hasChild === true) {
this.element.append(frag); this.appendFragment(frag);
} }
}, },

17
src/core/wrapper/layout/adapt/adapt.center.js

@ -87,20 +87,9 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$tr.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$table);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag);
this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {

17
src/core/wrapper/layout/adapt/adapt.horizontal.js

@ -86,20 +86,9 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$tr.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$table);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag);
this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {

17
src/core/wrapper/layout/adapt/adapt.vertical.js

@ -87,20 +87,9 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$tr.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$table);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag);
this.element.append(this.$table);
}
}, },
_getWrapper: function () { _getWrapper: function () {

17
src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js

@ -24,20 +24,9 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$wrapper.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$wrapper);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag);
this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {

17
src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js

@ -54,20 +54,9 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$wrapper.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$wrapper);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag);
this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {

17
src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js

@ -54,20 +54,9 @@ BI.FlexVerticalCenter = BI.inherit(BI.Layout, {
return w; return w;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$wrapper.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$wrapper);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$wrapper.append(frag);
this.element.append(this.$wrapper);
}
}, },
_getWrapper: function () { _getWrapper: function () {

18
src/core/wrapper/layout/layout.horizontal.js

@ -87,23 +87,11 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
return td; return td;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$tr.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$table);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$tr.append(frag);
this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {
// console.log("horizontal layout do not need to resize"); // console.log("horizontal layout do not need to resize");
}, },

17
src/core/wrapper/layout/layout.td.js

@ -119,20 +119,9 @@ BI.TdLayout = BI.inherit(BI.Layout, {
return tr; return tr;
}, },
_mountChildren: function () { appendFragment: function (frag) {
var self = this; this.$table.append(frag);
var frag = document.createDocumentFragment(); this.element.append(this.$table);
var hasChild = false;
BI.each(this._children, function (i, widget) {
if (widget.element !== self.element) {
frag.appendChild(widget.element[0]);
hasChild = true;
}
});
if (hasChild === true) {
this.$table.append(frag);
this.element.append(this.$table);
}
}, },
resize: function () { resize: function () {

2
src/polyfill/console.js

@ -3,7 +3,7 @@
* Created by wang on 15/6/23. * Created by wang on 15/6/23.
*/ */
// 解决console未定义问题 guy // 解决console未定义问题 guy
window.console = window.console || (function () { _global.console = _global.console || (function () {
var c = {}; var c = {};
c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
= c.clear = c.exception = c.trace = c.assert = function () { = c.clear = c.exception = c.trace = c.assert = function () {

2
src/polyfill/localStorage.js

@ -1,7 +1,7 @@
/* /*
* 前端缓存 * 前端缓存
*/ */
window.localStorage || (window.localStorage = { _global.localStorage || (_global.localStorage = {
items: {}, items: {},
setItem: function (k, v) { setItem: function (k, v) {
BI.Cache.addCookie(k, v); BI.Cache.addCookie(k, v);

2
src/polyfill/sort.js

@ -25,7 +25,7 @@
return this; return this;
} }
return _sort.call(this); return _sort.call(this);
}; };
} }
}(window); }(window);

8
src/router/router.js

@ -318,8 +318,8 @@
// Ensure that `History` can be used outside of the browser. // Ensure that `History` can be used outside of the browser.
if (typeof window !== "undefined") { if (typeof window !== "undefined") {
this.location = window.location; this.location = _global.location;
this.history = window.history; this.history = _global.history;
} }
}; };
@ -437,7 +437,7 @@
} }
// Add a cross-platform `addEventListener` shim for older browsers. // Add a cross-platform `addEventListener` shim for older browsers.
var addEventListener = window.addEventListener || function (eventName, listener) { var addEventListener = _global.addEventListener || function (eventName, listener) {
return attachEvent("on" + eventName, listener); return attachEvent("on" + eventName, listener);
}; };
@ -458,7 +458,7 @@
// but possibly useful for unit testing Routers. // but possibly useful for unit testing Routers.
stop: function () { stop: function () {
// Add a cross-platform `removeEventListener` shim for older browsers. // Add a cross-platform `removeEventListener` shim for older browsers.
var removeEventListener = window.removeEventListener || function (eventName, listener) { var removeEventListener = _global.removeEventListener || function (eventName, listener) {
return detachEvent("on" + eventName, listener); return detachEvent("on" + eventName, listener);
}; };

2
src/third/jquery.mousewheel.js

@ -72,7 +72,7 @@
function handler (event) { function handler (event) {
var orgEvent = event || window.event, var orgEvent = event || _global.event,
args = slice.call(arguments, 1), args = slice.call(arguments, 1),
delta = 0, delta = 0,
deltaX = 0, deltaX = 0,

13
src/widget/multiselect/multiselect.loader.js

@ -103,12 +103,15 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
}, },
value: this.storeValue value: this.storeValue
}); });
BI.createWidget({
type: "bi.vertical", BI.createWidget(BI.extend({
element: this, element: this
items: [this.button_group], }, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Top), BI.extend({
scrolly: true,
vgap: 5 vgap: 5
}); }, opts.logic, {
items: BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Top, this.button_group)
}))));
this.button_group.on(BI.Controller.EVENT_CHANGE, function () { this.button_group.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}); });

Loading…
Cancel
Save