@ibiz-template/runtime 0.7.41-alpha.138 → 0.7.41-alpha.139
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.
- package/dist/index.esm.js +253 -254
- package/dist/index.system.min.js +1 -1
- package/out/de-logic/de-logic-context.d.ts +14 -4
- package/out/de-logic/de-logic-context.d.ts.map +1 -1
- package/out/de-logic/de-logic-context.js +4 -3
- package/out/de-logic/de-logic.d.ts.map +1 -1
- package/out/de-logic/de-logic.js +4 -7
- package/out/de-logic/index.js +1 -1
- package/out/interface/api/common/i-api-de-logic-params.d.ts +7 -0
- package/out/interface/api/common/i-api-de-logic-params.d.ts.map +1 -1
- package/out/interface/api/common/i-api-logic-params.d.ts +1 -7
- package/out/interface/api/common/i-api-logic-params.d.ts.map +1 -1
- package/out/interface/api/common/i-api-ui-logic-params.d.ts +7 -0
- package/out/interface/api/common/i-api-ui-logic-params.d.ts.map +1 -1
- package/out/interface/de-logic/i-de-logic-context.d.ts +10 -0
- package/out/interface/de-logic/i-de-logic-context.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/de-logic/de-logic-context.ts +17 -4
- package/src/de-logic/de-logic.ts +4 -7
- package/src/de-logic/index.ts +1 -1
- package/src/interface/api/common/i-api-de-logic-params.ts +9 -1
- package/src/interface/api/common/i-api-logic-params.ts +1 -8
- package/src/interface/api/common/i-api-ui-logic-params.ts +8 -0
- package/src/interface/de-logic/i-de-logic-context.ts +8 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DELogicParam } from './de-logic-param/de-logic-param';
|
|
2
|
-
import { IDeLogicContext
|
|
2
|
+
import { IDeLogicContext } from '../interface';
|
|
3
3
|
/**
|
|
4
4
|
* 实体逻辑执行上下文
|
|
5
5
|
*
|
|
@@ -10,7 +10,6 @@ import { IDeLogicContext, IDeLogicParams } from '../interface';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class DELogicContext implements IDeLogicContext {
|
|
12
12
|
private deLogicParams;
|
|
13
|
-
parameters: IDeLogicParams;
|
|
14
13
|
/**
|
|
15
14
|
* 上一次返回值
|
|
16
15
|
* @author lxm
|
|
@@ -18,6 +17,17 @@ export declare class DELogicContext implements IDeLogicContext {
|
|
|
18
17
|
* @type {unknown}
|
|
19
18
|
*/
|
|
20
19
|
lastReturn: unknown;
|
|
20
|
+
/**
|
|
21
|
+
* 实体逻辑执行参数
|
|
22
|
+
* @author lxm
|
|
23
|
+
* @date 2023-10-16 02:22:31
|
|
24
|
+
* @type {{ context: IContext; data: IData[]; params: IParams }}
|
|
25
|
+
*/
|
|
26
|
+
parameters: {
|
|
27
|
+
context: IContext;
|
|
28
|
+
data: IData[];
|
|
29
|
+
params: IParams;
|
|
30
|
+
};
|
|
21
31
|
/**
|
|
22
32
|
* 上下文
|
|
23
33
|
*/
|
|
@@ -36,10 +46,10 @@ export declare class DELogicContext implements IDeLogicContext {
|
|
|
36
46
|
* @date 2023-03-24 09:15:14
|
|
37
47
|
* @param {Map<string, DELogicParam>} deLogicParams 实体逻辑参数集合
|
|
38
48
|
* @param {IContext} context 上下文
|
|
39
|
-
* @param {IData} data 数据对象
|
|
49
|
+
* @param {IData | IData[]} data 数据对象
|
|
40
50
|
* @param {IParams} params 视图参数
|
|
41
51
|
*/
|
|
42
|
-
constructor(deLogicParams: Map<string, DELogicParam>,
|
|
52
|
+
constructor(deLogicParams: Map<string, DELogicParam>, context: IContext, data: IData | IData[], params: IParams);
|
|
43
53
|
/**
|
|
44
54
|
* 重置实体逻辑参数
|
|
45
55
|
* @author lxm
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"de-logic-context.d.ts","sourceRoot":"","sources":["../../src/de-logic/de-logic-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"de-logic-context.d.ts","sourceRoot":"","sources":["../../src/de-logic/de-logic-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;;;;;;GAOG;AACH,qBAAa,cAAe,YAAW,eAAe;IAsDlD,OAAO,CAAC,aAAa;IArDvB;;;;;OAKG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;;;;OAKG;IACH,UAAU,EAAE;QAAE,OAAO,EAAE,QAAQ,CAAC;QAAC,IAAI,EAAE,KAAK,EAAE,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;IAElE;;OAEG;IACH,IAAI,OAAO,IAAI,QAAQ,CAKtB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,KAAK,EAAE,CAElB;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAKvB;IAED;;;;;;;;OAQG;gBAEO,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAChD,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,GAAG,KAAK,EAAE,EACrB,MAAM,EAAE,OAAO;IAKjB;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI9B;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI9B;;;;;;;OAOG;IAEH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAEjC;;;;;;OAMG;IACH,MAAM,EAAE,OAAO,CAAQ;IAEvB;;;;;;OAMG;IACH,SAAS,EAAE,OAAO,CAAS;IAE3B;;;;;;OAMG;IACH,gBAAgB,EAAE,MAAM,CAAa;IAErC;;;;;OAKG;IACH,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAInC;;;;;OAKG;IACH,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQtC;;;;;;OAMG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;CAIxC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isArray } from 'lodash-es';
|
|
1
2
|
/**
|
|
2
3
|
* 实体逻辑执行上下文
|
|
3
4
|
*
|
|
@@ -37,12 +38,11 @@ export class DELogicContext {
|
|
|
37
38
|
* @date 2023-03-24 09:15:14
|
|
38
39
|
* @param {Map<string, DELogicParam>} deLogicParams 实体逻辑参数集合
|
|
39
40
|
* @param {IContext} context 上下文
|
|
40
|
-
* @param {IData} data 数据对象
|
|
41
|
+
* @param {IData | IData[]} data 数据对象
|
|
41
42
|
* @param {IParams} params 视图参数
|
|
42
43
|
*/
|
|
43
|
-
constructor(deLogicParams,
|
|
44
|
+
constructor(deLogicParams, context, data, params) {
|
|
44
45
|
this.deLogicParams = deLogicParams;
|
|
45
|
-
this.parameters = parameters;
|
|
46
46
|
/**
|
|
47
47
|
* 实体逻辑参数
|
|
48
48
|
*
|
|
@@ -77,6 +77,7 @@ export class DELogicContext {
|
|
|
77
77
|
* @type {string}
|
|
78
78
|
*/
|
|
79
79
|
this.defaultParamName = 'Default';
|
|
80
|
+
this.parameters = { context, data: isArray(data) ? data : [data], params };
|
|
80
81
|
}
|
|
81
82
|
/**
|
|
82
83
|
* 重置实体逻辑参数
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"de-logic.d.ts","sourceRoot":"","sources":["../../src/de-logic/de-logic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"de-logic.d.ts","sourceRoot":"","sources":["../../src/de-logic/de-logic.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAiB,cAAc,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGtE;;;;;GAKG;AACH,qBAAa,OAAQ,YAAW,QAAQ;IAqC7B,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,cAAc;IArC/B;;;;;;;OAOG;IACH,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAa;IAEvD;;;;;;;OAOG;IACH,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAa;IAExD;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;IAEpC;;;;;OAKG;gBAEM,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,cAAc;IAG/B;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA0C3B;;;;;OAKG;IACH,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI;IASpD;;;;;OAKG;IACG,IAAI,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IA0BxD;;;;;;;OAOG;cACa,QAAQ,CACtB,IAAI,EAAE,YAAY,EAClB,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,IAAI,CAAC;CAiBjB"}
|
package/out/de-logic/de-logic.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-await-in-loop */
|
|
2
|
-
import {
|
|
3
|
-
import { clone } from 'ramda';
|
|
2
|
+
import { RuntimeModelError } from '@ibiz-template/core';
|
|
4
3
|
import { ScriptFactory } from '../utils';
|
|
5
4
|
import { DELogicContext } from './de-logic-context';
|
|
6
5
|
import { DELogicParam } from './de-logic-param/de-logic-param';
|
|
@@ -97,13 +96,11 @@ export class DELogic {
|
|
|
97
96
|
* @memberof DELogic
|
|
98
97
|
*/
|
|
99
98
|
async exec(parameters) {
|
|
100
|
-
|
|
101
|
-
parameters.context = IBizContext.create(parameters.context);
|
|
102
|
-
parameters.params = clone(parameters.params || {});
|
|
99
|
+
const { context, params, data } = parameters;
|
|
103
100
|
if (this.scriptFn) {
|
|
104
|
-
return this.scriptFn.exec(
|
|
101
|
+
return this.scriptFn.exec({ context, data, params });
|
|
105
102
|
}
|
|
106
|
-
const ctx = new DELogicContext(this.params,
|
|
103
|
+
const ctx = new DELogicContext(this.params, context, data, params);
|
|
107
104
|
this.initLogicParams(ctx);
|
|
108
105
|
const { startDELogicNodeId } = this.model;
|
|
109
106
|
if (startDELogicNodeId && this.nodes.has(startDELogicNodeId)) {
|
package/out/de-logic/index.js
CHANGED
|
@@ -32,7 +32,7 @@ export async function execDELogic(deDELogic, appDataEntity, context, data = {},
|
|
|
32
32
|
const deLogic = deLogicMap.get(deDELogic);
|
|
33
33
|
const result = await deLogic.exec({
|
|
34
34
|
context,
|
|
35
|
-
data
|
|
35
|
+
data,
|
|
36
36
|
params,
|
|
37
37
|
});
|
|
38
38
|
ibiz.log.debug(ibiz.i18n.t('runtime.deLogic.deLogicNode.endExecution', {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IApiData } from '@ibiz-template/core';
|
|
1
2
|
import { IApiLogicParams } from './i-api-logic-params';
|
|
2
3
|
/**
|
|
3
4
|
* @description 实体逻辑通用参数接口
|
|
@@ -5,5 +6,11 @@ import { IApiLogicParams } from './i-api-logic-params';
|
|
|
5
6
|
* @interface IApiDELogicParams
|
|
6
7
|
*/
|
|
7
8
|
export interface IApiDeLogicParams extends IApiLogicParams {
|
|
9
|
+
/**
|
|
10
|
+
* @description 数据集合
|
|
11
|
+
* @type {(IApiData | IApiData[])}
|
|
12
|
+
* @memberof IApiDeLogicParams
|
|
13
|
+
*/
|
|
14
|
+
data: IApiData | IApiData[];
|
|
8
15
|
}
|
|
9
16
|
//# sourceMappingURL=i-api-de-logic-params.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i-api-de-logic-params.d.ts","sourceRoot":"","sources":["../../../../src/interface/api/common/i-api-de-logic-params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,eAAe;
|
|
1
|
+
{"version":3,"file":"i-api-de-logic-params.d.ts","sourceRoot":"","sources":["../../../../src/interface/api/common/i-api-de-logic-params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD;;;;OAIG;IACH,IAAI,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAAC;CAC7B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IApiContext,
|
|
1
|
+
import { IApiContext, IApiParams } from '@ibiz-template/core';
|
|
2
2
|
/**
|
|
3
3
|
* @description 逻辑通用参数接口
|
|
4
4
|
* @export
|
|
@@ -17,11 +17,5 @@ export interface IApiLogicParams {
|
|
|
17
17
|
* @memberof IApiLogicParams
|
|
18
18
|
*/
|
|
19
19
|
params: IApiParams;
|
|
20
|
-
/**
|
|
21
|
-
* @description 数据集合
|
|
22
|
-
* @type {IApiData[]}
|
|
23
|
-
* @memberof IApiLogicParams
|
|
24
|
-
*/
|
|
25
|
-
data: IApiData[];
|
|
26
20
|
}
|
|
27
21
|
//# sourceMappingURL=i-api-logic-params.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i-api-logic-params.d.ts","sourceRoot":"","sources":["../../../../src/interface/api/common/i-api-logic-params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"i-api-logic-params.d.ts","sourceRoot":"","sources":["../../../../src/interface/api/common/i-api-logic-params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,OAAO,EAAE,WAAW,CAAC;IAErB;;;;OAIG;IACH,MAAM,EAAE,UAAU,CAAC;CACpB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IApiData } from '@ibiz-template/core';
|
|
1
2
|
import { IApiControlController, IApiViewController } from '../controller';
|
|
2
3
|
import { IApiLogicParams } from './i-api-logic-params';
|
|
3
4
|
/**
|
|
@@ -30,5 +31,11 @@ export interface IApiUILogicParams extends IApiLogicParams {
|
|
|
30
31
|
* @memberof IApiUILogicParams
|
|
31
32
|
*/
|
|
32
33
|
noWaitRoute?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* @description 数据集合
|
|
36
|
+
* @type {IApiData[]}
|
|
37
|
+
* @memberof IApiLogicParams
|
|
38
|
+
*/
|
|
39
|
+
data: IApiData[];
|
|
33
40
|
}
|
|
34
41
|
//# sourceMappingURL=i-api-ui-logic-params.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i-api-ui-logic-params.d.ts","sourceRoot":"","sources":["../../../../src/interface/api/common/i-api-ui-logic-params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD;;;;OAIG;IACH,IAAI,EAAE,kBAAkB,CAAC;IAEzB;;;;OAIG;IACH,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAE7B;;;;OAIG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"i-api-ui-logic-params.d.ts","sourceRoot":"","sources":["../../../../src/interface/api/common/i-api-ui-logic-params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD;;;;OAIG;IACH,IAAI,EAAE,kBAAkB,CAAC;IAEzB;;;;OAIG;IACH,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAE7B;;;;OAIG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,IAAI,EAAE,QAAQ,EAAE,CAAC;CAClB"}
|
|
@@ -6,5 +6,15 @@ import { ILogicContext } from '../common';
|
|
|
6
6
|
* @extends {ILogicContext}
|
|
7
7
|
*/
|
|
8
8
|
export interface IDeLogicContext extends ILogicContext {
|
|
9
|
+
/**
|
|
10
|
+
* @description 实体逻辑执行参数
|
|
11
|
+
* @type {{ context: IContext; data: IData[]; params: IParams }}
|
|
12
|
+
* @memberof IDeLogicContext
|
|
13
|
+
*/
|
|
14
|
+
parameters: {
|
|
15
|
+
context: IContext;
|
|
16
|
+
data: IData[];
|
|
17
|
+
params: IParams;
|
|
18
|
+
};
|
|
9
19
|
}
|
|
10
20
|
//# sourceMappingURL=i-de-logic-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i-de-logic-context.d.ts","sourceRoot":"","sources":["../../../src/interface/de-logic/i-de-logic-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,WAAW,eAAgB,SAAQ,aAAa;
|
|
1
|
+
{"version":3,"file":"i-de-logic-context.d.ts","sourceRoot":"","sources":["../../../src/interface/de-logic/i-de-logic-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD;;;;OAIG;IACH,UAAU,EAAE;QAAE,OAAO,EAAE,QAAQ,CAAC;QAAC,IAAI,EAAE,KAAK,EAAE,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;CACnE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/runtime",
|
|
3
|
-
"version": "0.7.41-alpha.
|
|
3
|
+
"version": "0.7.41-alpha.139",
|
|
4
4
|
"description": "运行时逻辑库",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "out/index.js",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"qx-util": "^0.4.8",
|
|
71
71
|
"ramda": "^0.29.0"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "b875543c236f00a5838e22a3ebe97ac773bee9f8"
|
|
74
74
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { isArray } from 'lodash-es';
|
|
1
2
|
import { DELogicParam } from './de-logic-param/de-logic-param';
|
|
2
|
-
import { IDeLogicContext
|
|
3
|
+
import { IDeLogicContext } from '../interface';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* 实体逻辑执行上下文
|
|
@@ -18,6 +19,14 @@ export class DELogicContext implements IDeLogicContext {
|
|
|
18
19
|
*/
|
|
19
20
|
lastReturn: unknown;
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* 实体逻辑执行参数
|
|
24
|
+
* @author lxm
|
|
25
|
+
* @date 2023-10-16 02:22:31
|
|
26
|
+
* @type {{ context: IContext; data: IData[]; params: IParams }}
|
|
27
|
+
*/
|
|
28
|
+
parameters: { context: IContext; data: IData[]; params: IParams };
|
|
29
|
+
|
|
21
30
|
/**
|
|
22
31
|
* 上下文
|
|
23
32
|
*/
|
|
@@ -51,13 +60,17 @@ export class DELogicContext implements IDeLogicContext {
|
|
|
51
60
|
* @date 2023-03-24 09:15:14
|
|
52
61
|
* @param {Map<string, DELogicParam>} deLogicParams 实体逻辑参数集合
|
|
53
62
|
* @param {IContext} context 上下文
|
|
54
|
-
* @param {IData} data 数据对象
|
|
63
|
+
* @param {IData | IData[]} data 数据对象
|
|
55
64
|
* @param {IParams} params 视图参数
|
|
56
65
|
*/
|
|
57
66
|
constructor(
|
|
58
67
|
private deLogicParams: Map<string, DELogicParam>,
|
|
59
|
-
|
|
60
|
-
|
|
68
|
+
context: IContext,
|
|
69
|
+
data: IData | IData[],
|
|
70
|
+
params: IParams,
|
|
71
|
+
) {
|
|
72
|
+
this.parameters = { context, data: isArray(data) ? data : [data], params };
|
|
73
|
+
}
|
|
61
74
|
|
|
62
75
|
/**
|
|
63
76
|
* 重置实体逻辑参数
|
package/src/de-logic/de-logic.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-await-in-loop */
|
|
2
|
-
import {
|
|
3
|
-
import { clone } from 'ramda';
|
|
2
|
+
import { RuntimeModelError } from '@ibiz-template/core';
|
|
4
3
|
import { IAppDELogic, IAppDataEntity } from '@ibiz/model-core';
|
|
5
4
|
import { ScriptFactory, ScriptFunction } from '../utils';
|
|
6
5
|
import { DELogicContext } from './de-logic-context';
|
|
@@ -124,13 +123,11 @@ export class DELogic implements IDeLogic {
|
|
|
124
123
|
* @memberof DELogic
|
|
125
124
|
*/
|
|
126
125
|
async exec(parameters: IDeLogicParams): Promise<unknown> {
|
|
127
|
-
|
|
128
|
-
parameters.context = IBizContext.create(parameters.context);
|
|
129
|
-
parameters.params = clone(parameters.params || {});
|
|
126
|
+
const { context, params, data } = parameters;
|
|
130
127
|
if (this.scriptFn) {
|
|
131
|
-
return this.scriptFn.exec({
|
|
128
|
+
return this.scriptFn.exec({ context, data, params });
|
|
132
129
|
}
|
|
133
|
-
const ctx = new DELogicContext(this.params,
|
|
130
|
+
const ctx = new DELogicContext(this.params, context, data, params);
|
|
134
131
|
this.initLogicParams(ctx);
|
|
135
132
|
const { startDELogicNodeId } = this.model;
|
|
136
133
|
if (startDELogicNodeId && this.nodes.has(startDELogicNodeId)) {
|
package/src/de-logic/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IApiData } from '@ibiz-template/core';
|
|
1
2
|
import { IApiLogicParams } from './i-api-logic-params';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -5,4 +6,11 @@ import { IApiLogicParams } from './i-api-logic-params';
|
|
|
5
6
|
* @export
|
|
6
7
|
* @interface IApiDELogicParams
|
|
7
8
|
*/
|
|
8
|
-
export interface IApiDeLogicParams extends IApiLogicParams {
|
|
9
|
+
export interface IApiDeLogicParams extends IApiLogicParams {
|
|
10
|
+
/**
|
|
11
|
+
* @description 数据集合
|
|
12
|
+
* @type {(IApiData | IApiData[])}
|
|
13
|
+
* @memberof IApiDeLogicParams
|
|
14
|
+
*/
|
|
15
|
+
data: IApiData | IApiData[];
|
|
16
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IApiContext,
|
|
1
|
+
import { IApiContext, IApiParams } from '@ibiz-template/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description 逻辑通用参数接口
|
|
@@ -19,11 +19,4 @@ export interface IApiLogicParams {
|
|
|
19
19
|
* @memberof IApiLogicParams
|
|
20
20
|
*/
|
|
21
21
|
params: IApiParams;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @description 数据集合
|
|
25
|
-
* @type {IApiData[]}
|
|
26
|
-
* @memberof IApiLogicParams
|
|
27
|
-
*/
|
|
28
|
-
data: IApiData[];
|
|
29
22
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IApiData } from '@ibiz-template/core';
|
|
1
2
|
import { IApiControlController, IApiViewController } from '../controller';
|
|
2
3
|
import { IApiLogicParams } from './i-api-logic-params';
|
|
3
4
|
|
|
@@ -34,4 +35,11 @@ export interface IApiUILogicParams extends IApiLogicParams {
|
|
|
34
35
|
* @memberof IApiUILogicParams
|
|
35
36
|
*/
|
|
36
37
|
noWaitRoute?: boolean;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @description 数据集合
|
|
41
|
+
* @type {IApiData[]}
|
|
42
|
+
* @memberof IApiLogicParams
|
|
43
|
+
*/
|
|
44
|
+
data: IApiData[];
|
|
37
45
|
}
|
|
@@ -6,4 +6,11 @@ import { ILogicContext } from '../common';
|
|
|
6
6
|
* @interface IDeLogicContext
|
|
7
7
|
* @extends {ILogicContext}
|
|
8
8
|
*/
|
|
9
|
-
export interface IDeLogicContext extends ILogicContext {
|
|
9
|
+
export interface IDeLogicContext extends ILogicContext {
|
|
10
|
+
/**
|
|
11
|
+
* @description 实体逻辑执行参数
|
|
12
|
+
* @type {{ context: IContext; data: IData[]; params: IParams }}
|
|
13
|
+
* @memberof IDeLogicContext
|
|
14
|
+
*/
|
|
15
|
+
parameters: { context: IContext; data: IData[]; params: IParams };
|
|
16
|
+
}
|