Browse Source

Merge branch 'master' of ssh://cloud.finedevelop.com:7999/~dailer/fineui

# Conflicts:
#	dist/2.0/fineui.ie.min.js
#	dist/2.0/fineui.min.css
#	dist/2.0/fineui.min.js
#	dist/bundle.ie.min.js
#	dist/bundle.min.css
#	dist/bundle.min.js
#	dist/fineui.ie.min.js
#	dist/fineui.min.css
#	dist/fineui.min.js
#	dist/utils.min.js
es6
dailer 5 years ago
parent
commit
8d15f892e5
  1. 80
      dist/2.0/fineui.ie.js
  2. 48
      dist/2.0/fineui.ie.min.js
  3. 80
      dist/2.0/fineui.js
  4. 18
      dist/2.0/fineui.min.js
  5. 2
      dist/base.js
  6. 80
      dist/bundle.ie.js
  7. 48
      dist/bundle.ie.min.js
  8. 80
      dist/bundle.js
  9. 18
      dist/bundle.min.js
  10. 11
      dist/case.js
  11. 67
      dist/core.js
  12. 80
      dist/fineui.ie.js
  13. 79
      dist/fineui.ie.min.js
  14. 80
      dist/fineui.js
  15. 79
      dist/fineui.min.js
  16. 57
      dist/fineui_without_jquery_polyfill.js
  17. 22
      dist/utils.js
  18. 8
      dist/utils.min.js
  19. 2
      src/base/layer/layer.popover.js
  20. 1
      src/case/colorchooser/colorchooser.js
  21. 2
      src/case/editor/editor.sign.js
  22. 2
      src/case/editor/editor.state.js
  23. 2
      src/case/editor/editor.state.simple.js
  24. 4
      src/case/list/list.select.js
  25. 22
      src/core/ob.js
  26. 13
      src/core/shortcut.js
  27. 10
      src/core/widget.js

80
dist/2.0/fineui.ie.js vendored

@ -11480,23 +11480,31 @@ if (!_global.BI) {
* @abstract * @abstract
*/ */
BI.OB = function (config) { BI.OB = function (config) {
var props = this.props; this._constructor(config);
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
this._init();
this._initRef();
}; };
_.extend(BI.OB.prototype, { _.extend(BI.OB.prototype, {
props: {}, props: {},
init: null, init: null,
destroyed: null, destroyed: null,
_constructor: function (config) {
this._initProps(config);
this._init();
this._initRef();
},
_defaultConfig: function (config) { _defaultConfig: function (config) {
return {}; return {};
}, },
_initProps: function (config) {
var props = this.props;
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
},
_init: function () { _init: function () {
this._initListeners(); this._initListeners();
this.init && this.init(); this.init && this.init();
@ -11653,6 +11661,9 @@ if (!_global.BI) {
}); });
}, },
// 覆盖父类的_constructor方法,widget不走ob的生命周期
_constructor: function () {},
beforeInit: null, beforeInit: null,
// 生命周期函数 // 生命周期函数
@ -11813,16 +11824,17 @@ if (!_global.BI) {
* @private * @private
*/ */
_mount: function (force, deep, lifeHook, predicate) { _mount: function (force, deep, lifeHook, predicate) {
var self = this;
if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) { if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
return false; return false;
} }
lifeHook !== false && this.beforeMount && this.beforeMount(); lifeHook !== false && this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); this._mountChildren && this._mountChildren();
if(BI.isNotNull(this._parent)) {
!this._parent.isEnabled() && this._setEnable(false);
!this._parent.isValid() && this._setValid(false);
}
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false);
widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate); widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate);
}); });
lifeHook !== false && this.mounted && this.mounted(); lifeHook !== false && this.mounted && this.mounted();
@ -12170,12 +12182,15 @@ if (!_global.BI) {
// 根据配置属性生成widget // 根据配置属性生成widget
var createWidget = function (config) { var createWidget = function (config) {
if (config["classType"]) {
return new (new Function("return " + config["classType"] + ";")())(config);
}
var cls = kv[config.type]; var cls = kv[config.type];
return new cls(config);
var widget = new cls();
widget._initProps(config);
widget._init();
widget._initRef();
return widget;
}; };
BI.createWidget = function (item, options, context) { BI.createWidget = function (item, options, context) {
@ -21576,20 +21591,14 @@ BI.prepares.push(function () {
if (_global.document && !attachEvent) { if (_global.document && !attachEvent) {
var requestFrame = (function () { var requestFrame = (function () {
var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame || var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame ||
function (fn) { function (fn) { return _global.setTimeout(fn, 20); };
return _global.setTimeout(fn, 20); return function (fn) { return raf(fn); };
};
return function (fn) {
return raf(fn);
};
})(); })();
var cancelFrame = (function () { var cancelFrame = (function () {
var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame || var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame ||
_global.clearTimeout; _global.clearTimeout;
return function (id) { return function (id) { return cancel(id); };
return cancel(id);
};
})(); })();
var resetTriggers = function (element) { var resetTriggers = function (element) {
@ -21662,8 +21671,8 @@ BI.prepares.push(function () {
if (!stylesCreated) { if (!stylesCreated) {
// opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360 // opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
var css = (animationKeyframes ? animationKeyframes : "") + var css = (animationKeyframes ? animationKeyframes : "") +
".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " + ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " +
".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }", ".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }",
head = document.head || document.getElementsByTagName("head")[0], head = document.head || document.getElementsByTagName("head")[0],
style = document.createElement("style"); style = document.createElement("style");
@ -21694,15 +21703,11 @@ BI.prepares.push(function () {
"<div class=\"contract-trigger\"></div>"; "<div class=\"contract-trigger\"></div>";
element.appendChild(element.__resizeTriggers__); element.appendChild(element.__resizeTriggers__);
resetTriggers(element); resetTriggers(element);
element.addEventListener("scroll", scrollListener, true); element.addEventListener("scroll", scrollListener, true);
/* Listen for a css animation to detect element display/re-attach */ /* Listen for a css animation to detect element display/re-attach */
animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) { animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) {
if (e.animationName === animationName) { if (e.animationName === animationName) {resetTriggers(element);}
resetTriggers(element);
}
}); });
} }
element.__resizeListeners__.push(fn); element.__resizeListeners__.push(fn);
@ -44187,7 +44192,7 @@ BI.shortcut("bi.popover", BI.Popover);
BI.BarPopover = BI.inherit(BI.Popover, { BI.BarPopover = BI.inherit(BI.Popover, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), {
btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] btns: [BI.i18nText("BI-Basic_Sure"), BI.i18nText("BI-Basic_Cancel")]
}); });
}, },
@ -54240,7 +54245,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
} }
}] }]
}, o.popup), }, o.popup),
stopPropagation: true,
width: 230 width: 230
}, },
value: o.value value: o.value
@ -57990,7 +57994,7 @@ BI.SignEditor = BI.inherit(BI.Widget, {
tipType: o.tipType, tipType: o.tipType,
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -58258,7 +58262,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -58552,7 +58556,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -59297,7 +59301,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
callback.apply(self, arguments); callback.apply(self, arguments);
if (op.times === 1) { if (op.times === 1) {
self.toolbar.setVisible(items && items.length > 0); self.toolbar.setVisible(items && items.length > 0);
self.toolbar.setEnable(items && items.length > 0); self.toolbar.setEnable(self.isEnabled() && items && items.length > 0);
} }
self._checkAllSelected(); self._checkAllSelected();
}); });
@ -59405,7 +59409,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
populate: function (items) { populate: function (items) {
this.toolbar.setVisible(!BI.isEmptyArray(items)); this.toolbar.setVisible(!BI.isEmptyArray(items));
this.toolbar.setEnable(!BI.isEmptyArray(items)); this.toolbar.setEnable(this.isEnabled() && !BI.isEmptyArray(items));
this.list.populate.apply(this.list, arguments); this.list.populate.apply(this.list, arguments);
this._checkAllSelected(); this._checkAllSelected();
}, },

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

