guy 7 years ago
parent
commit
59f546ba3f
  1. 4
      bi/base.js
  2. 59
      bi/core.js
  3. 4
      dist/base.js
  4. 59
      dist/core.js
  5. 4
      src/base/combination/group.virtual.js
  6. 12
      src/core/view.js
  7. 2
      src/core/widget.js
  8. 11
      src/core/wrapper/layout.js
  9. 34
      src/core/wrapper/layout/layout.card.js

4
bi/base.js

@ -3632,6 +3632,10 @@ BI.shortcut("bi.combo_group", BI.ComboGroup);BI.VirtualGroup = BI.inherit(BI.Wid
return this.layouts.getValue();
},
empty: function () {
this.layouts.empty();
},
populate: function (items) {
var self = this;
items = items || [];

59
bi/core.js

@ -4795,8 +4795,8 @@ BI.Widget = BI.inherit(BI.OB, {
isolate: function () {
if (this._parent) {
this._parent.removeWidget(this);
BI.DOM.hang([this]);
}
BI.DOM.hang([this]);
},
empty: function () {
@ -5649,18 +5649,6 @@ BI.View = BI.inherit(BI.V, {
return this.model.getEditing();
},
read: function (options) {
this.model.read(options)
},
update: function (options) {
this.model.update(options);
},
patch: function (options) {
this.model.patch(options);
},
reading: function (options) {
var self = this;
var name = BI.UUID();
@ -11526,8 +11514,8 @@ BI.Layout = BI.inherit(BI.Widget, {
update: function (item) {
var o = this.options;
var items = item.items;
var updated = false, i, len;
var items = item.items || [];
var updated, i, len;
for (i = 0, len = Math.min(o.items.length, items.length); i < len; i++) {
if (!this._compare(o.items[i], items[i])) {
updated = this.updateItemAt(i, items[i]) || updated;
@ -11538,6 +11526,7 @@ BI.Layout = BI.inherit(BI.Widget, {
for (i = items.length; i < o.items.length; i++) {
deleted.push(this._children[this._getChildName(i)]);
}
o.items.splice(items.length);
BI.each(deleted, function (i, w) {
w.destroy();
})
@ -11546,7 +11535,6 @@ BI.Layout = BI.inherit(BI.Widget, {
this.addItemAt(i, items[i]);
}
}
this.options.items = items;
return updated;
},
@ -11580,6 +11568,11 @@ BI.Layout = BI.inherit(BI.Widget, {
this.options.items = [];
},
destroy: function () {
BI.Layout.superclass.destroy.apply(this, arguments);
this.options.items = [];
},
populate: function (items) {
var self = this, o = this.options;
items = items || [];
@ -13371,7 +13364,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
if (!self.hasWidget(item.cardName)) {
var w = BI.createWidget(item);
w.on(BI.Events.DESTROY, function () {
var index = BI.findKey(o.items, function (i, tItem) {
var index = BI.findIndex(o.items, function (i, tItem) {
return tItem.cardName == item.cardName;
});
if (index > -1) {
@ -13415,17 +13408,23 @@ BI.CardLayout = BI.inherit(BI.Layout, {
return this._children[cardName];
},
deleteCardByName: function (cardName) {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
}
var index = BI.findKey(this.options.items, function (i, item) {
_deleteCardByName: function (cardName) {
delete this._children[cardName];
var index = BI.findIndex(this.options.items, function (i, item) {
return item.cardName == cardName;
});
if (index > -1) {
this.options.items.splice(index, 1);
}
},
deleteCardByName: function (cardName) {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
}
var child = this._children[cardName];
this._deleteCardByName(cardName);
child && child.destroy();
},
@ -13521,6 +13520,22 @@ BI.CardLayout = BI.inherit(BI.Layout, {
}
});
return flag;
},
removeWidget: function (nameOrWidget) {
var removeName;
if (BI.isWidget(nameOrWidget)) {
BI.each(this._children, function (name, child) {
if (child === nameOrWidget) {
removeName = name;
}
})
} else {
removeName = nameOrWidget;
}
if (removeName) {
this._deleteCardByName(removeName);
}
}
});
BI.shortcut('bi.card', BI.CardLayout);/**

4
dist/base.js vendored

@ -3632,6 +3632,10 @@ BI.shortcut("bi.combo_group", BI.ComboGroup);BI.VirtualGroup = BI.inherit(BI.Wid
return this.layouts.getValue();
},
empty: function () {
this.layouts.empty();
},
populate: function (items) {
var self = this;
items = items || [];

59
dist/core.js vendored

@ -14707,8 +14707,8 @@ BI.Widget = BI.inherit(BI.OB, {
isolate: function () {
if (this._parent) {
this._parent.removeWidget(this);
BI.DOM.hang([this]);
}
BI.DOM.hang([this]);
},
empty: function () {
@ -15561,18 +15561,6 @@ BI.View = BI.inherit(BI.V, {
return this.model.getEditing();
},
read: function (options) {
this.model.read(options)
},
update: function (options) {
this.model.update(options);
},
patch: function (options) {
this.model.patch(options);
},
reading: function (options) {
var self = this;
var name = BI.UUID();
@ -19659,8 +19647,8 @@ BI.Layout = BI.inherit(BI.Widget, {
update: function (item) {
var o = this.options;
var items = item.items;
var updated = false, i, len;
var items = item.items || [];
var updated, i, len;
for (i = 0, len = Math.min(o.items.length, items.length); i < len; i++) {
if (!this._compare(o.items[i], items[i])) {
updated = this.updateItemAt(i, items[i]) || updated;
@ -19671,6 +19659,7 @@ BI.Layout = BI.inherit(BI.Widget, {
for (i = items.length; i < o.items.length; i++) {
deleted.push(this._children[this._getChildName(i)]);
}
o.items.splice(items.length);
BI.each(deleted, function (i, w) {
w.destroy();
})
@ -19679,7 +19668,6 @@ BI.Layout = BI.inherit(BI.Widget, {
this.addItemAt(i, items[i]);
}
}
this.options.items = items;
return updated;
},
@ -19713,6 +19701,11 @@ BI.Layout = BI.inherit(BI.Widget, {
this.options.items = [];
},
destroy: function () {
BI.Layout.superclass.destroy.apply(this, arguments);
this.options.items = [];
},
populate: function (items) {
var self = this, o = this.options;
items = items || [];
@ -26785,7 +26778,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
if (!self.hasWidget(item.cardName)) {
var w = BI.createWidget(item);
w.on(BI.Events.DESTROY, function () {
var index = BI.findKey(o.items, function (i, tItem) {
var index = BI.findIndex(o.items, function (i, tItem) {
return tItem.cardName == item.cardName;
});
if (index > -1) {
@ -26829,17 +26822,23 @@ BI.CardLayout = BI.inherit(BI.Layout, {
return this._children[cardName];
},
deleteCardByName: function (cardName) {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
}
var index = BI.findKey(this.options.items, function (i, item) {
_deleteCardByName: function (cardName) {
delete this._children[cardName];
var index = BI.findIndex(this.options.items, function (i, item) {
return item.cardName == cardName;
});
if (index > -1) {
this.options.items.splice(index, 1);
}
},
deleteCardByName: function (cardName) {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
}
var child = this._children[cardName];
this._deleteCardByName(cardName);
child && child.destroy();
},
@ -26935,6 +26934,22 @@ BI.CardLayout = BI.inherit(BI.Layout, {
}
});
return flag;
},
removeWidget: function (nameOrWidget) {
var removeName;
if (BI.isWidget(nameOrWidget)) {
BI.each(this._children, function (name, child) {
if (child === nameOrWidget) {
removeName = name;
}
})
} else {
removeName = nameOrWidget;
}
if (removeName) {
this._deleteCardByName(removeName);
}
}
});
BI.shortcut('bi.card', BI.CardLayout);/**

4
src/base/combination/group.virtual.js

@ -63,6 +63,10 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
return this.layouts.getValue();
},
empty: function () {
this.layouts.empty();
},
populate: function (items) {
var self = this;
items = items || [];

12
src/core/view.js

@ -369,18 +369,6 @@ BI.View = BI.inherit(BI.V, {
return this.model.getEditing();
},
read: function (options) {
this.model.read(options)
},
update: function (options) {
this.model.update(options);
},
patch: function (options) {
this.model.patch(options);
},
reading: function (options) {
var self = this;
var name = BI.UUID();

2
src/core/widget.js

@ -372,8 +372,8 @@ BI.Widget = BI.inherit(BI.OB, {
isolate: function () {
if (this._parent) {
this._parent.removeWidget(this);
BI.DOM.hang([this]);
}
BI.DOM.hang([this]);
},
empty: function () {

11
src/core/wrapper/layout.js

@ -327,8 +327,8 @@ BI.Layout = BI.inherit(BI.Widget, {
update: function (item) {
var o = this.options;
var items = item.items;
var updated = false, i, len;
var items = item.items || [];
var updated, i, len;
for (i = 0, len = Math.min(o.items.length, items.length); i < len; i++) {
if (!this._compare(o.items[i], items[i])) {
updated = this.updateItemAt(i, items[i]) || updated;
@ -339,6 +339,7 @@ BI.Layout = BI.inherit(BI.Widget, {
for (i = items.length; i < o.items.length; i++) {
deleted.push(this._children[this._getChildName(i)]);
}
o.items.splice(items.length);
BI.each(deleted, function (i, w) {
w.destroy();
})
@ -347,7 +348,6 @@ BI.Layout = BI.inherit(BI.Widget, {
this.addItemAt(i, items[i]);
}
}
this.options.items = items;
return updated;
},
@ -381,6 +381,11 @@ BI.Layout = BI.inherit(BI.Widget, {
this.options.items = [];
},
destroy: function () {
BI.Layout.superclass.destroy.apply(this, arguments);
this.options.items = [];
},
populate: function (items) {
var self = this, o = this.options;
items = items || [];

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

@ -30,7 +30,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
if (!self.hasWidget(item.cardName)) {
var w = BI.createWidget(item);
w.on(BI.Events.DESTROY, function () {
var index = BI.findKey(o.items, function (i, tItem) {
var index = BI.findIndex(o.items, function (i, tItem) {
return tItem.cardName == item.cardName;
});
if (index > -1) {
@ -74,17 +74,23 @@ BI.CardLayout = BI.inherit(BI.Layout, {
return this._children[cardName];
},
deleteCardByName: function (cardName) {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
}
var index = BI.findKey(this.options.items, function (i, item) {
_deleteCardByName: function (cardName) {
delete this._children[cardName];
var index = BI.findIndex(this.options.items, function (i, item) {
return item.cardName == cardName;
});
if (index > -1) {
this.options.items.splice(index, 1);
}
},
deleteCardByName: function (cardName) {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
}
var child = this._children[cardName];
this._deleteCardByName(cardName);
child && child.destroy();
},
@ -180,6 +186,22 @@ BI.CardLayout = BI.inherit(BI.Layout, {
}
});
return flag;
},
removeWidget: function (nameOrWidget) {
var removeName;
if (BI.isWidget(nameOrWidget)) {
BI.each(this._children, function (name, child) {
if (child === nameOrWidget) {
removeName = name;
}
})
} else {
removeName = nameOrWidget;
}
if (removeName) {
this._deleteCardByName(removeName);
}
}
});
BI.shortcut('bi.card', BI.CardLayout);
Loading…
Cancel
Save