@ibiz-template/runtime 0.0.1-alpha.3 → 0.0.1-alpha.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-de-ui-action-util.d.ts","sourceRoot":"","sources":["../../../src/utils/app-de-ui-action-util/app-de-ui-action-util.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"app-de-ui-action-util.d.ts","sourceRoot":"","sources":["../../../src/utils/app-de-ui-action-util/app-de-ui-action-util.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGjB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD;;;;;;;GAOG;AACH,qBAAa,iBAAiB;IAC5B;;;;;;;;;;;;OAYG;WACU,IAAI,CACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,EACf,IAAI,CAAC,EAAE,KAAK,GACX,OAAO,CAAC,eAAe,CAAC;IAqE3B;;;;;;;;;;;;;;;;OAgBG;qBACoB,YAAY,CACjC,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC;QACT,aAAa,EAAE,QAAQ,CAAC;QACxB,UAAU,EAAE,KAAK,EAAE,CAAC;QACpB,YAAY,EAAE,OAAO,CAAC;KACvB,CAAC;IAwDF;;;;;;;;OAQG;WACU,kBAAkB,CAC7B,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,IAAI,CAAC,EAAE,KAAK,GACX,OAAO,CAAC,eAAe,CAAC;IAmF3B;;;;;;;;;;;;OAYG;WACU,oBAAoB,CAC/B,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,QAAQ,EACjB,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,EACrB,MAAM,EAAE,OAAO,EACf,IAAI,CAAC,EAAE,KAAK,GACX,OAAO,CAAC,eAAe,CAAC;IAiB3B;;;;;;;;;;;OAWG;WACU,sBAAsB,CACjC,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,QAAQ,EACjB,KAAK,EAAE,KAAK,EAAE,EACd,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,eAAe,CAAC;CAY5B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UnsupportedModelError, } from '@ibiz-template/model';
|
|
1
2
|
import { notNilEmpty } from 'qx-util';
|
|
2
3
|
import { OpenAppViewCommand } from '../../command';
|
|
3
4
|
import { convertNavData } from '../nav-params/nav-params';
|
|
@@ -24,12 +25,11 @@ export class AppDEUIActionUtil {
|
|
|
24
25
|
* @return {*} {Promise<IUIActionResult>}
|
|
25
26
|
*/
|
|
26
27
|
static async exec(action, context, data, params, opts) {
|
|
27
|
-
console.log(action);
|
|
28
28
|
// **用户操作确认**
|
|
29
29
|
if (action.enableConfirm && action.confirmMsg) {
|
|
30
30
|
// todo 用户操作确认
|
|
31
31
|
}
|
|
32
|
-
const {
|
|
32
|
+
const { neuron } = opts;
|
|
33
33
|
const result = {
|
|
34
34
|
refresh: action.reloadData,
|
|
35
35
|
closeView: action.closeEditView,
|
|
@@ -61,17 +61,17 @@ export class AppDEUIActionUtil {
|
|
|
61
61
|
}
|
|
62
62
|
// *刷新引用视图
|
|
63
63
|
if (result.refresh) {
|
|
64
|
-
if (!
|
|
64
|
+
if (!neuron.call.refresh) {
|
|
65
65
|
throw new Error(`该视图不存在刷新能力`);
|
|
66
66
|
}
|
|
67
|
-
await
|
|
67
|
+
await neuron.call.refresh();
|
|
68
68
|
}
|
|
69
69
|
// *关闭引用视图
|
|
70
70
|
if (result.closeView) {
|
|
71
|
-
if (!
|
|
71
|
+
if (!neuron.call.closeView) {
|
|
72
72
|
throw new Error(`该视图不存在关闭视图能力`);
|
|
73
73
|
}
|
|
74
|
-
await
|
|
74
|
+
await neuron.call.closeView();
|
|
75
75
|
}
|
|
76
76
|
return result;
|
|
77
77
|
}
|
|
@@ -139,7 +139,7 @@ export class AppDEUIActionUtil {
|
|
|
139
139
|
* @returns {*} {Promise<IUIActionResult>}
|
|
140
140
|
*/
|
|
141
141
|
static async executeSysUIAction(action, data, opts) {
|
|
142
|
-
const {
|
|
142
|
+
const { neuron, event } = opts;
|
|
143
143
|
const { uIActionTag } = action;
|
|
144
144
|
const result = {};
|
|
145
145
|
// todo 暂未支持部分
|
|
@@ -151,51 +151,50 @@ export class AppDEUIActionUtil {
|
|
|
151
151
|
'RefreshAll',
|
|
152
152
|
'Import',
|
|
153
153
|
].indexOf(uIActionTag) !== -1) {
|
|
154
|
-
|
|
155
|
-
return result;
|
|
154
|
+
throw new UnsupportedModelError(action, `${uIActionTag}暂未支持`);
|
|
156
155
|
}
|
|
157
156
|
// 打开新建数据视图
|
|
158
157
|
if (uIActionTag === 'New') {
|
|
159
|
-
if (!
|
|
158
|
+
if (!neuron.call.newData) {
|
|
160
159
|
throw new Error(`该视图不存在newData能力`);
|
|
161
160
|
}
|
|
162
|
-
await
|
|
161
|
+
await neuron.call.newData(event);
|
|
163
162
|
}
|
|
164
163
|
// 打开新建数据视图
|
|
165
164
|
if (uIActionTag === 'Edit') {
|
|
166
|
-
if (!
|
|
165
|
+
if (!neuron.call.openData) {
|
|
167
166
|
throw new Error(`该视图不存在openData能力`);
|
|
168
167
|
}
|
|
169
|
-
await
|
|
168
|
+
await neuron.call.openData(data === null || data === void 0 ? void 0 : data[0], event);
|
|
170
169
|
}
|
|
171
170
|
// 保存能力
|
|
172
171
|
const saveTags = ['SaveAndExit', 'Save', 'SaveAndStart', 'SaveRow'];
|
|
173
172
|
if (saveTags.indexOf(uIActionTag) !== -1) {
|
|
174
|
-
if (!
|
|
173
|
+
if (!neuron.call.save) {
|
|
175
174
|
throw new Error(`该视图不存在save能力`);
|
|
176
175
|
}
|
|
177
|
-
await
|
|
176
|
+
await neuron.call.save();
|
|
178
177
|
}
|
|
179
178
|
// 保存并新建
|
|
180
179
|
if (uIActionTag === 'SaveAndNew') {
|
|
181
|
-
if (!
|
|
180
|
+
if (!neuron.call.saveAndNew) {
|
|
182
181
|
throw new Error(`该视图不存在saveAndNew能力`);
|
|
183
182
|
}
|
|
184
|
-
await
|
|
183
|
+
await neuron.call.saveAndNew();
|
|
185
184
|
}
|
|
186
185
|
// 删除能力
|
|
187
186
|
if (uIActionTag === 'Remove' || uIActionTag === 'RemoveAndExit') {
|
|
188
|
-
if (!
|
|
187
|
+
if (!neuron.call.remove) {
|
|
189
188
|
throw new Error(`该视图不存在remove能力`);
|
|
190
189
|
}
|
|
191
|
-
await
|
|
190
|
+
await neuron.call.remove();
|
|
192
191
|
}
|
|
193
192
|
// 新建行能力
|
|
194
193
|
if (uIActionTag === 'NewRow') {
|
|
195
|
-
if (!
|
|
194
|
+
if (!neuron.call.newRow) {
|
|
196
195
|
throw new Error(`该视图不存在newRow能力`);
|
|
197
196
|
}
|
|
198
|
-
await
|
|
197
|
+
await neuron.call.newRow();
|
|
199
198
|
}
|
|
200
199
|
// 需要关闭视图的
|
|
201
200
|
if (['SaveAndExit', 'Exit', 'SaveAndStart', 'RemoveAndExit'].indexOf(uIActionTag) !== -1) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/runtime",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.4",
|
|
4
4
|
"description": "控制器包",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"types": "out/index.d.ts",
|
|
@@ -19,19 +19,20 @@
|
|
|
19
19
|
},
|
|
20
20
|
"author": "chitanda",
|
|
21
21
|
"license": "MIT",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@ibiz-template/command": "^0.0.1-alpha.2"
|
|
24
|
+
},
|
|
22
25
|
"devDependencies": {
|
|
23
|
-
"@ibiz-template/
|
|
24
|
-
"@ibiz-template/
|
|
25
|
-
"@ibiz-template/
|
|
26
|
-
"@ibiz-template/service": "^0.0.1-alpha.3",
|
|
26
|
+
"@ibiz-template/core": "^0.0.1-alpha.4",
|
|
27
|
+
"@ibiz-template/model": "^0.0.1-alpha.4",
|
|
28
|
+
"@ibiz-template/service": "^0.0.1-alpha.4",
|
|
27
29
|
"qx-util": "^0.4.0"
|
|
28
30
|
},
|
|
29
31
|
"peerDependencies": {
|
|
30
|
-
"@ibiz-template/command": "^0.0.1-alpha.2",
|
|
31
32
|
"@ibiz-template/core": "^0.0.1-alpha.2",
|
|
32
33
|
"@ibiz-template/model": "^0.0.1-alpha.2",
|
|
33
34
|
"@ibiz-template/service": "^0.0.1-alpha.2",
|
|
34
35
|
"qx-util": "^0.4.0"
|
|
35
36
|
},
|
|
36
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "e21190e748f8e9ccdcda19ce09bc21c8e0ad7e87"
|
|
37
38
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
IPSAppDEUIAction,
|
|
3
|
+
IPSNavigateContext,
|
|
4
|
+
UnsupportedModelError,
|
|
5
|
+
} from '@ibiz-template/model';
|
|
2
6
|
import { notNilEmpty } from 'qx-util';
|
|
3
7
|
import { OpenAppViewCommand } from '../../command';
|
|
4
8
|
import { IUIActionResult } from '../../interface';
|
|
@@ -33,13 +37,12 @@ export class AppDEUIActionUtil {
|
|
|
33
37
|
params: IParams,
|
|
34
38
|
opts?: IData,
|
|
35
39
|
): Promise<IUIActionResult> {
|
|
36
|
-
console.log(action);
|
|
37
40
|
// **用户操作确认**
|
|
38
41
|
if (action.enableConfirm && action.confirmMsg) {
|
|
39
42
|
// todo 用户操作确认
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
const {
|
|
45
|
+
const { neuron } = opts!;
|
|
43
46
|
const result: IUIActionResult = {
|
|
44
47
|
refresh: action.reloadData,
|
|
45
48
|
closeView: action.closeEditView,
|
|
@@ -85,18 +88,18 @@ export class AppDEUIActionUtil {
|
|
|
85
88
|
|
|
86
89
|
// *刷新引用视图
|
|
87
90
|
if (result.refresh) {
|
|
88
|
-
if (!
|
|
91
|
+
if (!neuron.call.refresh) {
|
|
89
92
|
throw new Error(`该视图不存在刷新能力`);
|
|
90
93
|
}
|
|
91
|
-
await
|
|
94
|
+
await neuron.call.refresh();
|
|
92
95
|
}
|
|
93
96
|
|
|
94
97
|
// *关闭引用视图
|
|
95
98
|
if (result.closeView) {
|
|
96
|
-
if (!
|
|
99
|
+
if (!neuron.call.closeView) {
|
|
97
100
|
throw new Error(`该视图不存在关闭视图能力`);
|
|
98
101
|
}
|
|
99
|
-
await
|
|
102
|
+
await neuron.call.closeView();
|
|
100
103
|
}
|
|
101
104
|
|
|
102
105
|
return result;
|
|
@@ -198,7 +201,7 @@ export class AppDEUIActionUtil {
|
|
|
198
201
|
data: IData[] | null,
|
|
199
202
|
opts?: IData,
|
|
200
203
|
): Promise<IUIActionResult> {
|
|
201
|
-
const {
|
|
204
|
+
const { neuron, event } = opts!;
|
|
202
205
|
const { uIActionTag } = action;
|
|
203
206
|
const result: IUIActionResult = {};
|
|
204
207
|
|
|
@@ -213,56 +216,55 @@ export class AppDEUIActionUtil {
|
|
|
213
216
|
'Import',
|
|
214
217
|
].indexOf(uIActionTag) !== -1
|
|
215
218
|
) {
|
|
216
|
-
|
|
217
|
-
return result;
|
|
219
|
+
throw new UnsupportedModelError(action, `${uIActionTag}暂未支持`);
|
|
218
220
|
}
|
|
219
221
|
|
|
220
222
|
// 打开新建数据视图
|
|
221
223
|
if (uIActionTag === 'New') {
|
|
222
|
-
if (!
|
|
224
|
+
if (!neuron.call.newData) {
|
|
223
225
|
throw new Error(`该视图不存在newData能力`);
|
|
224
226
|
}
|
|
225
|
-
await
|
|
227
|
+
await neuron.call.newData(event);
|
|
226
228
|
}
|
|
227
229
|
// 打开新建数据视图
|
|
228
230
|
if (uIActionTag === 'Edit') {
|
|
229
|
-
if (!
|
|
231
|
+
if (!neuron.call.openData) {
|
|
230
232
|
throw new Error(`该视图不存在openData能力`);
|
|
231
233
|
}
|
|
232
|
-
await
|
|
234
|
+
await neuron.call.openData(data?.[0], event);
|
|
233
235
|
}
|
|
234
236
|
|
|
235
237
|
// 保存能力
|
|
236
238
|
const saveTags = ['SaveAndExit', 'Save', 'SaveAndStart', 'SaveRow'];
|
|
237
239
|
if (saveTags.indexOf(uIActionTag) !== -1) {
|
|
238
|
-
if (!
|
|
240
|
+
if (!neuron.call.save) {
|
|
239
241
|
throw new Error(`该视图不存在save能力`);
|
|
240
242
|
}
|
|
241
|
-
await
|
|
243
|
+
await neuron.call.save();
|
|
242
244
|
}
|
|
243
245
|
|
|
244
246
|
// 保存并新建
|
|
245
247
|
if (uIActionTag === 'SaveAndNew') {
|
|
246
|
-
if (!
|
|
248
|
+
if (!neuron.call.saveAndNew) {
|
|
247
249
|
throw new Error(`该视图不存在saveAndNew能力`);
|
|
248
250
|
}
|
|
249
|
-
await
|
|
251
|
+
await neuron.call.saveAndNew();
|
|
250
252
|
}
|
|
251
253
|
|
|
252
254
|
// 删除能力
|
|
253
255
|
if (uIActionTag === 'Remove' || uIActionTag === 'RemoveAndExit') {
|
|
254
|
-
if (!
|
|
256
|
+
if (!neuron.call.remove) {
|
|
255
257
|
throw new Error(`该视图不存在remove能力`);
|
|
256
258
|
}
|
|
257
|
-
await
|
|
259
|
+
await neuron.call.remove();
|
|
258
260
|
}
|
|
259
261
|
|
|
260
262
|
// 新建行能力
|
|
261
263
|
if (uIActionTag === 'NewRow') {
|
|
262
|
-
if (!
|
|
264
|
+
if (!neuron.call.newRow) {
|
|
263
265
|
throw new Error(`该视图不存在newRow能力`);
|
|
264
266
|
}
|
|
265
|
-
await
|
|
267
|
+
await neuron.call.newRow();
|
|
266
268
|
}
|
|
267
269
|
|
|
268
270
|
// 需要关闭视图的
|