File diff suppressed because one or more lines are too long

80
dist/2.0/fineui.js vendored

@ -11480,23 +11480,31 @@ if (!_global.BI) {
* @abstract * @abstract
*/ */
BI.OB = function (config) { BI.OB = function (config) {
var props = this.props; this._constructor(config);
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
this._init();
this._initRef();
}; };
_.extend(BI.OB.prototype, { _.extend(BI.OB.prototype, {
props: {}, props: {},
init: null, init: null,
destroyed: null, destroyed: null,
_constructor: function (config) {
this._initProps(config);
this._init();
this._initRef();
},
_defaultConfig: function (config) { _defaultConfig: function (config) {
return {}; return {};
}, },
_initProps: function (config) {
var props = this.props;
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
},
_init: function () { _init: function () {
this._initListeners(); this._initListeners();
this.init && this.init(); this.init && this.init();
@ -11653,6 +11661,9 @@ if (!_global.BI) {
}); });
}, },
// 覆盖父类的_constructor方法,widget不走ob的生命周期
_constructor: function () {},
beforeInit: null, beforeInit: null,
// 生命周期函数 // 生命周期函数
@ -11813,16 +11824,17 @@ if (!_global.BI) {
* @private * @private
*/ */
_mount: function (force, deep, lifeHook, predicate) { _mount: function (force, deep, lifeHook, predicate) {
var self = this;
if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) { if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
return false; return false;
} }
lifeHook !== false && this.beforeMount && this.beforeMount(); lifeHook !== false && this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); this._mountChildren && this._mountChildren();
if(BI.isNotNull(this._parent)) {
!this._parent.isEnabled() && this._setEnable(false);
!this._parent.isValid() && this._setValid(false);
}
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false);
widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate); widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate);
}); });
lifeHook !== false && this.mounted && this.mounted(); lifeHook !== false && this.mounted && this.mounted();
@ -12170,12 +12182,15 @@ if (!_global.BI) {
// 根据配置属性生成widget // 根据配置属性生成widget
var createWidget = function (config) { var createWidget = function (config) {
if (config["classType"]) {
return new (new Function("return " + config["classType"] + ";")())(config);
}
var cls = kv[config.type]; var cls = kv[config.type];
return new cls(config);
var widget = new cls();
widget._initProps(config);
widget._init();
widget._initRef();
return widget;
}; };
BI.createWidget = function (item, options, context) { BI.createWidget = function (item, options, context) {
@ -21576,20 +21591,14 @@ BI.prepares.push(function () {
if (_global.document && !attachEvent) { if (_global.document && !attachEvent) {
var requestFrame = (function () { var requestFrame = (function () {
var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame || var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame ||
function (fn) { function (fn) { return _global.setTimeout(fn, 20); };
return _global.setTimeout(fn, 20); return function (fn) { return raf(fn); };
};
return function (fn) {
return raf(fn);
};
})(); })();
var cancelFrame = (function () { var cancelFrame = (function () {
var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame || var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame ||
_global.clearTimeout; _global.clearTimeout;
return function (id) { return function (id) { return cancel(id); };
return cancel(id);
};
})(); })();
var resetTriggers = function (element) { var resetTriggers = function (element) {
@ -21662,8 +21671,8 @@ BI.prepares.push(function () {
if (!stylesCreated) { if (!stylesCreated) {
// opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360 // opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
var css = (animationKeyframes ? animationKeyframes : "") + var css = (animationKeyframes ? animationKeyframes : "") +
".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " + ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " +
".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }", ".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }",
head = document.head || document.getElementsByTagName("head")[0], head = document.head || document.getElementsByTagName("head")[0],
style = document.createElement("style"); style = document.createElement("style");
@ -21694,15 +21703,11 @@ BI.prepares.push(function () {
"<div class=\"contract-trigger\"></div>"; "<div class=\"contract-trigger\"></div>";
element.appendChild(element.__resizeTriggers__); element.appendChild(element.__resizeTriggers__);
resetTriggers(element); resetTriggers(element);
element.addEventListener("scroll", scrollListener, true); element.addEventListener("scroll", scrollListener, true);
/* Listen for a css animation to detect element display/re-attach */ /* Listen for a css animation to detect element display/re-attach */
animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) { animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) {
if (e.animationName === animationName) { if (e.animationName === animationName) {resetTriggers(element);}
resetTriggers(element);
}
}); });
} }
element.__resizeListeners__.push(fn); element.__resizeListeners__.push(fn);
@ -44591,7 +44596,7 @@ BI.shortcut("bi.popover", BI.Popover);
BI.BarPopover = BI.inherit(BI.Popover, { BI.BarPopover = BI.inherit(BI.Popover, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), {
btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] btns: [BI.i18nText("BI-Basic_Sure"), BI.i18nText("BI-Basic_Cancel")]
}); });
}, },
@ -54644,7 +54649,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
} }
}] }]
}, o.popup), }, o.popup),
stopPropagation: true,
width: 230 width: 230
}, },
value: o.value value: o.value
@ -58394,7 +58398,7 @@ BI.SignEditor = BI.inherit(BI.Widget, {
tipType: o.tipType, tipType: o.tipType,
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -58662,7 +58666,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -58956,7 +58960,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -59701,7 +59705,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
callback.apply(self, arguments); callback.apply(self, arguments);
if (op.times === 1) { if (op.times === 1) {
self.toolbar.setVisible(items && items.length > 0); self.toolbar.setVisible(items && items.length > 0);
self.toolbar.setEnable(items && items.length > 0); self.toolbar.setEnable(self.isEnabled() && items && items.length > 0);
} }
self._checkAllSelected(); self._checkAllSelected();
}); });
@ -59809,7 +59813,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
populate: function (items) { populate: function (items) {
this.toolbar.setVisible(!BI.isEmptyArray(items)); this.toolbar.setVisible(!BI.isEmptyArray(items));
this.toolbar.setEnable(!BI.isEmptyArray(items)); this.toolbar.setEnable(this.isEnabled() && !BI.isEmptyArray(items));
this.list.populate.apply(this.list, arguments); this.list.populate.apply(this.list, arguments);
this._checkAllSelected(); this._checkAllSelected();
}, },

