@ibiz-template/runtime 0.1.29-dev.0 → 0.1.29
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 +795 -618
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/out/command/app/open-app-view/open-app-view.d.ts +1 -1
- package/out/command/app/open-app-view/open-app-view.d.ts.map +1 -1
- package/out/command/app/open-app-view/open-app-view.js +16 -5
- package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
- package/out/controller/common/control/md-control.controller.js +2 -1
- package/out/controller/control/dashboard/dashboard.controller.d.ts.map +1 -1
- package/out/controller/control/dashboard/dashboard.controller.js +2 -6
- package/out/controller/control/form/edit-form/edit-form.controller.d.ts +11 -2
- package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
- package/out/controller/control/form/edit-form/edit-form.controller.js +56 -2
- package/out/controller/control/form/edit-form/edit-form.service.js +1 -1
- package/out/controller/control/form/form/form.controller.d.ts.map +1 -1
- package/out/controller/control/form/form/form.controller.js +2 -6
- package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
- package/out/controller/control/grid/grid/grid.controller.js +5 -10
- package/out/controller/control/toolbar/toolbar.controllerr.d.ts.map +1 -1
- package/out/controller/control/toolbar/toolbar.controllerr.js +8 -8
- package/out/controller/control/tree/tree.service.d.ts.map +1 -1
- package/out/controller/control/tree/tree.service.js +6 -11
- package/out/engine/md-view.engine.d.ts.map +1 -1
- package/out/engine/md-view.engine.js +5 -4
- package/out/global/global-util/global-util.d.ts +8 -0
- package/out/global/global-util/global-util.d.ts.map +1 -1
- package/out/global/global-util/global-util.js +8 -0
- package/out/interface/common/i-error-handler/i-error-handler.d.ts +17 -0
- package/out/interface/common/i-error-handler/i-error-handler.d.ts.map +1 -0
- package/out/interface/common/i-error-handler/i-error-handler.js +1 -0
- package/out/interface/common/index.d.ts +1 -0
- package/out/interface/common/index.d.ts.map +1 -1
- package/out/interface/controller/state/view/i-edit-view.state.d.ts +8 -0
- package/out/interface/controller/state/view/i-edit-view.state.d.ts.map +1 -1
- package/out/logic-scheduler/executor/app-ui-logic-executor.d.ts.map +1 -1
- package/out/logic-scheduler/executor/app-ui-logic-executor.js +10 -4
- package/out/logic-scheduler/trigger/item-dyna-logic-trigger.d.ts.map +1 -1
- package/out/logic-scheduler/trigger/item-dyna-logic-trigger.js +1 -4
- package/out/model/data-entity/data-entity.js +2 -2
- package/out/register/helper/control-register.d.ts.map +1 -1
- package/out/register/helper/control-register.js +6 -1
- package/out/utils/error-handler/default-error-handler.d.ts +13 -0
- package/out/utils/error-handler/default-error-handler.d.ts.map +1 -0
- package/out/utils/error-handler/default-error-handler.js +36 -0
- package/out/utils/error-handler/error-handler-center.d.ts +41 -0
- package/out/utils/error-handler/error-handler-center.d.ts.map +1 -0
- package/out/utils/error-handler/error-handler-center.js +59 -0
- package/out/utils/error-handler/index.d.ts +3 -0
- package/out/utils/error-handler/index.d.ts.map +1 -0
- package/out/utils/error-handler/index.js +2 -0
- package/out/utils/index.d.ts +1 -0
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +1 -0
- package/out/utils/promise/promise.d.ts +15 -0
- package/out/utils/promise/promise.d.ts.map +1 -0
- package/out/utils/promise/promise.js +38 -0
- package/package.json +2 -2
- package/src/command/app/open-app-view/open-app-view.ts +18 -5
- package/src/controller/common/control/md-control.controller.ts +2 -1
- package/src/controller/control/dashboard/dashboard.controller.ts +2 -6
- package/src/controller/control/form/edit-form/edit-form.controller.ts +71 -3
- package/src/controller/control/form/edit-form/edit-form.service.ts +1 -1
- package/src/controller/control/form/form/form.controller.ts +2 -6
- package/src/controller/control/grid/grid/grid.controller.ts +5 -9
- package/src/controller/control/toolbar/toolbar.controllerr.ts +14 -8
- package/src/controller/control/tree/tree.service.ts +8 -9
- package/src/engine/md-view.engine.ts +6 -4
- package/src/global/global-util/global-util.ts +15 -0
- package/src/interface/common/i-error-handler/i-error-handler.ts +16 -0
- package/src/interface/common/index.ts +1 -0
- package/src/interface/controller/state/view/i-edit-view.state.ts +10 -1
- package/src/logic-scheduler/executor/app-ui-logic-executor.ts +13 -4
- package/src/logic-scheduler/trigger/item-dyna-logic-trigger.ts +1 -4
- package/src/model/data-entity/data-entity.ts +2 -2
- package/src/register/helper/control-register.ts +6 -1
- package/src/utils/error-handler/default-error-handler.ts +40 -0
- package/src/utils/error-handler/error-handler-center.ts +61 -0
- package/src/utils/error-handler/index.ts +2 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/promise/promise.ts +41 -0
|
@@ -15,6 +15,7 @@ import { OpenAppViewCommand } from '../../command';
|
|
|
15
15
|
import { calcDeCodeNameById, getFormTypeFieldName } from '../../model';
|
|
16
16
|
import { convertNavData } from '../../utils';
|
|
17
17
|
import { LogicExecutor } from './logic-executor';
|
|
18
|
+
import { Srfuf } from '../../service';
|
|
18
19
|
/**
|
|
19
20
|
* 应用预置界面逻辑
|
|
20
21
|
* @author lxm
|
|
@@ -163,11 +164,16 @@ export class AppUILogicExecutor extends LogicExecutor {
|
|
|
163
164
|
tempParams = convertNavData(navParams, _data, params, context);
|
|
164
165
|
}
|
|
165
166
|
// 拷贝数据处理
|
|
166
|
-
if (
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
if (params.srfcopymode) {
|
|
168
|
+
const entity = await ibiz.hub.getAppDataEntity(view.model.appDataEntityId);
|
|
169
|
+
const key = entity.keyAppDEFieldId;
|
|
170
|
+
if (key && _data) {
|
|
171
|
+
tempParams[key] = _data.srfkey;
|
|
172
|
+
tempParams.srfcopymode = true;
|
|
173
|
+
}
|
|
170
174
|
}
|
|
175
|
+
// 特殊处理标记,标记当前是新建数据。在打开视图前会被删除,具体在 open-app-view.ts 中处理
|
|
176
|
+
tempParams.srfuf = Srfuf.CREATE;
|
|
171
177
|
// 打开视图
|
|
172
178
|
const result = await ibiz.commands.execute(OpenAppViewCommand.TAG, newViewRef.refAppViewId, tempContext, tempParams, rest);
|
|
173
179
|
// 执行批添加新建逻辑
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item-dyna-logic-trigger.d.ts","sourceRoot":"","sources":["../../../src/logic-scheduler/trigger/item-dyna-logic-trigger.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,qBAAa,oBAAqB,SAAQ,YAAY;IAC5C,IAAI,EAAE,aAAa,GAAG,YAAY,GAAG,WAAW,CAAC;IAEjD,QAAQ,EAAE,cAAc,CAAC;IAEjC,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAS3C,kBAAkB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAmBlD,KAAK,CAAC,WAAW,EAAE,mBAAmB,GAAG,OAAO;IAShD,OAAO,CAAC,aAAa,EAAE,cAAc,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"item-dyna-logic-trigger.d.ts","sourceRoot":"","sources":["../../../src/logic-scheduler/trigger/item-dyna-logic-trigger.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,qBAAa,oBAAqB,SAAQ,YAAY;IAC5C,IAAI,EAAE,aAAa,GAAG,YAAY,GAAG,WAAW,CAAC;IAEjD,QAAQ,EAAE,cAAc,CAAC;IAEjC,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAS3C,kBAAkB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAmBlD,KAAK,CAAC,WAAW,EAAE,mBAAmB,GAAG,OAAO;IAShD,OAAO,CAAC,aAAa,EAAE,cAAc,GAAG,OAAO;CAIhD"}
|
|
@@ -30,9 +30,6 @@ export class ItemDynaLogicTrigger extends LogicTrigger {
|
|
|
30
30
|
}
|
|
31
31
|
execute(executeParams) {
|
|
32
32
|
const result = this.executor.execute(executeParams);
|
|
33
|
-
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
throw new RuntimeError(`${this.logic.id}逻辑返回值不是布尔值`);
|
|
33
|
+
return !!result;
|
|
37
34
|
}
|
|
38
35
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { notNilEmpty } from 'qx-util';
|
|
2
2
|
/**
|
|
3
3
|
* 从实体id计算实体codeName(小写)
|
|
4
4
|
* @author lxm
|
|
@@ -23,7 +23,7 @@ export function calcDeCodeNameById(id) {
|
|
|
23
23
|
*/
|
|
24
24
|
export function hasDeCodeName(params, entityId) {
|
|
25
25
|
const codeName = calcDeCodeNameById(entityId);
|
|
26
|
-
return
|
|
26
|
+
return notNilEmpty(params[codeName]);
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* 通过appDEACModeId从实体中找出对应自填模式模型
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-register.d.ts","sourceRoot":"","sources":["../../../src/register/helper/control-register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGnD,cAAc;AACd,eAAO,MAAM,uBAAuB,YAAY,CAAC;AAEjD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,gBAAgB,GAC/B,IAAI,CAEN;AAQD;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,QAAQ,GACd,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"control-register.d.ts","sourceRoot":"","sources":["../../../src/register/helper/control-register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGnD,cAAc;AACd,eAAO,MAAM,uBAAuB,YAAY,CAAC;AAEjD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,gBAAgB,GAC/B,IAAI,CAEN;AAQD;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,QAAQ,GACd,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CA6CvC"}
|
|
@@ -53,7 +53,12 @@ export async function getControlProvider(model) {
|
|
|
53
53
|
// 找部件类型
|
|
54
54
|
provider = getProvider(controlType);
|
|
55
55
|
if (!provider) {
|
|
56
|
-
|
|
56
|
+
switch (controlType) {
|
|
57
|
+
case 'DATAINFOBAR':
|
|
58
|
+
return;
|
|
59
|
+
default:
|
|
60
|
+
ibiz.log.error(`找不到部件类型${controlType}对应的适配器`);
|
|
61
|
+
}
|
|
57
62
|
}
|
|
58
63
|
else {
|
|
59
64
|
return provider;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IErrorHandler } from '../../interface';
|
|
2
|
+
/**
|
|
3
|
+
* 默认处理器
|
|
4
|
+
* @author lxm
|
|
5
|
+
* @date 2023-09-26 04:52:18
|
|
6
|
+
* @export
|
|
7
|
+
* @class DefaultErrorHandler
|
|
8
|
+
* @implements {IErrorHandler}
|
|
9
|
+
*/
|
|
10
|
+
export declare class DefaultErrorHandler implements IErrorHandler {
|
|
11
|
+
handle(error: unknown): boolean | undefined;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=default-error-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-error-handler.d.ts","sourceRoot":"","sources":["../../../src/utils/error-handler/default-error-handler.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;GAOG;AACH,qBAAa,mBAAoB,YAAW,aAAa;IACvD,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;CAqB5C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { RuntimeModelError, ModelError, HttpError, NoticeError, RuntimeError, } from '@ibiz-template/core';
|
|
2
|
+
/**
|
|
3
|
+
* 默认处理器
|
|
4
|
+
* @author lxm
|
|
5
|
+
* @date 2023-09-26 04:52:18
|
|
6
|
+
* @export
|
|
7
|
+
* @class DefaultErrorHandler
|
|
8
|
+
* @implements {IErrorHandler}
|
|
9
|
+
*/
|
|
10
|
+
export class DefaultErrorHandler {
|
|
11
|
+
handle(error) {
|
|
12
|
+
if (error instanceof RuntimeModelError || error instanceof ModelError) {
|
|
13
|
+
ibiz.message.error(error.message, 10, true);
|
|
14
|
+
}
|
|
15
|
+
else if (error instanceof HttpError) {
|
|
16
|
+
if (error.status === 401) {
|
|
17
|
+
ibiz.message.error('没有注册无权限错误处理器');
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
ibiz.notification.error({
|
|
21
|
+
title: '',
|
|
22
|
+
desc: error.message,
|
|
23
|
+
duration: 10,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else if (error instanceof NoticeError) {
|
|
28
|
+
ibiz.message.error(error.message, error.duration, error.duration === 0);
|
|
29
|
+
}
|
|
30
|
+
else if (error instanceof RuntimeError) {
|
|
31
|
+
ibiz.message.error(error.message, 10, true);
|
|
32
|
+
}
|
|
33
|
+
ibiz.log.error(error);
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IErrorHandler } from '../../interface';
|
|
2
|
+
/**
|
|
3
|
+
* 事件处理工具
|
|
4
|
+
*
|
|
5
|
+
* @author lxm
|
|
6
|
+
* @date 2022-09-21 18:09:31
|
|
7
|
+
* @export
|
|
8
|
+
* @class ErrorHandler
|
|
9
|
+
*/
|
|
10
|
+
export declare class ErrorHandlerCenter {
|
|
11
|
+
/**
|
|
12
|
+
* 处理器集合
|
|
13
|
+
* @author lxm
|
|
14
|
+
* @date 2023-09-26 04:56:29
|
|
15
|
+
* @type {IErrorHandler[]}
|
|
16
|
+
*/
|
|
17
|
+
protected handlers: IErrorHandler[];
|
|
18
|
+
/**
|
|
19
|
+
* 注册处理器(后注册的优先级更高)
|
|
20
|
+
* @author lxm
|
|
21
|
+
* @date 2023-09-26 04:59:06
|
|
22
|
+
* @param {IErrorHandler} handler
|
|
23
|
+
*/
|
|
24
|
+
register(handler: IErrorHandler): void;
|
|
25
|
+
/**
|
|
26
|
+
* 处理单个报错
|
|
27
|
+
* @author lxm
|
|
28
|
+
* @date 2023-09-26 05:18:18
|
|
29
|
+
* @protected
|
|
30
|
+
* @param {unknown} error
|
|
31
|
+
*/
|
|
32
|
+
protected handleSingle(error: unknown): void;
|
|
33
|
+
/**
|
|
34
|
+
* 按顺序检测处理器,最先满足条件的处理该异常
|
|
35
|
+
* @author lxm
|
|
36
|
+
* @date 2023-09-26 05:01:08
|
|
37
|
+
* @param {unknown} error
|
|
38
|
+
*/
|
|
39
|
+
handle(error: unknown): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=error-handler-center.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler-center.d.ts","sourceRoot":"","sources":["../../../src/utils/error-handler/error-handler-center.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;GAOG;AACH,qBAAa,kBAAkB;IAC7B;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAM;IAEzC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAItC;;;;;;OAMG;IACH,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAS5C;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;CAS7B"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 事件处理工具
|
|
3
|
+
*
|
|
4
|
+
* @author lxm
|
|
5
|
+
* @date 2022-09-21 18:09:31
|
|
6
|
+
* @export
|
|
7
|
+
* @class ErrorHandler
|
|
8
|
+
*/
|
|
9
|
+
export class ErrorHandlerCenter {
|
|
10
|
+
constructor() {
|
|
11
|
+
/**
|
|
12
|
+
* 处理器集合
|
|
13
|
+
* @author lxm
|
|
14
|
+
* @date 2023-09-26 04:56:29
|
|
15
|
+
* @type {IErrorHandler[]}
|
|
16
|
+
*/
|
|
17
|
+
this.handlers = [];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 注册处理器(后注册的优先级更高)
|
|
21
|
+
* @author lxm
|
|
22
|
+
* @date 2023-09-26 04:59:06
|
|
23
|
+
* @param {IErrorHandler} handler
|
|
24
|
+
*/
|
|
25
|
+
register(handler) {
|
|
26
|
+
this.handlers.unshift(handler);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 处理单个报错
|
|
30
|
+
* @author lxm
|
|
31
|
+
* @date 2023-09-26 05:18:18
|
|
32
|
+
* @protected
|
|
33
|
+
* @param {unknown} error
|
|
34
|
+
*/
|
|
35
|
+
handleSingle(error) {
|
|
36
|
+
const find = this.handlers.find(item => {
|
|
37
|
+
return !!item.handle(error);
|
|
38
|
+
});
|
|
39
|
+
if (!find) {
|
|
40
|
+
ibiz.log.error('没有找到能处理该错误的处理器', error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 按顺序检测处理器,最先满足条件的处理该异常
|
|
45
|
+
* @author lxm
|
|
46
|
+
* @date 2023-09-26 05:01:08
|
|
47
|
+
* @param {unknown} error
|
|
48
|
+
*/
|
|
49
|
+
handle(error) {
|
|
50
|
+
if (error instanceof Array) {
|
|
51
|
+
error.forEach(item => {
|
|
52
|
+
this.handleSingle(item);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.handleSingle(error);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/error-handler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/out/utils/index.d.ts
CHANGED
|
@@ -10,4 +10,5 @@ export * from './value-rule/value-rule';
|
|
|
10
10
|
export * from './script/index';
|
|
11
11
|
export { TextUtil } from './text-util/text-util';
|
|
12
12
|
export { RawValueUtil } from './raw-value-util/raw-value-util';
|
|
13
|
+
export { handleAllSettled } from './promise/promise';
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
package/out/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,cAAc,yBAAyB,CAAC;AACxC,OAAO,EACL,yBAAyB,EACzB,gBAAgB,GACjB,MAAM,yCAAyC,CAAC;AACjD,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,cAAc,yBAAyB,CAAC;AACxC,OAAO,EACL,yBAAyB,EACzB,gBAAgB,GACjB,MAAM,yCAAyC,CAAC;AACjD,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/out/utils/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 异步等待所有promise完成后才会结束异步
|
|
3
|
+
* 只返回成功的promise的返回值集合
|
|
4
|
+
* - 如果isThrow为true,有异常时抛出异常
|
|
5
|
+
* - 如果isThrow为false,有异常时用全局异常处理弹提示,逻辑不会中断
|
|
6
|
+
* @author lxm
|
|
7
|
+
* @date 2023-09-26 06:57:33
|
|
8
|
+
* @export
|
|
9
|
+
* @template T
|
|
10
|
+
* @param {(Iterable<T | PromiseLike<T>>)} values
|
|
11
|
+
* @param {boolean} [isThrow=true]
|
|
12
|
+
* @return {*} {Promise<Awaited<T>[]>}
|
|
13
|
+
*/
|
|
14
|
+
export declare function handleAllSettled<T>(values: Iterable<T | PromiseLike<T>>, isThrow?: boolean): Promise<Awaited<T>[]>;
|
|
15
|
+
//# sourceMappingURL=promise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../../src/utils/promise/promise.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,MAAM,EAAE,QAAQ,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,EACpC,OAAO,UAAO,GACb,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAwBvB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 异步等待所有promise完成后才会结束异步
|
|
3
|
+
* 只返回成功的promise的返回值集合
|
|
4
|
+
* - 如果isThrow为true,有异常时抛出异常
|
|
5
|
+
* - 如果isThrow为false,有异常时用全局异常处理弹提示,逻辑不会中断
|
|
6
|
+
* @author lxm
|
|
7
|
+
* @date 2023-09-26 06:57:33
|
|
8
|
+
* @export
|
|
9
|
+
* @template T
|
|
10
|
+
* @param {(Iterable<T | PromiseLike<T>>)} values
|
|
11
|
+
* @param {boolean} [isThrow=true]
|
|
12
|
+
* @return {*} {Promise<Awaited<T>[]>}
|
|
13
|
+
*/
|
|
14
|
+
export async function handleAllSettled(values, isThrow = true) {
|
|
15
|
+
const allResults = await Promise.allSettled(values);
|
|
16
|
+
const successResult = [];
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
+
const errorResult = [];
|
|
19
|
+
allResults.forEach(item => {
|
|
20
|
+
if (item.status === 'fulfilled') {
|
|
21
|
+
successResult.push(item.value);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
errorResult.push(item.reason);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
// 有报错时根据是否抛出处理,抛出就抛,不抛就拿全局的异常处理弹提示。
|
|
28
|
+
if (errorResult.length > 0) {
|
|
29
|
+
const error = errorResult.length === 1 ? errorResult[0] : errorResult;
|
|
30
|
+
if (isThrow) {
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
ibiz.util.error.handle(error);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return successResult;
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/runtime",
|
|
3
|
-
"version": "0.1.29
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"description": "控制器包",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "out/index.js",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"qx-util": "^0.4.8",
|
|
58
58
|
"ramda": "^0.29.0"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "ad1df38edba37a696e639c986b12087f72ead394"
|
|
61
61
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ModelError, RuntimeError } from '@ibiz-template/core';
|
|
2
2
|
import { IAppRedirectView } from '@ibiz/model-core';
|
|
3
|
+
import { clone } from 'ramda';
|
|
3
4
|
import { IModalData, IOpenViewOptions, IViewConfig } from '../../../interface';
|
|
4
5
|
import { calcDeCodeNameById } from '../../../model';
|
|
5
6
|
import { openRedirectView } from '../../../utils';
|
|
7
|
+
import { Srfuf } from '../../../service';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* 打开应用视图
|
|
@@ -32,20 +34,31 @@ export class OpenAppViewCommand {
|
|
|
32
34
|
*/
|
|
33
35
|
async exec(
|
|
34
36
|
appViewId: string,
|
|
35
|
-
|
|
37
|
+
_context: IContext,
|
|
36
38
|
params: IParams = {},
|
|
37
39
|
opts: IOpenViewOptions = {},
|
|
38
40
|
): Promise<IModalData | void> {
|
|
41
|
+
const context = clone(_context);
|
|
39
42
|
const appView = await ibiz.hub.config.view.get(appViewId!);
|
|
40
43
|
if (!appView) {
|
|
41
44
|
throw new RuntimeError(`应用视图[${appViewId}]不存在`);
|
|
42
45
|
}
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
if (
|
|
48
|
+
(context.srfkey || params.srfuf === Srfuf.CREATE) &&
|
|
49
|
+
appView.appDataEntityId
|
|
50
|
+
) {
|
|
46
51
|
const deName = calcDeCodeNameById(appView.appDataEntityId);
|
|
47
|
-
|
|
48
|
-
context.srfkey
|
|
52
|
+
// 识别上下文的srfkey并转成对应视图实体名称,然后置空srfkey
|
|
53
|
+
if (context.srfkey) {
|
|
54
|
+
context[deName] = context.srfkey;
|
|
55
|
+
context.srfkey = undefined;
|
|
56
|
+
}
|
|
57
|
+
// 识别参数的 srfuf=0 时为新建。置空和当前要打开视图同实体的主键,避免同上下文导致后一个页面识别为了编辑。然后置空srfuf
|
|
58
|
+
if (params.srfuf === Srfuf.CREATE) {
|
|
59
|
+
context[deName] = undefined;
|
|
60
|
+
delete params.srfuf;
|
|
61
|
+
}
|
|
49
62
|
}
|
|
50
63
|
|
|
51
64
|
if (appView.redirectView) {
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from '../../../interface';
|
|
11
11
|
import { calcDeCodeNameById } from '../../../model';
|
|
12
12
|
import { MDControlService, Srfuf } from '../../../service';
|
|
13
|
+
import { handleAllSettled } from '../../../utils';
|
|
13
14
|
import { ControllerEvent } from '../../utils';
|
|
14
15
|
import { ControlController } from './control.controller';
|
|
15
16
|
|
|
@@ -282,7 +283,7 @@ export class MDControlController<
|
|
|
282
283
|
let needRefresh = false;
|
|
283
284
|
try {
|
|
284
285
|
const deName = calcDeCodeNameById(this.model.appDataEntityId!);
|
|
285
|
-
await
|
|
286
|
+
await handleAllSettled(
|
|
286
287
|
data.map(async item => {
|
|
287
288
|
// 新建未保存的数据直接走后续删除处理逻辑
|
|
288
289
|
if (item.srfuf !== Srfuf.CREATE) {
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
IPortletContainerController,
|
|
13
13
|
} from '../../../interface';
|
|
14
14
|
import { getPortletProvider } from '../../../register';
|
|
15
|
+
import { handleAllSettled } from '../../../utils';
|
|
15
16
|
import { ControlController } from '../../common';
|
|
16
17
|
import { getOriginData } from '../../utils';
|
|
17
18
|
|
|
@@ -113,15 +114,10 @@ export class DashboardController
|
|
|
113
114
|
*/
|
|
114
115
|
async dataChangeNotify(data: IData): Promise<void> {
|
|
115
116
|
// 通知所有成员项去处理成员项相关逻辑
|
|
116
|
-
|
|
117
|
+
await handleAllSettled(
|
|
117
118
|
Object.values(this.portlets).map(async portlet => {
|
|
118
119
|
return portlet.dataChangeNotify(data);
|
|
119
120
|
}),
|
|
120
121
|
);
|
|
121
|
-
const rejectedValue = values.find(item => item.status === 'rejected');
|
|
122
|
-
if (rejectedValue) {
|
|
123
|
-
ibiz.log.error('dataChangeNotify报错', values);
|
|
124
|
-
throw (rejectedValue as PromiseRejectedResult).reason;
|
|
125
|
-
}
|
|
126
122
|
}
|
|
127
123
|
}
|
|
@@ -5,14 +5,18 @@ import {
|
|
|
5
5
|
RuntimeError,
|
|
6
6
|
mergeDefaultInLeft,
|
|
7
7
|
} from '@ibiz-template/core';
|
|
8
|
-
import { IDEEditForm } from '@ibiz/model-core';
|
|
8
|
+
import { IAppDEEditView, IDEEditForm } from '@ibiz/model-core';
|
|
9
9
|
import { debounce } from 'lodash-es';
|
|
10
|
+
import { clone } from 'ramda';
|
|
10
11
|
import {
|
|
11
12
|
IEditFormState,
|
|
12
13
|
IEditFormEvent,
|
|
13
14
|
IEditFormController,
|
|
15
|
+
IViewController,
|
|
16
|
+
IEditViewState,
|
|
17
|
+
IEditViewEvent,
|
|
14
18
|
} from '../../../../interface';
|
|
15
|
-
import { hasDeCodeName } from '../../../../model';
|
|
19
|
+
import { calcDeCodeNameById, hasDeCodeName } from '../../../../model';
|
|
16
20
|
import { Srfuf, ControlVO } from '../../../../service';
|
|
17
21
|
import { ScriptFactory } from '../../../../utils';
|
|
18
22
|
import { FormNotifyState } from '../../../constant';
|
|
@@ -40,6 +44,14 @@ export class EditFormController
|
|
|
40
44
|
*/
|
|
41
45
|
service!: EditFormService;
|
|
42
46
|
|
|
47
|
+
get view(): IViewController<IAppDEEditView, IEditViewState, IEditViewEvent> {
|
|
48
|
+
return this.ctx.view as IViewController<
|
|
49
|
+
IAppDEEditView,
|
|
50
|
+
IEditViewState,
|
|
51
|
+
IEditViewEvent
|
|
52
|
+
>;
|
|
53
|
+
}
|
|
54
|
+
|
|
43
55
|
/**
|
|
44
56
|
* 初始化方法
|
|
45
57
|
*
|
|
@@ -108,6 +120,57 @@ export class EditFormController
|
|
|
108
120
|
return this.data;
|
|
109
121
|
}
|
|
110
122
|
|
|
123
|
+
/**
|
|
124
|
+
* 拷贝模式加载数据
|
|
125
|
+
*
|
|
126
|
+
* @author chitanda
|
|
127
|
+
* @date 2023-09-26 19:09:21
|
|
128
|
+
* @return {*} {Promise<IData>}
|
|
129
|
+
*/
|
|
130
|
+
protected async copy(): Promise<IData> {
|
|
131
|
+
const context = clone(this.context);
|
|
132
|
+
const queryParams: IParams = clone(this.params);
|
|
133
|
+
|
|
134
|
+
const appDataEntity = await ibiz.hub.getAppDataEntity(
|
|
135
|
+
this.model.appDataEntityId!,
|
|
136
|
+
);
|
|
137
|
+
const key = appDataEntity.keyAppDEFieldId;
|
|
138
|
+
if (key && this.params[key]) {
|
|
139
|
+
const deCodeName = calcDeCodeNameById(this.model.appDataEntityId!);
|
|
140
|
+
context[deCodeName] = this.params[key];
|
|
141
|
+
delete queryParams[key];
|
|
142
|
+
delete this.params[key];
|
|
143
|
+
delete queryParams.srfcopymode;
|
|
144
|
+
delete this.params.srfcopymode;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
let res;
|
|
148
|
+
try {
|
|
149
|
+
await this.startLoading();
|
|
150
|
+
await this.evt.emit('onBeforeLoad', undefined);
|
|
151
|
+
res = await this.service.get(context, queryParams);
|
|
152
|
+
} catch (error) {
|
|
153
|
+
await this.evt.emit('onLoadError', undefined);
|
|
154
|
+
this.actionNotification('GETERROR', {
|
|
155
|
+
error: error as Error,
|
|
156
|
+
});
|
|
157
|
+
throw error;
|
|
158
|
+
} finally {
|
|
159
|
+
await this.endLoading();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
res.data.$origin.srfsourcekey = undefined;
|
|
163
|
+
|
|
164
|
+
this.state.modified = false;
|
|
165
|
+
this.state.data = res.data;
|
|
166
|
+
this.formStateNotify(FormNotifyState.LOAD);
|
|
167
|
+
|
|
168
|
+
await this.evt.emit('onLoadSuccess', undefined);
|
|
169
|
+
this.actionNotification('GETSUCCESS');
|
|
170
|
+
this.state.isLoaded = true;
|
|
171
|
+
return this.data;
|
|
172
|
+
}
|
|
173
|
+
|
|
111
174
|
/**
|
|
112
175
|
* 部件加载数据行为
|
|
113
176
|
*
|
|
@@ -115,6 +178,11 @@ export class EditFormController
|
|
|
115
178
|
* @date 2022-08-19 14:08:50
|
|
116
179
|
*/
|
|
117
180
|
async load(): Promise<IData> {
|
|
181
|
+
// 复制模式独立处理
|
|
182
|
+
const copyMode = this.params.srfcopymode;
|
|
183
|
+
if (copyMode) {
|
|
184
|
+
return this.copy();
|
|
185
|
+
}
|
|
118
186
|
const isLoadDraft = !hasDeCodeName(
|
|
119
187
|
this.context,
|
|
120
188
|
this.model.appDataEntityId!,
|
|
@@ -124,7 +192,7 @@ export class EditFormController
|
|
|
124
192
|
return this.loadDraft();
|
|
125
193
|
}
|
|
126
194
|
|
|
127
|
-
const queryParams =
|
|
195
|
+
const queryParams = clone(this.params);
|
|
128
196
|
|
|
129
197
|
let res;
|
|
130
198
|
try {
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import { findChildFormDetails } from '../../../../model';
|
|
12
12
|
import { getFormDetailProvider } from '../../../../register';
|
|
13
13
|
import { ControlVO } from '../../../../service';
|
|
14
|
+
import { handleAllSettled } from '../../../../utils';
|
|
14
15
|
import { ControlController } from '../../../common';
|
|
15
16
|
import { FormNotifyState } from '../../../constant';
|
|
16
17
|
import { ControllerEvent, isValueChange } from '../../../utils';
|
|
@@ -97,16 +98,11 @@ export abstract class FormController<
|
|
|
97
98
|
*/
|
|
98
99
|
async dataChangeNotify(names: string[]): Promise<void> {
|
|
99
100
|
// 通知所有成员项去处理成员项相关逻辑
|
|
100
|
-
|
|
101
|
+
await handleAllSettled(
|
|
101
102
|
Object.values(this.details).map(async detail => {
|
|
102
103
|
return detail.dataChangeNotify(names);
|
|
103
104
|
}),
|
|
104
105
|
);
|
|
105
|
-
const rejectedValue = values.find(item => item.status === 'rejected');
|
|
106
|
-
if (rejectedValue) {
|
|
107
|
-
ibiz.log.error('dataChangeNotify报错', values);
|
|
108
|
-
throw (rejectedValue as PromiseRejectedResult).reason;
|
|
109
|
-
}
|
|
110
106
|
}
|
|
111
107
|
|
|
112
108
|
/**
|
|
@@ -32,7 +32,7 @@ import { ControlVO, Srfuf } from '../../../../service';
|
|
|
32
32
|
import { MDControlController } from '../../../common';
|
|
33
33
|
import { GridNotifyState } from '../../../constant';
|
|
34
34
|
import { getDefaultValue, isValueChange } from '../../../utils';
|
|
35
|
-
import { ScriptFactory } from '../../../../utils';
|
|
35
|
+
import { handleAllSettled, ScriptFactory } from '../../../../utils';
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* 表格控制器
|
|
@@ -267,10 +267,11 @@ export class GridController
|
|
|
267
267
|
): Promise<ControlVO[]> {
|
|
268
268
|
await super.afterLoad(args, items);
|
|
269
269
|
// 每次表格刷新时通知表格属性列,加载代码表,避免动态代码表更新不及时
|
|
270
|
-
await
|
|
270
|
+
await handleAllSettled(
|
|
271
271
|
Object.values(this.fieldColumns).map(async fieldColumn => {
|
|
272
272
|
await fieldColumn.loadCodeList();
|
|
273
273
|
}),
|
|
274
|
+
false,
|
|
274
275
|
);
|
|
275
276
|
|
|
276
277
|
// 生成表格row对象
|
|
@@ -536,7 +537,7 @@ export class GridController
|
|
|
536
537
|
return;
|
|
537
538
|
}
|
|
538
539
|
|
|
539
|
-
|
|
540
|
+
await handleAllSettled(
|
|
540
541
|
needSaveData.map(data => {
|
|
541
542
|
return this.save(data);
|
|
542
543
|
}),
|
|
@@ -695,16 +696,11 @@ export class GridController
|
|
|
695
696
|
*/
|
|
696
697
|
async dataChangeNotify(row: GridRowState, names: string[]): Promise<void> {
|
|
697
698
|
// 通知所有编辑项去处理编辑项相关逻辑
|
|
698
|
-
|
|
699
|
+
await handleAllSettled(
|
|
699
700
|
Object.values(this.editColumns).map(async column => {
|
|
700
701
|
return column.dataChangeNotify(row, names);
|
|
701
702
|
}),
|
|
702
703
|
);
|
|
703
|
-
const rejectedValue = values.find(item => item.status === 'rejected');
|
|
704
|
-
if (rejectedValue) {
|
|
705
|
-
ibiz.log.error('dataChangeNotify报错', values);
|
|
706
|
-
throw (rejectedValue as PromiseRejectedResult).reason;
|
|
707
|
-
}
|
|
708
704
|
}
|
|
709
705
|
|
|
710
706
|
/**
|