zova-module-a-bean 5.1.33 → 5.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,7 @@ export async function generateFileComponent(
13
13
  const { moduleName } = options;
14
14
  const { className } = globFile;
15
15
  const {
16
+ type,
16
17
  name,
17
18
  nameCapitalize,
18
19
  controllerExtJs,
@@ -63,6 +64,12 @@ export async function generateFileComponent(
63
64
  `import type { ${_contentImportTypeController.join(', ')} } from '../../component/${name}/controller${controllerExtJs}';`,
64
65
  );
65
66
  }
67
+ if (type === 'component' && name === 'routedDialog') {
68
+ contentImports.push(
69
+ "import { routeLocationKey, routerKey, routerViewLocationKey, viewDepthKey } from '@cabloy/vue-router';",
70
+ "import { computed, provide, shallowReactive } from 'vue';",
71
+ );
72
+ }
66
73
  contentImports.push("import { defineComponent } from 'vue'");
67
74
  contentImports.push("import { prepareComponentOptions, useController } from 'zova';");
68
75
  // controller
@@ -137,7 +144,39 @@ export async function generateFileComponent(
137
144
  }`;
138
145
  }
139
146
  // component
140
- const contentComponent = `export const Z${nameCapitalize} = defineComponent(
147
+ const contentComponent =
148
+ type === 'component' && name === 'routedDialog'
149
+ ? `export const Z${nameCapitalize} = defineComponent(
150
+ ${genericDeclare}(props: ${typeControllerPublicPropsName}${genericArguments}) => {
151
+ const router = props.item.state.router;
152
+ if (router) {
153
+ const currentRoute = router.currentRoute;
154
+ const reactiveRoute = {} as Record<string, unknown>;
155
+ for (const key in currentRoute.value) {
156
+ Object.defineProperty(reactiveRoute, key, {
157
+ get: () => currentRoute.value[key],
158
+ enumerable: true,
159
+ });
160
+ }
161
+ provide(routerKey, router.router);
162
+ provide(routeLocationKey, shallowReactive(reactiveRoute) as any);
163
+ provide(routerViewLocationKey, currentRoute);
164
+ provide(
165
+ viewDepthKey,
166
+ computed(() => router.getEmbeddedRouterViewDepth(currentRoute.value)),
167
+ );
168
+ }
169
+ useController(${className}, ${hasRenderFirst ? classNameRenderFirst : undefined}, ${hasStyleFirst ? classNameStyleFirst : undefined});
170
+ return () => {};
171
+ },
172
+ {
173
+ ...prepareComponentOptions(${componentOptions}),
174
+ props: {
175
+ item: { type: Object, required: true },
176
+ },
177
+ },
178
+ );`
179
+ : `export const Z${nameCapitalize} = defineComponent(
141
180
  ${genericDeclare}(_props: ${typeControllerPublicPropsName}${genericArguments}) => {
142
181
  useController(${className}, ${hasRenderFirst ? classNameRenderFirst : undefined}, ${hasStyleFirst ? classNameStyleFirst : undefined});
143
182
  return () => {};
package/dist/index.js CHANGED
@@ -37,7 +37,10 @@ function AopMethod(options) {
37
37
  }
38
38
  //#endregion
39
39
  //#region src/service/onion_.ts
40
- var _dec$3, _dec2$3, _dec3$2, _class$3;
40
+ var _dec$3;
41
+ var _dec2$3;
42
+ var _dec3$2;
43
+ var _class$3;
41
44
  var ServiceOnion = (_dec$3 = ProxyDisable(), _dec2$3 = Service(), _dec3$2 = BeanInfo({ module: "a-bean" }), _dec$3(_class$3 = _dec2$3(_class$3 = _dec3$2(_class$3 = class ServiceOnion extends BeanSimple {
42
45
  constructor(...args) {
43
46
  super(...args);
@@ -140,7 +143,10 @@ var ServiceOnion = (_dec$3 = ProxyDisable(), _dec2$3 = Service(), _dec3$2 = Bean
140
143
  }) || _class$3) || _class$3) || _class$3);
141
144
  //#endregion
142
145
  //#region src/bean/sys.onion.ts
143
- var _dec$2, _dec2$2, _dec3$1, _class$2;
146
+ var _dec$2;
147
+ var _dec2$2;
148
+ var _dec3$1;
149
+ var _class$2;
144
150
  var SysOnion = (_dec$2 = ProxyDisable(), _dec2$2 = Sys(), _dec3$1 = BeanInfo({ module: "a-bean" }), _dec$2(_class$2 = _dec2$2(_class$2 = _dec3$1(_class$2 = class SysOnion extends BeanBase {
145
151
  constructor(...args) {
146
152
  super(...args);
@@ -170,7 +176,14 @@ function __onionMatchSelector(match, selector, matchThis, ...matchArgs) {
170
176
  var SymbolDecoratorUseAopMethod = Symbol("SymbolDecoratorUseAopMethod");
171
177
  //#endregion
172
178
  //#region src/service/aop.ts
173
- var _dec$1, _dec2$1, _dec3, _dec4, _dec5, _class$1, _class2, _descriptor;
179
+ var _dec$1;
180
+ var _dec2$1;
181
+ var _dec3;
182
+ var _dec4;
183
+ var _dec5;
184
+ var _class$1;
185
+ var _class2;
186
+ var _descriptor;
174
187
  function _initializerDefineProperty(e, i, r, l) {
175
188
  r && Object.defineProperty(e, i, {
176
189
  enumerable: r.enumerable,
@@ -258,7 +271,9 @@ function Scope() {
258
271
  //#region src/.metadata/index.ts
259
272
  /** monkeySys: end */
260
273
  /** scope: begin */
261
- var _dec, _dec2, _class;
274
+ var _dec;
275
+ var _dec2;
276
+ var _class;
262
277
  var ScopeModuleABean = (_dec = Scope(), _dec2 = BeanInfo({ module: "a-bean" }), _dec(_class = _dec2(_class = class ScopeModuleABean extends BeanScopeBase {}) || _class) || _class);
263
278
  /** scope: end */
264
279
  //#endregion
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/lib/bean.ts","../src/service/onion_.ts","../src/bean/sys.onion.ts","../src/types/aopMethod.ts","../src/service/aop.ts","../src/monkeySys.ts","../src/lib/scope.ts","../src/.metadata/index.ts","../src/lib/useAopMethod.ts","../src/types/onion.ts"],"sourcesContent":["import { createBeanDecorator } from 'zova';\nexport function Sys() {\n return createBeanDecorator('sys', 'sys');\n}\nexport function Bean() {\n return createBeanDecorator('bean', 'ctx');\n}\nexport function Service() {\n return createBeanDecorator('service', 'ctx');\n}\nexport function Tool() {\n return createBeanDecorator('tool', 'app');\n}\nexport function Data() {\n return createBeanDecorator('data', 'new');\n}\nexport function Controller() {\n return createBeanDecorator('controller', 'ctx');\n}\nexport function Render() {\n return createBeanDecorator('render', 'ctx');\n}\nexport function Style() {\n return createBeanDecorator('style', 'ctx');\n}\nexport function Aop(options) {\n return createBeanDecorator('aop', 'sys', true, options);\n}\nexport function AopMethod(options) {\n return createBeanDecorator('aopMethod', 'sys', true, options);\n}","var _dec, _dec2, _dec3, _class;\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\nimport { compose as _compose } from '@cabloy/compose';\nimport { swapDeps } from '@cabloy/deps';\nimport { getOnionScenesMeta } from '@cabloy/module-info';\nimport { appResource, BeanSimple, cast, deepExtend, ProxyDisable } from 'zova';\nimport { Service } from '../lib/bean.js';\n\n// const SymbolOnionsEnabled = Symbol('SymbolOnionsEnabled');\n// const SymbolOnionsEnabledWrapped = Symbol('SymbolOnionsEnabledWrapped');\n\nexport let ServiceOnion = (_dec = ProxyDisable(), _dec2 = Service(), _dec3 = __z_BeanInfo({\n module: \"a-bean\"\n}), _dec(_class = _dec2(_class = _dec3(_class = class ServiceOnion extends BeanSimple {\n constructor(...args) {\n super(...args);\n this.sysOnion = void 0;\n this.sceneName = void 0;\n this.sceneMeta = void 0;\n this.onionsAll = void 0;\n }\n // private [SymbolOnionsEnabled]: Record<string, IOnionSlice<OPTIONS, ONIONNAME>[]> = {};\n // private [SymbolOnionsEnabledWrapped]: Record<string, Function[]> = {};\n\n __init__(sceneName, sysOnion) {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n const modulesMeta = this.sys.meta.module.getModulesMeta();\n if (!modulesMeta) {\n throw new Error('module registry has been disposed');\n }\n this.sysOnion = sysOnion;\n this.sceneName = sceneName;\n this.sceneMeta = getOnionScenesMeta(modulesMeta.modules)[this.sceneName];\n if (this.sceneMeta.optionsPackage) {\n this._initOnionsAll(modulesMeta);\n this._swapOnions(this.onionsAll);\n }\n }\n _initOnionsAll(modulesMeta) {\n this.onionsAll = [];\n for (const moduleName in modulesMeta.modules) {\n const module = modulesMeta.modules[moduleName];\n const nodeItems = module.info.onionsMeta?.onionsConfig?.[this.sceneName];\n if (!nodeItems) continue;\n for (const itemName in nodeItems) {\n let itemOptions = nodeItems[itemName];\n // extend config\n const onionName = `${moduleName}:${itemName}`;\n const optionsConfig = this.sys.config.onions[this.sceneName]?.[onionName];\n if (optionsConfig) {\n itemOptions = deepExtend({}, itemOptions, optionsConfig);\n }\n this.onionsAll.push({\n name: onionName,\n options: itemOptions\n });\n }\n }\n }\n _swapOnions(onions) {\n swapDeps(onions, {\n name: 'name',\n dependencies: item => {\n const onionOptions = cast(item).options;\n return onionOptions.dependencies;\n },\n dependents: item => {\n const onionOptions = cast(item).options;\n return onionOptions.dependents;\n }\n });\n }\n\n // getOnionsEnabled(selector?: string) {\n // if (!selector) selector = '';\n // if (!this[SymbolOnionsEnabled][selector]) {\n // this[SymbolOnionsEnabled][selector] = this.onionsGlobal.filter(onionSlice => {\n // const onionOptions = onionSlice.beanOptions.options as IOnionOptionsEnable & IOnionOptionsMatch<string>;\n // return this.sysOnion.checkOnionOptionsEnabled(onionOptions, selector);\n // }) as unknown as IOnionSlice<OPTIONS, ONIONNAME>[];\n // }\n // return this[SymbolOnionsEnabled][selector];\n // }\n\n // getOnionsEnabledOfMeta(beanName: string, selector?: string) {\n // return this.getOnionsEnabled(selector).filter(item => item.beanOptions.name === beanName);\n // }\n\n // getOnionsEnabledWrapped(wrapFn: Function, selector?: string) {\n // if (!selector) selector = '';\n // if (!this[SymbolOnionsEnabledWrapped][selector]) {\n // const onions = this.getOnionsEnabled(selector);\n // this[SymbolOnionsEnabledWrapped][selector] = onions.map(item => {\n // return wrapFn(item);\n // });\n // }\n // return this[SymbolOnionsEnabledWrapped][selector];\n // }\n\n // getOnionSlice(onionName: ONIONNAME): IOnionSlice<OPTIONS, ONIONNAME> {\n // return this.onionsNormal[onionName];\n // }\n\n // getOnionOptions<OPTIONS>(onionName: ONIONNAME): OPTIONS | undefined {\n // return this.getOnionSlice(onionName).beanOptions.options as OPTIONS | undefined;\n // }\n\n async loadOnionsFromPackage(selector, matchThis, ...matchArgs) {\n // onionItems\n const onionItems = this.getOnionsEnabled(this.onionsAll, selector, matchThis, ...matchArgs);\n // loadOnions\n return await this.loadOnions(onionItems, selector, matchThis, ...matchArgs);\n }\n async loadOnions(onionItems, selector, matchThis, ...matchArgs) {\n if (!Array.isArray(onionItems)) onionItems = [onionItems];\n if (onionItems.length === 0) return [];\n // load modules\n const moduleNames = onionItems.map(item => item.name.split(':')[0]);\n await this._loadModules(moduleNames);\n // onion slices\n const onionSlices = [];\n for (const item of onionItems) {\n const beanFullName = item.name.replace(':', `.${this.sceneName}.`);\n const beanOptions = appResource.getBean(beanFullName);\n if (!beanOptions) throw new Error(`behavior not found: ${beanFullName}`);\n // options\n let options;\n if (beanOptions.optionsPrimitive) {\n options = item.options !== undefined ? item.options : beanOptions.options;\n } else {\n options = item.options !== undefined ? deepExtend({}, beanOptions.options, item.options) : beanOptions.options;\n }\n // ok\n onionSlices.push({\n name: item.name,\n options,\n beanFullName\n });\n }\n // optionsPackage\n if (this.sceneMeta.optionsPackage) return onionSlices;\n // swap\n this._swapOnions(onionSlices);\n // filter\n return this.getOnionsEnabled(onionSlices, selector, matchThis, ...matchArgs);\n }\n getOnionsEnabled(onions, selector, matchThis, ...matchArgs) {\n if (!onions) return [];\n return onions.filter(onionItem => {\n const onionOptions = onionItem.options;\n return this.sysOnion.checkOnionOptionsEnabled(onionOptions, selector, matchThis, ...matchArgs);\n });\n }\n compose(onions, executeCustom) {\n // fns\n const fns = [];\n for (const item of onions) {\n fns.push(this._wrapOnion(item, executeCustom));\n }\n // compose\n return _compose(fns);\n }\n async _loadModules(moduleNames) {\n // load modules\n moduleNames = Array.from(new Set(moduleNames)).filter(item => !this.sys.meta.module.get(item));\n await this.sys.meta.module.loadModules(moduleNames);\n }\n\n /** internal */\n _wrapOnion(item, executeCustom) {\n const fn = (data, next) => {\n return executeCustom(item, data, next);\n };\n fn._name = item.name;\n return fn;\n }\n}) || _class) || _class) || _class);","var _dec, _dec2, _dec3, _class;\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\nimport { checkMeta, isNil, matchSelector } from '@cabloy/utils';\nimport { BeanBase, ProxyDisable } from 'zova';\nimport { Sys } from '../lib/bean.js';\nimport { ServiceOnion } from '../service/onion_.js';\nexport let SysOnion = (_dec = ProxyDisable(), _dec2 = Sys(), _dec3 = __z_BeanInfo({\n module: \"a-bean\"\n}), _dec(_class = _dec2(_class = _dec3(_class = class SysOnion extends BeanBase {\n constructor(...args) {\n super(...args);\n this.__instances = {};\n }\n __get__(prop) {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n if (!this.__instances[prop]) {\n this.__instances[prop] = this.bean._newBeanSimple(ServiceOnion, false, prop, this);\n }\n return this.__instances[prop];\n }\n checkOnionOptionsEnabled(options, selector, matchThis, ...matchArgs) {\n if (options.enable === false) return false;\n if (!this.checkOnionOptionsMeta(options.meta)) return false;\n if (isNil(selector) || selector === false) return true;\n if (isNil(options.match) && isNil(options.ignore)) return true;\n return !isNil(options.match) && __onionMatchSelector(options.match, selector, matchThis, ...matchArgs) || !isNil(options.ignore) && !__onionMatchSelector(options.ignore, selector, matchThis, ...matchArgs);\n }\n checkOnionOptionsMeta(meta) {\n return checkMeta(meta, this.sys.config.meta);\n }\n}) || _class) || _class) || _class);\nfunction __onionMatchSelector(match, selector, matchThis, ...matchArgs) {\n return matchSelector(match, selector, matchThis, ...matchArgs);\n}","export const SymbolDecoratorUseAopMethod = Symbol('SymbolDecoratorUseAopMethod');","var _dec, _dec2, _dec3, _dec4, _dec5, _class, _class2, _descriptor;\nfunction _initializerDefineProperty(e, i, r, l) { r && Object.defineProperty(e, i, { enumerable: r.enumerable, configurable: r.configurable, writable: r.writable, value: r.initializer ? r.initializer.call(l) : void 0 }); }\nfunction _applyDecoratedDescriptor(i, e, r, n, l) { var a = {}; return Object.keys(n).forEach(function (i) { a[i] = n[i]; }), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, (\"value\" in a || a.initializer) && (a.writable = !0), a = r.slice().reverse().reduce(function (r, n) { return n(i, e, r) || r; }, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a; }\nfunction _initializerWarningHelper(r, e) { throw Error(\"Decorating class property failed. Please ensure that transform-class-properties is enabled and runs after the decorators transform.\"); }\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\nimport { appMetadata, appResource, BeanBase, ProxyDisable, Use } from 'zova';\nimport { SysOnion } from '../bean/sys.onion.js';\nimport { Service } from '../lib/bean.js';\nimport { SymbolDecoratorUseAopMethod } from '../types/aopMethod.js';\nexport let ServiceAop = (_dec = ProxyDisable(), _dec2 = Service(), _dec3 = __z_BeanInfo({\n module: \"a-bean\"\n}), _dec4 = Use(), _dec5 = Reflect.metadata(\"design:type\", typeof SysOnion === \"undefined\" ? Object : SysOnion), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class ServiceAop extends BeanBase {\n constructor(...args) {\n super(...args);\n _initializerDefineProperty(this, \"$$sysOnion\", _descriptor, this);\n }\n async findAopsMatched(beanFullName) {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n // beanOptions\n const beanOptions = appResource.getBean(beanFullName);\n if (!beanOptions) return;\n // loadOnions\n return await this.$$sysOnion.aop.loadOnionsFromPackage(beanOptions.beanFullName);\n }\n async findAopMethodsMatched(beanFullName) {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n // beanOptions\n const beanOptions = appResource.getBean(beanFullName);\n if (!beanOptions) return;\n const aopMethodsMatchedAll = {};\n const uses = appMetadata.getMetadata(SymbolDecoratorUseAopMethod, beanOptions.beanClass.prototype);\n for (const prop in uses) {\n const onionItems = [];\n const aopMethods = uses[prop];\n for (const aopMethod of aopMethods) {\n onionItems.push({\n name: aopMethod.onionName,\n options: aopMethod.options\n });\n }\n // load onions\n const onionSlices = await this.$$sysOnion.aopMethod.loadOnions(onionItems);\n // aopMethodsMatched\n const aopMethodsMatched = [];\n for (const onionSlice of onionSlices) {\n const beanInstance = await this.sys.bean._getBean(onionSlice.beanFullName, true);\n aopMethodsMatched.push({\n onionName: onionSlice.name,\n beanInstance,\n options: onionSlice.options\n });\n }\n aopMethodsMatchedAll[prop] = aopMethodsMatched;\n }\n return Object.keys(aopMethodsMatchedAll).length === 0 ? undefined : aopMethodsMatchedAll;\n }\n}, _descriptor = _applyDecoratedDescriptor(_class2.prototype, \"$$sysOnion\", [_dec4, _dec5], {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: null\n}), _class2)) || _class) || _class) || _class);","import { BeanSimple } from 'zova';\nexport class MonkeySys extends BeanSimple {\n async sysInitialize() {\n const modulesMeta = this.sys.meta.module.getModulesMeta();\n if (!modulesMeta) {\n throw new Error('module registry has been disposed');\n }\n let beansPreload = [];\n for (const moduleName in modulesMeta.modules) {\n const module = modulesMeta.modules[moduleName];\n if (!module.info.onionsMeta?.beansPreload) continue;\n beansPreload = beansPreload.concat(module.info.onionsMeta?.beansPreload);\n }\n const promises = beansPreload.map(item => {\n return this.sys.bean._getBean(item, false);\n });\n await Promise.all(promises);\n }\n}","import { createBeanDecorator } from 'zova';\nexport function Scope() {\n return createBeanDecorator('scope', 'app', false);\n}","var _dec, _dec2, _class;\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\n// eslint-disable\n/** sys: begin */\nexport * from '../bean/sys.onion.js';\nimport 'zova';\n/** sys: end */\n/** sys: begin */\nimport { SysOnion } from '../bean/sys.onion.js';\nimport 'zova';\n/** sys: end */\n/** service: begin */\nexport * from '../service/aop.js';\nexport * from '../service/onion_.js';\nimport 'zova-module-a-bean';\n/** service: end */\n/** service: begin */\nimport { ServiceAop } from '../service/aop.js';\nimport 'zova';\n/** service: end */\n/** monkeySys: begin */\nexport * from '../monkeySys.js';\n/** monkeySys: end */\n/** scope: begin */\nimport { BeanScopeBase } from 'zova';\nimport { Scope } from '../lib/scope.js';\nexport let ScopeModuleABean = (_dec = Scope(), _dec2 = __z_BeanInfo({\n module: \"a-bean\"\n}), _dec(_class = _dec2(_class = class ScopeModuleABean extends BeanScopeBase {}) || _class) || _class);\nimport 'zova';\n\n/** scope: end */","import { appMetadata, registerMappedClassMetadataKey } from 'zova';\nimport { SymbolDecoratorUseAopMethod } from '../types/aopMethod.js';\nexport function UseAopMethod(aopMethodName, options) {\n return function (target, prop, descriptor) {\n registerMappedClassMetadataKey(target, SymbolDecoratorUseAopMethod);\n const uses = appMetadata.getOwnMetadataMap(true, SymbolDecoratorUseAopMethod, target);\n if (!uses[prop]) uses[prop] = [];\n uses[prop].push({\n onionName: aopMethodName,\n options\n });\n return descriptor;\n };\n}","export const SymbolUseOnionLocal = Symbol('SymbolUseOnionLocal');\nexport const SymbolUseOnionOptions = Symbol('SymbolUseOnionOptions');"],"mappings":";;;;;;;AACA,SAAgB,MAAM;CACpB,OAAO,oBAAoB,OAAO,KAAK;AACzC;AACA,SAAgB,OAAO;CACrB,OAAO,oBAAoB,QAAQ,KAAK;AAC1C;AACA,SAAgB,UAAU;CACxB,OAAO,oBAAoB,WAAW,KAAK;AAC7C;AACA,SAAgB,OAAO;CACrB,OAAO,oBAAoB,QAAQ,KAAK;AAC1C;AACA,SAAgB,OAAO;CACrB,OAAO,oBAAoB,QAAQ,KAAK;AAC1C;AACA,SAAgB,aAAa;CAC3B,OAAO,oBAAoB,cAAc,KAAK;AAChD;AACA,SAAgB,SAAS;CACvB,OAAO,oBAAoB,UAAU,KAAK;AAC5C;AACA,SAAgB,QAAQ;CACtB,OAAO,oBAAoB,SAAS,KAAK;AAC3C;AACA,SAAgB,IAAI,SAAS;CAC3B,OAAO,oBAAoB,OAAO,OAAO,MAAM,OAAO;AACxD;AACA,SAAgB,UAAU,SAAS;CACjC,OAAO,oBAAoB,aAAa,OAAO,MAAM,OAAO;AAC9D;;;AC9BA,IAAI,QAAM,SAAO,SAAO;AAWxB,IAAW,gBAAgB,SAAO,aAAa,GAAG,UAAQ,QAAQ,GAAG,UAAQ,SAAa,EACxF,QAAQ,SACV,CAAC,GAAG,OAAK,WAAS,QAAM,WAAS,QAAM,WAAS,MAAM,qBAAqB,WAAW;CACpF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AAe,SAAS;CACnD,OAAO,SAAU,QAAQ,MAAM,YAAY;EACzC,+BAA+B,QAAQ,2BAA2B;EAClE,MAAM,OAAO,YAAY,kBAAkB,MAAM,6BAA6B,MAAM;EACpF,IAAI,CAAC,KAAK,OAAO,KAAK,QAAQ,CAAC;EAC/B,KAAK,KAAK,CAAC,KAAK;GACd,WAAW;GACX;EACF,CAAC;EACD,OAAO;CACT;AACF;;;ACbA,IAAa,sBAAsB,OAAO,qBAAqB;AAC/D,IAAa,wBAAwB,OAAO,uBAAuB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/lib/bean.ts","../src/service/onion_.ts","../src/bean/sys.onion.ts","../src/types/aopMethod.ts","../src/service/aop.ts","../src/monkeySys.ts","../src/lib/scope.ts","../src/.metadata/index.ts","../src/lib/useAopMethod.ts","../src/types/onion.ts"],"sourcesContent":["import { createBeanDecorator } from 'zova';\nexport function Sys() {\n return createBeanDecorator('sys', 'sys');\n}\nexport function Bean() {\n return createBeanDecorator('bean', 'ctx');\n}\nexport function Service() {\n return createBeanDecorator('service', 'ctx');\n}\nexport function Tool() {\n return createBeanDecorator('tool', 'app');\n}\nexport function Data() {\n return createBeanDecorator('data', 'new');\n}\nexport function Controller() {\n return createBeanDecorator('controller', 'ctx');\n}\nexport function Render() {\n return createBeanDecorator('render', 'ctx');\n}\nexport function Style() {\n return createBeanDecorator('style', 'ctx');\n}\nexport function Aop(options) {\n return createBeanDecorator('aop', 'sys', true, options);\n}\nexport function AopMethod(options) {\n return createBeanDecorator('aopMethod', 'sys', true, options);\n}","var _dec, _dec2, _dec3, _class;\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\nimport { compose as _compose } from '@cabloy/compose';\nimport { swapDeps } from '@cabloy/deps';\nimport { getOnionScenesMeta } from '@cabloy/module-info';\nimport { appResource, BeanSimple, cast, deepExtend, ProxyDisable } from 'zova';\nimport { Service } from '../lib/bean.js';\n\n// const SymbolOnionsEnabled = Symbol('SymbolOnionsEnabled');\n// const SymbolOnionsEnabledWrapped = Symbol('SymbolOnionsEnabledWrapped');\n\nexport let ServiceOnion = (_dec = ProxyDisable(), _dec2 = Service(), _dec3 = __z_BeanInfo({\n module: \"a-bean\"\n}), _dec(_class = _dec2(_class = _dec3(_class = class ServiceOnion extends BeanSimple {\n constructor(...args) {\n super(...args);\n this.sysOnion = void 0;\n this.sceneName = void 0;\n this.sceneMeta = void 0;\n this.onionsAll = void 0;\n }\n // private [SymbolOnionsEnabled]: Record<string, IOnionSlice<OPTIONS, ONIONNAME>[]> = {};\n // private [SymbolOnionsEnabledWrapped]: Record<string, Function[]> = {};\n\n __init__(sceneName, sysOnion) {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n const modulesMeta = this.sys.meta.module.getModulesMeta();\n if (!modulesMeta) {\n throw new Error('module registry has been disposed');\n }\n this.sysOnion = sysOnion;\n this.sceneName = sceneName;\n this.sceneMeta = getOnionScenesMeta(modulesMeta.modules)[this.sceneName];\n if (this.sceneMeta.optionsPackage) {\n this._initOnionsAll(modulesMeta);\n this._swapOnions(this.onionsAll);\n }\n }\n _initOnionsAll(modulesMeta) {\n this.onionsAll = [];\n for (const moduleName in modulesMeta.modules) {\n const module = modulesMeta.modules[moduleName];\n const nodeItems = module.info.onionsMeta?.onionsConfig?.[this.sceneName];\n if (!nodeItems) continue;\n for (const itemName in nodeItems) {\n let itemOptions = nodeItems[itemName];\n // extend config\n const onionName = `${moduleName}:${itemName}`;\n const optionsConfig = this.sys.config.onions[this.sceneName]?.[onionName];\n if (optionsConfig) {\n itemOptions = deepExtend({}, itemOptions, optionsConfig);\n }\n this.onionsAll.push({\n name: onionName,\n options: itemOptions\n });\n }\n }\n }\n _swapOnions(onions) {\n swapDeps(onions, {\n name: 'name',\n dependencies: item => {\n const onionOptions = cast(item).options;\n return onionOptions.dependencies;\n },\n dependents: item => {\n const onionOptions = cast(item).options;\n return onionOptions.dependents;\n }\n });\n }\n\n // getOnionsEnabled(selector?: string) {\n // if (!selector) selector = '';\n // if (!this[SymbolOnionsEnabled][selector]) {\n // this[SymbolOnionsEnabled][selector] = this.onionsGlobal.filter(onionSlice => {\n // const onionOptions = onionSlice.beanOptions.options as IOnionOptionsEnable & IOnionOptionsMatch<string>;\n // return this.sysOnion.checkOnionOptionsEnabled(onionOptions, selector);\n // }) as unknown as IOnionSlice<OPTIONS, ONIONNAME>[];\n // }\n // return this[SymbolOnionsEnabled][selector];\n // }\n\n // getOnionsEnabledOfMeta(beanName: string, selector?: string) {\n // return this.getOnionsEnabled(selector).filter(item => item.beanOptions.name === beanName);\n // }\n\n // getOnionsEnabledWrapped(wrapFn: Function, selector?: string) {\n // if (!selector) selector = '';\n // if (!this[SymbolOnionsEnabledWrapped][selector]) {\n // const onions = this.getOnionsEnabled(selector);\n // this[SymbolOnionsEnabledWrapped][selector] = onions.map(item => {\n // return wrapFn(item);\n // });\n // }\n // return this[SymbolOnionsEnabledWrapped][selector];\n // }\n\n // getOnionSlice(onionName: ONIONNAME): IOnionSlice<OPTIONS, ONIONNAME> {\n // return this.onionsNormal[onionName];\n // }\n\n // getOnionOptions<OPTIONS>(onionName: ONIONNAME): OPTIONS | undefined {\n // return this.getOnionSlice(onionName).beanOptions.options as OPTIONS | undefined;\n // }\n\n async loadOnionsFromPackage(selector, matchThis, ...matchArgs) {\n // onionItems\n const onionItems = this.getOnionsEnabled(this.onionsAll, selector, matchThis, ...matchArgs);\n // loadOnions\n return await this.loadOnions(onionItems, selector, matchThis, ...matchArgs);\n }\n async loadOnions(onionItems, selector, matchThis, ...matchArgs) {\n if (!Array.isArray(onionItems)) onionItems = [onionItems];\n if (onionItems.length === 0) return [];\n // load modules\n const moduleNames = onionItems.map(item => item.name.split(':')[0]);\n await this._loadModules(moduleNames);\n // onion slices\n const onionSlices = [];\n for (const item of onionItems) {\n const beanFullName = item.name.replace(':', `.${this.sceneName}.`);\n const beanOptions = appResource.getBean(beanFullName);\n if (!beanOptions) throw new Error(`behavior not found: ${beanFullName}`);\n // options\n let options;\n if (beanOptions.optionsPrimitive) {\n options = item.options !== undefined ? item.options : beanOptions.options;\n } else {\n options = item.options !== undefined ? deepExtend({}, beanOptions.options, item.options) : beanOptions.options;\n }\n // ok\n onionSlices.push({\n name: item.name,\n options,\n beanFullName\n });\n }\n // optionsPackage\n if (this.sceneMeta.optionsPackage) return onionSlices;\n // swap\n this._swapOnions(onionSlices);\n // filter\n return this.getOnionsEnabled(onionSlices, selector, matchThis, ...matchArgs);\n }\n getOnionsEnabled(onions, selector, matchThis, ...matchArgs) {\n if (!onions) return [];\n return onions.filter(onionItem => {\n const onionOptions = onionItem.options;\n return this.sysOnion.checkOnionOptionsEnabled(onionOptions, selector, matchThis, ...matchArgs);\n });\n }\n compose(onions, executeCustom) {\n // fns\n const fns = [];\n for (const item of onions) {\n fns.push(this._wrapOnion(item, executeCustom));\n }\n // compose\n return _compose(fns);\n }\n async _loadModules(moduleNames) {\n // load modules\n moduleNames = Array.from(new Set(moduleNames)).filter(item => !this.sys.meta.module.get(item));\n await this.sys.meta.module.loadModules(moduleNames);\n }\n\n /** internal */\n _wrapOnion(item, executeCustom) {\n const fn = (data, next) => {\n return executeCustom(item, data, next);\n };\n fn._name = item.name;\n return fn;\n }\n}) || _class) || _class) || _class);","var _dec, _dec2, _dec3, _class;\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\nimport { checkMeta, isNil, matchSelector } from '@cabloy/utils';\nimport { BeanBase, ProxyDisable } from 'zova';\nimport { Sys } from '../lib/bean.js';\nimport { ServiceOnion } from '../service/onion_.js';\nexport let SysOnion = (_dec = ProxyDisable(), _dec2 = Sys(), _dec3 = __z_BeanInfo({\n module: \"a-bean\"\n}), _dec(_class = _dec2(_class = _dec3(_class = class SysOnion extends BeanBase {\n constructor(...args) {\n super(...args);\n this.__instances = {};\n }\n __get__(prop) {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n if (!this.__instances[prop]) {\n this.__instances[prop] = this.bean._newBeanSimple(ServiceOnion, false, prop, this);\n }\n return this.__instances[prop];\n }\n checkOnionOptionsEnabled(options, selector, matchThis, ...matchArgs) {\n if (options.enable === false) return false;\n if (!this.checkOnionOptionsMeta(options.meta)) return false;\n if (isNil(selector) || selector === false) return true;\n if (isNil(options.match) && isNil(options.ignore)) return true;\n return !isNil(options.match) && __onionMatchSelector(options.match, selector, matchThis, ...matchArgs) || !isNil(options.ignore) && !__onionMatchSelector(options.ignore, selector, matchThis, ...matchArgs);\n }\n checkOnionOptionsMeta(meta) {\n return checkMeta(meta, this.sys.config.meta);\n }\n}) || _class) || _class) || _class);\nfunction __onionMatchSelector(match, selector, matchThis, ...matchArgs) {\n return matchSelector(match, selector, matchThis, ...matchArgs);\n}","export const SymbolDecoratorUseAopMethod = Symbol('SymbolDecoratorUseAopMethod');","var _dec, _dec2, _dec3, _dec4, _dec5, _class, _class2, _descriptor;\nfunction _initializerDefineProperty(e, i, r, l) { r && Object.defineProperty(e, i, { enumerable: r.enumerable, configurable: r.configurable, writable: r.writable, value: r.initializer ? r.initializer.call(l) : void 0 }); }\nfunction _applyDecoratedDescriptor(i, e, r, n, l) { var a = {}; return Object.keys(n).forEach(function (i) { a[i] = n[i]; }), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, (\"value\" in a || a.initializer) && (a.writable = !0), a = r.slice().reverse().reduce(function (r, n) { return n(i, e, r) || r; }, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a; }\nfunction _initializerWarningHelper(r, e) { throw Error(\"Decorating class property failed. Please ensure that transform-class-properties is enabled and runs after the decorators transform.\"); }\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\nimport { appMetadata, appResource, BeanBase, ProxyDisable, Use } from 'zova';\nimport { SysOnion } from '../bean/sys.onion.js';\nimport { Service } from '../lib/bean.js';\nimport { SymbolDecoratorUseAopMethod } from '../types/aopMethod.js';\nexport let ServiceAop = (_dec = ProxyDisable(), _dec2 = Service(), _dec3 = __z_BeanInfo({\n module: \"a-bean\"\n}), _dec4 = Use(), _dec5 = Reflect.metadata(\"design:type\", typeof SysOnion === \"undefined\" ? Object : SysOnion), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class ServiceAop extends BeanBase {\n constructor(...args) {\n super(...args);\n _initializerDefineProperty(this, \"$$sysOnion\", _descriptor, this);\n }\n async findAopsMatched(beanFullName) {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n // beanOptions\n const beanOptions = appResource.getBean(beanFullName);\n if (!beanOptions) return;\n // loadOnions\n return await this.$$sysOnion.aop.loadOnionsFromPackage(beanOptions.beanFullName);\n }\n async findAopMethodsMatched(beanFullName) {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n // beanOptions\n const beanOptions = appResource.getBean(beanFullName);\n if (!beanOptions) return;\n const aopMethodsMatchedAll = {};\n const uses = appMetadata.getMetadata(SymbolDecoratorUseAopMethod, beanOptions.beanClass.prototype);\n for (const prop in uses) {\n const onionItems = [];\n const aopMethods = uses[prop];\n for (const aopMethod of aopMethods) {\n onionItems.push({\n name: aopMethod.onionName,\n options: aopMethod.options\n });\n }\n // load onions\n const onionSlices = await this.$$sysOnion.aopMethod.loadOnions(onionItems);\n // aopMethodsMatched\n const aopMethodsMatched = [];\n for (const onionSlice of onionSlices) {\n const beanInstance = await this.sys.bean._getBean(onionSlice.beanFullName, true);\n aopMethodsMatched.push({\n onionName: onionSlice.name,\n beanInstance,\n options: onionSlice.options\n });\n }\n aopMethodsMatchedAll[prop] = aopMethodsMatched;\n }\n return Object.keys(aopMethodsMatchedAll).length === 0 ? undefined : aopMethodsMatchedAll;\n }\n}, _descriptor = _applyDecoratedDescriptor(_class2.prototype, \"$$sysOnion\", [_dec4, _dec5], {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: null\n}), _class2)) || _class) || _class) || _class);","import { BeanSimple } from 'zova';\nexport class MonkeySys extends BeanSimple {\n async sysInitialize() {\n const modulesMeta = this.sys.meta.module.getModulesMeta();\n if (!modulesMeta) {\n throw new Error('module registry has been disposed');\n }\n let beansPreload = [];\n for (const moduleName in modulesMeta.modules) {\n const module = modulesMeta.modules[moduleName];\n if (!module.info.onionsMeta?.beansPreload) continue;\n beansPreload = beansPreload.concat(module.info.onionsMeta?.beansPreload);\n }\n const promises = beansPreload.map(item => {\n return this.sys.bean._getBean(item, false);\n });\n await Promise.all(promises);\n }\n}","import { createBeanDecorator } from 'zova';\nexport function Scope() {\n return createBeanDecorator('scope', 'app', false);\n}","var _dec, _dec2, _class;\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\n// eslint-disable\n/** sys: begin */\nexport * from '../bean/sys.onion.js';\nimport 'zova';\n/** sys: end */\n/** sys: begin */\nimport { SysOnion } from '../bean/sys.onion.js';\nimport 'zova';\n/** sys: end */\n/** service: begin */\nexport * from '../service/aop.js';\nexport * from '../service/onion_.js';\nimport 'zova-module-a-bean';\n/** service: end */\n/** service: begin */\nimport { ServiceAop } from '../service/aop.js';\nimport 'zova';\n/** service: end */\n/** monkeySys: begin */\nexport * from '../monkeySys.js';\n/** monkeySys: end */\n/** scope: begin */\nimport { BeanScopeBase } from 'zova';\nimport { Scope } from '../lib/scope.js';\nexport let ScopeModuleABean = (_dec = Scope(), _dec2 = __z_BeanInfo({\n module: \"a-bean\"\n}), _dec(_class = _dec2(_class = class ScopeModuleABean extends BeanScopeBase {}) || _class) || _class);\nimport 'zova';\n\n/** scope: end */","import { appMetadata, registerMappedClassMetadataKey } from 'zova';\nimport { SymbolDecoratorUseAopMethod } from '../types/aopMethod.js';\nexport function UseAopMethod(aopMethodName, options) {\n return function (target, prop, descriptor) {\n registerMappedClassMetadataKey(target, SymbolDecoratorUseAopMethod);\n const uses = appMetadata.getOwnMetadataMap(true, SymbolDecoratorUseAopMethod, target);\n if (!uses[prop]) uses[prop] = [];\n uses[prop].push({\n onionName: aopMethodName,\n options\n });\n return descriptor;\n };\n}","export const SymbolUseOnionLocal = Symbol('SymbolUseOnionLocal');\nexport const SymbolUseOnionOptions = Symbol('SymbolUseOnionOptions');"],"mappings":";;;;;;;AACA,SAAgB,MAAM;CACpB,OAAO,oBAAoB,OAAO,KAAK;AACzC;AACA,SAAgB,OAAO;CACrB,OAAO,oBAAoB,QAAQ,KAAK;AAC1C;AACA,SAAgB,UAAU;CACxB,OAAO,oBAAoB,WAAW,KAAK;AAC7C;AACA,SAAgB,OAAO;CACrB,OAAO,oBAAoB,QAAQ,KAAK;AAC1C;AACA,SAAgB,OAAO;CACrB,OAAO,oBAAoB,QAAQ,KAAK;AAC1C;AACA,SAAgB,aAAa;CAC3B,OAAO,oBAAoB,cAAc,KAAK;AAChD;AACA,SAAgB,SAAS;CACvB,OAAO,oBAAoB,UAAU,KAAK;AAC5C;AACA,SAAgB,QAAQ;CACtB,OAAO,oBAAoB,SAAS,KAAK;AAC3C;AACA,SAAgB,IAAI,SAAS;CAC3B,OAAO,oBAAoB,OAAO,OAAO,MAAM,OAAO;AACxD;AACA,SAAgB,UAAU,SAAS;CACjC,OAAO,oBAAoB,aAAa,OAAO,MAAM,OAAO;AAC9D;;;AC9BA,IAAI;AAAM,IAAA;AAAO,IAAA;AAAO,IAAA;AAWxB,IAAW,gBAAgB,SAAO,aAAa,GAAG,UAAQ,QAAQ,GAAG,UAAQ,SAAa,EACxF,QAAQ,SACV,CAAC,GAAG,OAAK,WAAS,QAAM,WAAS,QAAM,WAAS,MAAM,qBAAqB,WAAW;CACpF,YAAY,GAAG,MAAM;EACnB,MAAM,GAAG,IAAI;EACb,KAAK,WAAW,KAAK;EACrB,KAAK,YAAY,KAAK;EACtB,KAAK,YAAY,KAAK;EACtB,KAAK,YAAY,KAAK;CACxB;CAIA,SAAS,WAAW,UAAU;EAC5B,IAAI,QAAQ,IAAI,OAAO,KAAK,KAAK,kBAAkB,OACjD,MAAM,IAAI,MAAM,yBAAy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;EAC/B,KAAK,KAAK,CAAC,KAAK;GACd,WAAW;GACX;EACF,CAAC;EACD,OAAO;CACT;AACF;;;ACbA,IAAa,sBAAsB,OAAO,qBAAqB;AAC/D,IAAa,wBAAwB,OAAO,uBAAuB"}
@@ -2,7 +2,7 @@ import { combineContentRenderAndStyle } from "./utils.js";
2
2
  export async function generateFileComponent(options, globFile, controllerInfo) {
3
3
  const { moduleName } = options;
4
4
  const { className } = globFile;
5
- const { name, nameCapitalize, controllerExtJs, hasComponentOptions, nameProps, hasProps, hasGeneric, nameModels, hasModels, hasModelValue, generic, genericKeys, generateImports, importRenderFirst, hasRenderFirst, classNameRenderFirst, importStyleFirst, hasStyleFirst, classNameStyleFirst, } = controllerInfo;
5
+ const { type, name, nameCapitalize, controllerExtJs, hasComponentOptions, nameProps, hasProps, hasGeneric, nameModels, hasModels, hasModelValue, generic, genericKeys, generateImports, importRenderFirst, hasRenderFirst, classNameRenderFirst, importStyleFirst, hasStyleFirst, classNameStyleFirst, } = controllerInfo;
6
6
  const contentImports = [];
7
7
  if (generateImports) {
8
8
  contentImports.push(...generateImports);
@@ -30,6 +30,9 @@ export async function generateFileComponent(options, globFile, controllerInfo) {
30
30
  if (_contentImportTypeController.length > 0) {
31
31
  contentImports.push(`import type { ${_contentImportTypeController.join(', ')} } from '../../component/${name}/controller${controllerExtJs}';`);
32
32
  }
33
+ if (type === 'component' && name === 'routedDialog') {
34
+ contentImports.push("import { routeLocationKey, routerKey, routerViewLocationKey, viewDepthKey } from '@cabloy/vue-router';", "import { computed, provide, shallowReactive } from 'vue';");
35
+ }
33
36
  contentImports.push("import { defineComponent } from 'vue'");
34
37
  contentImports.push("import { prepareComponentOptions, useController } from 'zova';");
35
38
  // controller
@@ -98,7 +101,38 @@ export async function generateFileComponent(options, globFile, controllerInfo) {
98
101
  }`;
99
102
  }
100
103
  // component
101
- const contentComponent = `export const Z${nameCapitalize} = defineComponent(
104
+ const contentComponent = type === 'component' && name === 'routedDialog'
105
+ ? `export const Z${nameCapitalize} = defineComponent(
106
+ ${genericDeclare}(props: ${typeControllerPublicPropsName}${genericArguments}) => {
107
+ const router = props.item.state.router;
108
+ if (router) {
109
+ const currentRoute = router.currentRoute;
110
+ const reactiveRoute = {} as Record<string, unknown>;
111
+ for (const key in currentRoute.value) {
112
+ Object.defineProperty(reactiveRoute, key, {
113
+ get: () => currentRoute.value[key],
114
+ enumerable: true,
115
+ });
116
+ }
117
+ provide(routerKey, router.router);
118
+ provide(routeLocationKey, shallowReactive(reactiveRoute) as any);
119
+ provide(routerViewLocationKey, currentRoute);
120
+ provide(
121
+ viewDepthKey,
122
+ computed(() => router.getEmbeddedRouterViewDepth(currentRoute.value)),
123
+ );
124
+ }
125
+ useController(${className}, ${hasRenderFirst ? classNameRenderFirst : undefined}, ${hasStyleFirst ? classNameStyleFirst : undefined});
126
+ return () => {};
127
+ },
128
+ {
129
+ ...prepareComponentOptions(${componentOptions}),
130
+ props: {
131
+ item: { type: Object, required: true },
132
+ },
133
+ },
134
+ );`
135
+ : `export const Z${nameCapitalize} = defineComponent(
102
136
  ${genericDeclare}(_props: ${typeControllerPublicPropsName}${genericArguments}) => {
103
137
  useController(${className}, ${hasRenderFirst ? classNameRenderFirst : undefined}, ${hasStyleFirst ? classNameStyleFirst : undefined});
104
138
  return () => {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zova-module-a-bean",
3
- "version": "5.1.33",
4
- "gitHead": "eb85d771ef75776a439e56df3af8be6a3a36c1c2",
3
+ "version": "5.1.34",
4
+ "gitHead": "bd7ffc467ab9d5e7e420e38d1c36a1162991f9fc",
5
5
  "description": "",
6
6
  "keywords": [
7
7
  "Zova Module"