18
dist/2.0/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/base.js vendored

@ -6337,7 +6337,7 @@ BI.shortcut("bi.popover", BI.Popover);
BI.BarPopover = BI.inherit(BI.Popover, { BI.BarPopover = BI.inherit(BI.Popover, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), {
btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] btns: [BI.i18nText("BI-Basic_Sure"), BI.i18nText("BI-Basic_Cancel")]
}); });
}, },

80
dist/bundle.ie.js vendored

@ -11480,23 +11480,31 @@ if (!_global.BI) {
* @abstract * @abstract
*/ */
BI.OB = function (config) { BI.OB = function (config) {
var props = this.props; this._constructor(config);
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
this._init();
this._initRef();
}; };
_.extend(BI.OB.prototype, { _.extend(BI.OB.prototype, {
props: {}, props: {},
init: null, init: null,
destroyed: null, destroyed: null,
_constructor: function (config) {
this._initProps(config);
this._init();
this._initRef();
},
_defaultConfig: function (config) { _defaultConfig: function (config) {
return {}; return {};
}, },
_initProps: function (config) {
var props = this.props;
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
},
_init: function () { _init: function () {
this._initListeners(); this._initListeners();
this.init && this.init(); this.init && this.init();
@ -11653,6 +11661,9 @@ if (!_global.BI) {
}); });
}, },
// 覆盖父类的_constructor方法,widget不走ob的生命周期
_constructor: function () {},
beforeInit: null, beforeInit: null,
// 生命周期函数 // 生命周期函数
@ -11813,16 +11824,17 @@ if (!_global.BI) {
* @private * @private
*/ */
_mount: function (force, deep, lifeHook, predicate) { _mount: function (force, deep, lifeHook, predicate) {
var self = this;
if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) { if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
return false; return false;
} }
lifeHook !== false && this.beforeMount && this.beforeMount(); lifeHook !== false && this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); this._mountChildren && this._mountChildren();
if(BI.isNotNull(this._parent)) {
!this._parent.isEnabled() && this._setEnable(false);
!this._parent.isValid() && this._setValid(false);
}
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false);
widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate); widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate);
}); });
lifeHook !== false && this.mounted && this.mounted(); lifeHook !== false && this.mounted && this.mounted();
@ -12170,12 +12182,15 @@ if (!_global.BI) {
// 根据配置属性生成widget // 根据配置属性生成widget
var createWidget = function (config) { var createWidget = function (config) {
if (config["classType"]) {
return new (new Function("return " + config["classType"] + ";")())(config);
}
var cls = kv[config.type]; var cls = kv[config.type];
return new cls(config);
var widget = new cls();
widget._initProps(config);
widget._init();
widget._initRef();
return widget;
}; };
BI.createWidget = function (item, options, context) { BI.createWidget = function (item, options, context) {
@ -21576,20 +21591,14 @@ BI.prepares.push(function () {
if (_global.document && !attachEvent) { if (_global.document && !attachEvent) {
var requestFrame = (function () { var requestFrame = (function () {
var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame || var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame ||
function (fn) { function (fn) { return _global.setTimeout(fn, 20); };
return _global.setTimeout(fn, 20); return function (fn) { return raf(fn); };
};
return function (fn) {
return raf(fn);
};
})(); })();
var cancelFrame = (function () { var cancelFrame = (function () {
var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame || var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame ||
_global.clearTimeout; _global.clearTimeout;
return function (id) { return function (id) { return cancel(id); };
return cancel(id);
};
})(); })();
var resetTriggers = function (element) { var resetTriggers = function (element) {
@ -21662,8 +21671,8 @@ BI.prepares.push(function () {
if (!stylesCreated) { if (!stylesCreated) {
// opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360 // opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
var css = (animationKeyframes ? animationKeyframes : "") + var css = (animationKeyframes ? animationKeyframes : "") +
".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " + ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " +
".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }", ".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }",
head = document.head || document.getElementsByTagName("head")[0], head = document.head || document.getElementsByTagName("head")[0],
style = document.createElement("style"); style = document.createElement("style");
@ -21694,15 +21703,11 @@ BI.prepares.push(function () {
"<div class=\"contract-trigger\"></div>"; "<div class=\"contract-trigger\"></div>";
element.appendChild(element.__resizeTriggers__); element.appendChild(element.__resizeTriggers__);
resetTriggers(element); resetTriggers(element);
element.addEventListener("scroll", scrollListener, true); element.addEventListener("scroll", scrollListener, true);
/* Listen for a css animation to detect element display/re-attach */ /* Listen for a css animation to detect element display/re-attach */
animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) { animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) {
if (e.animationName === animationName) { if (e.animationName === animationName) {resetTriggers(element);}
resetTriggers(element);
}
}); });
} }
element.__resizeListeners__.push(fn); element.__resizeListeners__.push(fn);
@ -44187,7 +44192,7 @@ BI.shortcut("bi.popover", BI.Popover);
BI.BarPopover = BI.inherit(BI.Popover, { BI.BarPopover = BI.inherit(BI.Popover, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), {
btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] btns: [BI.i18nText("BI-Basic_Sure"), BI.i18nText("BI-Basic_Cancel")]
}); });
}, },
@ -54240,7 +54245,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
} }
}] }]
}, o.popup), }, o.popup),
stopPropagation: true,
width: 230 width: 230
}, },
value: o.value value: o.value
@ -57990,7 +57994,7 @@ BI.SignEditor = BI.inherit(BI.Widget, {
tipType: o.tipType, tipType: o.tipType,
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -58258,7 +58262,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -58552,7 +58556,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -59297,7 +59301,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
callback.apply(self, arguments); callback.apply(self, arguments);
if (op.times === 1) { if (op.times === 1) {
self.toolbar.setVisible(items && items.length > 0); self.toolbar.setVisible(items && items.length > 0);
self.toolbar.setEnable(items && items.length > 0); self.toolbar.setEnable(self.isEnabled() && items && items.length > 0);
} }
self._checkAllSelected(); self._checkAllSelected();
}); });
@ -59405,7 +59409,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
populate: function (items) { populate: function (items) {
this.toolbar.setVisible(!BI.isEmptyArray(items)); this.toolbar.setVisible(!BI.isEmptyArray(items));
this.toolbar.setEnable(!BI.isEmptyArray(items)); this.toolbar.setEnable(this.isEnabled() && !BI.isEmptyArray(items));
this.list.populate.apply(this.list, arguments); this.list.populate.apply(this.list, arguments);
this._checkAllSelected(); this._checkAllSelected();
}, },

