Browse Source

Pull request #3530: KERNEL-14316 fix:装饰器缺了service

Merge in VISUAL/fineui from ~TREECAT/fineui:es6 to es6

* commit 'cc53a9d236711c15515aaf3e205169cff4950069':
  KERNEL-14316 fix:装饰器缺了service
  KERNEL-14316 fix:装饰器缺了service
es6
treecat-罗群 1 year ago
parent
commit
ce80b28276
  1. 40
      packages/fineui/src/core/decorator.js
  2. 2
      packages/fineui/src/core/index.js

40
packages/fineui/src/core/decorator.js

@ -1,33 +1,17 @@
// export * from "../../typescript/core/decorator/decorator.ts"; import * as inject from "./5.inject";
import { shortcut as biShortcut, provider as biProvider, model as biModel, Models } from "./5.inject"; const transFunc2Decorator = targetFunc => {
return function () {
/** return function decorator(Target) {
* 注册widget targetFunc(Target.xtype, Target);
*/ };
export function shortcut() {
return function decorator(Target) {
biShortcut(Target.xtype, Target);
};
}
/**
* 注册provider
*/
export function provider() {
return function decorator(Target) {
biProvider(Target.xtype, Target);
}; };
} };
/** export const shortcut = transFunc2Decorator(inject.shortcut);
* 注册model export const service = transFunc2Decorator(inject.service);
*/ export const provider = transFunc2Decorator(inject.provider);
export function model() { export const model = transFunc2Decorator(inject.model);
return function decorator(Target) {
biModel(Target.xtype, Target);
};
}
/** /**
* 类注册_store属性 * 类注册_store属性
@ -40,7 +24,7 @@ export function store(Model, opts = {}) {
_store() { _store() {
const props = opts.props ? opts.props.apply(this) : undefined; const props = opts.props ? opts.props.apply(this) : undefined;
return Models.getModel(Model.xtype, props); return inject.Models.getModel(Model.xtype, props);
} }
}; };
}; };

2
packages/fineui/src/core/index.js

@ -33,7 +33,7 @@ export * from './wrapper';
export * from './platform/web'; export * from './platform/web';
export * from './utils'; export * from './utils';
export { shortcut, provider, store, model, mixin, mixins } from './decorator'; export { shortcut, provider, store, model, mixin, mixins, service } from './decorator';

Loading…
Cancel
Save