|
|
|
@ -9,7 +9,7 @@
|
|
|
|
|
}; |
|
|
|
|
BI.module = BI.module || function (xtype, cls) { |
|
|
|
|
if (moduleInjection[xtype] != null) { |
|
|
|
|
_global.console && console.error("module: [" + xtype + "] 已经注册过了"); |
|
|
|
|
_global.console && console.error("module: [" + xtype + "] already registered"); |
|
|
|
|
} else { |
|
|
|
|
if (BI.isFunction(cls)) { |
|
|
|
|
cls = cls(); |
|
|
|
@ -41,7 +41,7 @@
|
|
|
|
|
var constantInjection = {}; |
|
|
|
|
BI.constant = BI.constant || function (xtype, cls) { |
|
|
|
|
if (constantInjection[xtype] != null) { |
|
|
|
|
_global.console && console.error("constant: [" + xtype + "]已经注册过了"); |
|
|
|
|
_global.console && console.error("constant: [" + xtype + "]already registered"); |
|
|
|
|
} else { |
|
|
|
|
constantInjection[xtype] = cls; |
|
|
|
|
} |
|
|
|
@ -54,7 +54,7 @@
|
|
|
|
|
var modelInjection = {}; |
|
|
|
|
BI.model = BI.model || function (xtype, cls) { |
|
|
|
|
if (modelInjection[xtype] != null) { |
|
|
|
|
_global.console && console.error("model: [" + xtype + "] 已经注册过了"); |
|
|
|
|
_global.console && console.error("model: [" + xtype + "] already registered"); |
|
|
|
|
} else { |
|
|
|
|
modelInjection[xtype] = cls; |
|
|
|
|
} |
|
|
|
@ -67,7 +67,7 @@
|
|
|
|
|
var storeInjection = {}; |
|
|
|
|
BI.store = BI.store || function (xtype, cls) { |
|
|
|
|
if (storeInjection[xtype] != null) { |
|
|
|
|
_global.console && console.error("store: [" + xtype + "] 已经注册过了"); |
|
|
|
|
_global.console && console.error("store: [" + xtype + "] already registered"); |
|
|
|
|
} else { |
|
|
|
|
storeInjection[xtype] = cls; |
|
|
|
|
} |
|
|
|
@ -80,7 +80,7 @@
|
|
|
|
|
var serviceInjection = {}; |
|
|
|
|
BI.service = BI.service || function (xtype, cls) { |
|
|
|
|
if (serviceInjection[xtype] != null) { |
|
|
|
|
_global.console && console.error("service: [" + xtype + "] 已经注册过了"); |
|
|
|
|
_global.console && console.error("service: [" + xtype + "] already registered"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
serviceInjection[xtype] = cls; |
|
|
|
@ -93,7 +93,7 @@
|
|
|
|
|
var providerInjection = {}; |
|
|
|
|
BI.provider = BI.provider || function (xtype, cls) { |
|
|
|
|
if (providerInjection[xtype] != null) { |
|
|
|
|
_global.console && console.error("provider: [" + xtype + "] 已经注册过了"); |
|
|
|
|
_global.console && console.error("provider: [" + xtype + "] already registered"); |
|
|
|
|
} else { |
|
|
|
|
providerInjection[xtype] = cls; |
|
|
|
|
} |
|
|
|
@ -151,7 +151,7 @@
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (findVersion === true) { |
|
|
|
|
_global.console && console.error("moduleId: [" + module.moduleId + "] 接口: [" + type + "] 接口版本: [" + version + "] 已过期,版本要求为:", dependencies[module.moduleId], "=>", moduleInjection[module.moduleId]); |
|
|
|
|
_global.console && console.error("moduleId: [" + module.moduleId + "] interface : [" + type + "] version: [" + version + "] has expired,The version requirement is:", dependencies[module.moduleId], "=>", moduleInjection[module.moduleId]); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -251,7 +251,7 @@
|
|
|
|
|
BI.Modules = BI.Modules || { |
|
|
|
|
getModule: function (type) { |
|
|
|
|
if (!moduleInjection[type]) { |
|
|
|
|
_global.console && console.error("module: [" + type + "] 未定义"); |
|
|
|
|
_global.console && console.error("module: [" + type + "] undefined"); |
|
|
|
|
} |
|
|
|
|
return moduleInjection[type]; |
|
|
|
|
}, |
|
|
|
@ -263,7 +263,7 @@
|
|
|
|
|
BI.Constants = BI.Constants || { |
|
|
|
|
getConstant: function (type) { |
|
|
|
|
if (BI.isNull(constantInjection[type])) { |
|
|
|
|
_global.console && console.error("constant: [" + type + "] 未定义"); |
|
|
|
|
_global.console && console.error("constant: [" + type + "] undefined"); |
|
|
|
|
} |
|
|
|
|
runConfigFunction(type); |
|
|
|
|
return BI.isFunction(constantInjection[type]) ? constantInjection[type]() : constantInjection[type]; |
|
|
|
@ -311,7 +311,7 @@
|
|
|
|
|
BI.Models = BI.Models || { |
|
|
|
|
getModel: function (type, config) { |
|
|
|
|
if (!modelInjection[type]) { |
|
|
|
|
_global.console && console.error("model: [" + type + "] 未定义"); |
|
|
|
|
_global.console && console.error("model: [" + type + "] undefined"); |
|
|
|
|
} |
|
|
|
|
runConfigFunction(type); |
|
|
|
|
var inst = new modelInjection[type](config); |
|
|
|
@ -327,7 +327,7 @@
|
|
|
|
|
BI.Stores = BI.Stores || { |
|
|
|
|
getStore: function (type, config) { |
|
|
|
|
if (!storeInjection[type]) { |
|
|
|
|
_global.console && console.error("store: [" + type + "] 未定义"); |
|
|
|
|
_global.console && console.error("store: [" + type + "] undefined"); |
|
|
|
|
} |
|
|
|
|
if (stores[type]) { |
|
|
|
|
return stores[type]; |
|
|
|
@ -346,7 +346,7 @@
|
|
|
|
|
BI.Services = BI.Services || { |
|
|
|
|
getService: function (type, config) { |
|
|
|
|
if (!serviceInjection[type]) { |
|
|
|
|
_global.console && console.error("service: [" + type + "] 未定义"); |
|
|
|
|
_global.console && console.error("service: [" + type + "] undefined"); |
|
|
|
|
} |
|
|
|
|
if (services[type]) { |
|
|
|
|
return services[type]; |
|
|
|
@ -363,7 +363,7 @@
|
|
|
|
|
BI.Providers = BI.Providers || { |
|
|
|
|
getProvider: function (type, config) { |
|
|
|
|
if (!providerInjection[type]) { |
|
|
|
|
_global.console && console.error("provider: [" + type + "] 未定义"); |
|
|
|
|
_global.console && console.error("provider: [" + type + "] undefined"); |
|
|
|
|
} |
|
|
|
|
runConfigFunction(type); |
|
|
|
|
if (!providers[type]) { |
|
|
|
@ -401,7 +401,7 @@
|
|
|
|
|
var kv = {}; |
|
|
|
|
BI.shortcut = BI.component = BI.shortcut || function (xtype, cls) { |
|
|
|
|
if (kv[xtype] != null) { |
|
|
|
|
_global.console && console.error("组件: [" + xtype + "] 已经注册过了"); |
|
|
|
|
_global.console && console.error("widget: [" + xtype + "] already registered"); |
|
|
|
|
} |
|
|
|
|
if (cls) { |
|
|
|
|
cls["xtype"] = xtype; |
|
|
|
@ -414,7 +414,7 @@
|
|
|
|
|
var cls = BI.isFunction(config.type) ? config.type : kv[config.type]; |
|
|
|
|
|
|
|
|
|
if (!cls) { |
|
|
|
|
throw new Error("组件: [" + config.type + "] 未定义"); |
|
|
|
|
throw new Error("widget: [" + config.type + "] undefined"); |
|
|
|
|
} |
|
|
|
|
var pushed = false; |
|
|
|
|
var widget = new cls(); |
|
|
|
@ -472,12 +472,14 @@
|
|
|
|
|
if (wType === elType) { |
|
|
|
|
if (BI.Plugin.hasObject(elType)) { |
|
|
|
|
if (!w.listeners || BI.isArray(w.listeners)) { |
|
|
|
|
w.listeners = (w.listeners || []).concat([{ |
|
|
|
|
eventName: BI.Events.MOUNT, |
|
|
|
|
action: function () { |
|
|
|
|
BI.Plugin.getObject(elType, this); |
|
|
|
|
w.listeners = (w.listeners || []).concat([ |
|
|
|
|
{ |
|
|
|
|
eventName: BI.Events.MOUNT, |
|
|
|
|
action: function () { |
|
|
|
|
BI.Plugin.getObject(elType, this); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}]); |
|
|
|
|
]); |
|
|
|
|
} else { |
|
|
|
|
w.listeners[BI.Events.MOUNT] = [ |
|
|
|
|
function () { |
|
|
|
@ -493,7 +495,7 @@
|
|
|
|
|
if (BI.isWidget(item.el)) { |
|
|
|
|
return item.el; |
|
|
|
|
} |
|
|
|
|
throw new Error("组件:无法根据item创建组件", item); |
|
|
|
|
throw new Error("widget: Unable to create widget from item ", item); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI._lazyCreateWidget = BI._lazyCreateWidget || function (item, options, context) { |
|
|
|
@ -521,6 +523,6 @@
|
|
|
|
|
if (providerInjection[type]) { |
|
|
|
|
return BI.Providers.getProvider(type, config); |
|
|
|
|
} |
|
|
|
|
throw new Error("未知类型: [" + type + "] 未定义"); |
|
|
|
|
throw new Error("unknown type: [" + type + "] undefined"); |
|
|
|
|
}; |
|
|
|
|
})(); |
|
|
|
|