48
dist/bundle.ie.min.js vendored

File diff suppressed because one or more lines are too long

80
dist/bundle.js vendored

@ -11480,23 +11480,31 @@ if (!_global.BI) {
* @abstract * @abstract
*/ */
BI.OB = function (config) { BI.OB = function (config) {
var props = this.props; this._constructor(config);
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
this._init();
this._initRef();
}; };
_.extend(BI.OB.prototype, { _.extend(BI.OB.prototype, {
props: {}, props: {},
init: null, init: null,
destroyed: null, destroyed: null,
_constructor: function (config) {
this._initProps(config);
this._init();
this._initRef();
},
_defaultConfig: function (config) { _defaultConfig: function (config) {
return {}; return {};
}, },
_initProps: function (config) {
var props = this.props;
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
},
_init: function () { _init: function () {
this._initListeners(); this._initListeners();
this.init && this.init(); this.init && this.init();
@ -11653,6 +11661,9 @@ if (!_global.BI) {
}); });
}, },
// 覆盖父类的_constructor方法,widget不走ob的生命周期
_constructor: function () {},
beforeInit: null, beforeInit: null,
// 生命周期函数 // 生命周期函数
@ -11813,16 +11824,17 @@ if (!_global.BI) {
* @private * @private
*/ */
_mount: function (force, deep, lifeHook, predicate) { _mount: function (force, deep, lifeHook, predicate) {
var self = this;
if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) { if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
return false; return false;
} }
lifeHook !== false && this.beforeMount && this.beforeMount(); lifeHook !== false && this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); this._mountChildren && this._mountChildren();
if(BI.isNotNull(this._parent)) {
!this._parent.isEnabled() && this._setEnable(false);
!this._parent.isValid() && this._setValid(false);
}
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false);
widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate); widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate);
}); });
lifeHook !== false && this.mounted && this.mounted(); lifeHook !== false && this.mounted && this.mounted();
@ -12170,12 +12182,15 @@ if (!_global.BI) {
// 根据配置属性生成widget // 根据配置属性生成widget
var createWidget = function (config) { var createWidget = function (config) {
if (config["classType"]) {
return new (new Function("return " + config["classType"] + ";")())(config);
}
var cls = kv[config.type]; var cls = kv[config.type];
return new cls(config);
var widget = new cls();
widget._initProps(config);
widget._init();
widget._initRef();
return widget;
}; };
BI.createWidget = function (item, options, context) { BI.createWidget = function (item, options, context) {
@ -21576,20 +21591,14 @@ BI.prepares.push(function () {
if (_global.document && !attachEvent) { if (_global.document && !attachEvent) {
var requestFrame = (function () { var requestFrame = (function () {
var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame || var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame ||
function (fn) { function (fn) { return _global.setTimeout(fn, 20); };
return _global.setTimeout(fn, 20); return function (fn) { return raf(fn); };
};
return function (fn) {
return raf(fn);
};
})(); })();
var cancelFrame = (function () { var cancelFrame = (function () {
var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame || var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame ||
_global.clearTimeout; _global.clearTimeout;
return function (id) { return function (id) { return cancel(id); };
return cancel(id);
};
})(); })();
var resetTriggers = function (element) { var resetTriggers = function (element) {
@ -21662,8 +21671,8 @@ BI.prepares.push(function () {
if (!stylesCreated) { if (!stylesCreated) {
// opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360 // opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
var css = (animationKeyframes ? animationKeyframes : "") + var css = (animationKeyframes ? animationKeyframes : "") +
".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " + ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " +
".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }", ".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }",
head = document.head || document.getElementsByTagName("head")[0], head = document.head || document.getElementsByTagName("head")[0],
style = document.createElement("style"); style = document.createElement("style");
@ -21694,15 +21703,11 @@ BI.prepares.push(function () {
"<div class=\"contract-trigger\"></div>"; "<div class=\"contract-trigger\"></div>";
element.appendChild(element.__resizeTriggers__); element.appendChild(element.__resizeTriggers__);
resetTriggers(element); resetTriggers(element);
element.addEventListener("scroll", scrollListener, true); element.addEventListener("scroll", scrollListener, true);
/* Listen for a css animation to detect element display/re-attach */ /* Listen for a css animation to detect element display/re-attach */
animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) { animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) {
if (e.animationName === animationName) { if (e.animationName === animationName) {resetTriggers(element);}
resetTriggers(element);
}
}); });
} }
element.__resizeListeners__.push(fn); element.__resizeListeners__.push(fn);
@ -44591,7 +44596,7 @@ BI.shortcut("bi.popover", BI.Popover);
BI.BarPopover = BI.inherit(BI.Popover, { BI.BarPopover = BI.inherit(BI.Popover, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), {
btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] btns: [BI.i18nText("BI-Basic_Sure"), BI.i18nText("BI-Basic_Cancel")]
}); });
}, },
@ -54644,7 +54649,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
} }
}] }]
}, o.popup), }, o.popup),
stopPropagation: true,
width: 230 width: 230
}, },
value: o.value value: o.value
@ -58394,7 +58398,7 @@ BI.SignEditor = BI.inherit(BI.Widget, {
tipType: o.tipType, tipType: o.tipType,
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -58662,7 +58666,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -58956,7 +58960,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -59701,7 +59705,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
callback.apply(self, arguments); callback.apply(self, arguments);
if (op.times === 1) { if (op.times === 1) {
self.toolbar.setVisible(items && items.length > 0); self.toolbar.setVisible(items && items.length > 0);
self.toolbar.setEnable(items && items.length > 0); self.toolbar.setEnable(self.isEnabled() && items && items.length > 0);
} }
self._checkAllSelected(); self._checkAllSelected();
}); });
@ -59809,7 +59813,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
populate: function (items) { populate: function (items) {
this.toolbar.setVisible(!BI.isEmptyArray(items)); this.toolbar.setVisible(!BI.isEmptyArray(items));
this.toolbar.setEnable(!BI.isEmptyArray(items)); this.toolbar.setEnable(this.isEnabled() && !BI.isEmptyArray(items));
this.list.populate.apply(this.list, arguments); this.list.populate.apply(this.list, arguments);
this._checkAllSelected(); this._checkAllSelected();
}, },

18
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

11
dist/case.js vendored

