windy 7 years ago
parent
commit
c913609ebf
  1. 18
      dist/base.js
  2. 4
      dist/bundle.css
  3. 197
      dist/bundle.js
  4. 2
      dist/bundle.min.css
  5. 30
      dist/case.js
  6. 149
      dist/core.js
  7. 4
      dist/fineui.css
  8. 238
      dist/fineui.js
  9. 2
      dist/fineui.min.css
  10. 41
      dist/fix/fix.compact.js
  11. 17
      dist/fix/fix.js
  12. 4
      dist/widget.css
  13. 2
      src/base/combination/combo.js
  14. 2
      src/base/combination/expander.js
  15. 4
      src/base/combination/searcher.js
  16. 2
      src/base/combination/switcher.js
  17. 8
      src/base/layer/layer.popup.js
  18. 30
      src/case/tree/branchrelation.js
  19. 2
      src/core/base.js
  20. 10
      src/core/controller/controller.floatbox.js
  21. 6
      src/core/controller/controller.layer.js
  22. 2
      src/core/inject.js
  23. 13
      src/core/plugin.js
  24. 16
      src/core/shortcut.js
  25. 12
      src/core/widget.js
  26. 2
      src/core/wrapper/layout.js
  27. 4
      src/core/wrapper/layout/adapt/adapt.center.js
  28. 4
      src/core/wrapper/layout/adapt/adapt.horizontal.js
  29. 8
      src/core/wrapper/layout/adapt/adapt.leftrightvertical.js
  30. 4
      src/core/wrapper/layout/adapt/adapt.vertical.js
  31. 2
      src/core/wrapper/layout/adapt/float.center.js
  32. 2
      src/core/wrapper/layout/adapt/float.horizontal.js
  33. 10
      src/core/wrapper/layout/layout.border.js
  34. 4
      src/core/wrapper/layout/layout.card.js
  35. 2
      src/core/wrapper/layout/layout.division.js
  36. 6
      src/core/wrapper/layout/layout.flow.js
  37. 6
      src/core/wrapper/layout/layout.grid.js
  38. 4
      src/core/wrapper/layout/layout.horizontal.js
  39. 2
      src/core/wrapper/layout/layout.table.js
  40. 4
      src/core/wrapper/layout/layout.tape.js
  41. 6
      src/core/wrapper/layout/layout.td.js
  42. 2
      src/core/wrapper/layout/layout.window.js
  43. 4
      src/core/wrapper/layout/middle/middle.center.js
  44. 4
      src/core/wrapper/layout/middle/middle.float.center.js
  45. 4
      src/core/wrapper/layout/middle/middle.horizontal.js
  46. 4
      src/core/wrapper/layout/middle/middle.vertical.js
  47. 1
      src/css/widget/previewtable/previewtable.cell.css
  48. 2
      src/css/widget/previewtable/previewtable.css
  49. 1
      src/css/widget/previewtable/previewtable.header.cell.css
  50. 1
      src/less/widget/previewtable/previewtable.cell.less
  51. 1
      src/less/widget/previewtable/previewtable.header.cell.less
  52. 4
      utils/utils.js

18
dist/base.js vendored

