@ibiz-template/runtime 0.2.18-dev.1 → 0.2.18-dev.2
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 +117 -29
- package/dist/index.system.min.js +2 -2
- package/dist/index.system.min.js.map +1 -1
- package/out/controller/control/form/form/form.controller.d.ts.map +1 -1
- package/out/controller/control/form/form/form.controller.js +5 -0
- package/out/controller/control/form/form-detail/form-button/form-button.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-button/form-button.controller.js +1 -0
- package/out/controller/control/form/form-detail/form-detail/form-detail.controller.d.ts +6 -0
- package/out/controller/control/form/form-detail/form-detail/form-detail.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-detail/form-detail.controller.js +12 -0
- package/out/controller/control/form/form-detail/form-item/form-item.controller.d.ts +12 -0
- package/out/controller/control/form/form-detail/form-item/form-item.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-item/form-item.controller.js +28 -0
- package/out/interface/controller/event/argument/form-detail.event.d.ts +26 -0
- package/out/interface/controller/event/argument/form-detail.event.d.ts.map +1 -0
- package/out/interface/controller/event/argument/form-detail.event.js +1 -0
- package/out/interface/controller/event/argument/index.d.ts +1 -0
- package/out/interface/controller/event/argument/index.d.ts.map +1 -1
- package/out/interface/controller/event/control/i-form.event.d.ts +13 -1
- package/out/interface/controller/event/control/i-form.event.d.ts.map +1 -1
- package/out/interface/controller/event/view/i-map-view.event.d.ts +12 -0
- package/out/interface/controller/event/view/i-map-view.event.d.ts.map +1 -0
- package/out/interface/controller/event/view/i-map-view.event.js +1 -0
- package/out/interface/controller/event/view/index.d.ts +1 -0
- package/out/interface/controller/event/view/index.d.ts.map +1 -1
- package/out/interface/controller/event/view/index.js +1 -0
- package/out/interface/controller/state/view/i-map-view.state.d.ts +11 -0
- package/out/interface/controller/state/view/i-map-view.state.d.ts.map +1 -0
- package/out/interface/controller/state/view/i-map-view.state.js +1 -0
- package/out/interface/controller/state/view/index.d.ts +1 -0
- package/out/interface/controller/state/view/index.d.ts.map +1 -1
- package/out/interface/controller/state/view/index.js +1 -0
- package/out/model/utils/util.d.ts.map +1 -1
- package/out/model/utils/util.js +7 -2
- package/out/service/dto/method.dto.d.ts +14 -0
- package/out/service/dto/method.dto.d.ts.map +1 -1
- package/out/service/dto/method.dto.js +63 -23
- package/out/utils/handlebars/handlebars.d.ts.map +1 -1
- package/out/utils/handlebars/handlebars.js +3 -1
- package/package.json +2 -2
- package/src/controller/control/form/form/form.controller.ts +9 -0
- package/src/controller/control/form/form-detail/form-button/form-button.controller.ts +1 -0
- package/src/controller/control/form/form-detail/form-detail/form-detail.controller.ts +13 -0
- package/src/controller/control/form/form-detail/form-item/form-item.controller.ts +30 -0
- package/src/interface/controller/event/argument/form-detail.event.ts +27 -0
- package/src/interface/controller/event/argument/index.ts +1 -0
- package/src/interface/controller/event/control/i-form.event.ts +14 -1
- package/src/interface/controller/event/view/i-map-view.event.ts +12 -0
- package/src/interface/controller/event/view/index.ts +1 -0
- package/src/interface/controller/state/view/i-map-view.state.ts +10 -0
- package/src/interface/controller/state/view/index.ts +1 -0
- package/src/model/utils/util.ts +7 -4
- package/src/service/dto/method.dto.ts +70 -26
- package/src/utils/handlebars/handlebars.ts +3 -1
|
@@ -8,3 +8,4 @@ export type { ControlTriggerEvent } from './control-trigger.event';
|
|
|
8
8
|
export type { NavViewChangeEvent } from './nav-view-change.event';
|
|
9
9
|
export type { RowEditChangeEvent } from './row-edit-change.event';
|
|
10
10
|
export type { PanelItemEvent } from './panel-item.event';
|
|
11
|
+
export type { FormDetailEvent } from './form-detail.event';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PartialWithObject } from '@ibiz-template/core';
|
|
2
|
+
import { EventBase, FormDetailEvent } from '../argument';
|
|
2
3
|
import { IControlEvent } from './i-control.event';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -51,4 +52,16 @@ export interface IFormEvent extends IControlEvent {
|
|
|
51
52
|
event: EventBase;
|
|
52
53
|
emitArgs: undefined;
|
|
53
54
|
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 表单里的成员事件监听
|
|
58
|
+
* @author lxm
|
|
59
|
+
* @date 2023-03-26 06:15:06
|
|
60
|
+
* @param {EventBase} event
|
|
61
|
+
* @return {*} {Promise<void>}
|
|
62
|
+
*/
|
|
63
|
+
onFormDetailEvent: {
|
|
64
|
+
event: FormDetailEvent;
|
|
65
|
+
emitArgs: PartialWithObject<FormDetailEvent, EventBase>;
|
|
66
|
+
};
|
|
54
67
|
}
|
package/src/model/utils/util.ts
CHANGED
|
@@ -21,10 +21,13 @@ export function findModelChild(
|
|
|
21
21
|
models: IModelObject[],
|
|
22
22
|
id: string,
|
|
23
23
|
): IModelObject | null {
|
|
24
|
-
if (models) {
|
|
25
|
-
const model = models.find(
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
if (models && id) {
|
|
25
|
+
const model = models.find(item => {
|
|
26
|
+
if (item.id) {
|
|
27
|
+
return item.id.toLowerCase() === id.toLowerCase();
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
});
|
|
28
31
|
if (model) {
|
|
29
32
|
return model;
|
|
30
33
|
}
|
|
@@ -9,6 +9,10 @@ import { Application } from '../../application';
|
|
|
9
9
|
import { AppDataEntity } from '../app-data-entity/app-data-entity';
|
|
10
10
|
import { findModelChild } from '../../model';
|
|
11
11
|
|
|
12
|
+
interface listMap {
|
|
13
|
+
[key: number]: IData;
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
/**
|
|
13
17
|
* 应用实体服务方法转换 DTO
|
|
14
18
|
*
|
|
@@ -37,6 +41,35 @@ export class MethodDto {
|
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
|
|
44
|
+
/**
|
|
45
|
+
* 转换数组成ListMap
|
|
46
|
+
*
|
|
47
|
+
* @param {IData[]} arr
|
|
48
|
+
* @return {*} listMap
|
|
49
|
+
*/
|
|
50
|
+
private convertArrayToListMap(arr: IData[]): listMap {
|
|
51
|
+
const result: listMap = {};
|
|
52
|
+
arr.forEach((obj, index) => {
|
|
53
|
+
result[index + 1] = obj;
|
|
54
|
+
});
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 转换ListMap成数组
|
|
60
|
+
*
|
|
61
|
+
* @param {listMap} obj
|
|
62
|
+
* @return {*} IData[]
|
|
63
|
+
*/
|
|
64
|
+
private convertListMapToArray(obj: listMap): IData[] {
|
|
65
|
+
const result: IData[] = [];
|
|
66
|
+
Object.keys(obj).forEach(key => {
|
|
67
|
+
const index = parseInt(key, 10);
|
|
68
|
+
result[index - 1] = obj[index];
|
|
69
|
+
});
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
|
|
40
73
|
/**
|
|
41
74
|
* 请求参数组合 DTO
|
|
42
75
|
*
|
|
@@ -57,24 +90,31 @@ export class MethodDto {
|
|
|
57
90
|
break;
|
|
58
91
|
}
|
|
59
92
|
case 'DTOS': {
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
93
|
+
if (field.listMap) {
|
|
94
|
+
params[key] =
|
|
95
|
+
data[key] && data[key].length > 0
|
|
96
|
+
? this.convertArrayToListMap(data[key])
|
|
97
|
+
: null;
|
|
98
|
+
} else {
|
|
99
|
+
if (data[key] !== undefined) {
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
// 没有实体id的不处理
|
|
103
|
+
if (!field.refAppDataEntityId) {
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
const dto = await this.getFieldDto(field);
|
|
107
|
+
const service = await this.app!.deService.getService(
|
|
108
|
+
field.refAppDataEntityId!,
|
|
109
|
+
);
|
|
110
|
+
const items: IData[] = service.local.getList(context);
|
|
111
|
+
if (items) {
|
|
112
|
+
const arr = [];
|
|
113
|
+
for (let j = 0; j < items.length; j++) {
|
|
114
|
+
arr.push(await dto.get(context, items[j]));
|
|
115
|
+
}
|
|
116
|
+
params[key] = arr;
|
|
76
117
|
}
|
|
77
|
-
params[key] = arr;
|
|
78
118
|
}
|
|
79
119
|
break;
|
|
80
120
|
}
|
|
@@ -108,17 +148,21 @@ export class MethodDto {
|
|
|
108
148
|
const all = this.fields
|
|
109
149
|
.filter(field => field.type === 'DTOS')
|
|
110
150
|
.map(async field => {
|
|
111
|
-
// 没有实体id的不处理
|
|
112
|
-
if (!field.refAppDataEntityId) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
151
|
const key = field.codeName!.toLowerCase();
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (items) {
|
|
119
|
-
await dto.sets(context, items);
|
|
152
|
+
if (field.listMap && typeof datum[key] === 'object') {
|
|
153
|
+
datum[key] = this.convertListMapToArray(datum[key]);
|
|
120
154
|
} else {
|
|
121
|
-
|
|
155
|
+
// 没有实体id的不处理
|
|
156
|
+
if (!field.refAppDataEntityId) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const dto = await this.getFieldDto(field);
|
|
160
|
+
const items: IData[] = datum[key];
|
|
161
|
+
if (items) {
|
|
162
|
+
await dto.sets(context, items);
|
|
163
|
+
} else {
|
|
164
|
+
await dto.sets(context, []);
|
|
165
|
+
}
|
|
122
166
|
}
|
|
123
167
|
});
|
|
124
168
|
for (let i = 0; i < all.length; i++) {
|
|
@@ -49,7 +49,9 @@ export class HandlebarsUtil {
|
|
|
49
49
|
return this.p;
|
|
50
50
|
}
|
|
51
51
|
this.p = import('handlebars');
|
|
52
|
-
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
|
+
const module = (await this.p) as any;
|
|
54
|
+
this.hsb = module.default || module;
|
|
53
55
|
this.p = null;
|
|
54
56
|
installHelpers(this.hsb);
|
|
55
57
|
return this.hsb;
|