@ -2261,7 +2261,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
} }
}] }]
}, o.popup), }, o.popup),
stopPropagation: true,
width: 230 width: 230
}, },
value: o.value value: o.value
@ -6011,7 +6010,7 @@ BI.SignEditor = BI.inherit(BI.Widget, {
tipType: o.tipType, tipType: o.tipType,
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -6279,7 +6278,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -6573,7 +6572,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -7318,7 +7317,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
callback.apply(self, arguments); callback.apply(self, arguments);
if (op.times === 1) { if (op.times === 1) {
self.toolbar.setVisible(items && items.length > 0); self.toolbar.setVisible(items && items.length > 0);
self.toolbar.setEnable(items && items.length > 0); self.toolbar.setEnable(self.isEnabled() && items && items.length > 0);
} }
self._checkAllSelected(); self._checkAllSelected();
}); });
@ -7426,7 +7425,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
populate: function (items) { populate: function (items) {
this.toolbar.setVisible(!BI.isEmptyArray(items)); this.toolbar.setVisible(!BI.isEmptyArray(items));
this.toolbar.setEnable(!BI.isEmptyArray(items)); this.toolbar.setEnable(this.isEnabled() && !BI.isEmptyArray(items));
this.list.populate.apply(this.list, arguments); this.list.populate.apply(this.list, arguments);
this._checkAllSelected(); this._checkAllSelected();
}, },

67
dist/core.js vendored

@ -11480,23 +11480,31 @@ if (!_global.BI) {
* @abstract * @abstract
*/ */
BI.OB = function (config) { BI.OB = function (config) {
var props = this.props; this._constructor(config);
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
this._init();
this._initRef();
}; };
_.extend(BI.OB.prototype, { _.extend(BI.OB.prototype, {
props: {}, props: {},
init: null, init: null,
destroyed: null, destroyed: null,
_constructor: function (config) {
this._initProps(config);
this._init();
this._initRef();
},
_defaultConfig: function (config) { _defaultConfig: function (config) {
return {}; return {};
}, },
_initProps: function (config) {
var props = this.props;
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
},
_init: function () { _init: function () {
this._initListeners(); this._initListeners();
this.init && this.init(); this.init && this.init();
@ -11653,6 +11661,9 @@ if (!_global.BI) {
}); });
}, },
// 覆盖父类的_constructor方法,widget不走ob的生命周期
_constructor: function () {},
beforeInit: null, beforeInit: null,
// 生命周期函数 // 生命周期函数
@ -11813,16 +11824,17 @@ if (!_global.BI) {
* @private * @private
*/ */
_mount: function (force, deep, lifeHook, predicate) { _mount: function (force, deep, lifeHook, predicate) {
var self = this;
if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) { if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
return false; return false;
} }
lifeHook !== false && this.beforeMount && this.beforeMount(); lifeHook !== false && this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); this._mountChildren && this._mountChildren();
if(BI.isNotNull(this._parent)) {
!this._parent.isEnabled() && this._setEnable(false);
!this._parent.isValid() && this._setValid(false);
}
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false);
widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate); widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate);
}); });
lifeHook !== false && this.mounted && this.mounted(); lifeHook !== false && this.mounted && this.mounted();
@ -12170,12 +12182,15 @@ if (!_global.BI) {
// 根据配置属性生成widget // 根据配置属性生成widget
var createWidget = function (config) { var createWidget = function (config) {
if (config["classType"]) {
return new (new Function("return " + config["classType"] + ";")())(config);
}
var cls = kv[config.type]; var cls = kv[config.type];
return new cls(config);
var widget = new cls();
widget._initProps(config);
widget._init();
widget._initRef();
return widget;
}; };
BI.createWidget = function (item, options, context) { BI.createWidget = function (item, options, context) {
@ -21576,20 +21591,14 @@ BI.prepares.push(function () {
if (_global.document && !attachEvent) { if (_global.document && !attachEvent) {
var requestFrame = (function () { var requestFrame = (function () {
var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame || var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame ||
function (fn) { function (fn) { return _global.setTimeout(fn, 20); };
return _global.setTimeout(fn, 20); return function (fn) { return raf(fn); };
};
return function (fn) {
return raf(fn);
};
})(); })();
var cancelFrame = (function () { var cancelFrame = (function () {
var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame || var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame ||
_global.clearTimeout; _global.clearTimeout;
return function (id) { return function (id) { return cancel(id); };
return cancel(id);
};
})(); })();
var resetTriggers = function (element) { var resetTriggers = function (element) {
@ -21662,8 +21671,8 @@ BI.prepares.push(function () {
if (!stylesCreated) { if (!stylesCreated) {
// opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360 // opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
var css = (animationKeyframes ? animationKeyframes : "") + var css = (animationKeyframes ? animationKeyframes : "") +
".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " + ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " +
".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }", ".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }",
head = document.head || document.getElementsByTagName("head")[0], head = document.head || document.getElementsByTagName("head")[0],
style = document.createElement("style"); style = document.createElement("style");
@ -21694,15 +21703,11 @@ BI.prepares.push(function () {
"<div class=\"contract-trigger\"></div>"; "<div class=\"contract-trigger\"></div>";
element.appendChild(element.__resizeTriggers__); element.appendChild(element.__resizeTriggers__);
resetTriggers(element); resetTriggers(element);
element.addEventListener("scroll", scrollListener, true); element.addEventListener("scroll", scrollListener, true);
/* Listen for a css animation to detect element display/re-attach */ /* Listen for a css animation to detect element display/re-attach */
animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) { animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) {
if (e.animationName === animationName) { if (e.animationName === animationName) {resetTriggers(element);}
resetTriggers(element);
}
}); });
} }
element.__resizeListeners__.push(fn); element.__resizeListeners__.push(fn);

80
dist/fineui.ie.js vendored

@ -11725,23 +11725,31 @@ if (!_global.BI) {
* @abstract * @abstract
*/ */
BI.OB = function (config) { BI.OB = function (config) {
var props = this.props; this._constructor(config);
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
this._init();
this._initRef();
}; };
_.extend(BI.OB.prototype, { _.extend(BI.OB.prototype, {
props: {}, props: {},
init: null, init: null,
destroyed: null, destroyed: null,
_constructor: function (config) {
this._initProps(config);
this._init();
this._initRef();
},
_defaultConfig: function (config) { _defaultConfig: function (config) {
return {}; return {};
}, },
_initProps: function (config) {
var props = this.props;
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
},
_init: function () { _init: function () {
this._initListeners(); this._initListeners();
this.init && this.init(); this.init && this.init();
@ -11898,6 +11906,9 @@ if (!_global.BI) {
}); });
}, },
// 覆盖父类的_constructor方法,widget不走ob的生命周期
_constructor: function () {},
beforeInit: null, beforeInit: null,
// 生命周期函数 // 生命周期函数
@ -12058,16 +12069,17 @@ if (!_global.BI) {
* @private * @private
*/ */
_mount: function (force, deep, lifeHook, predicate) { _mount: function (force, deep, lifeHook, predicate) {
var self = this;
if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) { if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
return false; return false;
} }
lifeHook !== false && this.beforeMount && this.beforeMount(); lifeHook !== false && this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); this._mountChildren && this._mountChildren();
if(BI.isNotNull(this._parent)) {
!this._parent.isEnabled() && this._setEnable(false);
!this._parent.isValid() && this._setValid(false);
}
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false);
widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate); widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate);
}); });
lifeHook !== false && this.mounted && this.mounted(); lifeHook !== false && this.mounted && this.mounted();
@ -12415,12 +12427,15 @@ if (!_global.BI) {
// 根据配置属性生成widget // 根据配置属性生成widget
var createWidget = function (config) { var createWidget = function (config) {
if (config["classType"]) {
return new (new Function("return " + config["classType"] + ";")())(config);
}
var cls = kv[config.type]; var cls = kv[config.type];
return new cls(config);
var widget = new cls();
widget._initProps(config);
widget._init();
widget._initRef();
return widget;
}; };
BI.createWidget = function (item, options, context) { BI.createWidget = function (item, options, context) {
@ -21821,20 +21836,14 @@ BI.prepares.push(function () {
if (_global.document && !attachEvent) { if (_global.document && !attachEvent) {
var requestFrame = (function () { var requestFrame = (function () {
var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame || var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame ||
function (fn) { function (fn) { return _global.setTimeout(fn, 20); };
return _global.setTimeout(fn, 20); return function (fn) { return raf(fn); };
};
return function (fn) {
return raf(fn);
};
})(); })();
var cancelFrame = (function () { var cancelFrame = (function () {
var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame || var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame ||
_global.clearTimeout; _global.clearTimeout;
return function (id) { return function (id) { return cancel(id); };
return cancel(id);
};
})(); })();
var resetTriggers = function (element) { var resetTriggers = function (element) {
@ -21907,8 +21916,8 @@ BI.prepares.push(function () {
if (!stylesCreated) { if (!stylesCreated) {
// opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360 // opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
var css = (animationKeyframes ? animationKeyframes : "") + var css = (animationKeyframes ? animationKeyframes : "") +
".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " + ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " +
".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }", ".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }",
head = document.head || document.getElementsByTagName("head")[0], head = document.head || document.getElementsByTagName("head")[0],
style = document.createElement("style"); style = document.createElement("style");
@ -21939,15 +21948,11 @@ BI.prepares.push(function () {
"<div class=\"contract-trigger\"></div>"; "<div class=\"contract-trigger\"></div>";
element.appendChild(element.__resizeTriggers__); element.appendChild(element.__resizeTriggers__);
resetTriggers(element); resetTriggers(element);
element.addEventListener("scroll", scrollListener, true); element.addEventListener("scroll", scrollListener, true);
/* Listen for a css animation to detect element display/re-attach */ /* Listen for a css animation to detect element display/re-attach */
animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) { animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) {
if (e.animationName === animationName) { if (e.animationName === animationName) {resetTriggers(element);}
resetTriggers(element);
}
}); });
} }
element.__resizeListeners__.push(fn); element.__resizeListeners__.push(fn);
@ -44432,7 +44437,7 @@ BI.shortcut("bi.popover", BI.Popover);
BI.BarPopover = BI.inherit(BI.Popover, { BI.BarPopover = BI.inherit(BI.Popover, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), {
btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] btns: [BI.i18nText("BI-Basic_Sure"), BI.i18nText("BI-Basic_Cancel")]
}); });
}, },
@ -54485,7 +54490,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
} }
}] }]
}, o.popup), }, o.popup),
stopPropagation: true,
width: 230 width: 230
}, },
value: o.value value: o.value
@ -58235,7 +58239,7 @@ BI.SignEditor = BI.inherit(BI.Widget, {
tipType: o.tipType, tipType: o.tipType,
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -58503,7 +58507,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -58797,7 +58801,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -59542,7 +59546,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
callback.apply(self, arguments); callback.apply(self, arguments);
if (op.times === 1) { if (op.times === 1) {
self.toolbar.setVisible(items && items.length > 0); self.toolbar.setVisible(items && items.length > 0);
self.toolbar.setEnable(items && items.length > 0); self.toolbar.setEnable(self.isEnabled() && items && items.length > 0);
} }
self._checkAllSelected(); self._checkAllSelected();
}); });
@ -59650,7 +59654,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
populate: function (items) { populate: function (items) {
this.toolbar.setVisible(!BI.isEmptyArray(items)); this.toolbar.setVisible(!BI.isEmptyArray(items));
this.toolbar.setEnable(!BI.isEmptyArray(items)); this.toolbar.setEnable(this.isEnabled() && !BI.isEmptyArray(items));
this.list.populate.apply(this.list, arguments); this.list.populate.apply(this.list, arguments);
this._checkAllSelected(); this._checkAllSelected();
}, },

