Tangjinxia 4 years ago
parent
commit
9c0776dfc1
  1. 7
      changelog.md
  2. 7
      demo/js/config/fix.js
  3. 4
      demo/js/core/popup/demo.popover.js
  4. 10
      demo/js/fix-2.0/context.js
  5. 102
      demo/js/fix-2.0/inject.js
  6. 4
      dist/2.0/fineui.css
  7. 4
      dist/2.0/fineui.ie.min.js
  8. 2
      dist/2.0/fineui.ie.min.js.map
  9. 2360
      dist/2.0/fineui.js
  10. 2
      dist/2.0/fineui.js.map
  11. 4
      dist/2.0/fineui.min.css
  12. 4
      dist/2.0/fineui.min.js
  13. 2
      dist/2.0/fineui.min.js.map
  14. 4
      dist/2.0/fineui_without_normalize.css
  15. 4
      dist/2.0/fineui_without_normalize.min.css
  16. 4
      dist/bundle.min.css
  17. 4
      dist/bundle.min.js
  18. 2
      dist/bundle.min.js.map
  19. 4
      dist/demo.css
  20. 2724
      dist/demo.js
  21. 2
      dist/demo.js.map
  22. 4
      dist/fineui.css
  23. 4
      dist/fineui.ie.min.js
  24. 2
      dist/fineui.ie.min.js.map
  25. 2362
      dist/fineui.js
  26. 2
      dist/fineui.js.map
  27. 4
      dist/fineui.min.css
  28. 4
      dist/fineui.min.js
  29. 2
      dist/fineui.min.js.map
  30. 1496
      dist/fineui_without_jquery_polyfill.js
  31. 2
      dist/fineui_without_jquery_polyfill.js.map
  32. 107
      dist/fix/fix.compact.ie.js
  33. 77
      dist/fix/fix.compact.js
  34. 24
      dist/fix/fix.js
  35. 2
      dist/font.css
  36. BIN
      dist/font/iconfont.eot
  37. 14
      dist/font/iconfont.svg
  38. BIN
      dist/font/iconfont.ttf
  39. BIN
      dist/font/iconfont.woff
  40. BIN
      dist/font/iconfont.woff2
  41. 1
      dist/lib/base/single/single.d.ts
  42. 25
      dist/utils.js
  43. 2
      dist/utils.js.map
  44. 4
      dist/utils.min.js
  45. 2
      dist/utils.min.js.map
  46. 8
      karma.conf.js
  47. 2
      package.json
  48. 8
      src/base/collection/collection.js
  49. 47
      src/base/combination/combo.js
  50. 6
      src/base/grid/grid.js
  51. 33
      src/base/layer/layer.popover.js
  52. 33
      src/base/pane.js
  53. 17
      src/base/single/iframe/iframe.js
  54. 12
      src/base/single/img/img.js
  55. 6
      src/base/single/link/link.js
  56. 13
      src/base/single/single.js
  57. 6
      src/base/tree/ztree/parttree.js
  58. 7
      src/case/button/node/node.arrow.js
  59. 5
      src/case/button/node/node.icon.arrow.js
  60. 3
      src/case/button/node/node.multilayer.icon.arrow.js
  61. 1
      src/case/button/treeitem/item.multilayer.icon.treeleaf.js
  62. 5
      src/case/button/treeitem/item.treetextleaf.js
  63. 17
      src/case/combo/searchtextvaluecombo/__test__/combo.searchtextvaluecombo.test.js
  64. 6
      src/case/layer/layer.multipopup.js
  65. 6
      src/case/layer/layer.panel.js
  66. 77
      src/case/pager/pager.all.count.js
  67. 9
      src/case/tree/ztree/tree.display.js
  68. 17
      src/component/allvaluechooser/abstract.allvaluechooser.js
  69. 19
      src/component/allvaluechooser/combo.allvaluechooser.js
  70. 10
      src/component/treevaluechooser/abstract.treevaluechooser.js
  71. 2
      src/component/treevaluechooser/pane.treevaluechooser.js
  72. 2
      src/core/__test__/alias.test.js
  73. 8
      src/core/__test__/base.test.js
  74. 322
      src/core/__test__/context.test.js
  75. 6
      src/core/action/action.show.js
  76. 5
      src/core/alias.js
  77. 4
      src/core/base.js
  78. 9
      src/core/controller.js
  79. 18
      src/core/logic/logic.layout.js
  80. 2
      src/core/ob.js
  81. 31
      src/core/shortcut.js
  82. 64
      src/core/widget.js
  83. 2
      src/core/wrapper/layout.js
  84. 4
      src/core/wrapper/layout/adapt/adapt.table.js
  85. 8
      src/core/wrapper/layout/adapt/float.horizontal.js
  86. 12
      src/core/wrapper/layout/layout.border.js
  87. 6
      src/core/wrapper/layout/layout.card.js
  88. 4
      src/core/wrapper/layout/layout.division.js
  89. 8
      src/core/wrapper/layout/layout.grid.js
  90. 4
      src/core/wrapper/layout/layout.horizontal.js
  91. 4
      src/core/wrapper/layout/layout.table.js
  92. 6
      src/core/wrapper/layout/layout.tape.js
  93. 8
      src/core/wrapper/layout/layout.td.js
  94. 4
      src/core/wrapper/layout/layout.window.js
  95. 6
      src/core/wrapper/layout/middle/middle.center.js
  96. 6
      src/core/wrapper/layout/middle/middle.float.center.js
  97. 6
      src/core/wrapper/layout/middle/middle.horizontal.js
  98. 6
      src/core/wrapper/layout/middle/middle.vertical.js
  99. 6
      src/less/base/combo/combo.bubble.less
  100. 6
      src/less/base/single/tip/tip.less
  101. Some files were not shown because too many files have changed in this diff Show More

7
changelog.md

@ -1,5 +1,12 @@
# 更新日志
2.0(2020-10)
- 支持Composition API
- pane和loadingPane支持加载时自定义提示文本
2.0(2020-09)
- combo增加click-blur(点击显示,blur消失)作为触发条件功能
- allCountPager支持是否显示总行数
- 修复区间滑块setEnable(false)滑块不灰化的问题
- 修复同步复选下拉框系列setValue所有值后触发器不显示全选的问题
- BI.Tree.traversal方法迭代函数增加父节点参数

7
demo/js/config/fix.js

@ -46,4 +46,9 @@ Demo.FIX_CONFIG = [{
pId: 7,
text: "场景",
value: "demo.fix_scene"
}];
}, {
id: 80,
pId: 7,
text: "inject",
value: "demo.fix_inject"
}];

4
demo/js/core/popup/demo.popover.js

@ -189,6 +189,10 @@ Demo.Func = BI.inherit(BI.Widget, {
};
}),
},
footer: {
type: "bi.label",
text: "这个是footer",
},
}).open(id);
},
}],

10
demo/js/fix-2.0/context.js

@ -8,6 +8,8 @@
childContext: ["context"]
});
BI.model("demo.model.context.parent_store",ParentStore)
var ChildStore = BI.inherit(Fix.Model, {
context: ["context"],
computed: {
@ -22,9 +24,11 @@
}
});
BI.model("demo.model.context.child_store",ChildStore)
var Child = BI.inherit(BI.Widget, {
_store: function () {
return new ChildStore();
return BI.Models.getModel("demo.model.context.child_store");
},
watch: {
currContext: function (val) {
@ -53,7 +57,7 @@
var Parent = BI.inherit(BI.Widget, {
_store: function () {
return new ParentStore();
return BI.Models.getModel("demo.model.context.parent_store");
},
render: function () {
var self = this;
@ -72,4 +76,4 @@
});
BI.shortcut("demo.fix_context", Parent);
}());
}());

102
demo/js/fix-2.0/inject.js

@ -0,0 +1,102 @@
(function () {
var ParentStore = BI.inherit(Fix.Model, {
state: function () {
return {
context: {
one: {
key: "one.key"
}
}
};
},
childContext: ["context"],
actions: {
changeContext: function () {
this.model.context = {
two: {
key: "two.key"
}
};
}
}
});
BI.model("demo.model.inject.parent_store", ParentStore);
var ChildStore = BI.inherit(Fix.Model, {
inject: ["context"],
computed: {
currContext: function () {
return this.model.context.one.key;
}
},
actions: {
changeContext: function () {
this.model.context = {
one: {
key: "one.changed_key"
}
};
}
}
});
BI.model("demo.model.inject.child_store", ChildStore);
var Child = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.inject.child_store");
},
watch: {
currContext: function (val) {
this.button.setText(val);
}
},
render: function () {
var self = this;
return {
type: "bi.button",
ref: function () {
self.button = this;
},
text: this.model.currContext,
handler: function () {
self.store.changeContext();
}
};
},
});
BI.shortcut("demo.fix_inject_child", Child);
var Parent = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.inject.parent_store");
},
render: function () {
var self = this;
return {
type: "bi.vertical",
items: [{
el: {
type: "demo.fix_inject_child"
}
}, {
el: {
type: "bi.button",
text: "点击修改parent state",
handler: function () {
self.store.changeContext();
}
}
}]
};
},
mounted: function () {
}
});
BI.shortcut("demo.fix_inject", Parent);
}());

4
dist/2.0/fineui.css vendored

File diff suppressed because one or more lines are too long

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

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.ie.min.js.map vendored

File diff suppressed because one or more lines are too long

2360
dist/2.0/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/2.0/fineui.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.min.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui_without_normalize.css vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui_without_normalize.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/bundle.min.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/demo.css vendored

File diff suppressed because one or more lines are too long

2724
dist/demo.js vendored

File diff suppressed because it is too large Load Diff

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.css vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.ie.min.js.map vendored

File diff suppressed because one or more lines are too long

2362
dist/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/fineui.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.min.js.map vendored

File diff suppressed because one or more lines are too long

1496
dist/fineui_without_jquery_polyfill.js vendored

File diff suppressed because it is too large Load Diff

2
dist/fineui_without_jquery_polyfill.js.map vendored

File diff suppressed because one or more lines are too long

107
dist/fix/fix.compact.ie.js vendored

