|
|
@ -1,6 +1,6 @@ |
|
|
|
import { isFunction, isNull, isNotNull, isArray, each, isWidget, extend, init, isEmpty, remove } from "./2.base"; |
|
|
|
import { isFunction, isNull, isNotNull, isArray, each, isWidget, extend, init, isEmpty, remove } from "./2.base"; |
|
|
|
import OB from "./3.ob"; |
|
|
|
import { OB } from "./3.ob"; |
|
|
|
import Widget from "./4.widget" |
|
|
|
import { Widget } from "./4.widget" |
|
|
|
|
|
|
|
|
|
|
|
let moduleInjection = {}, moduleInjectionMap = { |
|
|
|
let moduleInjection = {}, moduleInjectionMap = { |
|
|
|
components: {}, |
|
|
|
components: {}, |
|
|
@ -39,7 +39,6 @@ export function module(xtype, cls) { |
|
|
|
|
|
|
|
|
|
|
|
return () => Modules.getModule(xtype); |
|
|
|
return () => Modules.getModule(xtype); |
|
|
|
} |
|
|
|
} |
|
|
|
BI.module = BI.module || module; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let constantInjection = {}; |
|
|
|
let constantInjection = {}; |
|
|
|
export function constant(xtype, cls) { |
|
|
|
export function constant(xtype, cls) { |
|
|
@ -51,7 +50,6 @@ export function constant(xtype, cls) { |
|
|
|
|
|
|
|
|
|
|
|
return () => Constants.getConstant(xtype); |
|
|
|
return () => Constants.getConstant(xtype); |
|
|
|
} |
|
|
|
} |
|
|
|
BI.constant = BI.constant || constant; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let modelInjection = {}; |
|
|
|
let modelInjection = {}; |
|
|
|
export function model(xtype, cls) { |
|
|
|
export function model(xtype, cls) { |
|
|
@ -63,7 +61,6 @@ export function model(xtype, cls) { |
|
|
|
|
|
|
|
|
|
|
|
return (config) => Models.getModel(xtype, config); |
|
|
|
return (config) => Models.getModel(xtype, config); |
|
|
|
} |
|
|
|
} |
|
|
|
BI.model = BI.model || model; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let storeInjection = {}; |
|
|
|
let storeInjection = {}; |
|
|
|
export function store(xtype, cls) { |
|
|
|
export function store(xtype, cls) { |
|
|
@ -75,7 +72,6 @@ export function store(xtype, cls) { |
|
|
|
|
|
|
|
|
|
|
|
return (config) => Stores.getStore(xtype, config); |
|
|
|
return (config) => Stores.getStore(xtype, config); |
|
|
|
} |
|
|
|
} |
|
|
|
BI.store = BI.store || store; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let serviceInjection = {}; |
|
|
|
let serviceInjection = {}; |
|
|
|
export function service(xtype, cls) { |
|
|
|
export function service(xtype, cls) { |
|
|
@ -87,7 +83,6 @@ export function service(xtype, cls) { |
|
|
|
|
|
|
|
|
|
|
|
return (config) => Services.getService(xtype, config); |
|
|
|
return (config) => Services.getService(xtype, config); |
|
|
|
} |
|
|
|
} |
|
|
|
BI.service = BI.service || service; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let providerInjection = {}; |
|
|
|
let providerInjection = {}; |
|
|
|
export function provider(xtype, cls) { |
|
|
|
export function provider(xtype, cls) { |
|
|
@ -99,7 +94,6 @@ export function provider(xtype, cls) { |
|
|
|
|
|
|
|
|
|
|
|
return (config) => Providers.getProvider(xtype, config); |
|
|
|
return (config) => Providers.getProvider(xtype, config); |
|
|
|
} |
|
|
|
} |
|
|
|
BI.provider = BI.provider || provider; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let configFunctions = OB.configFunctions = {}; |
|
|
|
let configFunctions = OB.configFunctions = {}; |
|
|
|
const runConfigFunction = function (type, configFn) { |
|
|
|
const runConfigFunction = function (type, configFn) { |
|
|
@ -200,12 +194,10 @@ export function config(type, configFn, opt) { |
|
|
|
return runConfigFunction(type, configFn); |
|
|
|
return runConfigFunction(type, configFn); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
BI.config = BI.config || config; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function getReference(type, fn) { |
|
|
|
export function getReference(type, fn) { |
|
|
|
return BI.Plugin.registerObject(type, fn); |
|
|
|
return BI.Plugin.registerObject(type, fn); |
|
|
|
} |
|
|
|
} |
|
|
|
BI.getReference = BI.getReference || getReference; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let actions = {}; |
|
|
|
let actions = {}; |
|
|
|
let globalAction = []; |
|
|
|
let globalAction = []; |
|
|
@ -227,7 +219,6 @@ export function action(type, actionFn) { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
BI.action = BI.action || action; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let points = {}; |
|
|
|
let points = {}; |
|
|
|
export function point(type, action, pointFn, after) { |
|
|
|
export function point(type, action, pointFn, after) { |
|
|
@ -242,7 +233,6 @@ export function point(type, action, pointFn, after) { |
|
|
|
} |
|
|
|
} |
|
|
|
points[type][action][after ? "after" : "before"].push(pointFn); |
|
|
|
points[type][action][after ? "after" : "before"].push(pointFn); |
|
|
|
} |
|
|
|
} |
|
|
|
BI.point = BI.point || point; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const Modules = { |
|
|
|
export const Modules = { |
|
|
|
getModule: function (type) { |
|
|
|
getModule: function (type) { |
|
|
@ -255,7 +245,6 @@ export const Modules = { |
|
|
|
return moduleInjection; |
|
|
|
return moduleInjection; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
BI.Modules = BI.Modules || Modules; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const Constants = { |
|
|
|
export const Constants = { |
|
|
|
getConstant: function (type) { |
|
|
|
getConstant: function (type) { |
|
|
@ -266,7 +255,6 @@ export const Constants = { |
|
|
|
return isFunction(constantInjection[type]) ? constantInjection[type]() : constantInjection[type]; |
|
|
|
return isFunction(constantInjection[type]) ? constantInjection[type]() : constantInjection[type]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
BI.Constants = BI.Constants || Constants; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const callPoint = function (inst, types) { |
|
|
|
const callPoint = function (inst, types) { |
|
|
|
types = isArray(types) ? types : [types]; |
|
|
|
types = isArray(types) ? types : [types]; |
|
|
@ -319,7 +307,6 @@ export const Models = { |
|
|
|
return inst; |
|
|
|
return inst; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
BI.Models = BI.Models || Models; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let stores = {}; |
|
|
|
let stores = {}; |
|
|
|
export const Stores = { |
|
|
|
export const Stores = { |
|
|
@ -338,7 +325,6 @@ export const Stores = { |
|
|
|
return inst; |
|
|
|
return inst; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
BI.Stores = BI.Stores || Stores; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let services = {}; |
|
|
|
let services = {}; |
|
|
|
export const Services = { |
|
|
|
export const Services = { |
|
|
@ -354,7 +340,6 @@ export const Services = { |
|
|
|
return services[type]; |
|
|
|
return services[type]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
BI.Services = BI.Services || Services; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let providers = {}, |
|
|
|
let providers = {}, |
|
|
|
providerInstance = {}; |
|
|
|
providerInstance = {}; |
|
|
@ -373,7 +358,6 @@ export const Providers = { |
|
|
|
return providerInstance[type]; |
|
|
|
return providerInstance[type]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
BI.Providers = BI.Providers || Providers; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const Actions = { |
|
|
|
export const Actions = { |
|
|
|
runAction: function (type, event, config) { |
|
|
|
runAction: function (type, event, config) { |
|
|
@ -396,7 +380,6 @@ export const Actions = { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
BI.Actions = BI.Actions || Actions; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let kv = {}; |
|
|
|
let kv = {}; |
|
|
|
export function shortcut(xtype, cls) { |
|
|
|
export function shortcut(xtype, cls) { |
|
|
@ -408,7 +391,6 @@ export function shortcut(xtype, cls) { |
|
|
|
} |
|
|
|
} |
|
|
|
kv[xtype] = cls; |
|
|
|
kv[xtype] = cls; |
|
|
|
} |
|
|
|
} |
|
|
|
BI.shortcut = BI.component = BI.shortcut || shortcut; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根据配置属性生成widget
|
|
|
|
// 根据配置属性生成widget
|
|
|
|
const createRealWidget = function (config, context, lazy) { |
|
|
|
const createRealWidget = function (config, context, lazy) { |
|
|
@ -496,18 +478,15 @@ export function createWidget(item, options, context, lazy) { |
|
|
|
} |
|
|
|
} |
|
|
|
throw new Error("组件:无法根据item创建组件", item); |
|
|
|
throw new Error("组件:无法根据item创建组件", item); |
|
|
|
} |
|
|
|
} |
|
|
|
BI.createWidget = BI.createWidget || createWidget; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function _lazyCreateWidget (item, options, context) { |
|
|
|
export function _lazyCreateWidget (item, options, context) { |
|
|
|
return createWidget(item, options, context, true); |
|
|
|
return createWidget(item, options, context, true); |
|
|
|
} |
|
|
|
} |
|
|
|
BI._lazyCreateWidget = BI._lazyCreateWidget || _lazyCreateWidget; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function createElement() { |
|
|
|
export function createElement() { |
|
|
|
const widget = createWidget.apply(this, arguments); |
|
|
|
const widget = createWidget.apply(this, arguments); |
|
|
|
return widget.element; |
|
|
|
return widget.element; |
|
|
|
} |
|
|
|
} |
|
|
|
BI.createElement = BI.createElement || createElement; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function getResource(type, config) { |
|
|
|
export function getResource(type, config) { |
|
|
|
if (isNotNull(constantInjection[type])) { |
|
|
|
if (isNotNull(constantInjection[type])) { |
|
|
@ -527,4 +506,3 @@ export function getResource(type, config) { |
|
|
|
} |
|
|
|
} |
|
|
|
throw new Error("未知类型: [" + type + "] 未定义"); |
|
|
|
throw new Error("未知类型: [" + type + "] 未定义"); |
|
|
|
} |
|
|
|
} |
|
|
|
BI.getResource = BI.getResource || getResource; |
|
|
|
|
|
|
|