79
dist/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

80
dist/fineui.js vendored

@ -11725,23 +11725,31 @@ if (!_global.BI) {
* @abstract * @abstract
*/ */
BI.OB = function (config) { BI.OB = function (config) {
var props = this.props; this._constructor(config);
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
this._init();
this._initRef();
}; };
_.extend(BI.OB.prototype, { _.extend(BI.OB.prototype, {
props: {}, props: {},
init: null, init: null,
destroyed: null, destroyed: null,
_constructor: function (config) {
this._initProps(config);
this._init();
this._initRef();
},
_defaultConfig: function (config) { _defaultConfig: function (config) {
return {}; return {};
}, },
_initProps: function (config) {
var props = this.props;
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
},
_init: function () { _init: function () {
this._initListeners(); this._initListeners();
this.init && this.init(); this.init && this.init();
@ -11898,6 +11906,9 @@ if (!_global.BI) {
}); });
}, },
// 覆盖父类的_constructor方法,widget不走ob的生命周期
_constructor: function () {},
beforeInit: null, beforeInit: null,
// 生命周期函数 // 生命周期函数
@ -12058,16 +12069,17 @@ if (!_global.BI) {
* @private * @private
*/ */
_mount: function (force, deep, lifeHook, predicate) { _mount: function (force, deep, lifeHook, predicate) {
var self = this;
if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) { if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
return false; return false;
} }
lifeHook !== false && this.beforeMount && this.beforeMount(); lifeHook !== false && this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); this._mountChildren && this._mountChildren();
if(BI.isNotNull(this._parent)) {
!this._parent.isEnabled() && this._setEnable(false);
!this._parent.isValid() && this._setValid(false);
}
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false);
widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate); widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate);
}); });
lifeHook !== false && this.mounted && this.mounted(); lifeHook !== false && this.mounted && this.mounted();
@ -12415,12 +12427,15 @@ if (!_global.BI) {
// 根据配置属性生成widget // 根据配置属性生成widget
var createWidget = function (config) { var createWidget = function (config) {
if (config["classType"]) {
return new (new Function("return " + config["classType"] + ";")())(config);
}
var cls = kv[config.type]; var cls = kv[config.type];
return new cls(config);
var widget = new cls();
widget._initProps(config);
widget._init();
widget._initRef();
return widget;
}; };
BI.createWidget = function (item, options, context) { BI.createWidget = function (item, options, context) {
@ -21821,20 +21836,14 @@ BI.prepares.push(function () {
if (_global.document && !attachEvent) { if (_global.document && !attachEvent) {
var requestFrame = (function () { var requestFrame = (function () {
var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame || var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame ||
function (fn) { function (fn) { return _global.setTimeout(fn, 20); };
return _global.setTimeout(fn, 20); return function (fn) { return raf(fn); };
};
return function (fn) {
return raf(fn);
};
})(); })();
var cancelFrame = (function () { var cancelFrame = (function () {
var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame || var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame ||
_global.clearTimeout; _global.clearTimeout;
return function (id) { return function (id) { return cancel(id); };
return cancel(id);
};
})(); })();
var resetTriggers = function (element) { var resetTriggers = function (element) {
@ -21907,8 +21916,8 @@ BI.prepares.push(function () {
if (!stylesCreated) { if (!stylesCreated) {
// opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360 // opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
var css = (animationKeyframes ? animationKeyframes : "") + var css = (animationKeyframes ? animationKeyframes : "") +
".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " + ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " +
".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }", ".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }",
head = document.head || document.getElementsByTagName("head")[0], head = document.head || document.getElementsByTagName("head")[0],
style = document.createElement("style"); style = document.createElement("style");
@ -21939,15 +21948,11 @@ BI.prepares.push(function () {
"<div class=\"contract-trigger\"></div>"; "<div class=\"contract-trigger\"></div>";
element.appendChild(element.__resizeTriggers__); element.appendChild(element.__resizeTriggers__);
resetTriggers(element); resetTriggers(element);
element.addEventListener("scroll", scrollListener, true); element.addEventListener("scroll", scrollListener, true);
/* Listen for a css animation to detect element display/re-attach */ /* Listen for a css animation to detect element display/re-attach */
animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) { animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) {
if (e.animationName === animationName) { if (e.animationName === animationName) {resetTriggers(element);}
resetTriggers(element);
}
}); });
} }
element.__resizeListeners__.push(fn); element.__resizeListeners__.push(fn);
@ -44836,7 +44841,7 @@ BI.shortcut("bi.popover", BI.Popover);
BI.BarPopover = BI.inherit(BI.Popover, { BI.BarPopover = BI.inherit(BI.Popover, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), {
btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] btns: [BI.i18nText("BI-Basic_Sure"), BI.i18nText("BI-Basic_Cancel")]
}); });
}, },
@ -54889,7 +54894,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
} }
}] }]
}, o.popup), }, o.popup),
stopPropagation: true,
width: 230 width: 230
}, },
value: o.value value: o.value
@ -58639,7 +58643,7 @@ BI.SignEditor = BI.inherit(BI.Widget, {
tipType: o.tipType, tipType: o.tipType,
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -58907,7 +58911,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -59201,7 +59205,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -59946,7 +59950,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
callback.apply(self, arguments); callback.apply(self, arguments);
if (op.times === 1) { if (op.times === 1) {
self.toolbar.setVisible(items && items.length > 0); self.toolbar.setVisible(items && items.length > 0);
self.toolbar.setEnable(items && items.length > 0); self.toolbar.setEnable(self.isEnabled() && items && items.length > 0);
} }
self._checkAllSelected(); self._checkAllSelected();
}); });
@ -60054,7 +60058,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
populate: function (items) { populate: function (items) {
this.toolbar.setVisible(!BI.isEmptyArray(items)); this.toolbar.setVisible(!BI.isEmptyArray(items));
this.toolbar.setEnable(!BI.isEmptyArray(items)); this.toolbar.setEnable(this.isEnabled() && !BI.isEmptyArray(items));
this.list.populate.apply(this.list, arguments); this.list.populate.apply(this.list, arguments);
this._checkAllSelected(); this._checkAllSelected();
}, },

