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