@ -1,5 +1,5 @@
;(function () {
function initWatch(vm, watch) {
function initWatch (vm, watch) {
vm._watchers || (vm._watchers = []);
for (var key in watch) {
var handler = watch[key];
@ -13,7 +13,7 @@
}
}
function createWatcher(vm, keyOrFn, cb, options) {
function createWatcher (vm, keyOrFn, cb, options) {
if (BI.isPlainObject(cb)) {
options = cb;
cb = cb.handler;
@ -27,27 +27,15 @@
var target = null;
var targetStack = [];
function pushTarget(_target) {
function pushTarget (_target) {
if (target) targetStack.push(target);
Fix.Model.target = target = _target;
}
function popTarget() {
function popTarget () {
Fix.Model.target = target = targetStack.pop();
}
var context = null;
var contextStack = [];
function pushContext(_context) {
if (context) contextStack.push(context);
Fix.Model.context = context = _context;
}
function popContext() {
Fix.Model.context = context = contextStack.pop();
}
var oldWatch = Fix.watch;
Fix.watch = function (model, expOrFn, cb, options) {
if (BI.isPlainObject(cb)) {
@ -65,11 +53,11 @@
}, options);
};
function findStore(widget) {
function findStore (widget) {
if (target != null) {
return target;
}
widget = widget || context;
widget = widget || BI.Widget.context;
var p = widget;
while (p) {
if (p instanceof Fix.Model || p.store || p.__cacheStore) {
@ -86,35 +74,55 @@
}
}
var _create = BI.createWidget;
BI.createWidget = function (item, options, context) {
var pushed = false;
if (BI.isWidget(options)) {
pushContext(options);
pushed = true;
} else if (context != null) {
pushContext(context);
pushed = true;
// var _create = BI.createWidget;
// BI.createWidget = function (item, options, context) {
// var pushed = false;
// if (BI.isWidget(options)) {
// pushContext(options);
// pushed = true;
// } else if (context != null) {
// pushContext(context);
// pushed = true;
// }
// var result = _create.apply(this, arguments);
// pushed && popContext();
// return result;
// };
BI.watch = function (watch, handler) {
if (BI.Widget.current) {
if (BI.isKey(watch)) {
var key = watch;
watch = {};
watch[key] = handler;
}
for (var key in watch) {
var handler = watch[key];
if (BI.isArray(handler)) {
for (var i = 0; i < handler.length; i++) {
BI.Widget.current._watchers.push(createWatcher(BI.Widget.current, key, handler[i]));
}
} else {
BI.Widget.current._watchers.push(createWatcher(BI.Widget.current, key, handler));
}
}
}
var result = _create.apply(this, arguments);
pushed && popContext();
return result;
};
_.each(["populate", "addItems", "prependItems"], function (name) {
var old = BI.Loader.prototype[name];
BI.Loader.prototype[name] = function () {
pushContext(this);
BI.Widget.pushContext(this);
var result = old.apply(this, arguments);
popContext();
BI.Widget.popContext();
return result;
};
});
function createStore() {
function createStore () {
var needPop = false;
if (_global.Fix && this._store) {
var store = findStore(this.options.context || this.options.element);
var store = findStore(this.options.context || this._parent || this.options.element);
if (store) {
pushTarget(store);
needPop = true;
@ -220,14 +228,14 @@
BI.defer(function () {
additionFunc();
}, 200);
}
};
var back = window.history.back;
window.history.back = function () {
back.apply(this, arguments);
BI.defer(function () {
additionFunc();
}, 200);
}
};
}
if (BI.Router) {
@ -235,22 +243,22 @@
BI.Router.prototype.execute = function () {
execute.apply(this, arguments);
additionFunc();
}
};
}
_.each(["each", "map", "reduce", "reduceRight", "find", "filter", "reject", "every", "all", "some", "any", "max", "min",
"sortBy", "groupBy", "indexBy", "countBy", "partition",
"keys", "allKeys", "values", "pairs", "invert",
"mapObject", "findKey", "pick", "omit", "tap"], function (name) {
var old = BI[name];
BI[name] = function (obj, fn, context) {
return typeof fn === "function" ? old(obj, function (key, value) {
if (!(key in Fix.$$skipArray)) {
return fn.apply(this, arguments);
}
}, context) : old.apply(this, arguments);
};
});
var old = BI[name];
BI[name] = function (obj, fn, context) {
return typeof fn === "function" ? old(obj, function (key, value) {
if (!(key in Fix.$$skipArray)) {
return fn.apply(this, arguments);
}
}, context) : old.apply(this, arguments);
};
});
BI.isEmpty = function (ob) {
if (BI.isPlainObject(ob) && ob.__ob__) {
return BI.keys(ob).length === 0;
@ -306,7 +314,7 @@
Fix.set = function (obj, k, v) {
try {
if(obj) {
if (obj) {
obj[k] = v;
}
} catch (e) {
@ -314,7 +322,7 @@
} finally {
return _.cloneDeep(obj);
}
}
};
Fix.del = function (obj, k) {
try {
delete obj[k];
@ -323,6 +331,5 @@
} finally {
return _.cloneDeep(obj);
}
}
BI.watch = Fix.watch;
};
}());

77
dist/fix/fix.compact.js vendored

@ -13,7 +13,7 @@
}
}
function createWatcher(vm, keyOrFn, cb, options) {
function createWatcher (vm, keyOrFn, cb, options) {
if (BI.isPlainObject(cb)) {
options = cb;
cb = cb.handler;
@ -36,18 +36,6 @@
Fix.Model.target = target = targetStack.pop();
}
var context = null;
var contextStack = [];
function pushContext (_context) {
if (context) contextStack.push(context);
Fix.Model.context = context = _context;
}
function popContext () {
Fix.Model.context = context = contextStack.pop();
}
var oldWatch = Fix.watch;
Fix.watch = function (model, expOrFn, cb, options) {
if (BI.isPlainObject(cb)) {
@ -73,7 +61,7 @@
if (target != null) {
return target;
}
widget = widget || context;
widget = widget || BI.Widget.context;
var p = widget;
while (p) {
if (p instanceof Fix.Model || p.store || p.__cacheStore) {
@ -90,36 +78,56 @@
}
}
var _create = BI.createWidget;
BI.createWidget = function (item, options, context) {
var pushed = false;
if (BI.isWidget(options)) {
pushContext(options);
pushed = true;
} else if (context != null) {
pushContext(context);
pushed = true;
// var _create = BI.createWidget;
// BI.createWidget = function (item, options, context) {
// var pushed = false;
// if (BI.isWidget(options)) {
// pushContext(options);
// pushed = true;
// } else if (context != null) {
// pushContext(context);
// pushed = true;
// }
// var result = _create.apply(this, arguments);
// // try {
// // var result = _create.apply(this, arguments);
// // } catch (e) {
// // console.error(e);
// // }
// pushed && popContext();
// return result;
// };
BI.watch = function (watch, handler) {
if (BI.Widget.current) {
if (BI.isKey(watch)) {
var key = watch;
watch = {};
watch[key] = handler;
}
for (var key in watch) {
var handler = watch[key];
if (BI.isArray(handler)) {
for (var i = 0; i < handler.length; i++) {
BI.Widget.current._watchers.push(createWatcher(BI.Widget.current, key, handler[i]));
}
} else {
BI.Widget.current._watchers.push(createWatcher(BI.Widget.current, key, handler));
}
}
}
var result = _create.apply(this, arguments);
// try {
// var result = _create.apply(this, arguments);
// } catch (e) {
// console.error(e);
// }
pushed && popContext();
return result;
};
_.each(["populate", "addItems", "prependItems"], function (name) {
var old = BI.Loader.prototype[name];
BI.Loader.prototype[name] = function () {
pushContext(this);
BI.Widget.pushContext(this);
try {
var result = old.apply(this, arguments);
} catch (e) {
console.error(e);
}
popContext();
BI.Widget.popContext();
return result;
};
});
@ -127,7 +135,7 @@
function createStore () {
var needPop = false;
if (_global.Fix && this._store) {
var store = findStore(this.options.context || this.options.element);
var store = findStore(this.options.context || this._parent || this.options.element);
if (store) {
pushTarget(store);
needPop = true;
@ -280,5 +288,4 @@
return Fix.toJSON(ob);
};
}
BI.watch = Fix.watch;
}());

24
dist/fix/fix.js vendored

@ -1332,6 +1332,25 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
vm.$$context = createViewModel$1({}, props);
}
function getInjectValue(vm, key) {
var p = vm._parent;
while (p) {
if (p.$$context && key in p.$$context) {
return p.$$context[key];
}
p = p._parent;
}
}
function getInjectValues(vm) {
var inject = vm.inject || [];
var result = {};
_.each(inject, function (key) {
result[key] = getInjectValue(vm, key);
});
return result;
}
var Model = function () {
function Model() {
_classCallCheck(this, Model);
@ -1350,17 +1369,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var state = _.isFunction(this.state) ? this.state() : this.state;
var computed = this.computed;
var context = this.context;
var inject = this.inject;
var childContext = this.childContext;
var watch$$1 = this.watch;
var actions = this.actions;
var keys = _.keys(this.$$model).concat(_.keys(state)).concat(_.keys(computed)).concat(context || []);
var keys = _.keys(this.$$model).concat(_.keys(state)).concat(_.keys(computed)).concat(inject || []).concat(context || []);
var mixins = this.mixins;
defineProps(this, keys);
childContext && defineContext(this, childContext);
this.$$model && (this.model.__ob__ = this.$$model.__ob__);
initMixins(this, mixins);
this.init();
initState(this, state);
initState(this, _.extend(getInjectValues(this), state));
initComputed(this, computed);
initWatch(this, watch$$1);
initMethods(this, actions);

2
dist/font.css vendored

File diff suppressed because one or more lines are too long

BIN
dist/font/iconfont.eot vendored

Binary file not shown.

14
dist/font/iconfont.svg vendored

@ -20,6 +20,18 @@ Created by iconfont
/>
<missing-glyph />
<glyph glyph-name="Tabzujian" unicode="&#59443;" d="M213.333333 469.333333h597.333334v-341.333333H213.333333zM170.666667 725.333333h170.666666a42.666667 42.666667 0 0 0 42.666667-42.666666v-128H128V682.666667a42.666667 42.666667 0 0 0 42.666667 42.666666zM469.333333 725.333333h128a42.666667 42.666667 0 0 0 42.666667-42.666666v-85.333334h-213.333333V682.666667a42.666667 42.666667 0 0 0 42.666666 42.666666zM725.333333 725.333333h128a42.666667 42.666667 0 0 0 42.666667-42.666666v-85.333334h-213.333333V682.666667a42.666667 42.666667 0 0 0 42.666666 42.666666zM341.333333 725.333333a42.666667 42.666667 0 0 0 42.666667-42.666666v-128h512v-426.666667a85.333333 85.333333 0 0 0-85.333333-85.333333H213.333333a85.333333 85.333333 0 0 0-85.333333 85.333333V682.666667a42.666667 42.666667 0 0 0 42.666667 42.666666h170.666666z m512-213.333333H170.666667v-384a42.666667 42.666667 0 0 1 37.674666-42.368L213.333333 85.333333h597.333334a42.666667 42.666667 0 0 1 42.368 37.674667L853.333333 128V512z m-42.666666-42.666667v-341.333333H213.333333v341.333333h597.333334z m-213.333334 256a42.666667 42.666667 0 0 0 42.666667-42.666666v-85.333334h-213.333333V682.666667a42.666667 42.666667 0 0 0 42.666666 42.666666h128z m256 0a42.666667 42.666667 0 0 0 42.666667-42.666666v-85.333334h-213.333333V682.666667a42.666667 42.666667 0 0 0 42.666666 42.666666h128z" horiz-adv-x="1024" />
<glyph glyph-name="zizhushujuji_shoudaodefenxiang" unicode="&#59442;" d="M704 480v-186.24c141.44 0 256-109.312 256-244.288 0-28.608-5.12-56.064-14.592-81.472-35.136 94.912-129.92 162.944-241.408 162.944v-186.24l-320 267.648L704 480zM257.92 591.616c42.24-2.752 78.976-32 90.944-72.768 8.064-27.328 4.608-53.504-10.24-77.888-3.904-6.4-2.752-9.28 2.944-13.44l85.312-61.824c-9.408-11.2-18.112-23.04-25.92-35.52-30.784 22.4-61.568 44.928-92.352 67.456-5.952 4.352-10.432 5.312-17.472 1.92-16.32-7.616-34.048-10.496-51.968-7.936-7.744 1.152-10.944-1.344-14.464-7.232a8896 8896 0 0 0-64.64-108.608c-4.032-6.656-4.224-10.624 1.152-17.408 24.064-30.272 27.136-63.36 9.024-97.28a89.6 89.6 0 0 0-89.024-45.568c-38.272 4.992-64.768 25.536-76.8 61.632-20.864 62.912 35.456 124.928 102.4 112.832 7.488-1.408 10.944 0.64 14.528 6.784 20.16 34.56 40.576 69.12 61.44 103.36 4.608 7.424 4.48 11.328-2.56 17.536a97.28 97.28 0 0 0-24.96 113.856c17.472 39.104 58.24 62.976 102.72 60.096zM885.376 800c71.936 0.192 132.48-53.76 138.24-123.2 5.76-70.464-44.416-132.032-116.8-143.68-16.64-2.688-33.024-2.368-49.28 1.28-6.4 1.408-8.768-0.448-11.52-5.12l-45.248-76.224a317.632 317.632 0 0 1-42.56 15.232l45.056 75.392c4.48 7.616 4.736 11.328-3.008 17.216a131.2 131.2 0 0 0-44.544 148.864c18.944 53.568 71.488 90.112 129.664 90.24z" horiz-adv-x="1024" />
<glyph glyph-name="shezhifenxixian" unicode="&#59440;" d="M160 832a32 32 0 0 0 32-32V640h128v-64H192v-256h128v-64H192v-192h736a32 32 0 1 0 0-64H192v-32a32 32 0 1 0-64 0V0h-32a32 32 0 1 0 0 64H128V800a32 32 0 0 0 32 32zM512 320v-64H384V320h128z m192 0v-64H576V320h128z m192 0v-64h-128V320h128zM512 640v-64H384V640h128z m192 0v-64H576V640h128z m192 0v-64h-128V640h128z" horiz-adv-x="1024" />
<glyph glyph-name="shezhizhizhou" unicode="&#59441;" d="M384 256h544a32 32 0 1 0 0-64H896v-128h-64v128h-64v-128h-64v128h-64v-128H576v128H512v-128H448v128H384v-160a32 32 0 1 0-64 0V192H160a32 32 0 1 0 0 64H320V320H192V384h128V448H192V512h128V576H192V640h128V704H192V768h128v32a32 32 0 0 0 64 0V256z" horiz-adv-x="1024" />
<glyph glyph-name="guanliyuan" unicode="&#59439;" d="M849.972205 320.354741l4.221398-0.639605c40.295168-10.361615 77.008543-32.172174 105.982688-62.873255 6.076256-6.460019 6.971704-16.43787 2.1107-23.985219a39.143878 39.143878 0 0 1-1.279212-40.423089c7.099625-12.728156 20.595308-20.147584 34.730597-19.188175a18.548569 18.548569 0 0 0 19.188176-13.815487 236.973965 236.973965 0 0 0 0-125.810469 18.740451 18.740451 0 0 0-19.188176-13.943407 36.585454 36.585454 0 0 1-34.666636-19.124215 39.079917 39.079917 0 0 1 1.279211-40.423089 19.571939 19.571939 0 0 0-2.17466-23.985219 221.943227 221.943227 0 0 0-105.982688-62.937215 18.548569 18.548569 0 0 0-21.234914 10.105772 37.033178 37.033178 0 0 1-66.902771 0 18.420648 18.420648 0 0 0-21.234914-10.105772 221.879267 221.879267 0 0 0-105.982688 62.937215 19.571939 19.571939 0 0 0-2.110699 23.985219 39.015956 39.015956 0 0 1 1.215251 40.423089 37.097139 37.097139 0 0 1-34.730598 19.188175 18.676491 18.676491 0 0 0-19.124214 13.879447 235.822674 235.822674 0 0 0 0 125.746509 18.420648 18.420648 0 0 0 19.188175 13.943407c14.071329-1.023369 27.567012 6.396058 34.666637 19.124215a39.079917 39.079917 0 0 1-1.279212 40.423089 19.571939 19.571939 0 0 0 2.17466 23.985219 222.071149 222.071149 0 0 0 105.982688 62.937215 18.484609 18.484609 0 0 0 21.234914-10.105772c6.268137-13.11192 19.252136-21.426796 33.451386-21.362835a37.097139 37.097139 0 0 1 33.451385 21.362835 18.740451 18.740451 0 0 0 12.792117 10.233693L850.036165 320.354741zM495.694528 864.019708a287.822629 287.822629 0 0 0 13.559644-575.325456L495.694528 288.374449a351.783214 351.783214 0 0 1-351.783213-351.783213 31.980292 31.980292 0 1 0-63.960585 0c0 179.089636 113.210234 331.763551 272.088326 390.287485A287.822629 287.822629 0 0 0 495.694528 864.019708z m354.405598-614.533294a63.704742 63.704742 0 0 0-101.185645 0 160.349185 160.349185 0 0 1-57.308683-34.027031c7.227546-18.868372 5.692492-40.039326-4.221399-57.564526-9.785969-17.589161-26.863445-29.54979-46.371423-32.555937-4.477241-22.386205-4.477241-45.539936 0-67.990101 19.507978-3.006147 36.585454-15.030737 46.371423-32.619898 9.913891-17.46124 11.512905-38.632193 4.221399-57.500565 16.629752-15.28658 36.13773-26.863445 57.308683-34.027031a63.704742 63.704742 0 0 0 101.185645 0c21.170953 7.163585 40.678932 18.740451 57.244723 34.027031a67.798219 67.798219 0 0 0 4.285359 57.564525c9.785969 17.5252 26.863445 29.54979 46.371423 32.555938 4.477241 22.386205 4.477241 45.603897 0 67.990101a64.280387 64.280387 0 0 0-46.371423 32.619898 67.926141 67.926141 0 0 0-4.285359 57.500565c-16.565791 15.28658-36.07377 26.863445-57.244723 34.027031zM799.507304 160.453281a63.960584 63.960584 0 1 0 0-127.921169 63.960584 63.960584 0 0 0 0 127.921169z m-303.812776 639.605843a223.862045 223.862045 0 1 1 0-447.72409 223.862045 223.862045 0 0 1 0 447.72409z" horiz-adv-x="1024" />
@ -359,7 +371,7 @@ Created by iconfont
<glyph glyph-name="queshizhitianchong" unicode="&#59330;" d="M960 704h-64V768H64v-768h832v64h64v-64a64 64 0 0 0-64-64H64a64 64 0 0 0-64 64V768a64 64 0 0 0 64 64h832a64 64 0 0 0 64-64v-64zM226.496 170.49599999999998V504L128 484.992v61.056l119.232 24.192h52.992v-399.744H226.496z m149.12 0v67.968c150.336 119.808 188.352 165.888 188.352 215.424 0 48.384-32.832 61.632-74.88 61.632-25.92 0-55.296-3.456-88.128-13.248v61.056C430.336 571.9680000000001 464.896 576 501.76 576c84.672 0 135.936-35.712 135.936-113.472 0-67.968-27.648-111.168-148.608-207.36l-24.768-19.584v-4.608h185.472v-60.48H375.616z m436.608-5.76a476.16 476.16 0 0 0-91.008 7.488v62.784c30.528-6.912 57.024-9.792 87.552-9.792 51.84 0 92.736 13.248 92.736 61.632 0 47.808-37.44 61.632-103.68 61.632h-31.104v55.872h30.528c60.48 0 96.768 17.28 96.768 59.328 0 39.744-28.224 52.992-77.184 52.992-23.616 0-55.872-4.608-78.912-11.52V564.48c19.008 6.336 54.144 11.52 86.976 11.52 86.976 0 140.544-28.8 140.544-107.712 0-46.08-22.464-73.728-66.816-88.128v-3.456c52.416-9.792 77.184-43.776 77.184-94.464 0-78.336-54.72-117.504-163.584-117.504z" horiz-adv-x="1024" />
<glyph glyph-name="xinshouyindao" unicode="&#59329;" d="M898.752 654.912C843.136 687.488 780.416 704 712.384 704a451.904 451.904 0 0 1-176.256-36.992v-485.824a25.6 25.6 0 0 0-26.112-24.96 25.6 25.6 0 0 0-26.112 24.96V666.88A451.84 451.84 0 0 1 307.648 704c-68.032 0-130.752-16.512-186.368-49.088a54.272 54.272 0 0 1-27.264-46.4v-537.984c0-19.648 11.2-37.824 29.184-47.488 17.728-9.472 40.32-9.024 57.728 1.088a246.976 246.976 0 0 0 126.72 33.024c57.216 0 118.4-17.408 172.544-49.024a59.008 59.008 0 0 1 59.648 0c54.08 31.616 115.392 49.024 172.544 49.024 46.72 0 89.344-11.072 126.784-33.024 17.28-10.112 39.872-10.56 57.728-1.024a54.016 54.016 0 0 1 29.12 47.424V608.448a54.272 54.272 0 0 1-27.264 46.4v0.064z" horiz-adv-x="1024" />
<glyph glyph-name="xinshouyindao" unicode="&#59329;" d="M512 832a448 448 0 1 0 0-896A448 448 0 0 0 512 832z m0-688a48 48 0 1 1 0-96 48 48 0 0 1 0 96z m0 550.144a206.08 206.08 0 0 1-206.72-205.376v-0.064c0-22.656 18.432-41.088 41.28-41.088a41.216 41.216 0 0 1 41.408 41.088C387.968 556.8 443.52 611.9680000000001 512 611.9680000000001c68.48 0 124.032-55.168 124.032-123.264A123.648 123.648 0 0 0 512 365.44000000000005a41.216 41.216 0 0 1-41.344-41.024v-82.304c0-22.656 18.56-40.96 41.344-40.96a41.152 41.152 0 0 1 41.344 40.96V287.36a205.824 205.824 0 0 1 165.44 201.344c0 113.472-92.608 205.44-206.784 205.44z" horiz-adv-x="1024" />
<glyph glyph-name="gou" unicode="&#59328;" d="M1222.434595 874.025514L514.490811 365.152865a110.702703 110.702703 0 0 0-126.311784-2.048l-225.28 151.109189a103.119568 103.119568 0 0 1-130.629189-12.92454 95.647135 95.647135 0 0 1-7.001946-126.920649l349.322378-439.406703a110.702703 110.702703 0 0 1 165.168433-9.132973l811.727567 816.819892a85.600865 85.600865 0 0 1 0 120.665946 99.798486 99.798486 0 0 1-129.024 10.710487z" horiz-adv-x="1383" />

Before

Width:  |  Height:  |  Size: 357 KiB

After

Width:  |  Height:  |  Size: 360 KiB

BIN
dist/font/iconfont.ttf vendored

Binary file not shown.

BIN
dist/font/iconfont.woff vendored

Binary file not shown.

BIN
dist/font/iconfont.woff2 vendored

Binary file not shown.

1
dist/lib/base/single/single.d.ts vendored

@ -7,6 +7,7 @@ export interface _Single extends _Widget {
disabledHover(): void;
setTitle(title: string, opt?: SingleOpt): void;
setWarningTitle(title: string, opt?: SingleOpt): void;
setTipType(v: string): void;
getTipType(): string;
isReadOnly(): boolean;
getTitle(): string;

25
dist/utils.js vendored

@ -1,4 +1,4 @@
/*! time: 2020-9-16 15:00:22 */
/*! time: 2020-10-21 16:00:27 */
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
@ -82,7 +82,7 @@
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1081);
/******/ return __webpack_require__(__webpack_require__.s = 1080);
/******/ })
/************************************************************************/
/******/ ({
@ -1301,6 +1301,7 @@ if (!_global.BI) {
case "%M":
min = parseInt(a[i], 10);
break;
case "%S":
sec = parseInt(a[i], 10);
break;
@ -1360,6 +1361,9 @@ if (!_global.BI) {
if (y == 0) {
y = today.getFullYear();
}
if (m === -1) {
m = today.getMonth();
}
if (m != -1 && d != 0) {
return BI.getDate(y, m, d, hr, min, sec);
}
@ -1688,7 +1692,7 @@ if (!_global.BI) {
/***/ (function(module, exports) {
!(function () {
function extend() {
function extend () {
var target = arguments[0] || {}, length = arguments.length, i = 1, options, name, src, copy;
for (; i < length; i++) {
// Only deal with non-null/undefined values
@ -4236,7 +4240,7 @@ if (!_global.BI) {
/***/ }),
/***/ 1081:
/***/ 1080:
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(101);
@ -4266,8 +4270,8 @@ __webpack_require__(118);
__webpack_require__(119);
__webpack_require__(120);
__webpack_require__(121);
__webpack_require__(746);
__webpack_require__(1082);
__webpack_require__(745);
__webpack_require__(1081);
__webpack_require__(131);
__webpack_require__(132);
module.exports = __webpack_require__(133);
@ -4275,7 +4279,7 @@ module.exports = __webpack_require__(133);
/***/ }),
/***/ 1082:
/***/ 1081:
/***/ (function(module, exports) {
/**
@ -7041,10 +7045,11 @@ BI.Region.prototype = {
"&": "&amp;",
"\"": "&quot;",
"<": "&lt;",
">": "&gt;"
">": "&gt;",
" ": "&nbsp;"
};
BI.htmlEncode = function (text) {
return BI.isNull(text) ? "" : BI.replaceAll(text + "", "&|\"|<|>", function (v) {
return BI.isNull(text) ? "" : BI.replaceAll(text + "", "&|\"|<|>|\\s", function (v) {
return SPECIAL_TAGS[v] ? SPECIAL_TAGS[v] : "&nbsp;";
});
};
@ -9167,7 +9172,7 @@ process.umask = function () {
/***/ }),
/***/ 746:
/***/ 745:
/***/ (function(module, exports) {
BI.i18n = {

2
dist/utils.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/utils.min.js.map vendored

File diff suppressed because one or more lines are too long

8
karma.conf.js

@ -19,11 +19,7 @@ module.exports = function (config) {
// list of files / patterns to load in the browser
files: [
"src/css/core/**/*.css",
"src/css/theme/**/*.css",
"src/css/base/**/*.css",
"src/css/widget/**/*.css",
"public/css/app.css",
"dist/fineui.min.css",
"src/core/foundation.js",
"src/core/lodash.js",
"src/core/base.js",
@ -58,6 +54,8 @@ module.exports = function (config) {
"src/case/**/*.js",
"src/widget/**/*.js",
"src/component/**/*.js",
"dist/fix/fix.js",
"dist/fix/fix.compact.js",
"src/**/*.test.js",
"test/**/*.js"
],

2
package.json

@ -1,6 +1,6 @@
{
"name": "fineui",
"version": "2.0.20200916150231",
"version": "2.0.20201021160253",
"description": "fineui",
"main": "dist/fineui.min.js",
"types": "dist/lib/index.d.ts",

8
src/base/collection/collection.js

@ -32,7 +32,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
this._debounceRelease = BI.debounce(function () {
self._scrollLock = false;
}, 1000 / 60);
this.container = BI.createWidget({
this.container = BI._lazyCreateWidget({
type: "bi.absolute"
});
this.element.scroll(function () {
@ -47,7 +47,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
scrollTop: o.scrollTop
});
});
BI.createWidget({
BI._lazyCreateWidget({
type: "bi.vertical",
element: this,
scrollable: o.overflowX === true && o.overflowY === true,
@ -176,7 +176,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
}
renderedCells.push(child = this.renderedCells[index]);
} else {
child = BI.createWidget(BI.extend({
child = BI._lazyCreateWidget(BI.extend({
type: "bi.label",
width: datum.width,
height: datum.height
@ -377,4 +377,4 @@ BI.CollectionView = BI.inherit(BI.Widget, {
}
});
BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.collection_view", BI.CollectionView);
BI.shortcut("bi.collection_view", BI.CollectionView);

47
src/base/combination/combo.js

@ -9,6 +9,9 @@
var conf = BI.Combo.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-combo" + (BI.isIE() ? " hack" : ""),
attributes: {
tabIndex: -1
},
trigger: "click",
toggle: true,
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right||right,innerRight||right,innerLeft||innerRight||innerLeft
@ -216,6 +219,43 @@
}
});
break;
case "click-blur":
var debounce = BI.debounce(function (e) {
if (self.combo.element.__isMouseInBounds__(e)) {
if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
// if (!o.toggle && self.isViewVisible()) {
// return;
// }
o.toggle ? self._toggle(e) : self._popupView(e);
if (self.isViewVisible()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
self.fireEvent(BI.Combo.EVENT_EXPAND);
} else {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo);
self.fireEvent(BI.Combo.EVENT_COLLAPSE);
}
}
}
}, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) {
debounce(e);
try {
self.element[0].focus();
} catch (e) {
}
st(e);
});
self.element.off("blur." + self.getName()).on("blur." + self.getName(), function (e) {
if (self.isViewVisible()) {
self._hideView(e);
}
st(e);
});
break;
}
});
},
@ -528,11 +568,14 @@
},
destroyed: function () {
BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName())
BI.Widget._renderEngine.createElement(document)
.unbind("click." + this.getName())
.unbind("mousedown." + this.getName())
.unbind("mousewheel." + this.getName())
.unbind("mouseenter." + this.getName())
.unbind("mousemove." + this.getName())
.unbind("mouseleave." + this.getName());
.unbind("mouseleave." + this.getName())
.unbind("blur." + this.getName());
BI.Resizers.remove(this.getName());
this.popupView && this.popupView._destroy();
delete needHideWhenAnotherComboOpen[this.getName()];

6
src/base/grid/grid.js

@ -35,7 +35,7 @@ BI.GridView = BI.inherit(BI.Widget, {
this._debounceRelease = BI.debounce(function () {
self._scrollLock = false;
}, 1000 / 60);
this.container = BI.createWidget({
this.container = BI._lazyCreateWidget({
type: "bi.absolute"
});
this.element.scroll(function () {
@ -50,7 +50,7 @@ BI.GridView = BI.inherit(BI.Widget, {
scrollTop: o.scrollTop
});
});
BI.createWidget({
BI._lazyCreateWidget({
type: "bi.vertical",
element: this,
scrollable: o.overflowX === true && o.overflowY === true,
@ -153,7 +153,7 @@ BI.GridView = BI.inherit(BI.Widget, {
child = this.renderedCells[index].el;
renderedCells.push(this.renderedCells[index]);
} else {
child = BI.createWidget(BI.extend({
child = BI._lazyCreateWidget(BI.extend({
type: "bi.label",
width: columnDatum.size,
height: rowDatum.size

33
src/base/layer/layer.popover.js

@ -10,6 +10,9 @@ BI.Popover = BI.inherit(BI.Widget, {
NORMAL: "normal",
BIG: "big",
},
MAX_HEIGHT: 600,
BODY_TGAP: 10,
BODY_HGAP: 20,
},
props: {
@ -17,7 +20,6 @@ BI.Popover = BI.inherit(BI.Widget, {
size: "normal", // small, normal, big
logic: {
dynamic: false,
maxHeight: 500,
},
header: null,
headerHeight: 40,
@ -29,6 +31,7 @@ BI.Popover = BI.inherit(BI.Widget, {
render: function () {
var self = this; var o = this.options;
var c = this._constant;
this.startX = 0;
this.startY = 0;
var size = this._calculateSize();
@ -87,28 +90,32 @@ BI.Popover = BI.inherit(BI.Widget, {
height: o.headerHeight,
},
height: o.headerHeight,
}, {
el: o.logic.dynamic ? {
}, o.logic.dynamic ? {
el: {
type: "bi.vertical",
scrolly: false,
scrolly: true,
cls: "popover-body",
ref: function () {
self.body = this;
},
hgap: 20,
tgap: 10,
css: {
"max-height": c.MAX_HEIGHT - o.headerHeight - (o.footer ? o.footerHeight : 0) - c.BODY_TGAP,
"min-height": size.height,
},
items: [{
el: BI.extend({}, o.body, {
extraCls: "dynamic-height-limit-layout-" + size.type,
}),
el: o.body,
}],
} : {
},
hgap: c.BODY_HGAP,
tgap: c.BODY_TGAP,
} : {
el: {
type: "bi.absolute",
items: [{
el: o.body,
left: 20,
top: 10,
right: 20,
left: c.BODY_HGAP,
top: c.BODY_TGAP,
right: c.BODY_HGAP,
bottom: 0,
}],
},

33
src/base/pane.js

@ -12,6 +12,7 @@ BI.Pane = BI.inherit(BI.Widget, {
return BI.extend(BI.Pane.superclass._defaultConfig.apply(this, arguments), {
_baseCls: "bi-pane",
tipText: BI.i18nText("BI-No_Selected_Item"),
loadingText: "",
overlap: true,
onLoaded: BI.emptyFn
});
@ -67,11 +68,9 @@ BI.Pane = BI.inherit(BI.Widget, {
if (o.overlap === true) {
if (!BI.Layers.has(this.getName())) {
BI.createWidget({
type: "bi.absolute_center_adapt",
type: "bi.center_adapt",
cls: "loading-container",
items: [{
el: loadingAnimation
}],
items: this._getLoadingTipItems(loadingAnimation),
element: BI.Layers.make(this.getName(), this)
});
}
@ -80,20 +79,32 @@ BI.Pane = BI.inherit(BI.Widget, {
this._loading = loadingAnimation;
this._loading.element.css("zIndex", 1);
BI.createWidget({
type: "bi.absolute_center_adapt",
type: "bi.center_adapt",
element: this,
cls: "loading-container",
items: [{
el: this._loading,
left: 0,
right: 0,
top: 0
}]
items: this._getLoadingTipItems(this._loading)
});
}
this.element.addClass("loading-status");
},
_getLoadingTipItems: function (loadingTip) {
var o = this.options;
var loadingTipItems = [{
type: "bi.horizontal_adapt",
items: [loadingTip]
}];
BI.isNotEmptyString(o.loadingText) && loadingTipItems.push({
type: "bi.text",
text: o.loadingText
});
return [{
type: "bi.vertical",
items: loadingTipItems
}];
},
loaded: function () {
var self = this, o = this.options;
BI.Layers.remove(self.getName());

17
src/base/single/iframe/iframe.js

@ -5,7 +5,7 @@
* Created by GameJian on 2016/3/2.
*/
BI.Iframe = BI.inherit(BI.Single, {
_defaultConfig: function () {
_defaultConfig: function (config) {
var conf = BI.Iframe.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
tagName: "iframe",
@ -19,16 +19,23 @@ BI.Iframe = BI.inherit(BI.Single, {
},
_init: function () {
var self = this, o = this.options;
o.attributes.frameborder = "0";
o.attributes.src = o.src;
o.attributes.name = o.name;
var self = this;
BI.Iframe.superclass._init.apply(this, arguments);
this.element.on("load", function () {
self.fireEvent("EVENT_LOADED");
});
},
_initProps: function () {
BI.Iframe.superclass._initProps.apply(this, arguments);
var o = this.options;
this.options.attributes = BI.extend({
frameborder: 0,
src: o.src,
name: o.name
}, this.options.attributes);
},
setSrc: function (src) {
this.options.src = src;
this.element.attr("src", src);

12
src/base/single/img/img.js

@ -7,22 +7,24 @@
* @abstract
*/
BI.Img = BI.inherit(BI.Single, {
_defaultConfig: function () {
_defaultConfig: function (config) {
var conf = BI.Img.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
tagName: "img",
baseCls: (conf.baseCls || "") + " bi-img display-block",
src: "",
attributes: {},
attributes: config.src ? { src: config.src } : {},
width: "100%",
height: "100%"
});
},
_init: function () {
_initProps: function () {
BI.Img.superclass._initProps.apply(this, arguments);
var o = this.options;
o.attributes.src = o.src;
BI.Img.superclass._init.apply(this, arguments);
this.options.attributes = BI.extend({
src: o.src
}, this.options.attributes);
},
setSrc: function (src) {

6
src/base/single/link/link.js

@ -28,11 +28,7 @@ BI.Link = BI.inherit(BI.Label, {
href: o.href,
target: o.target
};
},
_init: function () {
BI.Link.superclass._init.apply(this, arguments);
}
});
BI.shortcut("bi.link", BI.Link);
BI.shortcut("bi.link", BI.Link);

13
src/base/single/single.js

@ -96,7 +96,7 @@ BI.Single = BI.inherit(BI.Widget, {
clearTimeout(self.showTimeout);
self.showTimeout = null;
}
if(BI.isNull(self.hideTimeout)) {
if (BI.isNull(self.hideTimeout)) {
self.hideTimeout = BI.delay(function () {
if (BI.isNotNull(self.hideTimeout)) {
self._hideTooltip();
@ -176,7 +176,7 @@ BI.Single = BI.inherit(BI.Widget, {
getTitle: function () {
var title = this.options.title;
if(BI.isFunction(title)) {
if (BI.isFunction(title)) {
return title();
}
return title;
@ -184,7 +184,7 @@ BI.Single = BI.inherit(BI.Widget, {
getWarningTitle: function () {
var title = this.options.warningTitle;
if(BI.isFunction(title)) {
if (BI.isFunction(title)) {
return title();
}
return title;
@ -200,12 +200,11 @@ BI.Single = BI.inherit(BI.Widget, {
return this.options.value;
},
_unMount: function () {
BI.Single.superclass._unMount.apply(this, arguments);
if(BI.isNotNull(this.showTimeout)) {
destroyed: function () {
if (BI.isNotNull(this.showTimeout)) {
clearTimeout(this.showTimeout);
this.showTimeout = null;
}
BI.Tooltips.remove(this.getName());
}
},
});

6
src/base/tree/ztree/parttree.js

@ -9,10 +9,6 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
return BI.extend(BI.PartTree.superclass._defaultConfig.apply(this, arguments), {});
},
_init: function () {
BI.PartTree.superclass._init.apply(this, arguments);
},
_loadMore: function () {
var self = this, o = this.options;
var op = BI.extend({}, o.paras, {
@ -201,4 +197,4 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
}
});
BI.shortcut("bi.part_tree", BI.PartTree);
BI.shortcut("bi.part_tree", BI.PartTree);

7
src/case/button/node/node.arrow.js

@ -32,7 +32,8 @@ BI.ArrowNode = BI.inherit(BI.NodeButton, {
hgap: o.hgap,
text: o.text,
value: o.value,
py: o.py
py: o.py,
keyword: o.keyword
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -66,7 +67,7 @@ BI.ArrowNode = BI.inherit(BI.NodeButton, {
BI.ArrowNode.superclass.doClick.apply(this, arguments);
this.checkbox.setSelected(this.isOpened());
},
setText: function (text) {
BI.ArrowNode.superclass.setText.apply(this, arguments);
this.text.setText(text);
@ -78,4 +79,4 @@ BI.ArrowNode = BI.inherit(BI.NodeButton, {
}
});
BI.shortcut("bi.arrow_group_node", BI.ArrowNode);
BI.shortcut("bi.arrow_group_node", BI.ArrowNode);

5
src/case/button/node/node.icon.arrow.js

@ -50,7 +50,8 @@ BI.IconArrowNode = BI.inherit(BI.NodeButton, {
hgap: o.hgap,
text: o.text,
value: o.value,
py: o.py
py: o.py,
keyword: o.keyword
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
@ -98,4 +99,4 @@ BI.IconArrowNode = BI.inherit(BI.NodeButton, {
}
});
BI.shortcut("bi.icon_arrow_node", BI.IconArrowNode);
BI.shortcut("bi.icon_arrow_node", BI.IconArrowNode);

3
src/case/button/node/node.multilayer.icon.arrow.js

@ -29,7 +29,8 @@ BI.MultiLayerIconArrowNode = BI.inherit(BI.NodeButton, {
hgap: o.hgap,
text: o.text,
value: o.value,
py: o.py
py: o.py,
keyword: o.keyword
});
this.node.on(BI.Controller.EVENT_CHANGE, function (type) {
self.setSelected(self.isSelected());

1
src/case/button/treeitem/item.multilayer.icon.treeleaf.js

@ -28,6 +28,7 @@ BI.MultiLayerIconTreeLeafItem = BI.inherit(BI.BasicButton, {
text: o.text,
value: o.value,
py: o.py,
keyword: o.keyword,
iconWidth: o.iconWidth,
iconHeight: o.iconHeight
});

5
src/case/button/treeitem/item.treetextleaf.js

@ -30,7 +30,8 @@ BI.TreeTextLeafItem = BI.inherit(BI.BasicButton, {
rgap: o.hgap,
text: o.text,
value: o.value,
py: o.py
py: o.py,
keyword: o.keyword
});
BI.createWidget({
type: "bi.htape",
@ -66,4 +67,4 @@ BI.TreeTextLeafItem = BI.inherit(BI.BasicButton, {
}
});
BI.shortcut("bi.tree_text_leaf_item", BI.TreeTextLeafItem);
BI.shortcut("bi.tree_text_leaf_item", BI.TreeTextLeafItem);

17
src/case/combo/searchtextvaluecombo/__test__/combo.searchtextvaluecombo.test.js

@ -6,12 +6,15 @@
describe("search_text_value_combo", function () {
var items = BI.map(BI.makeArray(100, null), function(idx, v) {
return {
text: idx,
value: idx,
title: idx
};
var items;
before(function () {
items = BI.map(BI.makeArray(100, null), function(idx, v) {
return {
text: idx,
value: idx,
title: idx
};
});
});
/**
@ -77,7 +80,7 @@ describe("search_text_value_combo", function () {
BI.nextTick(function () {
BI.Test.triggerKeyDown(widget.element.find(".bi-search-text-value-trigger .bi-input"), "2", 50, function () {
BI.nextTick(function () {
widget.element.find(".bi-search-text-value-popup .bi-single-select-item").click();
widget.element.find(".bi-search-text-value-popup .bi-single-select-item")[0].click();
expect(widget.getValue()[0]).to.deep.equal(2);
widget.destroy();
done();

6
src/case/layer/layer.multipopup.js

@ -14,10 +14,6 @@ BI.MultiPopupView = BI.inherit(BI.PopupView, {
});
},
_init: function () {
BI.MultiPopupView.superclass._init.apply(this, arguments);
},
_createToolBar: function () {
var o = this.options, self = this;
if (o.buttons.length === 0) {
@ -61,4 +57,4 @@ BI.MultiPopupView = BI.inherit(BI.PopupView, {
BI.MultiPopupView.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON";
BI.shortcut("bi.multi_popup_view", BI.MultiPopupView);
BI.shortcut("bi.multi_popup_view", BI.MultiPopupView);

6
src/case/layer/layer.panel.js

@ -14,10 +14,6 @@ BI.PopupPanel = BI.inherit(BI.MultiPopupView, {
});
},
_init: function () {
BI.PopupPanel.superclass._init.apply(this, arguments);
},
_createTool: function () {
var self = this, o = this.options;
var close = BI.createWidget({
@ -54,4 +50,4 @@ BI.PopupPanel.EVENT_CHANGE = "EVENT_CHANGE";
BI.PopupPanel.EVENT_CLOSE = "EVENT_CLOSE";
BI.PopupPanel.EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON";
BI.shortcut("bi.popup_panel", BI.PopupPanel);
BI.shortcut("bi.popup_panel", BI.PopupPanel);

77
src/case/pager/pager.all.count.js

@ -11,7 +11,8 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
height: 24,
pages: 1, // 必选项
curr: 1, // 初始化当前页, pages为数字时可用,
count: 1 // 总行数
count: 1, // 总行数
showRowCount: true
});
},
_init: function () {
@ -21,7 +22,7 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
type: "bi.small_text_editor",
cls: "pager-editor bi-border-radius",
validationChecker: function (v) {
return (self.rowCount.getValue() === 0 && v === "0") || BI.isPositiveInteger(v);
return (o.pages === 0 && v === "0") || BI.isPositiveInteger(v);
},
hgap: 4,
vgap: 0,
@ -92,39 +93,17 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
invisible: o.pages <= 1
});
this.rowCount = BI.createWidget({
type: "bi.label",
cls: "row-count",
height: o.height,
hgap: 5,
text: o.count,
title: o.count
});
var count = BI.createWidget({
type: "bi.left",
height: o.height,
scrollable: false,
items: [{
type: "bi.label",
height: o.height,
text: BI.i18nText("BI-Basic_Total"),
width: 15
}, this.rowCount, {
type: "bi.label",
height: o.height,
text: BI.i18nText("BI-Tiao_Data"),
width: 50,
textAlign: "left"
}]
});
BI.createWidget({
BI.createWidget(o.showRowCount ? {
type: "bi.left_right_vertical_adapt",
element: this,
items: {
left: [count],
left: [this._getRowCountObject()],
right: [this.editor, this.allPages, this.pager]
}
} : {
type: "bi.vertical_adapt",
element: this,
items: [this.editor, this.allPages, this.pager]
});
},
@ -147,6 +126,38 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
}
},
_getRowCountObject: function() {
var self = this, o = this.options;
return {
type: "bi.left",
height: o.height,
scrollable: false,
items: [{
type: "bi.label",
height: o.height,
text: BI.i18nText("BI-Basic_Total"),
width: 15
}, {
type: "bi.label",
ref: function (_ref) {
self.rowCount = _ref;
},
cls: "row-count",
height: o.height,
hgap: 5,
text: o.count,
title: o.count
}, {
type: "bi.label",
height: o.height,
text: BI.i18nText("BI-Tiao_Data"),
width: 50,
textAlign: "left"
}]
};
},
setAllPages: function (v) {
this.allPages.setText("/" + v);
this.allPages.setTitle(v);
@ -165,8 +176,10 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
},
setCount: function (count) {
this.rowCount.setText(count);
this.rowCount.setTitle(count);
if (this.options.showRowCount) {
this.rowCount.setText(count);
this.rowCount.setTitle(count);
}
},
getCurrentPage: function () {

9
src/case/tree/ztree/tree.display.js

@ -10,9 +10,6 @@ BI.DisplayTree = BI.inherit(BI.TreeView, {
extraCls: "bi-display-tree"
});
},
_init: function () {
BI.DisplayTree.superclass._init.apply(this, arguments);
},
// 配置属性
_configSetting: function () {
@ -62,12 +59,8 @@ BI.DisplayTree = BI.inherit(BI.TreeView, {
initTree: function (nodes, setting) {
var setting = setting || this._configSetting();
this.nodes = BI.$.fn.zTree.init(this.tree.element, setting, nodes);
},
destroy: function () {
BI.DisplayTree.superclass.destroy.apply(this, arguments);
}
});
BI.DisplayTree.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.display_tree", BI.DisplayTree);
BI.shortcut("bi.display_tree", BI.DisplayTree);

17
src/component/allvaluechooser/abstract.allvaluechooser.js

@ -82,5 +82,20 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, {
hasNext: false
});
}
}
},
_assertValue: function (v) {
v = v || {};
var value = v;
if (BI.isNotNull(this.items)) {
var isAllSelect = BI.difference(BI.map(this.items, "value"), v.value).length === 0;
if (isAllSelect) {
value = {
type: BI.Selection.All,
value: [],
};
}
}
return value;
},
});

19
src/component/allvaluechooser/combo.allvaluechooser.js

@ -33,10 +33,10 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, {
valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width,
height: o.height,
value: {
value: this._assertValue({
type: BI.Selection.Multi,
value: o.value || []
}
})
});
this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () {
@ -45,18 +45,23 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, {
},
setValue: function (v) {
this.combo.setValue({
this.combo.setValue(this._assertValue({
type: BI.Selection.Multi,
value: v || []
});
}));
},
getValue: function () {
return this.getAllValue();
},
getAllValue: function () {
var val = this.combo.getValue() || {};
if (val.type === BI.Selection.All) {
return val.assist;
if (val.type === BI.Selection.Multi) {
return val.value || [];
}
return val.value || [];
return BI.difference(BI.map(this.items, "value"), val.value || []);
},
populate: function (items) {

10
src/component/treevaluechooser/abstract.treevaluechooser.js

@ -565,15 +565,19 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
parentCheckState.half = find.halfCheck;
}
var state = getCheckState(node.value, node.parentValues, valueMap, parentCheckState);
var isParent = node.getChildrenLength() > 0;
result.push({
id: node.id,
pId: node.pId,
value: node.value,
text: node.text,
times: 1,
isParent: node.getChildrenLength() > 0,
checked: state[0],
halfCheck: state[1],
isParent: isParent,
// 同步树的情况下,父亲节点的状态由子控制,不再设置checked和halfCheck属性
// 叶子节点本身不存在halfCheck属性且checked属性由计算得到
checked: isParent ? undefined : state[0],
// halfCheck: state[1],
open: self.options.open
});
});

2
src/component/treevaluechooser/pane.treevaluechooser.js

@ -46,7 +46,7 @@ BI.TreeValueChooserPane = BI.inherit(BI.AbstractTreeValueChooser, {
},
getAllValue: function() {
return this.buildCompleteTree(this.combo.getValue());
return this.buildCompleteTree(this.pane.getValue());
},
populate: function (items) {

2
src/core/__test__/alias.test.js

@ -18,7 +18,7 @@ describe("aliasFunctionTest", function () {
var targetString = "<a>1 2&</a>";
var encodeString = BI.htmlEncode(targetString);
expect(encodeString).to.equal("&lt;a&gt;1 2&amp;&lt;/a&gt;");
expect(encodeString).to.equal("&lt;a&gt;1&nbsp;2&amp;&lt;/a&gt;");
expect(BI.htmlDecode(encodeString)).to.equal(targetString);
});

8
src/core/__test__/base.test.js

@ -432,4 +432,12 @@ describe("baseFunctionTest", function () {
expect(BI.deepRemove(obj, { d: 3, e: { f: 4 } })).to.eql(true);
expect(BI.deepWithout(obj, { d: 3, e: { f: 4 } })).to.eql({ a: 1, b: 2 });
});
/**
* test_author_teller
* 只传一个时分秒format的时间进去后,在某些情况下,返回的是当前时间,然而想要的是返回正确的时分秒
*/
it("parseDateTime", function () {
expect(BI.parseDateTime("14:13:16", "%H:%M:%S").getTime()).to.eql(1602655996000);
});
});

322
src/core/__test__/context.test.js

@ -0,0 +1,322 @@
/**
* Created by windy on 2018/01/23.
*/
describe("contextTest", function () {
before(function () {
});
/**
* test_author_guy
*/
it("context测试", function () {
var ParentStore = BI.inherit(Fix.Model, {
state: function () {
return {
context: "默认context"
};
},
childContext: ["context"]
});
BI.model("demo.model.parent_store", ParentStore);
var ChildStore = BI.inherit(Fix.Model, {
context: ["context"],
computed: {
currContext: function () {
return this.model.context;
}
},
actions: {
changeContext: function () {
this.model.context = "改变后的context";
}
}
});
BI.model("demo.model.child_store", ChildStore);
var Label = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.child_store");
},
render: function () {
return {
type: "bi.label",
text: this.model.currContext
};
}
});
BI.shortcut("demo.label", Label);
var Demo = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.parent_store");
},
render: function () {
var self = this;
return {
type: "demo.label",
ref: function (_ref) {
self.child = _ref;
}
};
}
});
BI.shortcut("demo.demo", Demo);
var demo = BI.Test.createWidget({
type: "demo.demo"
});
expect(demo.child.model.currContext).to.equal("默认context");
demo.child.store.changeContext();
expect(demo.model.context).to.equal("改变后的context");
demo.destroy();
});
/**
* test_author_guy
*/
it("异步context测试-loader的populate测试", function (done) {
var ParentStore = BI.inherit(Fix.Model, {
state: function () {
return {
context: "默认context"
};
},
childContext: ["context"]
});
BI.model("demo.model.parent_store", ParentStore);
var ChildStore = BI.inherit(Fix.Model, {
context: ["context"],
computed: {
currContext: function () {
return this.model.context;
}
},
actions: {
changeContext: function () {
this.model.context = "改变后的context";
}
}
});
BI.model("demo.model.child_store", ChildStore);
var Label = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.child_store");
},
render: function () {
return {
type: "bi.label",
text: this.model.currContext
};
}
});
BI.shortcut("demo.label", Label);
var Demo = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.parent_store");
},
render: function () {
var items = BI.map([1, 2, 3], function (i, v) {
return {
text: v,
value: v,
title: v
};
});
var self = this;
this.labels = {};
return {
type: "bi.loader",
ref: function (_ref) {
self.child = _ref;
},
itemsCreator: function (options, populate) {
setTimeout(function () {
populate(BI.map(items.slice((options.times - 1) * 10, options.times * 10), function (i, v) {
return BI.extend(v, {
type: "demo.label",
ref: function (_ref) {
self.labels[i] = _ref;
},
height: 25
});
}));
}, 0);
},
hasNext: function (options) {
return options.times * 10 < items.length;
}
};
}
});
BI.shortcut("demo.demo", Demo);
var demo = BI.Test.createWidget({
type: "demo.demo"
});
demo.child.populate();
setTimeout(function () {
expect(demo.labels[0].model.currContext).to.equal("默认context");
demo.destroy();
done();
}, 0);
});
/**
* test_author_guy
*/
it("异步context测试-beforeInit测试", function (done) {
var ParentStore = BI.inherit(Fix.Model, {
state: function () {
return {
context: "默认context"
};
},
childContext: ["context"]
});
BI.model("demo.model.parent_store", ParentStore);
var ChildStore = BI.inherit(Fix.Model, {
context: ["context"],
computed: {
currContext: function () {
return this.model.context;
}
},
actions: {
changeContext: function () {
this.model.context = "改变后的context";
}
}
});
BI.model("demo.model.child_store", ChildStore);
var Label = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.child_store");
},
render: function () {
return {
type: "bi.label",
text: this.model.currContext
};
}
});
BI.shortcut("demo.label", Label);
var Demo = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.parent_store");
},
beforeInit: function (callback) {
setTimeout(callback, 0);
},
render: function () {
var self = this;
return {
type: "demo.label",
ref: function (_ref) {
self.child = _ref;
}
};
}
});
BI.shortcut("demo.demo", Demo);
var demo = BI.Test.createWidget({
type: "demo.demo"
});
setTimeout(function () {
expect(demo.child.model.currContext).to.equal("默认context");
demo.destroy();
done();
}, 0);
});
/**
* test_author_guy
*/
it("inject测试", function () {
var ParentStore = BI.inherit(Fix.Model, {
state: function () {
return {
context: "默认context"
};
},
childContext: ["context"]
});
BI.model("demo.model.parent_store", ParentStore);
var ChildStore = BI.inherit(Fix.Model, {
inject: ["context"],
computed: {
currContext: function () {
return this.model.context;
}
},
actions: {
changeContext: function () {
this.model.context = "改变后的context";
}
}
});
BI.model("demo.model.child_store", ChildStore);
var Label = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.child_store");
},
render: function () {
return {
type: "bi.label",
text: this.model.currContext
};
}
});
BI.shortcut("demo.label", Label);
var Demo = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.parent_store");
},
render: function () {
var self = this;
return {
type: "demo.label",
ref: function (_ref) {
self.child = _ref;
}
};
}
});
BI.shortcut("demo.demo", Demo);
var demo = BI.Test.createWidget({
type: "demo.demo"
});
expect(demo.child.model.currContext).to.equal("默认context");
demo.child.store.changeContext();
expect(demo.model.context).to.equal("默认context");
demo.destroy();
});
});

6
src/core/action/action.show.js

@ -9,10 +9,6 @@ BI.ShowAction = BI.inherit(BI.Action, {
return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), {});
},
_init: function () {
BI.ShowAction.superclass._init.apply(this, arguments);
},
actionPerformed: function (src, tar, callback) {
tar = tar || this.options.tar;
tar.setVisible(true);
@ -24,4 +20,4 @@ BI.ShowAction = BI.inherit(BI.Action, {
tar.setVisible(false);
callback && callback();
}
});
});

5
src/core/alias.js

@ -416,10 +416,11 @@
"&": "&amp;",
"\"": "&quot;",
"<": "&lt;",
">": "&gt;"
">": "&gt;",
" ": "&nbsp;"
};
BI.htmlEncode = function (text) {
return BI.isNull(text) ? "" : BI.replaceAll(text + "", "&|\"|<|>", function (v) {
return BI.isNull(text) ? "" : BI.replaceAll(text + "", "&|\"|<|>|\\s", function (v) {
return SPECIAL_TAGS[v] ? SPECIAL_TAGS[v] : "&nbsp;";
});
};

4
src/core/base.js

@ -1132,6 +1132,7 @@ if (!_global.BI) {
case "%M":
min = parseInt(a[i], 10);
break;
case "%S":
sec = parseInt(a[i], 10);
break;
@ -1191,6 +1192,9 @@ if (!_global.BI) {
if (y == 0) {
y = today.getFullYear();
}
if (m === -1) {
m = today.getMonth();
}
if (m != -1 && d != 0) {
return BI.getDate(y, m, d, hr, min, sec);
}

9
src/core/controller.js

@ -11,13 +11,6 @@ BI.Controller = BI.inherit(BI.OB, {
return BI.extend(BI.Controller.superclass._defaultConfig.apply(this, arguments), {
});
},
_init: function () {
BI.Controller.superclass._init.apply(this, arguments);
},
destroy: function () {
}
});
BI.Controller.EVENT_CHANGE = "__EVENT_CHANGE__";
BI.Controller.EVENT_CHANGE = "__EVENT_CHANGE__";

18
src/core/logic/logic.layout.js

@ -43,10 +43,6 @@ BI.VerticalLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap,
items: o.items
};
},
_init: function () {
BI.VerticalLayoutLogic.superclass._init.apply(this, arguments);
}
});
@ -96,10 +92,6 @@ BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap,
items: o.items
};
},
_init: function () {
BI.HorizontalLayoutLogic.superclass._init.apply(this, arguments);
}
});
@ -148,10 +140,6 @@ BI.TableLayoutLogic = BI.inherit(BI.Logic, {
vgap: o.vgap,
items: o.items
};
},
_init: function () {
BI.TableLayoutLogic.superclass._init.apply(this, arguments);
}
});
@ -204,9 +192,5 @@ BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap,
items: o.items
};
},
_init: function () {
BI.HorizontalFillLayoutLogic.superclass._init.apply(this, arguments);
}
});
});

2
src/core/ob.js

@ -1,5 +1,5 @@
!(function () {
function extend() {
function extend () {
var target = arguments[0] || {}, length = arguments.length, i = 1, options, name, src, copy;
for (; i < length; i++) {
// Only deal with non-null/undefined values

31
src/core/shortcut.js

@ -11,23 +11,28 @@
};
// 根据配置属性生成widget
var createWidget = function (config) {
var createWidget = function (config, context, lazy) {
var cls = kv[config.type];
if(!cls){
throw new Error("组件"+config.type +"未定义");
if (!cls) {
throw new Error("组件" + config.type + "未定义");
}
var pushed = false;
if (context) {
pushed = true;
BI.Widget.pushContext(context);
}
var widget = new cls();
widget._initProps(config);
widget._init();
widget._initRef();
widget._initRoot();
// if (!lazy || config.element || config.root) {
widget._lazyConstructor();
// }
pushed && BI.Widget.popContext();
return widget;
};
BI.createWidget = BI.createWidget || function (item, options, context) {
BI.createWidget = BI.createWidget || function (item, options, context, lazy) {
// 先把准备环境准备好
BI.init();
var el, w;
@ -55,7 +60,7 @@
BI.Plugin.getObject(el.type, this);
}
}]);
return w.type === el.type ? createWidget(w) : BI.createWidget(BI.extend({}, item, {type: w.type}, options));
return w.type === el.type ? createWidget(w, context, lazy) : BI.createWidget(BI.extend({}, item, {type: w.type}), options, context, lazy);
}
if (item.el && (item.el.type || options.type)) {
el = BI.extend({}, options, item.el);
@ -66,7 +71,7 @@
BI.Plugin.getObject(el.type, this);
}
}]);
return w.type === el.type ? createWidget(w) : BI.createWidget(BI.extend({}, item, {type: w.type}, options));
return w.type === el.type ? createWidget(w, context, lazy) : BI.createWidget(BI.extend({}, item, {type: w.type}), options, context, lazy);
}
if (BI.isWidget(item.el)) {
return item.el;
@ -74,6 +79,10 @@
throw new Error("无法根据item创建组件");
};
BI._lazyCreateWidget = BI._lazyCreateWidget || function (item, options, context) {
return BI.createWidget(item, options, context, true);
};
BI.createElement = BI.createElement || function () {
var widget = BI.createWidget.apply(this, arguments);
return widget.element;

64
src/core/widget.js

@ -28,6 +28,15 @@
// 覆盖父类的_constructor方法,widget不走ob的生命周期
_constructor: function () {
// do nothing
},
_lazyConstructor: function () {
if (!this._constructed) {
this._constructed = true;
this._init();
this._initRef();
}
},
beforeInit: null,
@ -54,7 +63,6 @@
_init: function () {
BI.Widget.superclass._init.apply(this, arguments);
this._initRoot();
this._initElementWidth();
this._initElementHeight();
this._initVisual();
@ -90,14 +98,15 @@
var o = this.options;
this.widgetName = o.widgetName || BI.uniqueId("widget");
this._isRoot = o.root;
this._children = {};
if (BI.isWidget(o.element)) {
this.element = this.options.element.element;
if (o.element instanceof BI.Widget) {
this._parent = o.element;
this._parent.addWidget(this.widgetName, this);
} else {
this._isRoot = true;
}
this.element = this.options.element.element;
} else if (o.element) {
// if (o.root !== true) {
// throw new Error("root is a required property");
@ -120,7 +129,6 @@
if (o.css) {
this.element.css(o.css);
}
this._children = {};
},
_initElementWidth: function () {
@ -164,12 +172,17 @@
_initElement: function () {
var self = this;
var els = this.render && this.render();
if (!els) {
pushTarget(this);
els = this.setup && this.setup();
popTarget();
}
if (BI.isPlainObject(els)) {
els = [els];
}
if (BI.isArray(els)) {
BI.each(els, function (i, el) {
BI.createWidget(el, {
BI._lazyCreateWidget(el, {
element: self
});
});
@ -486,11 +499,54 @@
destroy: function () {
this.__d();
this.element.destroy();
this.fireEvent(BI.Events.UNMOUNT);
this.fireEvent(BI.Events.DESTROY);
this._purgeRef();
this.purgeListeners();
}
});
var context = null, current = null;
var contextStack = [], currentStack = [];
BI.Widget.pushContext = function (_context) {
if (context) contextStack.push(context);
BI.Widget.context = context = _context;
};
BI.Widget.popContext = function () {
BI.Widget.context = context = contextStack.pop();
};
function pushTarget (_current) {
if (current) currentStack.push(current);
BI.Widget.current = current = _current;
}
function popTarget () {
BI.Widget.current = current = currentStack.pop();
}
BI.onBeforeMount = function (beforeMount) {
if (current) {
current.beforeMount = beforeMount;
}
};
BI.onMounted = function (mounted) {
if (current) {
current.mounted = mounted;
}
};
BI.onBeforeUnmount = function (beforeDestroy) {
if (current) {
current.beforeDestroy = beforeDestroy;
}
};
BI.onUnmounted = function (destroyed) {
if (current) {
current.destroyed = destroyed;
}
};
BI.Widget.registerRenderEngine = function (engine) {
BI.Widget._renderEngine = engine;
};

2
src/core/wrapper/layout.js

@ -89,7 +89,7 @@ BI.Layout = BI.inherit(BI.Widget, {
_addElement: function (i, item, context) {
var self = this, w;
if (!this.hasWidget(this._getChildName(i))) {
w = BI.createWidget(item, context);
w = BI._lazyCreateWidget(item, context);
w.on(BI.Events.DESTROY, function () {
BI.each(self._children, function (name, child) {
if (child === w) {

4
src/core/wrapper/layout/adapt/adapt.table.js

@ -37,9 +37,9 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item);
var w = BI._lazyCreateWidget(item);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({
td = BI._lazyCreateWidget({
type: "bi.default",
width: width,
items: [w]

8
src/core/wrapper/layout/adapt/float.horizontal.js

@ -33,7 +33,7 @@ BI.FloatHorizontalLayout = BI.inherit(BI.Layout, {
delete self._children[i];
}
});
BI.createWidget({
BI._lazyCreateWidget({
type: "bi.horizontal_auto",
element: this,
items: [this.left]
@ -42,7 +42,7 @@ BI.FloatHorizontalLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) {
var self = this, o = this.options;
this.left = BI.createWidget({
this.left = BI._lazyCreateWidget({
type: "bi.vertical",
items: [item],
hgap: o.hgap,
@ -53,7 +53,7 @@ BI.FloatHorizontalLayout = BI.inherit(BI.Layout, {
rgap: o.rgap
});
this.container = BI.createWidget({
this.container = BI._lazyCreateWidget({
type: "bi.left",
element: this,
items: [this.left]
@ -67,4 +67,4 @@ BI.FloatHorizontalLayout = BI.inherit(BI.Layout, {
this._mount();
}
});
BI.shortcut("bi.horizontal_float", BI.FloatHorizontalLayout);
BI.shortcut("bi.horizontal_float", BI.FloatHorizontalLayout);

12
src/core/wrapper/layout/layout.border.js

@ -36,7 +36,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) {
if (item.el) {
if (!this.hasWidget(this.getName() + "north")) {
var w = BI.createWidget(item);
var w = BI._lazyCreateWidget(item);
this.addWidget(this.getName() + "north", w);
}
this.getWidgetByName(this.getName() + "north").element.height(item.height)
@ -56,7 +56,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) {
if (item.el) {
if (!this.hasWidget(this.getName() + "south")) {
var w = BI.createWidget(item);
var w = BI._lazyCreateWidget(item);
this.addWidget(this.getName() + "south", w);
}
this.getWidgetByName(this.getName() + "south").element.height(item.height)
@ -76,7 +76,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) {
if (item.el) {
if (!this.hasWidget(this.getName() + "west")) {
var w = BI.createWidget(item);
var w = BI._lazyCreateWidget(item);
this.addWidget(this.getName() + "west", w);
}
this.getWidgetByName(this.getName() + "west").element.width(item.width)
@ -96,7 +96,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) {
if (item.el) {
if (!this.hasWidget(this.getName() + "east")) {
var w = BI.createWidget(item);
var w = BI._lazyCreateWidget(item);
this.addWidget(this.getName() + "east", w);
}
this.getWidgetByName(this.getName() + "east").element.width(item.width)
@ -115,7 +115,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
item = regions["center"];
if (item != null) {
if (!this.hasWidget(this.getName() + "center")) {
var w = BI.createWidget(item);
var w = BI._lazyCreateWidget(item);
this.addWidget(this.getName() + "center", w);
}
this.getWidgetByName(this.getName() + "center").element
@ -132,4 +132,4 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
this._mount();
}
});
BI.shortcut("bi.border", BI.BorderLayout);
BI.shortcut("bi.border", BI.BorderLayout);

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

@ -28,7 +28,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
BI.each(items, function (i, item) {
if (item) {
if (!self.hasWidget(item.cardName)) {
var w = BI.createWidget(item);
var w = BI._lazyCreateWidget(item);
w.on(BI.Events.DESTROY, function () {
var index = BI.findIndex(o.items, function (i, tItem) {
return tItem.cardName == item.cardName;
@ -98,7 +98,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
if (this.isCardExisted(cardName)) {
throw new Error("cardName is already exist");
}
var widget = BI.createWidget(cardItem, this);
var widget = BI._lazyCreateWidget(cardItem, this);
widget.element.css({
position: "relative",
top: "0",
@ -206,4 +206,4 @@ BI.CardLayout = BI.inherit(BI.Layout, {
}
}
});
BI.shortcut("bi.card", BI.CardLayout);
BI.shortcut("bi.card", BI.CardLayout);

4
src/core/wrapper/layout/layout.division.js

@ -115,7 +115,7 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
throw new Error("item be required");
}
if (!this.hasWidget(this.getName() + i + "_" + j)) {
var w = BI.createWidget(map[i][j]);
var w = BI._lazyCreateWidget(map[i][j]);
this.addWidget(this.getName() + i + "_" + j, w);
} else {
w = this.getWidgetByName(this.getName() + i + "_" + j);
@ -159,4 +159,4 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
this._mount();
}
});
BI.shortcut("bi.division", BI.DivisionLayout);
BI.shortcut("bi.division", BI.DivisionLayout);

8
src/core/wrapper/layout/layout.grid.js

@ -93,16 +93,16 @@ BI.GridLayout = BI.inherit(BI.Layout, {
BI.each(items, function (i, item) {
if (BI.isArray(item)) {
BI.each(item, function (j, el) {
els[i][j] = BI.createWidget(el);
els[i][j] = BI._lazyCreateWidget(el);
});
return;
}
els[item.row][item.column] = BI.createWidget(item);
els[item.row][item.column] = BI._lazyCreateWidget(item);
});
for (var i = 0; i < rows; i++) {
for (var j = 0; j < columns; j++) {
if (!els[i][j]) {
els[i][j] = BI.createWidget({
els[i][j] = BI._lazyCreateWidget({
type: "bi.layout"
});
}
@ -127,4 +127,4 @@ BI.GridLayout = BI.inherit(BI.Layout, {
this._mount();
}
});
BI.shortcut("bi.grid", BI.GridLayout);
BI.shortcut("bi.grid", BI.GridLayout);

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

@ -41,9 +41,9 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item);
var w = BI._lazyCreateWidget(item);
w.element.css({position: "relative", margin: "0px auto"});
td = BI.createWidget({
td = BI._lazyCreateWidget({
type: "bi.default",
tagName: "td",
attributes: {

4
src/core/wrapper/layout/layout.table.js

@ -110,7 +110,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
right: right <= 1 ? right * 100 + "%" : right
}, arr[i]));
}
var w = BI.createWidget({
var w = BI._lazyCreateWidget({
type: "bi.absolute",
height: BI.isArray(o.rowSize) ? o.rowSize[this.rows] : o.rowSize,
items: abs
@ -146,4 +146,4 @@ BI.TableLayout = BI.inherit(BI.Layout, {
this._mount();
}
});
BI.shortcut("bi.table", BI.TableLayout);
BI.shortcut("bi.table", BI.TableLayout);

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

@ -47,7 +47,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
items = BI.compact(items);
BI.each(items, function (i, item) {
if (!self.hasWidget(self.getName() + i + "")) {
var w = BI.createWidget(item);
var w = BI._lazyCreateWidget(item);
self.addWidget(self.getName() + i + "", w);
} else {
w = self.getWidgetByName(self.getName() + i + "");
@ -160,7 +160,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
items = BI.compact(items);
BI.each(items, function (i, item) {
if (!self.hasWidget(self.getName() + i + "")) {
var w = BI.createWidget(item);
var w = BI._lazyCreateWidget(item);
self.addWidget(self.getName() + i + "", w);
} else {
w = self.getWidgetByName(self.getName() + i + "");
@ -216,4 +216,4 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
this._mount();
}
});
BI.shortcut("bi.vtape", BI.VTapeLayout);
BI.shortcut("bi.vtape", BI.VTapeLayout);

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

@ -77,13 +77,13 @@ BI.TdLayout = BI.inherit(BI.Layout, {
}
}
var tr = BI.createWidget({
var tr = BI._lazyCreateWidget({
type: "bi.default",
tagName: "tr"
});
for (var i = 0; i < arr.length; i++) {
var w = BI.createWidget(arr[i]);
var w = BI._lazyCreateWidget(arr[i]);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
if (arr[i].lgap) {
w.element.css({"margin-left": arr[i].lgap + "px"});
@ -98,7 +98,7 @@ BI.TdLayout = BI.inherit(BI.Layout, {
w.element.css({"margin-bottom": arr[i].bgap + "px"});
}
first(w, this.rows++, i);
var td = BI.createWidget({
var td = BI._lazyCreateWidget({
type: "bi.default",
attributes: {
width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]
@ -143,4 +143,4 @@ BI.TdLayout = BI.inherit(BI.Layout, {
this._mount();
}
});
BI.shortcut("bi.td", BI.TdLayout);
BI.shortcut("bi.td", BI.TdLayout);

4
src/core/wrapper/layout/layout.window.js

@ -95,7 +95,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
throw new Error("item be required");
}
if (!this.hasWidget(this.getName() + i + "_" + j)) {
var w = BI.createWidget(o.items[i][j]);
var w = BI._lazyCreateWidget(o.items[i][j]);
w.element.css({position: "absolute"});
this.addWidget(this.getName() + i + "_" + j, w);
}
@ -188,4 +188,4 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
this._mount();
}
});
BI.shortcut("bi.window", BI.WindowLayout);
BI.shortcut("bi.window", BI.WindowLayout);

6
src/core/wrapper/layout/middle/middle.center.js

@ -24,7 +24,7 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
list.push({
column: i,
row: 0,
el: BI.createWidget({
el: BI._lazyCreateWidget({
type: "bi.default",
cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")
})
@ -32,7 +32,7 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
});
BI.each(items, function (i, item) {
if (item) {
var w = BI.createWidget(item);
var w = BI._lazyCreateWidget(item);
w.element.css({
position: "absolute",
left: o.hgap + o.lgap,
@ -73,4 +73,4 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
this.wrapper.populate.apply(this.wrapper, arguments);
}
});
BI.shortcut("bi.center", BI.CenterLayout);
BI.shortcut("bi.center", BI.CenterLayout);

6
src/core/wrapper/layout/middle/middle.float.center.js

@ -20,7 +20,7 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
var self = this, o = this.options, items = o.items;
var list = [], width = 100 / items.length;
BI.each(items, function (i) {
var widget = BI.createWidget({
var widget = BI._lazyCreateWidget({
type: "bi.default"
});
widget.element.addClass("center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")).css({
@ -33,7 +33,7 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
});
BI.each(items, function (i, item) {
if (item) {
var w = BI.createWidget(item);
var w = BI._lazyCreateWidget(item);
w.element.css({
position: "absolute",
left: o.hgap + o.lgap,
@ -72,4 +72,4 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
this.wrapper.populate.apply(this.wrapper, arguments);
}
});
BI.shortcut("bi.float_center", BI.FloatCenterLayout);
BI.shortcut("bi.float_center", BI.FloatCenterLayout);

6
src/core/wrapper/layout/middle/middle.horizontal.js

@ -23,7 +23,7 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
list.push({
column: i,
row: 0,
el: BI.createWidget({
el: BI._lazyCreateWidget({
type: "bi.default",
cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")
})
@ -31,7 +31,7 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
});
BI.each(items, function (i, item) {
if (item) {
var w = BI.createWidget(item);
var w = BI._lazyCreateWidget(item);
w.element.css({
position: "absolute",
left: o.hgap + o.lgap,
@ -71,4 +71,4 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
this.wrapper.populate.apply(this.wrapper, arguments);
}
});
BI.shortcut("bi.horizontal_center", BI.HorizontalCenterLayout);
BI.shortcut("bi.horizontal_center", BI.HorizontalCenterLayout);

6
src/core/wrapper/layout/middle/middle.vertical.js

@ -24,7 +24,7 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
list.push({
column: 0,
row: i,
el: BI.createWidget({
el: BI._lazyCreateWidget({
type: "bi.default",
cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")
})
@ -32,7 +32,7 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
});
BI.each(items, function (i, item) {
if (item) {
var w = BI.createWidget(item);
var w = BI._lazyCreateWidget(item);
w.element.css({
position: "absolute",
left: o.hgap + o.lgap,
@ -72,4 +72,4 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
this.wrapper.populate.apply(this.wrapper, arguments);
}
});
BI.shortcut("bi.vertical_center", BI.VerticalCenterLayout);
BI.shortcut("bi.vertical_center", BI.VerticalCenterLayout);

6
src/less/base/combo/combo.bubble.less

@ -3,6 +3,10 @@
.bi-bubble-combo {
& .button-combo-triangle-wrapper {
position: fixed !important;
// -ms-device-fixed >= IE11
// 与fixed表现形式一致,区别在于浏览器缩放的时候,-ms-device-fixed的元素不受其影响,而fixed的元素受其影响
// 最重要的是-ms-device-fixed解决了IE11下的残影问题
position: -ms-device-fixed !important;
// 消除祖先节点设置的line-height:normal对空白节点的行高影响
line-height: 0;
.z-index-layer(@zIndex-popup);
@ -44,4 +48,4 @@
}
}
}
}
}

6
src/less/base/single/tip/tip.less

@ -3,4 +3,8 @@
.bi-tip{
position: fixed !important;
}
// -ms-device-fixed >= IE11
// 与fixed表现形式一致,区别在于浏览器缩放的时候,-ms-device-fixed的元素不受其影响,而fixed的元素受其影响
// 最重要的是-ms-device-fixed解决了IE11下的残影问题
position: -ms-device-fixed !important;
}

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

Loading…
Cancel
Save