79
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

57
dist/fineui_without_jquery_polyfill.js vendored

@ -11480,23 +11480,31 @@ if (!_global.BI) {
* @abstract * @abstract
*/ */
BI.OB = function (config) { BI.OB = function (config) {
var props = this.props; this._constructor(config);
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
this._init();
this._initRef();
}; };
_.extend(BI.OB.prototype, { _.extend(BI.OB.prototype, {
props: {}, props: {},
init: null, init: null,
destroyed: null, destroyed: null,
_constructor: function (config) {
this._initProps(config);
this._init();
this._initRef();
},
_defaultConfig: function (config) { _defaultConfig: function (config) {
return {}; return {};
}, },
_initProps: function (config) {
var props = this.props;
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
},
_init: function () { _init: function () {
this._initListeners(); this._initListeners();
this.init && this.init(); this.init && this.init();
@ -11653,6 +11661,9 @@ if (!_global.BI) {
}); });
}, },
// 覆盖父类的_constructor方法,widget不走ob的生命周期
_constructor: function () {},
beforeInit: null, beforeInit: null,
// 生命周期函数 // 生命周期函数
@ -11813,16 +11824,17 @@ if (!_global.BI) {
* @private * @private
*/ */
_mount: function (force, deep, lifeHook, predicate) { _mount: function (force, deep, lifeHook, predicate) {
var self = this;
if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) { if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
return false; return false;
} }
lifeHook !== false && this.beforeMount && this.beforeMount(); lifeHook !== false && this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); this._mountChildren && this._mountChildren();
if(BI.isNotNull(this._parent)) {
!this._parent.isEnabled() && this._setEnable(false);
!this._parent.isValid() && this._setValid(false);
}
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false);
widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate); widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate);
}); });
lifeHook !== false && this.mounted && this.mounted(); lifeHook !== false && this.mounted && this.mounted();
@ -12170,12 +12182,15 @@ if (!_global.BI) {
// 根据配置属性生成widget // 根据配置属性生成widget
var createWidget = function (config) { var createWidget = function (config) {
if (config["classType"]) {
return new (new Function("return " + config["classType"] + ";")())(config);
}
var cls = kv[config.type]; var cls = kv[config.type];
return new cls(config);
var widget = new cls();
widget._initProps(config);
widget._init();
widget._initRef();
return widget;
}; };
BI.createWidget = function (item, options, context) { BI.createWidget = function (item, options, context) {
@ -31944,7 +31959,7 @@ BI.shortcut("bi.popover", BI.Popover);
BI.BarPopover = BI.inherit(BI.Popover, { BI.BarPopover = BI.inherit(BI.Popover, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), {
btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] btns: [BI.i18nText("BI-Basic_Sure"), BI.i18nText("BI-Basic_Cancel")]
}); });
}, },
@ -41208,7 +41223,7 @@ BI.SignEditor = BI.inherit(BI.Widget, {
tipType: o.tipType, tipType: o.tipType,
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -41476,7 +41491,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -41770,7 +41785,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();
@ -42515,7 +42530,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
callback.apply(self, arguments); callback.apply(self, arguments);
if (op.times === 1) { if (op.times === 1) {
self.toolbar.setVisible(items && items.length > 0); self.toolbar.setVisible(items && items.length > 0);
self.toolbar.setEnable(items && items.length > 0); self.toolbar.setEnable(self.isEnabled() && items && items.length > 0);
} }
self._checkAllSelected(); self._checkAllSelected();
}); });
@ -42623,7 +42638,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
populate: function (items) { populate: function (items) {
this.toolbar.setVisible(!BI.isEmptyArray(items)); this.toolbar.setVisible(!BI.isEmptyArray(items));
this.toolbar.setEnable(!BI.isEmptyArray(items)); this.toolbar.setEnable(this.isEnabled() && !BI.isEmptyArray(items));
this.list.populate.apply(this.list, arguments); this.list.populate.apply(this.list, arguments);
this._checkAllSelected(); this._checkAllSelected();
}, },

