diff --git a/dist/fix/fix.js b/dist/fix/fix.js
index 63ebd6374..6e1d60013 100644
--- a/dist/fix/fix.js
+++ b/dist/fix/fix.js
@@ -324,7 +324,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
uniq[name] = true;
}
}
- //添加访问器属性
+ //添加访问器属性
for (name in accessors) {
if (uniq[name]) {
continue;
@@ -579,7 +579,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
// remove self from vm's watcher list
// this is a somewhat expensive operation so we skip it
// if the vm is being destroyed.
- remove(this.vm._watchers, this);
+ remove(this.vm && this.vm._watchers, this);
var i = this.deps.length;
while (i--) {
this.deps[i].removeSub(this);
@@ -1532,4 +1532,4 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
exports.toJSON = toJSON;
exports.__esModule = true;
-});
\ No newline at end of file
+});
diff --git a/dist/font/iconfont.eot b/dist/font/iconfont.eot
index 69ce839c8..9467079b9 100644
Binary files a/dist/font/iconfont.eot and b/dist/font/iconfont.eot differ
diff --git a/dist/font/iconfont.svg b/dist/font/iconfont.svg
index f41328033..1d370825c 100644
--- a/dist/font/iconfont.svg
+++ b/dist/font/iconfont.svg
@@ -14,6 +14,8 @@
/>
+
+
diff --git a/dist/font/iconfont.ttf b/dist/font/iconfont.ttf
index c9c66fca5..112a82ca3 100644
Binary files a/dist/font/iconfont.ttf and b/dist/font/iconfont.ttf differ
diff --git a/dist/font/iconfont.woff b/dist/font/iconfont.woff
index cc2826fcb..601304710 100644
Binary files a/dist/font/iconfont.woff and b/dist/font/iconfont.woff differ
diff --git a/dist/font/iconfont.woff2 b/dist/font/iconfont.woff2
index 99326dd53..1d2e11a8e 100644
Binary files a/dist/font/iconfont.woff2 and b/dist/font/iconfont.woff2 differ
diff --git a/package.json b/package.json
index 40f59c9a8..90393f04b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "fineui",
- "version": "2.0.20220305232243",
+ "version": "2.0.20220308151319",
"description": "fineui",
"main": "dist/fineui.min.js",
"types": "dist/lib/index.d.ts",
diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js
index e0ad79943..8605e70c5 100644
--- a/src/base/collection/collection.js
+++ b/src/base/collection/collection.js
@@ -11,6 +11,9 @@ BI.CollectionView = BI.inherit(BI.Widget, {
baseCls: "bi-collection",
// width: 400, //必设
// height: 300, //必设
+ scrollable: true,
+ scrollx: false,
+ scrolly: false,
overflowX: true,
overflowY: true,
cellSizeAndPositionGetter: BI.emptyFn,
@@ -49,14 +52,30 @@ BI.CollectionView = BI.inherit(BI.Widget, {
scrollTop: o.scrollTop
});
});
+ // 兼容一下
+ var scrollable = o.scrollable, scrollx = o.scrollx, scrolly = o.scrolly;
+ if (o.overflowX === false) {
+ if (o.overflowY === false) {
+ scrollable = false;
+ } else {
+ scrollable = "y"
+ }
+ } else {
+ if (o.overflowY === false) {
+ scrollable = "x";
+ }
+ }
BI._lazyCreateWidget({
type: "bi.vertical",
element: this,
- scrollable: o.overflowX === true && o.overflowY === true,
- scrolly: o.overflowX === false && o.overflowY === true,
- scrollx: o.overflowX === true && o.overflowY === false,
+ scrollable: scrollable,
+ scrolly: scrolly,
+ scrollx: scrollx,
items: [this.container]
});
+ o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
if (o.items.length > 0) {
this._calculateSizeAndPositionData();
this._populate();
diff --git a/src/base/combination/group.button.js b/src/base/combination/group.button.js
index 9f392411a..4df7b392e 100644
--- a/src/base/combination/group.button.js
+++ b/src/base/combination/group.button.js
@@ -21,7 +21,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
},
render: function () {
- var o = this.options;
+ var self = this, o = this.options;
var behaviors = {};
BI.each(o.behaviors, function (key, rule) {
behaviors[key] = BI.BehaviorFactory.createBehavior(key, {
@@ -29,7 +29,15 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
});
});
this.behaviors = behaviors;
- this.populate(o.items);
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
+ if (BI.isFunction(o.value)) {
+ this.__watch(o.value, function (context, newValue) {
+ self.setValue(newValue);
+ })
+ }
if (BI.isKey(o.value) || BI.isNotEmptyArray(o.value)) {
this.setValue(o.value);
}
diff --git a/src/base/combination/group.virtual.js b/src/base/combination/group.virtual.js
index ab9b20c07..eb2b63b85 100644
--- a/src/base/combination/group.virtual.js
+++ b/src/base/combination/group.virtual.js
@@ -12,8 +12,16 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
},
render: function () {
- var o = this.options;
- this.populate(o.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
+ if (BI.isFunction(o.value)) {
+ this.__watch(o.value, function (context, newValue) {
+ self.setValue(newValue);
+ })
+ }
if (BI.isKey(o.value)) {
this.setValue(o.value);
}
diff --git a/src/base/combination/loader.js b/src/base/combination/loader.js
index a29ba45ce..a56e72708 100644
--- a/src/base/combination/loader.js
+++ b/src/base/combination/loader.js
@@ -109,8 +109,11 @@ BI.Loader = BI.inherit(BI.Widget, {
o.isDefaultInit && BI.isEmpty(o.items) && BI.nextTick(BI.bind(function () {
o.isDefaultInit && BI.isEmpty(o.items) && this._populate();
}, this));
- if (BI.isNotEmptyArray(o.items)) {
- this._populate(o.items);
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ if (BI.isNotEmptyArray(items)) {
+ this._populate(items);
}
},
@@ -162,7 +165,6 @@ BI.Loader = BI.inherit(BI.Widget, {
this.button_group.addItems.apply(this.button_group, arguments);
},
-
_populate: function (items) {
var self = this, o = this.options;
if (arguments.length === 0 && (BI.isFunction(o.itemsCreator))) {
diff --git a/src/base/combination/navigation.js b/src/base/combination/navigation.js
index 11b2e092d..b2d5ae867 100644
--- a/src/base/combination/navigation.js
+++ b/src/base/combination/navigation.js
@@ -50,6 +50,12 @@ BI.Navigation = BI.inherit(BI.Widget, {
afterCardCreated: BI.bind(this.afterCardCreated, this),
afterCardShow: BI.bind(this.afterCardShow, this)
});
+
+ if (BI.isFunction(o.showIndex)) {
+ this.__watch(o.showIndex, function (context, newValue) {
+ self.setSelect(newValue);
+ })
+ }
},
created: function () {
diff --git a/src/base/combination/tab.js b/src/base/combination/tab.js
index 06a9a06fd..33321322d 100644
--- a/src/base/combination/tab.js
+++ b/src/base/combination/tab.js
@@ -55,6 +55,12 @@ BI.Tab = BI.inherit(BI.Widget, {
listener.on(BI.ShowListener.EVENT_CHANGE, function (value) {
self.fireEvent(BI.Tab.EVENT_CHANGE, value, self);
});
+
+ if (BI.isFunction(o.showIndex)) {
+ this.__watch(o.showIndex, function (context, newValue) {
+ self.setSelect(newValue);
+ })
+ }
},
_deleteOtherCards: function (currCardName) {
diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js
index 7052e0fbd..b264660a7 100644
--- a/src/base/grid/grid.js
+++ b/src/base/grid/grid.js
@@ -11,6 +11,9 @@ BI.GridView = BI.inherit(BI.Widget, {
baseCls: "bi-grid-view",
// width: 400, //必设
// height: 300, //必设
+ scrollable: true,
+ scrollx: false,
+ scrolly: false,
overflowX: true,
overflowY: true,
overscanColumnCount: 0,
@@ -52,14 +55,30 @@ BI.GridView = BI.inherit(BI.Widget, {
scrollTop: o.scrollTop
});
});
+ // 兼容一下
+ var scrollable = o.scrollable, scrollx = o.scrollx, scrolly = o.scrolly;
+ if (o.overflowX === false) {
+ if (o.overflowY === false) {
+ scrollable = false;
+ } else {
+ scrollable = "y"
+ }
+ } else {
+ if (o.overflowY === false) {
+ scrollable = "x";
+ }
+ }
BI._lazyCreateWidget({
type: "bi.vertical",
element: this,
- scrollable: o.overflowX === true && o.overflowY === true,
- scrolly: o.overflowX === false && o.overflowY === true,
- scrollx: o.overflowX === true && o.overflowY === false,
+ scrollable: scrollable,
+ scrolly: scrolly,
+ scrollx: scrollx,
items: [this.container]
});
+ o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
if (o.items.length > 0) {
this._calculateSizeAndPositionData();
this._populate();
diff --git a/src/base/list/listview.js b/src/base/list/listview.js
index 3d936a028..052abc139 100644
--- a/src/base/list/listview.js
+++ b/src/base/list/listview.js
@@ -44,6 +44,9 @@ BI.ListView = BI.inherit(BI.Widget, {
// mounted之后绑定事件
mounted: function () {
var self = this, o = this.options;
+ o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
this._populate();
this.element.scroll(function (e) {
o.scrollTop = self.element.scrollTop();
diff --git a/src/base/list/virtualgrouplist.js b/src/base/list/virtualgrouplist.js
index 243f06fd8..7a4a9323b 100644
--- a/src/base/list/virtualgrouplist.js
+++ b/src/base/list/virtualgrouplist.js
@@ -57,11 +57,21 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
// mounted之后绑定事件
mounted: function () {
var self = this, o = this.options;
+ o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
this._populate();
- this.element.scroll(BI.debounce(function (e) {
+ this.ticking = false;
+ this.element.scroll(function() {
o.scrollTop = self.element.scrollTop();
- self._calculateBlocksToRender();
- }, 30));
+ if (!self.ticking) {
+ requestAnimationFrame(function () {
+ self._calculateBlocksToRender();
+ self.ticking = false;
+ });
+ self.ticking = true;
+ }
+ });
BI.ResizeDetector.addResizeListener(this, function () {
self._calculateBlocksToRender();
});
diff --git a/src/base/list/virtuallist.js b/src/base/list/virtuallist.js
index af61a6193..b7f2700c7 100644
--- a/src/base/list/virtuallist.js
+++ b/src/base/list/virtuallist.js
@@ -53,6 +53,9 @@ BI.VirtualList = BI.inherit(BI.Widget, {
// mounted之后绑定事件
mounted: function () {
var self = this, o = this.options;
+ o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
this._populate();
this.element.scroll(function (e) {
o.scrollTop = self.element.scrollTop();
diff --git a/src/base/single/0.single.js b/src/base/single/0.single.js
index 070935e24..bb926e9a2 100644
--- a/src/base/single/0.single.js
+++ b/src/base/single/0.single.js
@@ -46,8 +46,11 @@ BI.Single = BI.inherit(BI.Widget, {
},
_init: function () {
- BI.Single.superclass._init.apply(this, arguments);
var self = this, o = this.options;
+ o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
+ self.setValue(newValue);
+ }) : o.value;
+ BI.Single.superclass._init.apply(this, arguments);
if (BI.isKey(o.title) || BI.isKey(o.warningTitle)
|| BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) {
this.enableHover({
diff --git a/src/base/single/1.text.js b/src/base/single/1.text.js
index 235a1a404..4a22bf531 100644
--- a/src/base/single/1.text.js
+++ b/src/base/single/1.text.js
@@ -78,8 +78,6 @@
var text = BI.isFunction(o.text) ? this.__watch(o.text, function (context, newValue) {
self.setText(newValue);
- }, {
- deep: true
}) : o.text;
// 只要不是undefined就可以显示text值,否则显示value
if (!BI.isUndefined(text)) {
diff --git a/src/base/single/text.pure.js b/src/base/single/text.pure.js
index eb7f6e323..7c4d93c0c 100644
--- a/src/base/single/text.pure.js
+++ b/src/base/single/text.pure.js
@@ -10,7 +10,9 @@
render: function () {
var self = this, o = this.options;
- var text = this._getShowText();
+ var text = BI.isFunction(o.text) ? this.__watch(o.text, function (context, newValue) {
+ self.setText(newValue);
+ }) : o.text;
if (BI.isKey(text)) {
this.setText(text);
} else if (BI.isKey(o.value)) {
diff --git a/src/case/trigger/trigger.text.js b/src/case/trigger/trigger.text.js
index 4c7c13937..eb9c7c937 100644
--- a/src/case/trigger/trigger.text.js
+++ b/src/case/trigger/trigger.text.js
@@ -11,11 +11,15 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
},
_defaultConfig: function () {
+ var self = this;
var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger",
height: 24,
- textCls: ""
+ textCls: "",
+ title: function () {
+ return self.text.getText();
+ }
});
},
@@ -28,9 +32,6 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
textAlign: "left",
height: o.height,
text: o.text,
- title: function () {
- return self.text.getText();
- },
tipType: o.tipType,
warningTitle: o.warningTitle,
hgap: c.hgap,
diff --git a/src/core/4.widget.js b/src/core/4.widget.js
index 245a2491b..2d5c3d8da 100644
--- a/src/core/4.widget.js
+++ b/src/core/4.widget.js
@@ -224,8 +224,6 @@
}
}
self.element.css(css = newValue);
- }, {
- deep: true
});
this.element.css(css);
} else {
@@ -242,8 +240,10 @@
return getter.call(self, self);
}, (handler && function (v) {
handler.call(self, self, v);
- }) || BI.emptyFn, options);
- this._watchers.push(watcher);
+ }) || BI.emptyFn, BI.extend({deep: true}, options));
+ this._watchers.push(function unwatchFn () {
+ watcher.teardown();
+ });
return watcher.value;
} else {
return getter();
@@ -312,14 +312,10 @@
if (BI.isArray(o.effect)) {
if (BI.isArray(o.effect[0])) {
BI.each(o.effect, function (i, effect) {
- self.__watch(effect[0], effect[1], {
- deep: true
- });
+ self.__watch(effect[0], effect[1]);
});
} else {
- self.__watch(o.effect[0], o.effect[1], {
- deep: true
- });
+ self.__watch(o.effect[0], o.effect[1]);
}
} else {
this.__watch(o.effect);
@@ -574,6 +570,12 @@
throw new Error("组件:组件名已存在,不能进行添加");
}
widget._setParent && widget._setParent(this);
+ // if(!this.isEnabled()){
+ // widget._setEnable(false);
+ // }
+ // if(!this.isValid()){
+ // widget._setValid(false);
+ // }
widget.on(BI.Events.DESTROY, function () {
BI.remove(self._children, this);
});
@@ -692,12 +694,17 @@
},
__d: function () {
- callLifeHook(this, "beforeDestroy");
- this.beforeDestroy = null;
BI.each(this._children, function (i, widget) {
widget && widget._unMount && widget._unMount();
});
this._children = {};
+ },
+
+ // 主要是因为_destroy已经提供了protected方法
+ __destroy: function () {
+ callLifeHook(this, "beforeDestroy");
+ this.beforeDestroy = null;
+ this.__d();
this._parent = null;
this._isMounted = false;
callLifeHook(this, "destroyed");
@@ -705,7 +712,7 @@
},
_unMount: function () {
- this.__d();
+ this.__destroy();
this.fireEvent(BI.Events.UNMOUNT);
this.purgeListeners();
},
@@ -743,7 +750,8 @@
// }
// this._isMounted = false;
// this.purgeListeners();
- this._empty();
+ this.__d();
+ this.element.empty();
this.element.unbind();
this._initCurrent();
this._init();
@@ -752,14 +760,14 @@
},
_destroy: function () {
- this.__d();
+ this.__destroy();
this.element.destroy();
this.purgeListeners();
},
destroy: function () {
var self = this, o = this.options;
- this.__d();
+ this.__destroy();
if (o.animation) {
this._innerSetVisible(false);
setTimeout(function () {
diff --git a/src/core/h.js b/src/core/h.js
index 5ec9f5112..b768b1415 100644
--- a/src/core/h.js
+++ b/src/core/h.js
@@ -39,10 +39,17 @@ BI.h = function (type, props, children) {
right: children
}, props);
}
- if (children.length === 1 && BI.isKey(children[0])) {
- return BI.extend({
- type: type
- }, { text: children[0] }, props);
+ if (children.length === 1) {
+ if (BI.isKey(children[0])) {
+ return BI.extend({
+ type: type
+ }, { text: children[0] }, props);
+ }
+ if (BI.isFunction(children[0])) {
+ return BI.extend({
+ type: type
+ }, { items: children[0] }, props);
+ }
}
return BI.extend({
diff --git a/src/core/wrapper/layout.js b/src/core/wrapper/layout.js
index c77145b73..e6ea4d58a 100644
--- a/src/core/wrapper/layout.js
+++ b/src/core/wrapper/layout.js
@@ -29,8 +29,6 @@ BI.Layout = BI.inherit(BI.Widget, {
o.columnSize = this.__watch(columnSizeFn, function (context, newValue) {
o.columnSize = newValue;
self.resize();
- }, {
- deep: true
});
}
if (BI.isFunction(o.rowSize)) {
@@ -38,8 +36,6 @@ BI.Layout = BI.inherit(BI.Widget, {
o.rowSize = this.__watch(rowSizeFn, function (context, newValue) {
o.rowSize = newValue;
self.resize();
- }, {
- deep: true
});
}
},
diff --git a/src/core/wrapper/layout/adapt/absolute.center.js b/src/core/wrapper/layout/adapt/absolute.center.js
index fd4881975..67d37c4bc 100644
--- a/src/core/wrapper/layout/adapt/absolute.center.js
+++ b/src/core/wrapper/layout/adapt/absolute.center.js
@@ -18,7 +18,11 @@ BI.AbsoluteCenterLayout = BI.inherit(BI.Layout, {
render: function () {
BI.AbsoluteCenterLayout.superclass.render.apply(this, arguments);
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_addElement: function (i, item) {
diff --git a/src/core/wrapper/layout/adapt/adapt.table.js b/src/core/wrapper/layout/adapt/adapt.table.js
index 8c0b82590..9af2aa8cc 100644
--- a/src/core/wrapper/layout/adapt/adapt.table.js
+++ b/src/core/wrapper/layout/adapt/adapt.table.js
@@ -19,8 +19,8 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
});
},
render: function () {
- var o = this.options;
BI.TableAdaptLayout.superclass.render.apply(this, arguments);
+ var self = this, o = this.options;
this.$table = BI.Widget._renderEngine.createElement("
").css({
position: "relative",
display: "table",
@@ -28,7 +28,10 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
height: (o.verticalAlign !== BI.VerticalAlign.Top) ? "100%" : "auto",
"white-space": "nowrap"
});
- this.populate(this.options.items);
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_hasFill: function () {
diff --git a/src/core/wrapper/layout/adapt/auto.horizontal.js b/src/core/wrapper/layout/adapt/auto.horizontal.js
index 197b2badc..ed0f5e29c 100644
--- a/src/core/wrapper/layout/adapt/auto.horizontal.js
+++ b/src/core/wrapper/layout/adapt/auto.horizontal.js
@@ -18,7 +18,11 @@ BI.HorizontalAutoLayout = BI.inherit(BI.Layout, {
render: function () {
BI.HorizontalAutoLayout.superclass.render.apply(this, arguments);
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_addElement: function (i, item) {
diff --git a/src/core/wrapper/layout/fill/float.fill.horizontal.js b/src/core/wrapper/layout/fill/float.fill.horizontal.js
index 988b8c061..d6607703b 100644
--- a/src/core/wrapper/layout/fill/float.fill.horizontal.js
+++ b/src/core/wrapper/layout/fill/float.fill.horizontal.js
@@ -16,7 +16,11 @@ BI.FloatHorizontalFillLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.FloatHorizontalFillLayout.superclass.render.apply(this, arguments);
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
addItem: function (item) {
diff --git a/src/core/wrapper/layout/flex/flex.horizontal.js b/src/core/wrapper/layout/flex/flex.horizontal.js
index f1390b1f0..1d921c89f 100644
--- a/src/core/wrapper/layout/flex/flex.horizontal.js
+++ b/src/core/wrapper/layout/flex/flex.horizontal.js
@@ -23,7 +23,7 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.FlexHorizontalLayout.superclass.render.apply(this, arguments);
- var o = this.options;
+ var self = this, o = this.options;
this.element.addClass("v-" + o.verticalAlign).addClass("h-" + o.horizontalAlign);
if (o.scrollable === true || o.scrollx === true) {
this.element.addClass("f-scroll-x");
@@ -31,7 +31,10 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
if (o.scrollable === true || o.scrolly === true) {
this.element.addClass("f-scroll-y");
}
- this.populate(this.options.items);
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_hasFill: function () {
diff --git a/src/core/wrapper/layout/flex/flex.vertical.js b/src/core/wrapper/layout/flex/flex.vertical.js
index f2b9aa19f..e885f5b9e 100644
--- a/src/core/wrapper/layout/flex/flex.vertical.js
+++ b/src/core/wrapper/layout/flex/flex.vertical.js
@@ -22,7 +22,7 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.FlexVerticalLayout.superclass.render.apply(this, arguments);
- var o = this.options;
+ var self = this, o = this.options;
this.element.addClass("h-" + o.horizontalAlign).addClass("v-" + o.verticalAlign);
if (o.scrollable === true || o.scrollx === true) {
this.element.addClass("f-scroll-x");
@@ -30,7 +30,10 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, {
if (o.scrollable === true || o.scrolly === true) {
this.element.addClass("f-scroll-y");
}
- this.populate(this.options.items);
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_hasFill: function () {
diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
index 2a4c9706f..94e10fb14 100644
--- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
+++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
@@ -24,10 +24,13 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.FlexWrapperHorizontalLayout.superclass.render.apply(this, arguments);
- var o = this.options;
+ var self = this, o = this.options;
this.element.addClass("v-" + o.verticalAlign).addClass("h-" + o.horizontalAlign);
this.$wrapper = BI.Widget._renderEngine.createElement("
").addClass("f-s-h-w v-" + o.verticalAlign).addClass("h-" + o.horizontalAlign);
- this.populate(this.options.items);
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_hasFill: function () {
diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js
index 621dee46d..f9d85948f 100644
--- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js
+++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js
@@ -24,10 +24,13 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.FlexWrapperVerticalLayout.superclass.render.apply(this, arguments);
- var o = this.options;
+ var self = this, o = this.options;
this.element.addClass("v-" + o.verticalAlign).addClass("h-" + o.horizontalAlign);
this.$wrapper = BI.Widget._renderEngine.createElement("
").addClass("f-s-v-w h-" + o.horizontalAlign).addClass("v-" + o.verticalAlign);
- this.populate(this.options.items);
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_hasFill: function () {
diff --git a/src/core/wrapper/layout/float/float.absolute.center.js b/src/core/wrapper/layout/float/float.absolute.center.js
index afe3e77b7..08cc5b326 100644
--- a/src/core/wrapper/layout/float/float.absolute.center.js
+++ b/src/core/wrapper/layout/float/float.absolute.center.js
@@ -12,7 +12,11 @@ BI.FloatAbsoluteCenterLayout = BI.inherit(BI.Layout, {
render: function () {
BI.FloatAbsoluteCenterLayout.superclass.render.apply(this, arguments);
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_addElement: function (i, item) {
diff --git a/src/core/wrapper/layout/layout.absolute.js b/src/core/wrapper/layout/layout.absolute.js
index 86c7e94e1..6333b38a8 100644
--- a/src/core/wrapper/layout/layout.absolute.js
+++ b/src/core/wrapper/layout/layout.absolute.js
@@ -17,7 +17,11 @@ BI.AbsoluteLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.AbsoluteLayout.superclass.render.apply(this, arguments);
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_addElement: function (i, item) {
diff --git a/src/core/wrapper/layout/layout.adaptive.js b/src/core/wrapper/layout/layout.adaptive.js
index fe1c6292e..20b758ef4 100644
--- a/src/core/wrapper/layout/layout.adaptive.js
+++ b/src/core/wrapper/layout/layout.adaptive.js
@@ -12,7 +12,11 @@ BI.AdaptiveLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.AdaptiveLayout.superclass.render.apply(this, arguments);
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_addElement: function (i, item) {
diff --git a/src/core/wrapper/layout/layout.border.js b/src/core/wrapper/layout/layout.border.js
index eda061892..15d3877af 100644
--- a/src/core/wrapper/layout/layout.border.js
+++ b/src/core/wrapper/layout/layout.border.js
@@ -13,7 +13,11 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.BorderLayout.superclass.render.apply(this, arguments);
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
addItem: function (item) {
diff --git a/src/core/wrapper/layout/layout.card.js b/src/core/wrapper/layout/layout.card.js
index dd50a7b17..97034efba 100644
--- a/src/core/wrapper/layout/layout.card.js
+++ b/src/core/wrapper/layout/layout.card.js
@@ -16,7 +16,11 @@ BI.CardLayout = BI.inherit(BI.Layout, {
render: function () {
BI.CardLayout.superclass.render.apply(this, arguments);
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
stroke: function (items) {
diff --git a/src/core/wrapper/layout/layout.default.js b/src/core/wrapper/layout/layout.default.js
index a35f99a07..90e4bf569 100644
--- a/src/core/wrapper/layout/layout.default.js
+++ b/src/core/wrapper/layout/layout.default.js
@@ -18,7 +18,11 @@ BI.DefaultLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.DefaultLayout.superclass.render.apply(this, arguments);
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_addElement: function (i, item) {
diff --git a/src/core/wrapper/layout/layout.division.js b/src/core/wrapper/layout/layout.division.js
index 54fe3dbcc..988d118be 100644
--- a/src/core/wrapper/layout/layout.division.js
+++ b/src/core/wrapper/layout/layout.division.js
@@ -15,7 +15,11 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.DivisionLayout.superclass.render.apply(this, arguments);
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
addItem: function (item) {
diff --git a/src/core/wrapper/layout/layout.flow.js b/src/core/wrapper/layout/layout.flow.js
index b3304e8c3..4efc35123 100644
--- a/src/core/wrapper/layout/layout.flow.js
+++ b/src/core/wrapper/layout/layout.flow.js
@@ -21,7 +21,7 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.FloatLeftLayout.superclass.render.apply(this, arguments);
- var o = this.options;
+ var self = this, o = this.options;
if (o.innerHgap !== 0) {
this.element.css({
paddingLeft: this._optimiseGap(o.innerHgap),
@@ -34,7 +34,10 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, {
paddingBottom: this._optimiseGap(o.innerVgap)
})
}
- this.populate(this.options.items);
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_addElement: function (i, item) {
@@ -110,8 +113,23 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.FloatRightLayout.superclass.render.apply(this, arguments);
- var o = this.options;
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ if (o.innerHgap !== 0) {
+ this.element.css({
+ paddingLeft: this._optimiseGap(o.innerHgap),
+ paddingRight: this._optimiseGap(o.innerHgap)
+ })
+ }
+ if (o.innerVgap !== 0) {
+ this.element.css({
+ paddingTop: this._optimiseGap(o.innerVgap),
+ paddingBottom: this._optimiseGap(o.innerVgap)
+ })
+ }
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_addElement: function (i, item) {
diff --git a/src/core/wrapper/layout/layout.grid.js b/src/core/wrapper/layout/layout.grid.js
index dac59e74a..a81c31681 100644
--- a/src/core/wrapper/layout/layout.grid.js
+++ b/src/core/wrapper/layout/layout.grid.js
@@ -15,7 +15,11 @@ BI.GridLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.GridLayout.superclass.render.apply(this, arguments);
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
addItem: function () {
diff --git a/src/core/wrapper/layout/layout.inline.js b/src/core/wrapper/layout/layout.inline.js
index e90aba44d..a1d889337 100644
--- a/src/core/wrapper/layout/layout.inline.js
+++ b/src/core/wrapper/layout/layout.inline.js
@@ -27,11 +27,14 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
render: function () {
BI.InlineLayout.superclass.render.apply(this, arguments);
- var o = this.options;
+ var self = this, o = this.options;
this.element.css({
textAlign: o.horizontalAlign
});
- this.populate(o.items);
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_addElement: function (i, item) {
diff --git a/src/core/wrapper/layout/layout.lattice.js b/src/core/wrapper/layout/layout.lattice.js
index 9b5731815..34845aa7b 100644
--- a/src/core/wrapper/layout/layout.lattice.js
+++ b/src/core/wrapper/layout/layout.lattice.js
@@ -16,7 +16,11 @@ BI.LatticeLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.LatticeLayout.superclass.render.apply(this, arguments);
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_addElement: function (i, item) {
diff --git a/src/core/wrapper/layout/layout.table.js b/src/core/wrapper/layout/layout.table.js
index e577f822d..50f9a39f5 100644
--- a/src/core/wrapper/layout/layout.table.js
+++ b/src/core/wrapper/layout/layout.table.js
@@ -19,7 +19,11 @@ BI.TableLayout = BI.inherit(BI.Layout, {
render: function () {
BI.TableLayout.superclass.render.apply(this, arguments);
this.rows = 0;
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_addElement: function (idx, arr) {
diff --git a/src/core/wrapper/layout/layout.tape.js b/src/core/wrapper/layout/layout.tape.js
index 3eb2acf89..27075f6e7 100644
--- a/src/core/wrapper/layout/layout.tape.js
+++ b/src/core/wrapper/layout/layout.tape.js
@@ -20,7 +20,11 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.HTapeLayout.superclass.render.apply(this, arguments);
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
addItem: function (item) {
diff --git a/src/core/wrapper/layout/layout.td.js b/src/core/wrapper/layout/layout.td.js
index 340b347bf..8c9c5df73 100644
--- a/src/core/wrapper/layout/layout.td.js
+++ b/src/core/wrapper/layout/layout.td.js
@@ -32,7 +32,10 @@ BI.TdLayout = BI.inherit(BI.Layout, {
"border-collapse": "separate"
});
this.rows = 0;
- this.populate(this.options.items);
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_addElement: function (idx, arr) {
diff --git a/src/core/wrapper/layout/layout.vertical.js b/src/core/wrapper/layout/layout.vertical.js
index 90c78e1b7..b181b1d41 100644
--- a/src/core/wrapper/layout/layout.vertical.js
+++ b/src/core/wrapper/layout/layout.vertical.js
@@ -19,7 +19,11 @@ BI.VerticalLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.VerticalLayout.superclass.render.apply(this, arguments);
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
_addElement: function (i, item) {
diff --git a/src/core/wrapper/layout/layout.window.js b/src/core/wrapper/layout/layout.window.js
index 95a87ba97..c7d14623c 100644
--- a/src/core/wrapper/layout/layout.window.js
+++ b/src/core/wrapper/layout/layout.window.js
@@ -22,7 +22,11 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.WindowLayout.superclass.render.apply(this, arguments);
- this.populate(this.options.items);
+ var self = this, o = this.options;
+ var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
+ self.populate(newValue);
+ }) : o.items;
+ this.populate(items);
},
addItem: function (item) {
diff --git a/src/widget/editor/editor.text.js b/src/widget/editor/editor.text.js
index e74c16edf..554bf2286 100644
--- a/src/widget/editor/editor.text.js
+++ b/src/widget/editor/editor.text.js
@@ -50,7 +50,9 @@ BI.TextEditor = BI.inherit(BI.Widget, {
quitChecker: o.quitChecker,
allowBlank: o.allowBlank,
watermark: o.watermark,
- errorText: o.errorText
+ errorText: o.errorText,
+ inputType: o.inputType,
+ autocomplete: o.autocomplete
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
diff --git a/typescript/shims-tsx.ts b/typescript/shims-tsx.ts
index 12204bd50..111b6a082 100644
--- a/typescript/shims-tsx.ts
+++ b/typescript/shims-tsx.ts
@@ -13,6 +13,7 @@ interface UIProps {
bgap: number;
vgap: number;
hgap: number;
+ inset: number | string;
}
// 一些布局的附加属性