guy 7 years ago
parent
commit
721d368ab2
  1. 16
      dist/base.js
  2. 109
      dist/bundle.js
  3. 88
      dist/bundle.min.js
  4. 93
      dist/core.js
  5. 140
      dist/fineui.js
  6. 88
      dist/fineui.min.js
  7. 31
      dist/fix/fix.compact.js
  8. 2
      src/base/combination/combo.js
  9. 2
      src/base/combination/expander.js
  10. 2
      src/base/combination/searcher.js
  11. 2
      src/base/combination/switcher.js
  12. 8
      src/base/layer/layer.popup.js
  13. 4
      src/core/controller/controller.layer.js
  14. 7
      src/core/shortcut.js
  15. 2
      src/core/wrapper/layout.js
  16. 4
      src/core/wrapper/layout/adapt/adapt.center.js
  17. 4
      src/core/wrapper/layout/adapt/adapt.horizontal.js
  18. 8
      src/core/wrapper/layout/adapt/adapt.leftrightvertical.js
  19. 4
      src/core/wrapper/layout/adapt/adapt.vertical.js
  20. 2
      src/core/wrapper/layout/adapt/float.center.js
  21. 2
      src/core/wrapper/layout/adapt/float.horizontal.js
  22. 10
      src/core/wrapper/layout/layout.border.js
  23. 4
      src/core/wrapper/layout/layout.card.js
  24. 2
      src/core/wrapper/layout/layout.division.js
  25. 6
      src/core/wrapper/layout/layout.grid.js
  26. 4
      src/core/wrapper/layout/layout.horizontal.js
  27. 2
      src/core/wrapper/layout/layout.table.js
  28. 4
      src/core/wrapper/layout/layout.tape.js
  29. 6
      src/core/wrapper/layout/layout.td.js
  30. 2
      src/core/wrapper/layout/layout.window.js
  31. 4
      src/core/wrapper/layout/middle/middle.center.js
  32. 4
      src/core/wrapper/layout/middle/middle.float.center.js
  33. 4
      src/core/wrapper/layout/middle/middle.horizontal.js
  34. 4
      src/core/wrapper/layout/middle/middle.vertical.js

16
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);
} }
}, },
@ -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 () {

109
dist/bundle.js vendored

@ -12937,10 +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;
item || (item = {}); item || (item = {});
if (BI.isWidget(options)) {
context = options;
options = {};
} else {
options || (options = {}); 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"
@ -16628,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) {
@ -18596,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);
} }
@ -18615,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: [{
@ -22460,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",
@ -22469,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));
@ -22578,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",
@ -22587,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));
@ -22701,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",
@ -22716,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",
@ -22766,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",
@ -22814,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",
@ -22867,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",
@ -22876,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));
@ -23066,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",
@ -23134,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",
@ -23773,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)
@ -23793,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)
@ -23813,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)
@ -23833,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)
@ -23852,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
@ -23896,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;
@ -23966,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",
@ -24247,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);
@ -24532,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({
@ -24602,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",
@ -24611,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));
@ -24914,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
@ -24992,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 + "");
@ -25097,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 + "");
@ -25232,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"});
@ -25257,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",
@ -25461,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);
} }
@ -25593,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,
@ -25662,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%"
@ -25673,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,
@ -25739,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,
@ -25811,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,
@ -29058,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());
@ -29459,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) {
@ -30299,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);
} }
}, },
@ -30627,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) {
@ -41330,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;
}, },
@ -41340,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 () {
@ -41354,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 () {
@ -41372,7 +41377,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
shadow: true, shadow: true,
isShadowShowingOnSelected: true isShadowShowingOnSelected: true
}) })
}); }, this);
}, },
getView: function () { getView: function () {

88
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

93
dist/core.js vendored

@ -12937,10 +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;
item || (item = {}); item || (item = {});
if (BI.isWidget(options)) {
context = options;
options = {};
} else {
options || (options = {}); 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"
@ -16628,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) {
@ -18596,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);
} }
@ -18615,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: [{
@ -22460,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",
@ -22469,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));
@ -22578,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",
@ -22587,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));
@ -22701,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",
@ -22716,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",
@ -22766,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",
@ -22814,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",
@ -22867,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",
@ -22876,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));
@ -23066,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",
@ -23134,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",
@ -23773,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)
@ -23793,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)
@ -23813,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)
@ -23833,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)
@ -23852,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
@ -23896,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;
@ -23966,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",
@ -24247,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);
@ -24532,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({
@ -24602,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",
@ -24611,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));
@ -24914,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
@ -24992,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 + "");
@ -25097,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 + "");
@ -25232,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"});
@ -25257,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",
@ -25461,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);
} }
@ -25593,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,
@ -25662,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%"
@ -25673,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,
@ -25739,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,
@ -25811,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,

140
dist/fineui.js vendored

@ -13110,10 +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;
item || (item = {}); item || (item = {});
if (BI.isWidget(options)) {
context = options;
options = {};
} else {
options || (options = {}); 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"
@ -16801,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) {
@ -18769,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);
} }
@ -18788,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: [{
@ -22633,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",
@ -22642,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));
@ -22751,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",
@ -22760,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));
@ -22874,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",
@ -22889,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",
@ -22939,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",
@ -22987,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",
@ -23040,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",
@ -23049,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));
@ -23239,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",
@ -23307,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",
@ -23946,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)
@ -23966,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)
@ -23986,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)
@ -24006,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)
@ -24025,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
@ -24069,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;
@ -24139,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",
@ -24420,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);
@ -24705,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({
@ -24775,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",
@ -24784,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));
@ -25087,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
@ -25165,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 + "");
@ -25270,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 + "");
@ -25405,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"});
@ -25430,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",
@ -25634,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);
} }
@ -25766,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,
@ -25835,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%"
@ -25846,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,
@ -25912,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,
@ -25984,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,
@ -27462,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;
} }
@ -27470,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)) {
@ -27501,12 +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 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;
@ -30760,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());
@ -31161,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) {
@ -32001,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);
} }
}, },
@ -32329,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) {
@ -43032,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;
}, },
@ -43042,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 () {
@ -43056,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 () {
@ -43074,7 +43106,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
shadow: true, shadow: true,
isShadowShowingOnSelected: true isShadowShowingOnSelected: true
}) })
}); }, this);
}, },
getView: function () { getView: function () {

88
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

31
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,12 +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 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;

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) {

2
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);
} }
}, },

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 () {

4
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: [{

7
src/core/shortcut.js

@ -17,10 +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;
item || (item = {}); item || (item = {});
if (BI.isWidget(options)) {
context = options;
options = {};
} else {
options || (options = {}); 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"

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.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,

Loading…
Cancel
Save