@ -3147,7 +3147,7 @@ BI.Combo = BI.inherit(BI.Widget, {
this.popupView = BI.createWidget(this.options.popup, { this.popupView = BI.createWidget(this.options.popup, {
type: "bi.popup_view", type: "bi.popup_view",
value: o.value value: o.value
}); }, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.combo.setValue(self.getValue()); self.combo.setValue(self.getValue());
@ -3548,7 +3548,7 @@ BI.Expander = BI.inherit(BI.Widget, {
vgap: 0 vgap: 0
}], }],
value: o.value value: o.value
}); }, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
@ -4388,7 +4388,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
BI.Maskers.create(this.getName(), o.adapter, BI.extend({ BI.Maskers.create(this.getName(), o.adapter, BI.extend({
container: this, container: this,
render: this.popupView render: this.popupView
}, o.masker)); }, o.masker), this);
} }
}, },
@ -4545,7 +4545,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
return o.popup.value; return o.popup.value;
} }
return this.popupView.getValue(); return this.popupView.getValue();
}, },
populate: function (result, searchResult, keyword) { populate: function (result, searchResult, keyword) {
@ -4716,7 +4716,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
vgap: 0 vgap: 0
}], }],
value: o.value value: o.value
}); }, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
@ -15419,7 +15419,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
_createView: function () { _createView: function () {
var o = this.options; var o = this.options;
this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value}); this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value}, this);
this.button_group.element.css({"min-height": o.minHeight + "px"}); this.button_group.element.css({"min-height": o.minHeight + "px"});
return this.button_group; return this.button_group;
}, },
@ -15429,7 +15429,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
if (false === o.tool) { if (false === o.tool) {
return; return;
} }
return BI.createWidget(o.tool); return BI.createWidget(o.tool, this);
}, },
_createTab: function () { _createTab: function () {
@ -15443,7 +15443,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
height: 25, height: 25,
items: o.tabs, items: o.tabs,
value: o.value value: o.value
}); }, this);
}, },
_createToolBar: function () { _createToolBar: function () {
@ -15461,7 +15461,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
shadow: true, shadow: true,
isShadowShowingOnSelected: true isShadowShowingOnSelected: true
}) })
}); }, this);
}, },
getView: function () { getView: function () {

4
dist/bundle.css vendored

@ -4436,19 +4436,16 @@ ul.ztree.zTreeDragUL {
.bi-preview-table-cell { .bi-preview-table-cell {
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }
.bi-preview-table-cell { .bi-preview-table-cell {
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }
.bi-preview-table-header-cell { .bi-preview-table-header-cell {
font-weight: bold; font-weight: bold;
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }
.bi-preview-table { .bi-preview-table {
@ -4471,7 +4468,6 @@ ul.ztree.zTreeDragUL {
font-weight: bold; font-weight: bold;
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }
.bi-quarter-trigger { .bi-quarter-trigger {
-webkit-border-radius: 2px; -webkit-border-radius: 2px;

197
dist/bundle.js vendored

@ -11715,7 +11715,7 @@ if (!window.BI) {
clone = {}; clone = {};
for (var i in obj) { for (var i in obj) {
if (_.has(obj, i)) { if (BI.has(obj, i)) {
clone[i] = BI.deepClone(obj[i]); clone[i] = BI.deepClone(obj[i]);
} }
} }
@ -12480,6 +12480,8 @@ BI.Widget = BI.inherit(BI.OB, {
}); });
}, },
beforeInit: null,
// 生命周期函数 // 生命周期函数
beforeCreate: null, beforeCreate: null,
@ -12502,12 +12504,20 @@ BI.Widget = BI.inherit(BI.OB, {
_init: function () { _init: function () {
BI.Widget.superclass._init.apply(this, arguments); BI.Widget.superclass._init.apply(this, arguments);
this.beforeCreate && this.beforeCreate();
this._initRoot(); this._initRoot();
this._initElementWidth(); this._initElementWidth();
this._initElementHeight(); this._initElementHeight();
this._initVisual(); this._initVisual();
this._initState(); this._initState();
if (this.beforeInit) {
this.beforeInit(BI.bind(this._render, this));
} else {
this._render();
}
},
_render: function(){
this.beforeCreate && this.beforeCreate();
this._initElement(); this._initElement();
this._initEffects(); this._initEffects();
this.created && this.created(); this.created && this.created();
@ -12927,9 +12937,15 @@ BI.Widget = BI.inherit(BI.OB, {
return new cls(config); return new cls(config);
}; };
BI.createWidget = function (item, options) { BI.createWidget = function (item, options, context) {
var el, w; var el, w;
options || (options = {}); item || (item = {});
if (BI.isWidget(options)) {
context = options;
options = {};
} else {
options || (options = {});
}
if (BI.isEmpty(item) && BI.isEmpty(options)) { if (BI.isEmpty(item) && BI.isEmpty(options)) {
return BI.createWidget({ return BI.createWidget({
type: "bi.layout" type: "bi.layout"
@ -12938,17 +12954,17 @@ BI.Widget = BI.inherit(BI.OB, {
if (BI.isWidget(item)) { if (BI.isWidget(item)) {
return item; return item;
} }
if (item && (item.type || options.type)) { if (item.type || options.type) {
el = BI.extend({}, options, item); el = BI.extend({}, options, item);
w = BI.Plugin.getWidget(el.type, el); w = BI.Plugin.getWidget(el.type, el);
return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options)); return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options));
} }
if (item && item.el && (item.el.type || options.type)) { if (item.el && (item.el.type || options.type)) {
el = BI.extend({}, options, item.el); el = BI.extend({}, options, item.el);
w = BI.Plugin.getWidget(el.type, el); w = BI.Plugin.getWidget(el.type, el);
return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options)); return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options));
} }
if (item && BI.isWidget(item.el)) { if (BI.isWidget(item.el)) {
return item.el; return item.el;
} }
throw new Error("无法根据item创建组件"); throw new Error("无法根据item创建组件");
@ -16617,7 +16633,7 @@ BI.Layout = BI.inherit(BI.Widget, {
_addElement: function (i, item) { _addElement: function (i, item) {
var self = this, w; var self = this, w;
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
w = BI.createWidget(item); w = BI.createWidget(item, this);
w.on(BI.Events.DESTROY, function () { w.on(BI.Events.DESTROY, function () {
BI.each(self._children, function (name, child) { BI.each(self._children, function (name, child) {
if (child === w) { if (child === w) {
@ -17106,9 +17122,15 @@ BI.shortcut("bi.layout", BI.Layout);BI.Plugin = BI.Plugin || {};
!(function () { !(function () {
var _WidgetsPlugin = {}; var _WidgetsPlugin = {};
var _ObjectPlugin = {}; var _ObjectPlugin = {};
var _ConfigPlugin = {};
BI.extend(BI.Plugin, { BI.extend(BI.Plugin, {
getWidget: function (type, options) { getWidget: function (type, options) {
if (_ConfigPlugin[type]) {
for (var i = _ConfigPlugin[type].length - 1; i >= 0; i--) {
_ConfigPlugin[type][i](options);
}
}
if (_WidgetsPlugin[type]) { if (_WidgetsPlugin[type]) {
var res; var res;
for (var i = _WidgetsPlugin[type].length - 1; i >= 0; i--) { for (var i = _WidgetsPlugin[type].length - 1; i >= 0; i--) {
@ -17120,6 +17142,13 @@ BI.shortcut("bi.layout", BI.Layout);BI.Plugin = BI.Plugin || {};
return options; return options;
}, },
configWidget: function (type, fn) {
if (!_ConfigPlugin[type]) {
_ConfigPlugin[type] = [];
}
_ConfigPlugin[type].push(fn);
},
registerWidget: function (type, fn) { registerWidget: function (type, fn) {
if (!_WidgetsPlugin[type]) { if (!_WidgetsPlugin[type]) {
_WidgetsPlugin[type] = []; _WidgetsPlugin[type] = [];
@ -18420,19 +18449,19 @@ BI.FloatBoxController = BI.inherit(BI.Controller, {
return BI.isNotNull(this.floatManager[name]); return BI.isNotNull(this.floatManager[name]);
}, },
create: function (name, section, options) { create: function (name, section, options, context) {
if (this._check(name)) { if (this._check(name)) {
return this; return this;
} }
var floatbox = BI.createWidget({ var floatbox = BI.createWidget({
type: "bi.float_box" type: "bi.float_box"
}, options); }, options, context);
floatbox.populate(section); floatbox.populate(section);
this.add(name, floatbox, options); this.add(name, floatbox, options, context);
return this; return this;
}, },
add: function (name, floatbox, options) { add: function (name, floatbox, options, context) {
var self = this; var self = this;
options || (options = {}); options || (options = {});
if (this._check(name)) { if (this._check(name)) {
@ -18445,7 +18474,7 @@ BI.FloatBoxController = BI.inherit(BI.Controller, {
el: (this.floatLayer[name] = BI.createWidget({ el: (this.floatLayer[name] = BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
items: [floatbox] items: [floatbox]
})), }, context)),
left: 0, left: 0,
right: 0, right: 0,
top: 0, top: 0,
@ -18572,7 +18601,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
return this.create(name, null, op); return this.create(name, null, op);
}, },
create: function (name, from, op) { create: function (name, from, op, context) {
if (this.has(name)) { if (this.has(name)) {
return this.get(name); return this.get(name);
} }
@ -18591,7 +18620,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
var widget = BI.createWidget((op.render || {}), { var widget = BI.createWidget((op.render || {}), {
type: "bi.layout", type: "bi.layout",
cls: op.cls cls: op.cls
}); }, context);
var layout = BI.createWidget({ var layout = BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
@ -18601,7 +18630,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
top: 0, top: 0,
bottom: 0 bottom: 0
}] }]
}); }, context);
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: op.container || this.options.render, element: op.container || this.options.render,
@ -20281,7 +20310,7 @@ BI.extend(BI.DOM, {
} }
return configFn(providers[type]); return configFn(providers[type]);
} }
BI.Plugin.registerWidget(type, configFn); BI.Plugin.configWidget(type, configFn);
}; };
var actions = {}; var actions = {};
@ -22436,7 +22465,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
@ -22445,7 +22474,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
width: width width: width
}, },
items: [w] items: [w]
}); }, this);
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
@ -22554,7 +22583,7 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
@ -22563,7 +22592,7 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
width: width width: width
}, },
items: [w] items: [w]
}); }, this);
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
@ -22677,7 +22706,7 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
hgap: o.lhgap, hgap: o.lhgap,
lgap: o.llgap, lgap: o.llgap,
rgap: o.lrgap rgap: o.lrgap
}); }, this);
left.element.css("height", "100%"); left.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.left", type: "bi.left",
@ -22692,7 +22721,7 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
hgap: o.rhgap, hgap: o.rhgap,
lgap: o.rlgap, lgap: o.rlgap,
rgap: o.rrgap rgap: o.rrgap
}); }, this);
right.element.css("height", "100%"); right.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.right", type: "bi.right",
@ -22742,7 +22771,7 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
lgap: o.lgap, lgap: o.lgap,
hgap: o.hgap, hgap: o.hgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
left.element.css("height", "100%"); left.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.left", type: "bi.left",
@ -22790,7 +22819,7 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
lgap: o.lgap, lgap: o.lgap,
hgap: o.hgap, hgap: o.hgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
right.element.css("height", "100%"); right.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.right", type: "bi.right",
@ -22843,7 +22872,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
@ -22852,7 +22881,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
width: width width: width
}, },
items: [w] items: [w]
}); }, this);
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
@ -23042,7 +23071,7 @@ BI.FloatCenterAdaptLayout = BI.inherit(BI.Layout, {
bgap: o.bgap, bgap: o.bgap,
lgap: o.lgap, lgap: o.lgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
this.container = BI.createWidget({ this.container = BI.createWidget({
type: "bi.left", type: "bi.left",
@ -23110,7 +23139,7 @@ BI.FloatHorizontalLayout = BI.inherit(BI.Layout, {
bgap: o.bgap, bgap: o.bgap,
lgap: o.lgap, lgap: o.lgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
this.container = BI.createWidget({ this.container = BI.createWidget({
type: "bi.left", type: "bi.left",
@ -23749,7 +23778,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "north")) { if (!this.hasWidget(this.getName() + "north")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
this.addWidget(this.getName() + "north", w); this.addWidget(this.getName() + "north", w);
} }
this.getWidgetByName(this.getName() + "north").element.height(item.height) this.getWidgetByName(this.getName() + "north").element.height(item.height)
@ -23769,7 +23798,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "south")) { if (!this.hasWidget(this.getName() + "south")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
this.addWidget(this.getName() + "south", w); this.addWidget(this.getName() + "south", w);
} }
this.getWidgetByName(this.getName() + "south").element.height(item.height) this.getWidgetByName(this.getName() + "south").element.height(item.height)
@ -23789,7 +23818,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "west")) { if (!this.hasWidget(this.getName() + "west")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
this.addWidget(this.getName() + "west", w); this.addWidget(this.getName() + "west", w);
} }
this.getWidgetByName(this.getName() + "west").element.width(item.width) this.getWidgetByName(this.getName() + "west").element.width(item.width)
@ -23809,7 +23838,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "east")) { if (!this.hasWidget(this.getName() + "east")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
this.addWidget(this.getName() + "east", w); this.addWidget(this.getName() + "east", w);
} }
this.getWidgetByName(this.getName() + "east").element.width(item.width) this.getWidgetByName(this.getName() + "east").element.width(item.width)
@ -23828,7 +23857,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
item = regions["center"]; item = regions["center"];
if (item != null) { if (item != null) {
if (!this.hasWidget(this.getName() + "center")) { if (!this.hasWidget(this.getName() + "center")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
this.addWidget(this.getName() + "center", w); this.addWidget(this.getName() + "center", w);
} }
this.getWidgetByName(this.getName() + "center").element this.getWidgetByName(this.getName() + "center").element
@ -23872,7 +23901,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
if (!self.hasWidget(item.cardName)) { if (!self.hasWidget(item.cardName)) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.on(BI.Events.DESTROY, function () { w.on(BI.Events.DESTROY, function () {
var index = BI.findIndex(o.items, function (i, tItem) { var index = BI.findIndex(o.items, function (i, tItem) {
return tItem.cardName == item.cardName; return tItem.cardName == item.cardName;
@ -23942,7 +23971,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
if (this.isCardExisted(cardName)) { if (this.isCardExisted(cardName)) {
throw new Error("cardName is already exist"); throw new Error("cardName is already exist");
} }
var widget = BI.createWidget(cardItem); var widget = BI.createWidget(cardItem, this);
widget.element.css({ widget.element.css({
position: "relative", position: "relative",
top: "0", top: "0",
@ -24223,7 +24252,7 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
throw new Error("item be required"); throw new Error("item be required");
} }
if(!this.hasWidget(this.getName() + i + "_" + j)) { if(!this.hasWidget(this.getName() + i + "_" + j)) {
var w = BI.createWidget(map[i][j]); var w = BI.createWidget(map[i][j], this);
this.addWidget(this.getName() + i + "_" + j, w); this.addWidget(this.getName() + i + "_" + j, w);
} else { } else {
w = this.getWidgetByName(this.getName() + i + "_" + j); w = this.getWidgetByName(this.getName() + i + "_" + j);
@ -24303,6 +24332,9 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, {
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({top: item.top}); w.element.css({top: item.top});
} }
if (BI.isNotNull(item.bottom)) {
w.element.css({bottom: item.bottom});
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px"
@ -24376,6 +24408,9 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, {
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({top: item.top}); w.element.css({top: item.top});
} }
if (BI.isNotNull(item.bottom)) {
w.element.css({bottom: item.bottom});
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px"
@ -24502,18 +24537,18 @@ BI.GridLayout = BI.inherit(BI.Layout, {
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (BI.isArray(item)) { if (BI.isArray(item)) {
BI.each(item, function (j, el) { BI.each(item, function (j, el) {
els[i][j] = BI.createWidget(el); els[i][j] = BI.createWidget(el, this);
}); });
return; return;
} }
els[item.row][item.column] = BI.createWidget(item); els[item.row][item.column] = BI.createWidget(item, this);
}); });
for (var i = 0; i < rows; i++) { for (var i = 0; i < rows; i++) {
for (var j = 0; j < columns; j++) { for (var j = 0; j < columns; j++) {
if (!els[i][j]) { if (!els[i][j]) {
els[i][j] = BI.createWidget({ els[i][j] = BI.createWidget({
type: "bi.layout" type: "bi.layout"
}); }, this);
} }
first(els[i][j], i, j); first(els[i][j], i, j);
els[i][j].element.css({ els[i][j].element.css({
@ -24572,7 +24607,7 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({position: "relative", margin: "0px auto"}); w.element.css({position: "relative", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
@ -24581,7 +24616,7 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
width: width width: width
}, },
items: [w] items: [w]
}); }, this);
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
@ -24884,7 +24919,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
type: "bi.absolute", type: "bi.absolute",
height: BI.isArray(o.rowSize) ? o.rowSize[this.rows] : o.rowSize, height: BI.isArray(o.rowSize) ? o.rowSize[this.rows] : o.rowSize,
items: abs items: abs
}); }, this);
if (this.rows > 0) { if (this.rows > 0) {
this.getWidgetByName(this.getName() + (this.rows - 1)).element.css({ this.getWidgetByName(this.getName() + (this.rows - 1)).element.css({
"margin-bottom": o.vgap "margin-bottom": o.vgap
@ -24962,7 +24997,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
items = BI.compact(items); items = BI.compact(items);
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!self.hasWidget(self.getName() + i + "")) { if (!self.hasWidget(self.getName() + i + "")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
self.addWidget(self.getName() + i + "", w); self.addWidget(self.getName() + i + "", w);
} else { } else {
w = self.getWidgetByName(self.getName() + i + ""); w = self.getWidgetByName(self.getName() + i + "");
@ -25067,7 +25102,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
items = BI.compact(items); items = BI.compact(items);
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!self.hasWidget(self.getName() + i + "")) { if (!self.hasWidget(self.getName() + i + "")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
self.addWidget(self.getName() + i + "", w); self.addWidget(self.getName() + i + "", w);
} else { } else {
w = self.getWidgetByName(self.getName() + i + ""); w = self.getWidgetByName(self.getName() + i + "");
@ -25202,10 +25237,10 @@ BI.TdLayout = BI.inherit(BI.Layout, {
var tr = BI.createWidget({ var tr = BI.createWidget({
type: "bi.default", type: "bi.default",
tagName: "tr" tagName: "tr"
}); }, this);
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
var w = BI.createWidget(arr[i]); var w = BI.createWidget(arr[i], this);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
if (arr[i].lgap) { if (arr[i].lgap) {
w.element.css({"margin-left": arr[i].lgap + "px"}); w.element.css({"margin-left": arr[i].lgap + "px"});
@ -25227,7 +25262,7 @@ BI.TdLayout = BI.inherit(BI.Layout, {
}, },
tagName: "td", tagName: "td",
items: [w] items: [w]
}); }, this);
td.element.css({ td.element.css({
position: "relative", position: "relative",
"vertical-align": "middle", "vertical-align": "middle",
@ -25431,7 +25466,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
throw new Error("item be required"); throw new Error("item be required");
} }
if (!this.hasWidget(this.getName() + i + "_" + j)) { if (!this.hasWidget(this.getName() + i + "_" + j)) {
var w = BI.createWidget(o.items[i][j]); var w = BI.createWidget(o.items[i][j], this);
w.element.css({position: "absolute"}); w.element.css({position: "absolute"});
this.addWidget(this.getName() + i + "_" + j, w); this.addWidget(this.getName() + i + "_" + j, w);
} }
@ -25563,12 +25598,12 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
el: BI.createWidget({ el: BI.createWidget({
type: "bi.default", type: "bi.default",
cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")
}) }, this)
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,
@ -25632,7 +25667,7 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
BI.each(items, function (i) { BI.each(items, function (i) {
var widget = BI.createWidget({ var widget = BI.createWidget({
type: "bi.default" type: "bi.default"
}); }, this);
widget.element.addClass("center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")).css({ widget.element.addClass("center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")).css({
width: width + "%", width: width + "%",
height: "100%" height: "100%"
@ -25643,7 +25678,7 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,
@ -25709,12 +25744,12 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
el: BI.createWidget({ el: BI.createWidget({
type: "bi.default", type: "bi.default",
cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")
}) }, this)
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,
@ -25781,12 +25816,12 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
el: BI.createWidget({ el: BI.createWidget({
type: "bi.default", type: "bi.default",
cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")
}) }, this)
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,
@ -29028,7 +29063,7 @@ BI.Combo = BI.inherit(BI.Widget, {
this.popupView = BI.createWidget(this.options.popup, { this.popupView = BI.createWidget(this.options.popup, {
type: "bi.popup_view", type: "bi.popup_view",
value: o.value value: o.value
}); }, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.combo.setValue(self.getValue()); self.combo.setValue(self.getValue());
@ -29429,7 +29464,7 @@ BI.Expander = BI.inherit(BI.Widget, {
vgap: 0 vgap: 0
}], }],
value: o.value value: o.value
}); }, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
@ -30269,7 +30304,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
BI.Maskers.create(this.getName(), o.adapter, BI.extend({ BI.Maskers.create(this.getName(), o.adapter, BI.extend({
container: this, container: this,
render: this.popupView render: this.popupView
}, o.masker)); }, o.masker), this);
} }
}, },
@ -30426,7 +30461,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
return o.popup.value; return o.popup.value;
} }
return this.popupView.getValue(); return this.popupView.getValue();
}, },
populate: function (result, searchResult, keyword) { populate: function (result, searchResult, keyword) {
@ -30597,7 +30632,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
vgap: 0 vgap: 0
}], }],
value: o.value value: o.value
}); }, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
@ -41300,7 +41335,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
_createView: function () { _createView: function () {
var o = this.options; var o = this.options;
this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value}); this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value}, this);
this.button_group.element.css({"min-height": o.minHeight + "px"}); this.button_group.element.css({"min-height": o.minHeight + "px"});
return this.button_group; return this.button_group;
}, },
@ -41310,7 +41345,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
if (false === o.tool) { if (false === o.tool) {
return; return;
} }
return BI.createWidget(o.tool); return BI.createWidget(o.tool, this);
}, },
_createTab: function () { _createTab: function () {
@ -41324,7 +41359,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
height: 25, height: 25,
items: o.tabs, items: o.tabs,
value: o.value value: o.value
}); }, this);
}, },
_createToolBar: function () { _createToolBar: function () {
@ -41342,7 +41377,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
shadow: true, shadow: true,
isShadowShowingOnSelected: true isShadowShowingOnSelected: true
}) })
}); }, this);
}, },
getView: function () { getView: function () {
@ -75268,39 +75303,11 @@ BI.BranchRelation = BI.inherit(BI.Widget, {
}, },
_transformToTreeFormat: function (sNodes) {
var i, l;
if (!sNodes) {
return [];
}
if (BI.isArray(sNodes)) {
var r = [];
var tmpMap = [];
for (i = 0, l = sNodes.length; i < l; i++) {
tmpMap[sNodes[i].id] = sNodes[i];
}
for (i = 0, l = sNodes.length; i < l; i++) {
if (tmpMap[sNodes[i].pId] && sNodes[i].id != sNodes[i].pId) {
if (!tmpMap[sNodes[i].pId].children) {
tmpMap[sNodes[i].pId].children = [];
}
tmpMap[sNodes[i].pId].children.push(sNodes[i]);
} else {
r.push(sNodes[i]);
}
}
return r;
}
return [sNodes];
},
populate: function (items) { populate: function (items) {
var self = this, o = this.options; var self = this, o = this.options;
o.items = items || []; o.items = items || [];
this.empty(); this.empty();
items = this._transformToTreeFormat(o.items); items = BI.Tree.transformToTreeFormat(o.items);
this.tree = new BI.Tree(); this.tree = new BI.Tree();
this.tree.initTree(items); this.tree.initTree(items);

2
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

30
dist/case.js vendored

@ -12966,39 +12966,11 @@ BI.BranchRelation = BI.inherit(BI.Widget, {
}, },
_transformToTreeFormat: function (sNodes) {
var i, l;
if (!sNodes) {
return [];
}
if (BI.isArray(sNodes)) {
var r = [];
var tmpMap = [];
for (i = 0, l = sNodes.length; i < l; i++) {
tmpMap[sNodes[i].id] = sNodes[i];
}
for (i = 0, l = sNodes.length; i < l; i++) {
if (tmpMap[sNodes[i].pId] && sNodes[i].id != sNodes[i].pId) {
if (!tmpMap[sNodes[i].pId].children) {
tmpMap[sNodes[i].pId].children = [];
}
tmpMap[sNodes[i].pId].children.push(sNodes[i]);
} else {
r.push(sNodes[i]);
}
}
return r;
}
return [sNodes];
},
populate: function (items) { populate: function (items) {
var self = this, o = this.options; var self = this, o = this.options;
o.items = items || []; o.items = items || [];
this.empty(); this.empty();
items = this._transformToTreeFormat(o.items); items = BI.Tree.transformToTreeFormat(o.items);
this.tree = new BI.Tree(); this.tree = new BI.Tree();
this.tree.initTree(items); this.tree.initTree(items);

149
dist/core.js vendored

@ -11715,7 +11715,7 @@ if (!window.BI) {
clone = {}; clone = {};
for (var i in obj) { for (var i in obj) {
if (_.has(obj, i)) { if (BI.has(obj, i)) {
clone[i] = BI.deepClone(obj[i]); clone[i] = BI.deepClone(obj[i]);
} }
} }
@ -12480,6 +12480,8 @@ BI.Widget = BI.inherit(BI.OB, {
}); });
}, },
beforeInit: null,
// 生命周期函数 // 生命周期函数
beforeCreate: null, beforeCreate: null,
@ -12502,12 +12504,20 @@ BI.Widget = BI.inherit(BI.OB, {
_init: function () { _init: function () {
BI.Widget.superclass._init.apply(this, arguments); BI.Widget.superclass._init.apply(this, arguments);
this.beforeCreate && this.beforeCreate();
this._initRoot(); this._initRoot();
this._initElementWidth(); this._initElementWidth();
this._initElementHeight(); this._initElementHeight();
this._initVisual(); this._initVisual();
this._initState(); this._initState();
if (this.beforeInit) {
this.beforeInit(BI.bind(this._render, this));
} else {
this._render();
}
},
_render: function(){
this.beforeCreate && this.beforeCreate();
this._initElement(); this._initElement();
this._initEffects(); this._initEffects();
this.created && this.created(); this.created && this.created();
@ -12927,9 +12937,15 @@ BI.Widget = BI.inherit(BI.OB, {
return new cls(config); return new cls(config);
}; };
BI.createWidget = function (item, options) { BI.createWidget = function (item, options, context) {
var el, w; var el, w;
options || (options = {}); item || (item = {});
if (BI.isWidget(options)) {
context = options;
options = {};
} else {
options || (options = {});
}
if (BI.isEmpty(item) && BI.isEmpty(options)) { if (BI.isEmpty(item) && BI.isEmpty(options)) {
return BI.createWidget({ return BI.createWidget({
type: "bi.layout" type: "bi.layout"
@ -12938,17 +12954,17 @@ BI.Widget = BI.inherit(BI.OB, {
if (BI.isWidget(item)) { if (BI.isWidget(item)) {
return item; return item;
} }
if (item && (item.type || options.type)) { if (item.type || options.type) {
el = BI.extend({}, options, item); el = BI.extend({}, options, item);
w = BI.Plugin.getWidget(el.type, el); w = BI.Plugin.getWidget(el.type, el);
return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options)); return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options));
} }
if (item && item.el && (item.el.type || options.type)) { if (item.el && (item.el.type || options.type)) {
el = BI.extend({}, options, item.el); el = BI.extend({}, options, item.el);
w = BI.Plugin.getWidget(el.type, el); w = BI.Plugin.getWidget(el.type, el);
return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options)); return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options));
} }
if (item && BI.isWidget(item.el)) { if (BI.isWidget(item.el)) {
return item.el; return item.el;
} }
throw new Error("无法根据item创建组件"); throw new Error("无法根据item创建组件");
@ -16617,7 +16633,7 @@ BI.Layout = BI.inherit(BI.Widget, {
_addElement: function (i, item) { _addElement: function (i, item) {
var self = this, w; var self = this, w;
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
w = BI.createWidget(item); w = BI.createWidget(item, this);
w.on(BI.Events.DESTROY, function () { w.on(BI.Events.DESTROY, function () {
BI.each(self._children, function (name, child) { BI.each(self._children, function (name, child) {
if (child === w) { if (child === w) {
@ -17106,9 +17122,15 @@ BI.shortcut("bi.layout", BI.Layout);BI.Plugin = BI.Plugin || {};
!(function () { !(function () {
var _WidgetsPlugin = {}; var _WidgetsPlugin = {};
var _ObjectPlugin = {}; var _ObjectPlugin = {};
var _ConfigPlugin = {};
BI.extend(BI.Plugin, { BI.extend(BI.Plugin, {
getWidget: function (type, options) { getWidget: function (type, options) {
if (_ConfigPlugin[type]) {
for (var i = _ConfigPlugin[type].length - 1; i >= 0; i--) {
_ConfigPlugin[type][i](options);
}
}
if (_WidgetsPlugin[type]) { if (_WidgetsPlugin[type]) {
var res; var res;
for (var i = _WidgetsPlugin[type].length - 1; i >= 0; i--) { for (var i = _WidgetsPlugin[type].length - 1; i >= 0; i--) {
@ -17120,6 +17142,13 @@ BI.shortcut("bi.layout", BI.Layout);BI.Plugin = BI.Plugin || {};
return options; return options;
}, },
configWidget: function (type, fn) {
if (!_ConfigPlugin[type]) {
_ConfigPlugin[type] = [];
}
_ConfigPlugin[type].push(fn);
},
registerWidget: function (type, fn) { registerWidget: function (type, fn) {
if (!_WidgetsPlugin[type]) { if (!_WidgetsPlugin[type]) {
_WidgetsPlugin[type] = []; _WidgetsPlugin[type] = [];
@ -18420,19 +18449,19 @@ BI.FloatBoxController = BI.inherit(BI.Controller, {
return BI.isNotNull(this.floatManager[name]); return BI.isNotNull(this.floatManager[name]);
}, },
create: function (name, section, options) { create: function (name, section, options, context) {
if (this._check(name)) { if (this._check(name)) {
return this; return this;
} }
var floatbox = BI.createWidget({ var floatbox = BI.createWidget({
type: "bi.float_box" type: "bi.float_box"
}, options); }, options, context);
floatbox.populate(section); floatbox.populate(section);
this.add(name, floatbox, options); this.add(name, floatbox, options, context);
return this; return this;
}, },
add: function (name, floatbox, options) { add: function (name, floatbox, options, context) {
var self = this; var self = this;
options || (options = {}); options || (options = {});
if (this._check(name)) { if (this._check(name)) {
@ -18445,7 +18474,7 @@ BI.FloatBoxController = BI.inherit(BI.Controller, {
el: (this.floatLayer[name] = BI.createWidget({ el: (this.floatLayer[name] = BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
items: [floatbox] items: [floatbox]
})), }, context)),
left: 0, left: 0,
right: 0, right: 0,
top: 0, top: 0,
@ -18572,7 +18601,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
return this.create(name, null, op); return this.create(name, null, op);
}, },
create: function (name, from, op) { create: function (name, from, op, context) {
if (this.has(name)) { if (this.has(name)) {
return this.get(name); return this.get(name);
} }
@ -18591,7 +18620,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
var widget = BI.createWidget((op.render || {}), { var widget = BI.createWidget((op.render || {}), {
type: "bi.layout", type: "bi.layout",
cls: op.cls cls: op.cls
}); }, context);
var layout = BI.createWidget({ var layout = BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
@ -18601,7 +18630,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
top: 0, top: 0,
bottom: 0 bottom: 0
}] }]
}); }, context);
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: op.container || this.options.render, element: op.container || this.options.render,
@ -20281,7 +20310,7 @@ BI.extend(BI.DOM, {
} }
return configFn(providers[type]); return configFn(providers[type]);
} }
BI.Plugin.registerWidget(type, configFn); BI.Plugin.configWidget(type, configFn);
}; };
var actions = {}; var actions = {};
@ -22436,7 +22465,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
@ -22445,7 +22474,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
width: width width: width
}, },
items: [w] items: [w]
}); }, this);
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
@ -22554,7 +22583,7 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
@ -22563,7 +22592,7 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
width: width width: width
}, },
items: [w] items: [w]
}); }, this);
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
@ -22677,7 +22706,7 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
hgap: o.lhgap, hgap: o.lhgap,
lgap: o.llgap, lgap: o.llgap,
rgap: o.lrgap rgap: o.lrgap
}); }, this);
left.element.css("height", "100%"); left.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.left", type: "bi.left",
@ -22692,7 +22721,7 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
hgap: o.rhgap, hgap: o.rhgap,
lgap: o.rlgap, lgap: o.rlgap,
rgap: o.rrgap rgap: o.rrgap
}); }, this);
right.element.css("height", "100%"); right.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.right", type: "bi.right",
@ -22742,7 +22771,7 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
lgap: o.lgap, lgap: o.lgap,
hgap: o.hgap, hgap: o.hgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
left.element.css("height", "100%"); left.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.left", type: "bi.left",
@ -22790,7 +22819,7 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
lgap: o.lgap, lgap: o.lgap,
hgap: o.hgap, hgap: o.hgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
right.element.css("height", "100%"); right.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.right", type: "bi.right",
@ -22843,7 +22872,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
@ -22852,7 +22881,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
width: width width: width
}, },
items: [w] items: [w]
}); }, this);
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
@ -23042,7 +23071,7 @@ BI.FloatCenterAdaptLayout = BI.inherit(BI.Layout, {
bgap: o.bgap, bgap: o.bgap,
lgap: o.lgap, lgap: o.lgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
this.container = BI.createWidget({ this.container = BI.createWidget({
type: "bi.left", type: "bi.left",
@ -23110,7 +23139,7 @@ BI.FloatHorizontalLayout = BI.inherit(BI.Layout, {
bgap: o.bgap, bgap: o.bgap,
lgap: o.lgap, lgap: o.lgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
this.container = BI.createWidget({ this.container = BI.createWidget({
type: "bi.left", type: "bi.left",
@ -23749,7 +23778,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "north")) { if (!this.hasWidget(this.getName() + "north")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
this.addWidget(this.getName() + "north", w); this.addWidget(this.getName() + "north", w);
} }
this.getWidgetByName(this.getName() + "north").element.height(item.height) this.getWidgetByName(this.getName() + "north").element.height(item.height)
@ -23769,7 +23798,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "south")) { if (!this.hasWidget(this.getName() + "south")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
this.addWidget(this.getName() + "south", w); this.addWidget(this.getName() + "south", w);
} }
this.getWidgetByName(this.getName() + "south").element.height(item.height) this.getWidgetByName(this.getName() + "south").element.height(item.height)
@ -23789,7 +23818,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "west")) { if (!this.hasWidget(this.getName() + "west")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
this.addWidget(this.getName() + "west", w); this.addWidget(this.getName() + "west", w);
} }
this.getWidgetByName(this.getName() + "west").element.width(item.width) this.getWidgetByName(this.getName() + "west").element.width(item.width)
@ -23809,7 +23838,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "east")) { if (!this.hasWidget(this.getName() + "east")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
this.addWidget(this.getName() + "east", w); this.addWidget(this.getName() + "east", w);
} }
this.getWidgetByName(this.getName() + "east").element.width(item.width) this.getWidgetByName(this.getName() + "east").element.width(item.width)
@ -23828,7 +23857,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
item = regions["center"]; item = regions["center"];
if (item != null) { if (item != null) {
if (!this.hasWidget(this.getName() + "center")) { if (!this.hasWidget(this.getName() + "center")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
this.addWidget(this.getName() + "center", w); this.addWidget(this.getName() + "center", w);
} }
this.getWidgetByName(this.getName() + "center").element this.getWidgetByName(this.getName() + "center").element
@ -23872,7 +23901,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
if (!self.hasWidget(item.cardName)) { if (!self.hasWidget(item.cardName)) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.on(BI.Events.DESTROY, function () { w.on(BI.Events.DESTROY, function () {
var index = BI.findIndex(o.items, function (i, tItem) { var index = BI.findIndex(o.items, function (i, tItem) {
return tItem.cardName == item.cardName; return tItem.cardName == item.cardName;
@ -23942,7 +23971,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
if (this.isCardExisted(cardName)) { if (this.isCardExisted(cardName)) {
throw new Error("cardName is already exist"); throw new Error("cardName is already exist");
} }
var widget = BI.createWidget(cardItem); var widget = BI.createWidget(cardItem, this);
widget.element.css({ widget.element.css({
position: "relative", position: "relative",
top: "0", top: "0",
@ -24223,7 +24252,7 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
throw new Error("item be required"); throw new Error("item be required");
} }
if(!this.hasWidget(this.getName() + i + "_" + j)) { if(!this.hasWidget(this.getName() + i + "_" + j)) {
var w = BI.createWidget(map[i][j]); var w = BI.createWidget(map[i][j], this);
this.addWidget(this.getName() + i + "_" + j, w); this.addWidget(this.getName() + i + "_" + j, w);
} else { } else {
w = this.getWidgetByName(this.getName() + i + "_" + j); w = this.getWidgetByName(this.getName() + i + "_" + j);
@ -24303,6 +24332,9 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, {
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({top: item.top}); w.element.css({top: item.top});
} }
if (BI.isNotNull(item.bottom)) {
w.element.css({bottom: item.bottom});
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px"
@ -24376,6 +24408,9 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, {
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({top: item.top}); w.element.css({top: item.top});
} }
if (BI.isNotNull(item.bottom)) {
w.element.css({bottom: item.bottom});
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px"
@ -24502,18 +24537,18 @@ BI.GridLayout = BI.inherit(BI.Layout, {
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (BI.isArray(item)) { if (BI.isArray(item)) {
BI.each(item, function (j, el) { BI.each(item, function (j, el) {
els[i][j] = BI.createWidget(el); els[i][j] = BI.createWidget(el, this);
}); });
return; return;
} }
els[item.row][item.column] = BI.createWidget(item); els[item.row][item.column] = BI.createWidget(item, this);
}); });
for (var i = 0; i < rows; i++) { for (var i = 0; i < rows; i++) {
for (var j = 0; j < columns; j++) { for (var j = 0; j < columns; j++) {
if (!els[i][j]) { if (!els[i][j]) {
els[i][j] = BI.createWidget({ els[i][j] = BI.createWidget({
type: "bi.layout" type: "bi.layout"
}); }, this);
} }
first(els[i][j], i, j); first(els[i][j], i, j);
els[i][j].element.css({ els[i][j].element.css({
@ -24572,7 +24607,7 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({position: "relative", margin: "0px auto"}); w.element.css({position: "relative", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
@ -24581,7 +24616,7 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
width: width width: width
}, },
items: [w] items: [w]
}); }, this);
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
@ -24884,7 +24919,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
type: "bi.absolute", type: "bi.absolute",
height: BI.isArray(o.rowSize) ? o.rowSize[this.rows] : o.rowSize, height: BI.isArray(o.rowSize) ? o.rowSize[this.rows] : o.rowSize,
items: abs items: abs
}); }, this);
if (this.rows > 0) { if (this.rows > 0) {
this.getWidgetByName(this.getName() + (this.rows - 1)).element.css({ this.getWidgetByName(this.getName() + (this.rows - 1)).element.css({
"margin-bottom": o.vgap "margin-bottom": o.vgap
@ -24962,7 +24997,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
items = BI.compact(items); items = BI.compact(items);
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!self.hasWidget(self.getName() + i + "")) { if (!self.hasWidget(self.getName() + i + "")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
self.addWidget(self.getName() + i + "", w); self.addWidget(self.getName() + i + "", w);
} else { } else {
w = self.getWidgetByName(self.getName() + i + ""); w = self.getWidgetByName(self.getName() + i + "");
@ -25067,7 +25102,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
items = BI.compact(items); items = BI.compact(items);
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!self.hasWidget(self.getName() + i + "")) { if (!self.hasWidget(self.getName() + i + "")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
self.addWidget(self.getName() + i + "", w); self.addWidget(self.getName() + i + "", w);
} else { } else {
w = self.getWidgetByName(self.getName() + i + ""); w = self.getWidgetByName(self.getName() + i + "");
@ -25202,10 +25237,10 @@ BI.TdLayout = BI.inherit(BI.Layout, {
var tr = BI.createWidget({ var tr = BI.createWidget({
type: "bi.default", type: "bi.default",
tagName: "tr" tagName: "tr"
}); }, this);
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
var w = BI.createWidget(arr[i]); var w = BI.createWidget(arr[i], this);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
if (arr[i].lgap) { if (arr[i].lgap) {
w.element.css({"margin-left": arr[i].lgap + "px"}); w.element.css({"margin-left": arr[i].lgap + "px"});
@ -25227,7 +25262,7 @@ BI.TdLayout = BI.inherit(BI.Layout, {
}, },
tagName: "td", tagName: "td",
items: [w] items: [w]
}); }, this);
td.element.css({ td.element.css({
position: "relative", position: "relative",
"vertical-align": "middle", "vertical-align": "middle",
@ -25431,7 +25466,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
throw new Error("item be required"); throw new Error("item be required");
} }
if (!this.hasWidget(this.getName() + i + "_" + j)) { if (!this.hasWidget(this.getName() + i + "_" + j)) {
var w = BI.createWidget(o.items[i][j]); var w = BI.createWidget(o.items[i][j], this);
w.element.css({position: "absolute"}); w.element.css({position: "absolute"});
this.addWidget(this.getName() + i + "_" + j, w); this.addWidget(this.getName() + i + "_" + j, w);
} }
@ -25563,12 +25598,12 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
el: BI.createWidget({ el: BI.createWidget({
type: "bi.default", type: "bi.default",
cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")
}) }, this)
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,
@ -25632,7 +25667,7 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
BI.each(items, function (i) { BI.each(items, function (i) {
var widget = BI.createWidget({ var widget = BI.createWidget({
type: "bi.default" type: "bi.default"
}); }, this);
widget.element.addClass("center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")).css({ widget.element.addClass("center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")).css({
width: width + "%", width: width + "%",
height: "100%" height: "100%"
@ -25643,7 +25678,7 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,
@ -25709,12 +25744,12 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
el: BI.createWidget({ el: BI.createWidget({
type: "bi.default", type: "bi.default",
cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")
}) }, this)
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,
@ -25781,12 +25816,12 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
el: BI.createWidget({ el: BI.createWidget({
type: "bi.default", type: "bi.default",
cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")
}) }, this)
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,

4
dist/fineui.css vendored

@ -4436,19 +4436,16 @@ ul.ztree.zTreeDragUL {
.bi-preview-table-cell { .bi-preview-table-cell {
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }
.bi-preview-table-cell { .bi-preview-table-cell {
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }
.bi-preview-table-header-cell { .bi-preview-table-header-cell {
font-weight: bold; font-weight: bold;
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }
.bi-preview-table { .bi-preview-table {
@ -4471,7 +4468,6 @@ ul.ztree.zTreeDragUL {
font-weight: bold; font-weight: bold;
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }
.bi-quarter-trigger { .bi-quarter-trigger {
-webkit-border-radius: 2px; -webkit-border-radius: 2px;

238
dist/fineui.js vendored

@ -11888,7 +11888,7 @@ if (!window.BI) {
clone = {}; clone = {};
for (var i in obj) { for (var i in obj) {
if (_.has(obj, i)) { if (BI.has(obj, i)) {
clone[i] = BI.deepClone(obj[i]); clone[i] = BI.deepClone(obj[i]);
} }
} }
@ -12653,6 +12653,8 @@ BI.Widget = BI.inherit(BI.OB, {
}); });
}, },
beforeInit: null,
// 生命周期函数 // 生命周期函数
beforeCreate: null, beforeCreate: null,
@ -12675,12 +12677,20 @@ BI.Widget = BI.inherit(BI.OB, {
_init: function () { _init: function () {
BI.Widget.superclass._init.apply(this, arguments); BI.Widget.superclass._init.apply(this, arguments);
this.beforeCreate && this.beforeCreate();
this._initRoot(); this._initRoot();
this._initElementWidth(); this._initElementWidth();
this._initElementHeight(); this._initElementHeight();
this._initVisual(); this._initVisual();
this._initState(); this._initState();
if (this.beforeInit) {
this.beforeInit(BI.bind(this._render, this));
} else {
this._render();
}
},
_render: function(){
this.beforeCreate && this.beforeCreate();
this._initElement(); this._initElement();
this._initEffects(); this._initEffects();
this.created && this.created(); this.created && this.created();
@ -13100,9 +13110,15 @@ BI.Widget = BI.inherit(BI.OB, {
return new cls(config); return new cls(config);
}; };
BI.createWidget = function (item, options) { BI.createWidget = function (item, options, context) {
var el, w; var el, w;
options || (options = {}); item || (item = {});
if (BI.isWidget(options)) {
context = options;
options = {};
} else {
options || (options = {});
}
if (BI.isEmpty(item) && BI.isEmpty(options)) { if (BI.isEmpty(item) && BI.isEmpty(options)) {
return BI.createWidget({ return BI.createWidget({
type: "bi.layout" type: "bi.layout"
@ -13111,17 +13127,17 @@ BI.Widget = BI.inherit(BI.OB, {
if (BI.isWidget(item)) { if (BI.isWidget(item)) {
return item; return item;
} }
if (item && (item.type || options.type)) { if (item.type || options.type) {
el = BI.extend({}, options, item); el = BI.extend({}, options, item);
w = BI.Plugin.getWidget(el.type, el); w = BI.Plugin.getWidget(el.type, el);
return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options)); return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options));
} }
if (item && item.el && (item.el.type || options.type)) { if (item.el && (item.el.type || options.type)) {
el = BI.extend({}, options, item.el); el = BI.extend({}, options, item.el);
w = BI.Plugin.getWidget(el.type, el); w = BI.Plugin.getWidget(el.type, el);
return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options)); return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options));
} }
if (item && BI.isWidget(item.el)) { if (BI.isWidget(item.el)) {
return item.el; return item.el;
} }
throw new Error("无法根据item创建组件"); throw new Error("无法根据item创建组件");
@ -16790,7 +16806,7 @@ BI.Layout = BI.inherit(BI.Widget, {
_addElement: function (i, item) { _addElement: function (i, item) {
var self = this, w; var self = this, w;
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
w = BI.createWidget(item); w = BI.createWidget(item, this);
w.on(BI.Events.DESTROY, function () { w.on(BI.Events.DESTROY, function () {
BI.each(self._children, function (name, child) { BI.each(self._children, function (name, child) {
if (child === w) { if (child === w) {
@ -17279,9 +17295,15 @@ BI.shortcut("bi.layout", BI.Layout);BI.Plugin = BI.Plugin || {};
!(function () { !(function () {
var _WidgetsPlugin = {}; var _WidgetsPlugin = {};
var _ObjectPlugin = {}; var _ObjectPlugin = {};
var _ConfigPlugin = {};
BI.extend(BI.Plugin, { BI.extend(BI.Plugin, {
getWidget: function (type, options) { getWidget: function (type, options) {
if (_ConfigPlugin[type]) {
for (var i = _ConfigPlugin[type].length - 1; i >= 0; i--) {
_ConfigPlugin[type][i](options);
}
}
if (_WidgetsPlugin[type]) { if (_WidgetsPlugin[type]) {
var res; var res;
for (var i = _WidgetsPlugin[type].length - 1; i >= 0; i--) { for (var i = _WidgetsPlugin[type].length - 1; i >= 0; i--) {
@ -17293,6 +17315,13 @@ BI.shortcut("bi.layout", BI.Layout);BI.Plugin = BI.Plugin || {};
return options; return options;
}, },
configWidget: function (type, fn) {
if (!_ConfigPlugin[type]) {
_ConfigPlugin[type] = [];
}
_ConfigPlugin[type].push(fn);
},
registerWidget: function (type, fn) { registerWidget: function (type, fn) {
if (!_WidgetsPlugin[type]) { if (!_WidgetsPlugin[type]) {
_WidgetsPlugin[type] = []; _WidgetsPlugin[type] = [];
@ -18593,19 +18622,19 @@ BI.FloatBoxController = BI.inherit(BI.Controller, {
return BI.isNotNull(this.floatManager[name]); return BI.isNotNull(this.floatManager[name]);
}, },
create: function (name, section, options) { create: function (name, section, options, context) {
if (this._check(name)) { if (this._check(name)) {
return this; return this;
} }
var floatbox = BI.createWidget({ var floatbox = BI.createWidget({
type: "bi.float_box" type: "bi.float_box"
}, options); }, options, context);
floatbox.populate(section); floatbox.populate(section);
this.add(name, floatbox, options); this.add(name, floatbox, options, context);
return this; return this;
}, },
add: function (name, floatbox, options) { add: function (name, floatbox, options, context) {
var self = this; var self = this;
options || (options = {}); options || (options = {});
if (this._check(name)) { if (this._check(name)) {
@ -18618,7 +18647,7 @@ BI.FloatBoxController = BI.inherit(BI.Controller, {
el: (this.floatLayer[name] = BI.createWidget({ el: (this.floatLayer[name] = BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
items: [floatbox] items: [floatbox]
})), }, context)),
left: 0, left: 0,
right: 0, right: 0,
top: 0, top: 0,
@ -18745,7 +18774,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
return this.create(name, null, op); return this.create(name, null, op);
}, },
create: function (name, from, op) { create: function (name, from, op, context) {
if (this.has(name)) { if (this.has(name)) {
return this.get(name); return this.get(name);
} }
@ -18764,7 +18793,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
var widget = BI.createWidget((op.render || {}), { var widget = BI.createWidget((op.render || {}), {
type: "bi.layout", type: "bi.layout",
cls: op.cls cls: op.cls
}); }, context);
var layout = BI.createWidget({ var layout = BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
@ -18774,7 +18803,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
top: 0, top: 0,
bottom: 0 bottom: 0
}] }]
}); }, context);
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: op.container || this.options.render, element: op.container || this.options.render,
@ -20454,7 +20483,7 @@ BI.extend(BI.DOM, {
} }
return configFn(providers[type]); return configFn(providers[type]);
} }
BI.Plugin.registerWidget(type, configFn); BI.Plugin.configWidget(type, configFn);
}; };
var actions = {}; var actions = {};
@ -22609,7 +22638,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
@ -22618,7 +22647,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
width: width width: width
}, },
items: [w] items: [w]
}); }, this);
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
@ -22727,7 +22756,7 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
@ -22736,7 +22765,7 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
width: width width: width
}, },
items: [w] items: [w]
}); }, this);
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
@ -22850,7 +22879,7 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
hgap: o.lhgap, hgap: o.lhgap,
lgap: o.llgap, lgap: o.llgap,
rgap: o.lrgap rgap: o.lrgap
}); }, this);
left.element.css("height", "100%"); left.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.left", type: "bi.left",
@ -22865,7 +22894,7 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
hgap: o.rhgap, hgap: o.rhgap,
lgap: o.rlgap, lgap: o.rlgap,
rgap: o.rrgap rgap: o.rrgap
}); }, this);
right.element.css("height", "100%"); right.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.right", type: "bi.right",
@ -22915,7 +22944,7 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
lgap: o.lgap, lgap: o.lgap,
hgap: o.hgap, hgap: o.hgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
left.element.css("height", "100%"); left.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.left", type: "bi.left",
@ -22963,7 +22992,7 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
lgap: o.lgap, lgap: o.lgap,
hgap: o.hgap, hgap: o.hgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
right.element.css("height", "100%"); right.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.right", type: "bi.right",
@ -23016,7 +23045,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
@ -23025,7 +23054,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
width: width width: width
}, },
items: [w] items: [w]
}); }, this);
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
@ -23215,7 +23244,7 @@ BI.FloatCenterAdaptLayout = BI.inherit(BI.Layout, {
bgap: o.bgap, bgap: o.bgap,
lgap: o.lgap, lgap: o.lgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
this.container = BI.createWidget({ this.container = BI.createWidget({
type: "bi.left", type: "bi.left",
@ -23283,7 +23312,7 @@ BI.FloatHorizontalLayout = BI.inherit(BI.Layout, {
bgap: o.bgap, bgap: o.bgap,
lgap: o.lgap, lgap: o.lgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
this.container = BI.createWidget({ this.container = BI.createWidget({
type: "bi.left", type: "bi.left",
@ -23922,7 +23951,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "north")) { if (!this.hasWidget(this.getName() + "north")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
this.addWidget(this.getName() + "north", w); this.addWidget(this.getName() + "north", w);
} }
this.getWidgetByName(this.getName() + "north").element.height(item.height) this.getWidgetByName(this.getName() + "north").element.height(item.height)
@ -23942,7 +23971,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "south")) { if (!this.hasWidget(this.getName() + "south")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
this.addWidget(this.getName() + "south", w); this.addWidget(this.getName() + "south", w);
} }
this.getWidgetByName(this.getName() + "south").element.height(item.height) this.getWidgetByName(this.getName() + "south").element.height(item.height)
@ -23962,7 +23991,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "west")) { if (!this.hasWidget(this.getName() + "west")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
this.addWidget(this.getName() + "west", w); this.addWidget(this.getName() + "west", w);
} }
this.getWidgetByName(this.getName() + "west").element.width(item.width) this.getWidgetByName(this.getName() + "west").element.width(item.width)
@ -23982,7 +24011,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "east")) { if (!this.hasWidget(this.getName() + "east")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
this.addWidget(this.getName() + "east", w); this.addWidget(this.getName() + "east", w);
} }
this.getWidgetByName(this.getName() + "east").element.width(item.width) this.getWidgetByName(this.getName() + "east").element.width(item.width)
@ -24001,7 +24030,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
item = regions["center"]; item = regions["center"];
if (item != null) { if (item != null) {
if (!this.hasWidget(this.getName() + "center")) { if (!this.hasWidget(this.getName() + "center")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
this.addWidget(this.getName() + "center", w); this.addWidget(this.getName() + "center", w);
} }
this.getWidgetByName(this.getName() + "center").element this.getWidgetByName(this.getName() + "center").element
@ -24045,7 +24074,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
if (!self.hasWidget(item.cardName)) { if (!self.hasWidget(item.cardName)) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.on(BI.Events.DESTROY, function () { w.on(BI.Events.DESTROY, function () {
var index = BI.findIndex(o.items, function (i, tItem) { var index = BI.findIndex(o.items, function (i, tItem) {
return tItem.cardName == item.cardName; return tItem.cardName == item.cardName;
@ -24115,7 +24144,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
if (this.isCardExisted(cardName)) { if (this.isCardExisted(cardName)) {
throw new Error("cardName is already exist"); throw new Error("cardName is already exist");
} }
var widget = BI.createWidget(cardItem); var widget = BI.createWidget(cardItem, this);
widget.element.css({ widget.element.css({
position: "relative", position: "relative",
top: "0", top: "0",
@ -24396,7 +24425,7 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
throw new Error("item be required"); throw new Error("item be required");
} }
if(!this.hasWidget(this.getName() + i + "_" + j)) { if(!this.hasWidget(this.getName() + i + "_" + j)) {
var w = BI.createWidget(map[i][j]); var w = BI.createWidget(map[i][j], this);
this.addWidget(this.getName() + i + "_" + j, w); this.addWidget(this.getName() + i + "_" + j, w);
} else { } else {
w = this.getWidgetByName(this.getName() + i + "_" + j); w = this.getWidgetByName(this.getName() + i + "_" + j);
@ -24476,6 +24505,9 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, {
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({top: item.top}); w.element.css({top: item.top});
} }
if (BI.isNotNull(item.bottom)) {
w.element.css({bottom: item.bottom});
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px"
@ -24549,6 +24581,9 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, {
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({top: item.top}); w.element.css({top: item.top});
} }
if (BI.isNotNull(item.bottom)) {
w.element.css({bottom: item.bottom});
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px"
@ -24675,18 +24710,18 @@ BI.GridLayout = BI.inherit(BI.Layout, {
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (BI.isArray(item)) { if (BI.isArray(item)) {
BI.each(item, function (j, el) { BI.each(item, function (j, el) {
els[i][j] = BI.createWidget(el); els[i][j] = BI.createWidget(el, this);
}); });
return; return;
} }
els[item.row][item.column] = BI.createWidget(item); els[item.row][item.column] = BI.createWidget(item, this);
}); });
for (var i = 0; i < rows; i++) { for (var i = 0; i < rows; i++) {
for (var j = 0; j < columns; j++) { for (var j = 0; j < columns; j++) {
if (!els[i][j]) { if (!els[i][j]) {
els[i][j] = BI.createWidget({ els[i][j] = BI.createWidget({
type: "bi.layout" type: "bi.layout"
}); }, this);
} }
first(els[i][j], i, j); first(els[i][j], i, j);
els[i][j].element.css({ els[i][j].element.css({
@ -24745,7 +24780,7 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({position: "relative", margin: "0px auto"}); w.element.css({position: "relative", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
@ -24754,7 +24789,7 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
width: width width: width
}, },
items: [w] items: [w]
}); }, this);
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
@ -25057,7 +25092,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
type: "bi.absolute", type: "bi.absolute",
height: BI.isArray(o.rowSize) ? o.rowSize[this.rows] : o.rowSize, height: BI.isArray(o.rowSize) ? o.rowSize[this.rows] : o.rowSize,
items: abs items: abs
}); }, this);
if (this.rows > 0) { if (this.rows > 0) {
this.getWidgetByName(this.getName() + (this.rows - 1)).element.css({ this.getWidgetByName(this.getName() + (this.rows - 1)).element.css({
"margin-bottom": o.vgap "margin-bottom": o.vgap
@ -25135,7 +25170,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
items = BI.compact(items); items = BI.compact(items);
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!self.hasWidget(self.getName() + i + "")) { if (!self.hasWidget(self.getName() + i + "")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
self.addWidget(self.getName() + i + "", w); self.addWidget(self.getName() + i + "", w);
} else { } else {
w = self.getWidgetByName(self.getName() + i + ""); w = self.getWidgetByName(self.getName() + i + "");
@ -25240,7 +25275,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
items = BI.compact(items); items = BI.compact(items);
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!self.hasWidget(self.getName() + i + "")) { if (!self.hasWidget(self.getName() + i + "")) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
self.addWidget(self.getName() + i + "", w); self.addWidget(self.getName() + i + "", w);
} else { } else {
w = self.getWidgetByName(self.getName() + i + ""); w = self.getWidgetByName(self.getName() + i + "");
@ -25375,10 +25410,10 @@ BI.TdLayout = BI.inherit(BI.Layout, {
var tr = BI.createWidget({ var tr = BI.createWidget({
type: "bi.default", type: "bi.default",
tagName: "tr" tagName: "tr"
}); }, this);
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
var w = BI.createWidget(arr[i]); var w = BI.createWidget(arr[i], this);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
if (arr[i].lgap) { if (arr[i].lgap) {
w.element.css({"margin-left": arr[i].lgap + "px"}); w.element.css({"margin-left": arr[i].lgap + "px"});
@ -25400,7 +25435,7 @@ BI.TdLayout = BI.inherit(BI.Layout, {
}, },
tagName: "td", tagName: "td",
items: [w] items: [w]
}); }, this);
td.element.css({ td.element.css({
position: "relative", position: "relative",
"vertical-align": "middle", "vertical-align": "middle",
@ -25604,7 +25639,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
throw new Error("item be required"); throw new Error("item be required");
} }
if (!this.hasWidget(this.getName() + i + "_" + j)) { if (!this.hasWidget(this.getName() + i + "_" + j)) {
var w = BI.createWidget(o.items[i][j]); var w = BI.createWidget(o.items[i][j], this);
w.element.css({position: "absolute"}); w.element.css({position: "absolute"});
this.addWidget(this.getName() + i + "_" + j, w); this.addWidget(this.getName() + i + "_" + j, w);
} }
@ -25736,12 +25771,12 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
el: BI.createWidget({ el: BI.createWidget({
type: "bi.default", type: "bi.default",
cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")
}) }, this)
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,
@ -25805,7 +25840,7 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
BI.each(items, function (i) { BI.each(items, function (i) {
var widget = BI.createWidget({ var widget = BI.createWidget({
type: "bi.default" type: "bi.default"
}); }, this);
widget.element.addClass("center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")).css({ widget.element.addClass("center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")).css({
width: width + "%", width: width + "%",
height: "100%" height: "100%"
@ -25816,7 +25851,7 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,
@ -25882,12 +25917,12 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
el: BI.createWidget({ el: BI.createWidget({
type: "bi.default", type: "bi.default",
cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")
}) }, this)
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,
@ -25954,12 +25989,12 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
el: BI.createWidget({ el: BI.createWidget({
type: "bi.default", type: "bi.default",
cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")
}) }, this)
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,
@ -27432,7 +27467,7 @@ Data.Source = BISource = {
var targetStack = []; var targetStack = [];
function pushTarget (_target) { function pushTarget (_target) {
if (target) targetStack.push(target); if (_target) targetStack.push(_target);
Fix.Model.target = target = _target; Fix.Model.target = target = _target;
} }
@ -27440,6 +27475,18 @@ Data.Source = BISource = {
Fix.Model.target = target = targetStack.pop(); 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; var oldWatch = Fix.watch;
Fix.watch = function (model, expOrFn, cb, options) { Fix.watch = function (model, expOrFn, cb, options) {
if (BI.isPlainObject(cb)) { if (BI.isPlainObject(cb)) {
@ -27471,11 +27518,27 @@ Data.Source = BISource = {
} }
} }
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;
};
var _init = BI.Widget.prototype._init; var _init = BI.Widget.prototype._init;
BI.Widget.prototype._init = function () { BI.Widget.prototype._init = function () {
var self = this;
var needPop = false; var needPop = false;
if (window.Fix && this._store) { if (window.Fix && this._store) {
var store = findStore(this.options.element); var store = findStore(this.options.element || context);
if (store) { if (store) {
pushTarget(store); pushTarget(store);
needPop = true; needPop = true;
@ -27489,13 +27552,20 @@ Data.Source = BISource = {
} else { } else {
this.model = this.store; this.model = this.store;
} }
initWatch(this, this.watch);
needPop = true; needPop = true;
} }
_init.apply(this, arguments); _init.apply(this, arguments);
needPop && popTarget(); needPop && popTarget();
}; };
var _render = BI.Widget.prototype._render;
BI.Widget.prototype._render = function () {
if (window.Fix && this._store) {
initWatch(this, this.watch);
}
_render.apply(this, arguments);
};
var unMount = BI.Widget.prototype.__d; var unMount = BI.Widget.prototype.__d;
BI.Widget.prototype.__d = function () { BI.Widget.prototype.__d = function () {
unMount.apply(this, arguments); unMount.apply(this, arguments);
@ -30722,7 +30792,7 @@ BI.Combo = BI.inherit(BI.Widget, {
this.popupView = BI.createWidget(this.options.popup, { this.popupView = BI.createWidget(this.options.popup, {
type: "bi.popup_view", type: "bi.popup_view",
value: o.value value: o.value
}); }, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.combo.setValue(self.getValue()); self.combo.setValue(self.getValue());
@ -31123,7 +31193,7 @@ BI.Expander = BI.inherit(BI.Widget, {
vgap: 0 vgap: 0
}], }],
value: o.value value: o.value
}); }, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
@ -31963,7 +32033,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
BI.Maskers.create(this.getName(), o.adapter, BI.extend({ BI.Maskers.create(this.getName(), o.adapter, BI.extend({
container: this, container: this,
render: this.popupView render: this.popupView
}, o.masker)); }, o.masker), this);
} }
}, },
@ -32120,7 +32190,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
return o.popup.value; return o.popup.value;
} }
return this.popupView.getValue(); return this.popupView.getValue();
}, },
populate: function (result, searchResult, keyword) { populate: function (result, searchResult, keyword) {
@ -32291,7 +32361,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
vgap: 0 vgap: 0
}], }],
value: o.value value: o.value
}); }, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
@ -42994,7 +43064,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
_createView: function () { _createView: function () {
var o = this.options; var o = this.options;
this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value}); this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value}, this);
this.button_group.element.css({"min-height": o.minHeight + "px"}); this.button_group.element.css({"min-height": o.minHeight + "px"});
return this.button_group; return this.button_group;
}, },
@ -43004,7 +43074,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
if (false === o.tool) { if (false === o.tool) {
return; return;
} }
return BI.createWidget(o.tool); return BI.createWidget(o.tool, this);
}, },
_createTab: function () { _createTab: function () {
@ -43018,7 +43088,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
height: 25, height: 25,
items: o.tabs, items: o.tabs,
value: o.value value: o.value
}); }, this);
}, },
_createToolBar: function () { _createToolBar: function () {
@ -43036,7 +43106,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
shadow: true, shadow: true,
isShadowShowingOnSelected: true isShadowShowingOnSelected: true
}) })
}); }, this);
}, },
getView: function () { getView: function () {
@ -76962,39 +77032,11 @@ BI.BranchRelation = BI.inherit(BI.Widget, {
}, },
_transformToTreeFormat: function (sNodes) {
var i, l;
if (!sNodes) {
return [];
}
if (BI.isArray(sNodes)) {
var r = [];
var tmpMap = [];
for (i = 0, l = sNodes.length; i < l; i++) {
tmpMap[sNodes[i].id] = sNodes[i];
}
for (i = 0, l = sNodes.length; i < l; i++) {
if (tmpMap[sNodes[i].pId] && sNodes[i].id != sNodes[i].pId) {
if (!tmpMap[sNodes[i].pId].children) {
tmpMap[sNodes[i].pId].children = [];
}
tmpMap[sNodes[i].pId].children.push(sNodes[i]);
} else {
r.push(sNodes[i]);
}
}
return r;
}
return [sNodes];
},
populate: function (items) { populate: function (items) {
var self = this, o = this.options; var self = this, o = this.options;
o.items = items || []; o.items = items || [];
this.empty(); this.empty();
items = this._transformToTreeFormat(o.items); items = BI.Tree.transformToTreeFormat(o.items);
this.tree = new BI.Tree(); this.tree = new BI.Tree();
this.tree.initTree(items); this.tree.initTree(items);

2
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

41
dist/fix/fix.compact.js vendored

@ -23,7 +23,7 @@
var targetStack = []; var targetStack = [];
function pushTarget (_target) { function pushTarget (_target) {
if (target) targetStack.push(target); if (_target) targetStack.push(_target);
Fix.Model.target = target = _target; Fix.Model.target = target = _target;
} }
@ -31,6 +31,18 @@
Fix.Model.target = target = targetStack.pop(); 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; var oldWatch = Fix.watch;
Fix.watch = function (model, expOrFn, cb, options) { Fix.watch = function (model, expOrFn, cb, options) {
if (BI.isPlainObject(cb)) { if (BI.isPlainObject(cb)) {
@ -62,11 +74,27 @@
} }
} }
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;
};
var _init = BI.Widget.prototype._init; var _init = BI.Widget.prototype._init;
BI.Widget.prototype._init = function () { BI.Widget.prototype._init = function () {
var self = this;
var needPop = false; var needPop = false;
if (window.Fix && this._store) { if (window.Fix && this._store) {
var store = findStore(this.options.element); var store = findStore(this.options.element || context);
if (store) { if (store) {
pushTarget(store); pushTarget(store);
needPop = true; needPop = true;
@ -80,13 +108,20 @@
} else { } else {
this.model = this.store; this.model = this.store;
} }
initWatch(this, this.watch);
needPop = true; needPop = true;
} }
_init.apply(this, arguments); _init.apply(this, arguments);
needPop && popTarget(); needPop && popTarget();
}; };
var _render = BI.Widget.prototype._render;
BI.Widget.prototype._render = function () {
if (window.Fix && this._store) {
initWatch(this, this.watch);
}
_render.apply(this, arguments);
};
var unMount = BI.Widget.prototype.__d; var unMount = BI.Widget.prototype.__d;
BI.Widget.prototype.__d = function () { BI.Widget.prototype.__d = function () {
unMount.apply(this, arguments); unMount.apply(this, arguments);

17
dist/fix/fix.js vendored

@ -1262,11 +1262,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} }
this._parent = Model.target; this._parent = Model.target;
var state = _.isFunction(this.state) ? this.state() : this.state; var state = _.isFunction(this.state) ? this.state() : this.state;
var computed = _.isFunction(this.computed) ? this.computed() : this.computed; var computed = this.computed;
var context = _.isFunction(this.context) ? this.context() : this.context; var context = this.context;
var childContext = _.isFunction(this.childContext) ? this.childContext() : this.childContext; var childContext = this.childContext;
var watch$$1 = _.isFunction(this.watch) ? this.watch() : this.watch; var watch$$1 = this.watch;
var actions = _.isFunction(this.actions) ? this.actions() : this.actions; 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(context || []);
defineProps(this, keys); defineProps(this, keys);
childContext && defineContext(this, childContext); childContext && defineContext(this, childContext);
@ -1303,13 +1303,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return Model; return Model;
}(); }();
Model.prototype.state = {};
Model.prototype.computed = {};
Model.prototype.context = [];
Model.prototype.childContext = [];
Model.prototype.watch = {};
Model.prototype.actions = {};
function toJSON(model) { function toJSON(model) {
var result = void 0; var result = void 0;
if (_.isArray(model)) { if (_.isArray(model)) {

4
dist/widget.css vendored

@ -336,19 +336,16 @@
.bi-preview-table-cell { .bi-preview-table-cell {
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }
.bi-preview-table-cell { .bi-preview-table-cell {
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }
.bi-preview-table-header-cell { .bi-preview-table-header-cell {
font-weight: bold; font-weight: bold;
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }
.bi-preview-table { .bi-preview-table {
@ -371,7 +368,6 @@
font-weight: bold; font-weight: bold;
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }
.bi-quarter-trigger { .bi-quarter-trigger {
-webkit-border-radius: 2px; -webkit-border-radius: 2px;

2
src/base/combination/combo.js

@ -220,7 +220,7 @@ BI.Combo = BI.inherit(BI.Widget, {
this.popupView = BI.createWidget(this.options.popup, { this.popupView = BI.createWidget(this.options.popup, {
type: "bi.popup_view", type: "bi.popup_view",
value: o.value value: o.value
}); }, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.combo.setValue(self.getValue()); self.combo.setValue(self.getValue());

2
src/base/combination/expander.js

@ -143,7 +143,7 @@ BI.Expander = BI.inherit(BI.Widget, {
vgap: 0 vgap: 0
}], }],
value: o.value value: o.value
}); }, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {

4
src/base/combination/searcher.js

@ -119,7 +119,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
BI.Maskers.create(this.getName(), o.adapter, BI.extend({ BI.Maskers.create(this.getName(), o.adapter, BI.extend({
container: this, container: this,
render: this.popupView render: this.popupView
}, o.masker)); }, o.masker), this);
} }
}, },
@ -276,7 +276,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
return o.popup.value; return o.popup.value;
} }
return this.popupView.getValue(); return this.popupView.getValue();
}, },
populate: function (result, searchResult, keyword) { populate: function (result, searchResult, keyword) {

2
src/base/combination/switcher.js

@ -141,7 +141,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
vgap: 0 vgap: 0
}], }],
value: o.value value: o.value
}); }, this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {

8
src/base/layer/layer.popup.js

@ -93,7 +93,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
_createView: function () { _createView: function () {
var o = this.options; var o = this.options;
this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value}); this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value}, this);
this.button_group.element.css({"min-height": o.minHeight + "px"}); this.button_group.element.css({"min-height": o.minHeight + "px"});
return this.button_group; return this.button_group;
}, },
@ -103,7 +103,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
if (false === o.tool) { if (false === o.tool) {
return; return;
} }
return BI.createWidget(o.tool); return BI.createWidget(o.tool, this);
}, },
_createTab: function () { _createTab: function () {
@ -117,7 +117,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
height: 25, height: 25,
items: o.tabs, items: o.tabs,
value: o.value value: o.value
}); }, this);
}, },
_createToolBar: function () { _createToolBar: function () {
@ -135,7 +135,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
shadow: true, shadow: true,
isShadowShowingOnSelected: true isShadowShowingOnSelected: true
}) })
}); }, this);
}, },
getView: function () { getView: function () {

30
src/case/tree/branchrelation.js

@ -379,39 +379,11 @@ BI.BranchRelation = BI.inherit(BI.Widget, {
}, },
_transformToTreeFormat: function (sNodes) {
var i, l;
if (!sNodes) {
return [];
}
if (BI.isArray(sNodes)) {
var r = [];
var tmpMap = [];
for (i = 0, l = sNodes.length; i < l; i++) {
tmpMap[sNodes[i].id] = sNodes[i];
}
for (i = 0, l = sNodes.length; i < l; i++) {
if (tmpMap[sNodes[i].pId] && sNodes[i].id != sNodes[i].pId) {
if (!tmpMap[sNodes[i].pId].children) {
tmpMap[sNodes[i].pId].children = [];
}
tmpMap[sNodes[i].pId].children.push(sNodes[i]);
} else {
r.push(sNodes[i]);
}
}
return r;
}
return [sNodes];
},
populate: function (items) { populate: function (items) {
var self = this, o = this.options; var self = this, o = this.options;
o.items = items || []; o.items = items || [];
this.empty(); this.empty();
items = this._transformToTreeFormat(o.items); items = BI.Tree.transformToTreeFormat(o.items);
this.tree = new BI.Tree(); this.tree = new BI.Tree();
this.tree.initTree(items); this.tree.initTree(items);

2
src/core/base.js

@ -565,7 +565,7 @@ if (!window.BI) {
clone = {}; clone = {};
for (var i in obj) { for (var i in obj) {
if (_.has(obj, i)) { if (BI.has(obj, i)) {
clone[i] = BI.deepClone(obj[i]); clone[i] = BI.deepClone(obj[i]);
} }
} }

10
src/core/controller/controller.floatbox.js

@ -27,19 +27,19 @@ BI.FloatBoxController = BI.inherit(BI.Controller, {
return BI.isNotNull(this.floatManager[name]); return BI.isNotNull(this.floatManager[name]);
}, },
create: function (name, section, options) { create: function (name, section, options, context) {
if (this._check(name)) { if (this._check(name)) {
return this; return this;
} }
var floatbox = BI.createWidget({ var floatbox = BI.createWidget({
type: "bi.float_box" type: "bi.float_box"
}, options); }, options, context);
floatbox.populate(section); floatbox.populate(section);
this.add(name, floatbox, options); this.add(name, floatbox, options, context);
return this; return this;
}, },
add: function (name, floatbox, options) { add: function (name, floatbox, options, context) {
var self = this; var self = this;
options || (options = {}); options || (options = {});
if (this._check(name)) { if (this._check(name)) {
@ -52,7 +52,7 @@ BI.FloatBoxController = BI.inherit(BI.Controller, {
el: (this.floatLayer[name] = BI.createWidget({ el: (this.floatLayer[name] = BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
items: [floatbox] items: [floatbox]
})), }, context)),
left: 0, left: 0,
right: 0, right: 0,
top: 0, top: 0,

6
src/core/controller/controller.layer.js

@ -37,7 +37,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
return this.create(name, null, op); return this.create(name, null, op);
}, },
create: function (name, from, op) { create: function (name, from, op, context) {
if (this.has(name)) { if (this.has(name)) {
return this.get(name); return this.get(name);
} }
@ -56,7 +56,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
var widget = BI.createWidget((op.render || {}), { var widget = BI.createWidget((op.render || {}), {
type: "bi.layout", type: "bi.layout",
cls: op.cls cls: op.cls
}); }, context);
var layout = BI.createWidget({ var layout = BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
@ -66,7 +66,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
top: 0, top: 0,
bottom: 0 bottom: 0
}] }]
}); }, context);
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: op.container || this.options.render, element: op.container || this.options.render,

2
src/core/inject.js

@ -49,7 +49,7 @@
} }
return configFn(providers[type]); return configFn(providers[type]);
} }
BI.Plugin.registerWidget(type, configFn); BI.Plugin.configWidget(type, configFn);
}; };
var actions = {}; var actions = {};

13
src/core/plugin.js

@ -2,9 +2,15 @@ BI.Plugin = BI.Plugin || {};
!(function () { !(function () {
var _WidgetsPlugin = {}; var _WidgetsPlugin = {};
var _ObjectPlugin = {}; var _ObjectPlugin = {};
var _ConfigPlugin = {};
BI.extend(BI.Plugin, { BI.extend(BI.Plugin, {
getWidget: function (type, options) { getWidget: function (type, options) {
if (_ConfigPlugin[type]) {
for (var i = _ConfigPlugin[type].length - 1; i >= 0; i--) {
_ConfigPlugin[type][i](options);
}
}
if (_WidgetsPlugin[type]) { if (_WidgetsPlugin[type]) {
var res; var res;
for (var i = _WidgetsPlugin[type].length - 1; i >= 0; i--) { for (var i = _WidgetsPlugin[type].length - 1; i >= 0; i--) {
@ -16,6 +22,13 @@ BI.Plugin = BI.Plugin || {};
return options; return options;
}, },
configWidget: function (type, fn) {
if (!_ConfigPlugin[type]) {
_ConfigPlugin[type] = [];
}
_ConfigPlugin[type].push(fn);
},
registerWidget: function (type, fn) { registerWidget: function (type, fn) {
if (!_WidgetsPlugin[type]) { if (!_WidgetsPlugin[type]) {
_WidgetsPlugin[type] = []; _WidgetsPlugin[type] = [];

16
src/core/shortcut.js

@ -17,9 +17,15 @@
return new cls(config); return new cls(config);
}; };
BI.createWidget = function (item, options) { BI.createWidget = function (item, options, context) {
var el, w; var el, w;
options || (options = {}); item || (item = {});
if (BI.isWidget(options)) {
context = options;
options = {};
} else {
options || (options = {});
}
if (BI.isEmpty(item) && BI.isEmpty(options)) { if (BI.isEmpty(item) && BI.isEmpty(options)) {
return BI.createWidget({ return BI.createWidget({
type: "bi.layout" type: "bi.layout"
@ -28,17 +34,17 @@
if (BI.isWidget(item)) { if (BI.isWidget(item)) {
return item; return item;
} }
if (item && (item.type || options.type)) { if (item.type || options.type) {
el = BI.extend({}, options, item); el = BI.extend({}, options, item);
w = BI.Plugin.getWidget(el.type, el); w = BI.Plugin.getWidget(el.type, el);
return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options)); return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options));
} }
if (item && item.el && (item.el.type || options.type)) { if (item.el && (item.el.type || options.type)) {
el = BI.extend({}, options, item.el); el = BI.extend({}, options, item.el);
w = BI.Plugin.getWidget(el.type, el); w = BI.Plugin.getWidget(el.type, el);
return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options)); return w.type === el.type ? BI.Plugin.getObject(el.type, createWidget(w)) : BI.createWidget(BI.extend({}, item, {type: w.type}, options));
} }
if (item && BI.isWidget(item.el)) { if (BI.isWidget(item.el)) {
return item.el; return item.el;
} }
throw new Error("无法根据item创建组件"); throw new Error("无法根据item创建组件");

12
src/core/widget.js

@ -23,6 +23,8 @@ BI.Widget = BI.inherit(BI.OB, {
}); });
}, },
beforeInit: null,
// 生命周期函数 // 生命周期函数
beforeCreate: null, beforeCreate: null,
@ -45,12 +47,20 @@ BI.Widget = BI.inherit(BI.OB, {
_init: function () { _init: function () {
BI.Widget.superclass._init.apply(this, arguments); BI.Widget.superclass._init.apply(this, arguments);
this.beforeCreate && this.beforeCreate();
this._initRoot(); this._initRoot();
this._initElementWidth(); this._initElementWidth();
this._initElementHeight(); this._initElementHeight();
this._initVisual(); this._initVisual();
this._initState(); this._initState();
if (this.beforeInit) {
this.beforeInit(BI.bind(this._render, this));
} else {
this._render();
}
},
_render: function(){
this.beforeCreate && this.beforeCreate();
this._initElement(); this._initElement();
this._initEffects(); this._initEffects();
this.created && this.created(); this.created && this.created();

2
src/core/wrapper/layout.js

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

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

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

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

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

8
src/core/wrapper/layout/adapt/adapt.leftrightvertical.js

@ -43,7 +43,7 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
hgap: o.lhgap, hgap: o.lhgap,
lgap: o.llgap, lgap: o.llgap,
rgap: o.lrgap rgap: o.lrgap
}); }, this);
left.element.css("height", "100%"); left.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.left", type: "bi.left",
@ -58,7 +58,7 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
hgap: o.rhgap, hgap: o.rhgap,
lgap: o.rlgap, lgap: o.rlgap,
rgap: o.rrgap rgap: o.rrgap
}); }, this);
right.element.css("height", "100%"); right.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.right", type: "bi.right",
@ -108,7 +108,7 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
lgap: o.lgap, lgap: o.lgap,
hgap: o.hgap, hgap: o.hgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
left.element.css("height", "100%"); left.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.left", type: "bi.left",
@ -156,7 +156,7 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
lgap: o.lgap, lgap: o.lgap,
hgap: o.hgap, hgap: o.hgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
right.element.css("height", "100%"); right.element.css("height", "100%");
BI.createWidget({ BI.createWidget({
type: "bi.right", type: "bi.right",

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

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

2
src/core/wrapper/layout/adapt/float.center.js

@ -56,7 +56,7 @@ BI.FloatCenterAdaptLayout = BI.inherit(BI.Layout, {
bgap: o.bgap, bgap: o.bgap,
lgap: o.lgap, lgap: o.lgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
this.container = BI.createWidget({ this.container = BI.createWidget({
type: "bi.left", type: "bi.left",

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

@ -51,7 +51,7 @@ BI.FloatHorizontalLayout = BI.inherit(BI.Layout, {
bgap: o.bgap, bgap: o.bgap,
lgap: o.lgap, lgap: o.lgap,
rgap: o.rgap rgap: o.rgap
}); }, this);
this.container = BI.createWidget({ this.container = BI.createWidget({
type: "bi.left", type: "bi.left",

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

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

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

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

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

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

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

@ -37,6 +37,9 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, {
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({top: item.top}); w.element.css({top: item.top});
} }
if (BI.isNotNull(item.bottom)) {
w.element.css({bottom: item.bottom});
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px"
@ -110,6 +113,9 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, {
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({top: item.top}); w.element.css({top: item.top});
} }
if (BI.isNotNull(item.bottom)) {
w.element.css({bottom: item.bottom});
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px"

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

@ -92,18 +92,18 @@ BI.GridLayout = BI.inherit(BI.Layout, {
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (BI.isArray(item)) { if (BI.isArray(item)) {
BI.each(item, function (j, el) { BI.each(item, function (j, el) {
els[i][j] = BI.createWidget(el); els[i][j] = BI.createWidget(el, this);
}); });
return; return;
} }
els[item.row][item.column] = BI.createWidget(item); els[item.row][item.column] = BI.createWidget(item, this);
}); });
for (var i = 0; i < rows; i++) { for (var i = 0; i < rows; i++) {
for (var j = 0; j < columns; j++) { for (var j = 0; j < columns; j++) {
if (!els[i][j]) { if (!els[i][j]) {
els[i][j] = BI.createWidget({ els[i][j] = BI.createWidget({
type: "bi.layout" type: "bi.layout"
}); }, this);
} }
first(els[i][j], i, j); first(els[i][j], i, j);
els[i][j].element.css({ els[i][j].element.css({

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

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

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

@ -114,7 +114,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
type: "bi.absolute", type: "bi.absolute",
height: BI.isArray(o.rowSize) ? o.rowSize[this.rows] : o.rowSize, height: BI.isArray(o.rowSize) ? o.rowSize[this.rows] : o.rowSize,
items: abs items: abs
}); }, this);
if (this.rows > 0) { if (this.rows > 0) {
this.getWidgetByName(this.getName() + (this.rows - 1)).element.css({ this.getWidgetByName(this.getName() + (this.rows - 1)).element.css({
"margin-bottom": o.vgap "margin-bottom": o.vgap

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

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

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

@ -80,10 +80,10 @@ BI.TdLayout = BI.inherit(BI.Layout, {
var tr = BI.createWidget({ var tr = BI.createWidget({
type: "bi.default", type: "bi.default",
tagName: "tr" tagName: "tr"
}); }, this);
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
var w = BI.createWidget(arr[i]); var w = BI.createWidget(arr[i], this);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
if (arr[i].lgap) { if (arr[i].lgap) {
w.element.css({"margin-left": arr[i].lgap + "px"}); w.element.css({"margin-left": arr[i].lgap + "px"});
@ -105,7 +105,7 @@ BI.TdLayout = BI.inherit(BI.Layout, {
}, },
tagName: "td", tagName: "td",
items: [w] items: [w]
}); }, this);
td.element.css({ td.element.css({
position: "relative", position: "relative",
"vertical-align": "middle", "vertical-align": "middle",

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

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

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

@ -40,12 +40,12 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
el: BI.createWidget({ el: BI.createWidget({
type: "bi.default", type: "bi.default",
cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")
}) }, this)
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,

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

@ -35,7 +35,7 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
BI.each(items, function (i) { BI.each(items, function (i) {
var widget = BI.createWidget({ var widget = BI.createWidget({
type: "bi.default" type: "bi.default"
}); }, this);
widget.element.addClass("center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")).css({ widget.element.addClass("center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")).css({
width: width + "%", width: width + "%",
height: "100%" height: "100%"
@ -46,7 +46,7 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,

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

@ -39,12 +39,12 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
el: BI.createWidget({ el: BI.createWidget({
type: "bi.default", type: "bi.default",
cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")
}) }, this)
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,

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

@ -39,12 +39,12 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
el: BI.createWidget({ el: BI.createWidget({
type: "bi.default", type: "bi.default",
cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")
}) }, this)
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item, this);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: o.hgap + o.lgap,

1
src/css/widget/previewtable/previewtable.cell.css

@ -1,5 +1,4 @@
.bi-preview-table-cell { .bi-preview-table-cell {
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }

2
src/css/widget/previewtable/previewtable.css

@ -1,14 +1,12 @@
.bi-preview-table-cell { .bi-preview-table-cell {
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }
.bi-preview-table-header-cell { .bi-preview-table-header-cell {
font-weight: bold; font-weight: bold;
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }
.bi-preview-table { .bi-preview-table {

1
src/css/widget/previewtable/previewtable.header.cell.css

@ -2,5 +2,4 @@
font-weight: bold; font-weight: bold;
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }

1
src/less/widget/previewtable/previewtable.cell.less

@ -3,5 +3,4 @@
.bi-preview-table-cell { .bi-preview-table-cell {
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }

1
src/less/widget/previewtable/previewtable.header.cell.less

@ -4,5 +4,4 @@
font-weight: bold; font-weight: bold;
min-height: 25px; min-height: 25px;
min-width: 80px; min-width: 80px;
max-width: 220px;
} }

4
utils/utils.js

@ -2722,7 +2722,7 @@ if (!window.BI) {
clone = {}; clone = {};
for (var i in obj) { for (var i in obj) {
if (_.has(obj, i)) { if (BI.has(obj, i)) {
clone[i] = BI.deepClone(obj[i]); clone[i] = BI.deepClone(obj[i]);
} }
} }
@ -4200,7 +4200,7 @@ _.extend(BI.OB.prototype, {
} }
return configFn(providers[type]); return configFn(providers[type]);
} }
BI.Plugin.registerWidget(type, configFn); BI.Plugin.configWidget(type, configFn);
}; };
var actions = {}; var actions = {};

Loading…
Cancel
Save