22
dist/utils.js vendored

@ -12259,23 +12259,31 @@ if (!_global.BI) {
* @abstract * @abstract
*/ */
BI.OB = function (config) { BI.OB = function (config) {
var props = this.props; this._constructor(config);
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
this._init();
this._initRef();
}; };
_.extend(BI.OB.prototype, { _.extend(BI.OB.prototype, {
props: {}, props: {},
init: null, init: null,
destroyed: null, destroyed: null,
_constructor: function (config) {
this._initProps(config);
this._init();
this._initRef();
},
_defaultConfig: function (config) { _defaultConfig: function (config) {
return {}; return {};
}, },
_initProps: function (config) {
var props = this.props;
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
},
_init: function () { _init: function () {
this._initListeners(); this._initListeners();
this.init && this.init(); this.init && this.init();

8
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

2
src/base/layer/layer.popover.js

@ -209,7 +209,7 @@ BI.shortcut("bi.popover", BI.Popover);
BI.BarPopover = BI.inherit(BI.Popover, { BI.BarPopover = BI.inherit(BI.Popover, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), {
btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] btns: [BI.i18nText("BI-Basic_Sure"), BI.i18nText("BI-Basic_Cancel")]
}); });
}, },

1
src/case/colorchooser/colorchooser.js

@ -55,7 +55,6 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
} }
}] }]
}, o.popup), }, o.popup),
stopPropagation: true,
width: 230 width: 230
}, },
value: o.value value: o.value

2
src/case/editor/editor.sign.js

@ -51,7 +51,7 @@ BI.SignEditor = BI.inherit(BI.Widget, {
tipType: o.tipType, tipType: o.tipType,
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();

2
src/case/editor/editor.state.js

@ -50,7 +50,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();

2
src/case/editor/editor.state.simple.js

@ -51,7 +51,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
hgap: 4, hgap: o.hgap,
handler: function () { handler: function () {
self._showInput(); self._showInput();
self.editor.focus(); self.editor.focus();

4
src/case/list/list.select.js

@ -52,7 +52,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
callback.apply(self, arguments); callback.apply(self, arguments);
if (op.times === 1) { if (op.times === 1) {
self.toolbar.setVisible(items && items.length > 0); self.toolbar.setVisible(items && items.length > 0);
self.toolbar.setEnable(items && items.length > 0); self.toolbar.setEnable(self.isEnabled() && items && items.length > 0);
} }
self._checkAllSelected(); self._checkAllSelected();
}); });
@ -160,7 +160,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
populate: function (items) { populate: function (items) {
this.toolbar.setVisible(!BI.isEmptyArray(items)); this.toolbar.setVisible(!BI.isEmptyArray(items));
this.toolbar.setEnable(!BI.isEmptyArray(items)); this.toolbar.setEnable(this.isEnabled() && !BI.isEmptyArray(items));
this.list.populate.apply(this.list, arguments); this.list.populate.apply(this.list, arguments);
this._checkAllSelected(); this._checkAllSelected();
}, },

22
src/core/ob.js

@ -29,23 +29,31 @@
* @abstract * @abstract
*/ */
BI.OB = function (config) { BI.OB = function (config) {
var props = this.props; this._constructor(config);
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
this._init();
this._initRef();
}; };
_.extend(BI.OB.prototype, { _.extend(BI.OB.prototype, {
props: {}, props: {},
init: null, init: null,
destroyed: null, destroyed: null,
_constructor: function (config) {
this._initProps(config);
this._init();
this._initRef();
},
_defaultConfig: function (config) { _defaultConfig: function (config) {
return {}; return {};
}, },
_initProps: function (config) {
var props = this.props;
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
},
_init: function () { _init: function () {
this._initListeners(); this._initListeners();
this.init && this.init(); this.init && this.init();

13
src/core/shortcut.js

@ -9,12 +9,15 @@
// 根据配置属性生成widget // 根据配置属性生成widget
var createWidget = function (config) { var createWidget = function (config) {
if (config["classType"]) {
return new (new Function("return " + config["classType"] + ";")())(config);
}
var cls = kv[config.type]; var cls = kv[config.type];
return new cls(config);
var widget = new cls();
widget._initProps(config);
widget._init();
widget._initRef();
return widget;
}; };
BI.createWidget = function (item, options, context) { BI.createWidget = function (item, options, context) {

10
src/core/widget.js

@ -25,6 +25,9 @@
}); });
}, },
// 覆盖父类的_constructor方法,widget不走ob的生命周期
_constructor: function () {},
beforeInit: null, beforeInit: null,
// 生命周期函数 // 生命周期函数
@ -185,16 +188,17 @@
* @private * @private
*/ */
_mount: function (force, deep, lifeHook, predicate) { _mount: function (force, deep, lifeHook, predicate) {
var self = this;
if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) { if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) {
return false; return false;
} }
lifeHook !== false && this.beforeMount && this.beforeMount(); lifeHook !== false && this.beforeMount && this.beforeMount();
this._isMounted = true; this._isMounted = true;
this._mountChildren && this._mountChildren(); this._mountChildren && this._mountChildren();
if(BI.isNotNull(this._parent)) {
!this._parent.isEnabled() && this._setEnable(false);
!this._parent.isValid() && this._setValid(false);
}
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
!self.isEnabled() && widget._setEnable(false);
!self.isValid() && widget._setValid(false);
widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate); widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate);
}); });
lifeHook !== false && this.mounted && this.mounted(); lifeHook !== false && this.mounted && this.mounted();

Loading…
Cancel
Save