@ibiz-template/runtime 0.2.0 → 0.2.1
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 +154 -119
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/out/application.js +1 -1
- package/out/controller/control/data-view/data-view.controller.d.ts +7 -0
- package/out/controller/control/data-view/data-view.controller.d.ts.map +1 -1
- package/out/controller/control/data-view/data-view.controller.js +41 -0
- package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.js +4 -1
- package/out/de-logic/utils/handle-src-val.d.ts.map +1 -1
- package/out/de-logic/utils/handle-src-val.js +9 -4
- package/out/interface/common/i-sort-item/i-sort-item.d.ts +24 -0
- package/out/interface/common/i-sort-item/i-sort-item.d.ts.map +1 -0
- package/out/interface/common/i-sort-item/i-sort-item.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/control/i-data-view-control.state.d.ts +8 -0
- package/out/interface/controller/state/control/i-data-view-control.state.d.ts.map +1 -1
- package/out/service/service/control/control.service.d.ts.map +1 -1
- package/out/service/service/control/control.service.js +2 -1
- package/out/service/service/entity/method/de-action.d.ts.map +1 -1
- package/out/service/service/entity/method/de-action.js +2 -1
- package/out/service/vo/control.vo.d.ts +7 -7
- package/out/service/vo/control.vo.d.ts.map +1 -1
- package/out/service/vo/control.vo.js +52 -73
- package/out/ui-action/provider/ui-action-provider-base.d.ts.map +1 -1
- package/out/ui-action/provider/ui-action-provider-base.js +4 -2
- package/out/ui-logic/utils/handle-src-val.d.ts.map +1 -1
- package/out/ui-logic/utils/handle-src-val.js +9 -4
- package/package.json +2 -2
- package/src/application.ts +2 -2
- package/src/controller/control/data-view/data-view.controller.ts +46 -0
- package/src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts +4 -4
- package/src/de-logic/utils/handle-src-val.ts +12 -8
- package/src/interface/common/i-sort-item/i-sort-item.ts +25 -0
- package/src/interface/common/index.ts +1 -0
- package/src/interface/controller/state/control/i-data-view-control.state.ts +9 -0
- package/src/service/service/control/control.service.ts +2 -1
- package/src/service/service/entity/method/de-action.ts +2 -1
- package/src/service/vo/control.vo.ts +66 -24
- package/src/ui-action/provider/ui-action-provider-base.ts +7 -2
- package/src/ui-logic/utils/handle-src-val.ts +12 -8
|
@@ -80,14 +80,18 @@ export function handleSrcVal(
|
|
|
80
80
|
|
|
81
81
|
if (value && srcField) {
|
|
82
82
|
try {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
if (Array.isArray(value)) {
|
|
84
|
+
value = value[Number(srcField)];
|
|
85
|
+
} else {
|
|
86
|
+
value = ScriptFactory.execScriptFn(
|
|
87
|
+
{ srcValue: value },
|
|
88
|
+
`srcValue.${srcField}`,
|
|
89
|
+
{
|
|
90
|
+
singleRowReturn: true,
|
|
91
|
+
isAsync: false,
|
|
92
|
+
},
|
|
93
|
+
);
|
|
94
|
+
}
|
|
91
95
|
} catch (error) {
|
|
92
96
|
ibiz.log.error(`从源参数取属性${srcField}报错,源参数:`, value);
|
|
93
97
|
throw error;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ISortItem {
|
|
2
|
+
/**
|
|
3
|
+
* 唯一标识
|
|
4
|
+
* @author lxm
|
|
5
|
+
* @date 2023-10-24 05:55:30
|
|
6
|
+
* @type {string}
|
|
7
|
+
*/
|
|
8
|
+
key: string;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 显示标题
|
|
12
|
+
* @author lxm
|
|
13
|
+
* @date 2023-10-24 05:55:36
|
|
14
|
+
* @type {string}
|
|
15
|
+
*/
|
|
16
|
+
caption: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 排序顺序
|
|
20
|
+
* @author lxm
|
|
21
|
+
* @date 2023-10-24 05:55:45
|
|
22
|
+
* @type {('asc' | 'desc')}
|
|
23
|
+
*/
|
|
24
|
+
order?: 'asc' | 'desc';
|
|
25
|
+
}
|
|
@@ -31,3 +31,4 @@ export type {
|
|
|
31
31
|
export type { IOpenViewOptions } from './i-open-view-options/i-open-view-options';
|
|
32
32
|
export type { IErrorHandler } from './i-error-handler/i-error-handler';
|
|
33
33
|
export type { IFloatWindowOptions } from './i-float-window-options/i-float-window-options';
|
|
34
|
+
export type { ISortItem } from './i-sort-item/i-sort-item';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ISortItem } from '../../../common';
|
|
1
2
|
import { IButtonContainerState } from '../../common';
|
|
2
3
|
import { IMDControlState } from './i-md-control.state';
|
|
3
4
|
|
|
@@ -16,4 +17,12 @@ export interface IDataViewControlState extends IMDControlState {
|
|
|
16
17
|
* @memberof PortletPartState
|
|
17
18
|
*/
|
|
18
19
|
groupActionGroupState?: IButtonContainerState;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 排序栏项集合
|
|
23
|
+
* @author lxm
|
|
24
|
+
* @date 2023-10-24 05:57:37
|
|
25
|
+
* @type {ISortItem[]}
|
|
26
|
+
*/
|
|
27
|
+
sortItems: ISortItem[];
|
|
19
28
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IHttpResponse } from '@ibiz-template/core';
|
|
2
2
|
import { IControl } from '@ibiz/model-core';
|
|
3
|
+
import { clone } from 'ramda';
|
|
3
4
|
import { ControlVO } from '../../vo/control.vo';
|
|
4
5
|
import { UIMapField } from '../../vo/ui-map-field';
|
|
5
6
|
import { Application } from '../../../application';
|
|
@@ -92,7 +93,7 @@ export class ControlService<T extends IControl = IControl> {
|
|
|
92
93
|
*/
|
|
93
94
|
handleResponse(res: IHttpResponse): IHttpResponse {
|
|
94
95
|
// 公共处理
|
|
95
|
-
return res;
|
|
96
|
+
return clone(res);
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
/**
|
|
@@ -50,7 +50,8 @@ export class DEActionMethod extends Method {
|
|
|
50
50
|
data: IData | IData[],
|
|
51
51
|
): Promise<IData | IData[]> {
|
|
52
52
|
if (isArray(data)) {
|
|
53
|
-
|
|
53
|
+
// 多项数据不做dto转换
|
|
54
|
+
return data;
|
|
54
55
|
}
|
|
55
56
|
return this.input.handle(context, data);
|
|
56
57
|
}
|
|
@@ -41,12 +41,7 @@ export class ControlVO {
|
|
|
41
41
|
* @date 2022-09-06 22:09:24
|
|
42
42
|
* @type {Srfuf}
|
|
43
43
|
*/
|
|
44
|
-
|
|
45
|
-
if (isNil(this.$origin.srfuf)) {
|
|
46
|
-
return this.srfkey ? Srfuf.UPDATE : Srfuf.CREATE;
|
|
47
|
-
}
|
|
48
|
-
return this.$origin.srfuf;
|
|
49
|
-
}
|
|
44
|
+
declare srfuf: Srfuf;
|
|
50
45
|
|
|
51
46
|
/**
|
|
52
47
|
* 主键
|
|
@@ -55,9 +50,7 @@ export class ControlVO {
|
|
|
55
50
|
* @date 2022-09-07 19:09:42
|
|
56
51
|
* @type {string}
|
|
57
52
|
*/
|
|
58
|
-
|
|
59
|
-
return this.$origin.srfkey;
|
|
60
|
-
}
|
|
53
|
+
declare srfkey: string;
|
|
61
54
|
|
|
62
55
|
/**
|
|
63
56
|
* 主信息
|
|
@@ -66,9 +59,7 @@ export class ControlVO {
|
|
|
66
59
|
* @date 2022-09-07 19:09:42
|
|
67
60
|
* @type {string}
|
|
68
61
|
*/
|
|
69
|
-
|
|
70
|
-
return this.$origin.srfmajortext;
|
|
71
|
-
}
|
|
62
|
+
declare srfmajortext: string;
|
|
72
63
|
|
|
73
64
|
/**
|
|
74
65
|
* 实体模型标识
|
|
@@ -77,9 +68,7 @@ export class ControlVO {
|
|
|
77
68
|
* @date 2022-09-07 19:09:42
|
|
78
69
|
* @type {string}
|
|
79
70
|
*/
|
|
80
|
-
|
|
81
|
-
return this.$origin.srfdeid;
|
|
82
|
-
}
|
|
71
|
+
declare srfdeid: string;
|
|
83
72
|
|
|
84
73
|
/**
|
|
85
74
|
* 实体模型代码名称
|
|
@@ -88,9 +77,7 @@ export class ControlVO {
|
|
|
88
77
|
* @date 2022-09-07 19:09:42
|
|
89
78
|
* @type {string}
|
|
90
79
|
*/
|
|
91
|
-
|
|
92
|
-
return this.$origin.srfdecodename;
|
|
93
|
-
}
|
|
80
|
+
declare srfdecodename: string;
|
|
94
81
|
|
|
95
82
|
/**
|
|
96
83
|
* 实体主键属性
|
|
@@ -99,9 +86,7 @@ export class ControlVO {
|
|
|
99
86
|
* @date 2022-09-07 19:09:42
|
|
100
87
|
* @type {string}
|
|
101
88
|
*/
|
|
102
|
-
|
|
103
|
-
return this.$origin.srfkeyfile;
|
|
104
|
-
}
|
|
89
|
+
declare srfkeyfile: string;
|
|
105
90
|
|
|
106
91
|
/**
|
|
107
92
|
* 实体主信息属性
|
|
@@ -110,9 +95,7 @@ export class ControlVO {
|
|
|
110
95
|
* @date 2022-09-07 19:09:42
|
|
111
96
|
* @type {string}
|
|
112
97
|
*/
|
|
113
|
-
|
|
114
|
-
return this.$origin.srfmajorfile;
|
|
115
|
-
}
|
|
98
|
+
declare srfmajorfile: string;
|
|
116
99
|
|
|
117
100
|
/**
|
|
118
101
|
* Creates an instance of ControlVO.
|
|
@@ -137,6 +120,65 @@ export class ControlVO {
|
|
|
137
120
|
value: $dataUIMap || new Map(),
|
|
138
121
|
});
|
|
139
122
|
|
|
123
|
+
Object.defineProperty(this, 'srfuf', {
|
|
124
|
+
get() {
|
|
125
|
+
if (isNil(this.$origin.srfuf)) {
|
|
126
|
+
return this.srfkey ? Srfuf.UPDATE : Srfuf.CREATE;
|
|
127
|
+
}
|
|
128
|
+
return this.$origin.srfuf;
|
|
129
|
+
},
|
|
130
|
+
enumerable: false,
|
|
131
|
+
configurable: true,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
Object.defineProperty(this, 'srfkey', {
|
|
135
|
+
get() {
|
|
136
|
+
return this.$origin.srfkey;
|
|
137
|
+
},
|
|
138
|
+
enumerable: false,
|
|
139
|
+
configurable: true,
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
Object.defineProperty(this, 'srfmajortext', {
|
|
143
|
+
get() {
|
|
144
|
+
return this.$origin.srfmajortext;
|
|
145
|
+
},
|
|
146
|
+
enumerable: false,
|
|
147
|
+
configurable: true,
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
Object.defineProperty(this, 'srfdeid', {
|
|
151
|
+
get() {
|
|
152
|
+
return this.$origin.srfdeid;
|
|
153
|
+
},
|
|
154
|
+
enumerable: false,
|
|
155
|
+
configurable: true,
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
Object.defineProperty(this, 'srfdecodename', {
|
|
159
|
+
get() {
|
|
160
|
+
return this.$origin.srfdecodename;
|
|
161
|
+
},
|
|
162
|
+
enumerable: false,
|
|
163
|
+
configurable: true,
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
Object.defineProperty(this, 'srfkeyfile', {
|
|
167
|
+
get() {
|
|
168
|
+
return this.$origin.srfkeyfile;
|
|
169
|
+
},
|
|
170
|
+
enumerable: false,
|
|
171
|
+
configurable: true,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
Object.defineProperty(this, 'srfmajorfile', {
|
|
175
|
+
get() {
|
|
176
|
+
return this.$origin.srfmajorfile;
|
|
177
|
+
},
|
|
178
|
+
enumerable: false,
|
|
179
|
+
configurable: true,
|
|
180
|
+
});
|
|
181
|
+
|
|
140
182
|
// 先转换映射的属性
|
|
141
183
|
this.$dataUIMap.forEach((mapField, key) => {
|
|
142
184
|
const value = mapField.dataKey;
|
|
@@ -192,6 +192,11 @@ export abstract class UIActionProviderBase implements IUIActionProvider {
|
|
|
192
192
|
|
|
193
193
|
// 准备实体名称
|
|
194
194
|
const deName = calcDeCodeNameById(action.appDataEntityId!);
|
|
195
|
+
const entity = await ibiz.hub.getAppDataEntity(
|
|
196
|
+
action.appDataEntityId!,
|
|
197
|
+
context.srfappid,
|
|
198
|
+
);
|
|
199
|
+
const keyField = entity.keyAppDEFieldId!; // 主键属性名称
|
|
195
200
|
|
|
196
201
|
// 根据数据目标处理数据集合
|
|
197
202
|
switch (action.actionTarget) {
|
|
@@ -211,7 +216,7 @@ export abstract class UIActionProviderBase implements IUIActionProvider {
|
|
|
211
216
|
case 'MULTIKEY':
|
|
212
217
|
resultData =
|
|
213
218
|
deName && data.length > 0
|
|
214
|
-
? data.map(item => ({ [
|
|
219
|
+
? data.map(item => ({ [keyField]: item.srfkey || item[keyField] }))
|
|
215
220
|
: [{}];
|
|
216
221
|
break;
|
|
217
222
|
// 单项数据主键,传递包含一个对象的数组,对象里只含有一个主键
|
|
@@ -219,7 +224,7 @@ export abstract class UIActionProviderBase implements IUIActionProvider {
|
|
|
219
224
|
{
|
|
220
225
|
const originData = data[0] || {};
|
|
221
226
|
resultData = deName
|
|
222
|
-
? [{ [
|
|
227
|
+
? [{ [keyField]: originData.srfkey || originData[keyField] }]
|
|
223
228
|
: [{}];
|
|
224
229
|
}
|
|
225
230
|
break;
|
|
@@ -76,14 +76,18 @@ export function handleSrcVal(
|
|
|
76
76
|
|
|
77
77
|
if (value && srcField) {
|
|
78
78
|
try {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
if (Array.isArray(value)) {
|
|
80
|
+
value = value[Number(srcField)];
|
|
81
|
+
} else {
|
|
82
|
+
value = ScriptFactory.execScriptFn(
|
|
83
|
+
{ srcValue: value },
|
|
84
|
+
`srcValue.${srcField}`,
|
|
85
|
+
{
|
|
86
|
+
singleRowReturn: true,
|
|
87
|
+
isAsync: false,
|
|
88
|
+
},
|
|
89
|
+
);
|
|
90
|
+
}
|
|
87
91
|
} catch (error) {
|
|
88
92
|
ibiz.log.error(`从源参数取属性${srcField}报错,源参数:`, value);
|
|
89
93
|
throw error;
|