@lcap/nasl 0.3.10-beta.oom4 → 0.3.12-beta
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/out/service/app/api.js +17 -17
- package/out/service/app/api.js.map +1 -1
- package/out/service/create/errHandles.js +12 -0
- package/out/service/create/errHandles.js.map +1 -1
- package/out/service/create/index.js +5 -0
- package/out/service/create/index.js.map +1 -1
- package/out/service/logic/logic.d.ts +26 -17
- package/out/service/logic/logic.js +6 -0
- package/out/service/logic/logic.js.map +1 -1
- package/out/types/app/App.d.ts +9 -0
- package/out/types/app/App.js +25 -1
- package/out/types/app/App.js.map +1 -1
- package/out/types/app/History.js +3 -2
- package/out/types/app/History.js.map +1 -1
- package/out/types/app/Service.d.ts +3 -0
- package/out/types/app/Service.js +14 -6
- package/out/types/app/Service.js.map +1 -1
- package/out/types/cacheData.js.map +1 -1
- package/out/types/common/Vertex.js +2 -1
- package/out/types/common/Vertex.js.map +1 -1
- package/out/types/data/Entity.d.ts +4 -0
- package/out/types/data/Entity.js +8 -0
- package/out/types/data/Entity.js.map +1 -1
- package/out/types/data/EntityProperty.d.ts +5 -0
- package/out/types/data/EntityProperty.js +16 -0
- package/out/types/data/EntityProperty.js.map +1 -1
- package/out/types/data/GlobalLogicNode.js +8 -1
- package/out/types/data/GlobalLogicNode.js.map +1 -1
- package/out/types/data/dataTypes.js +1 -1
- package/out/types/data/dataTypes.js.map +1 -1
- package/out/types/data/genBlock/genCurdEditTableBlock.d.ts +3 -0
- package/out/types/data/genBlock/genCurdEditTableBlock.js +578 -0
- package/out/types/data/genBlock/genCurdEditTableBlock.js.map +1 -0
- package/out/types/data/genBlock/genEditTableBlock.d.ts +234 -0
- package/out/types/data/genBlock/genEditTableBlock.js +419 -0
- package/out/types/data/genBlock/genEditTableBlock.js.map +1 -0
- package/out/types/data/genBlock/genQueryComponent.d.ts +20 -0
- package/out/types/data/genBlock/genQueryComponent.js +57 -1
- package/out/types/data/genBlock/genQueryComponent.js.map +1 -1
- package/out/types/data/genBlock/genTableBlock.js +9 -5
- package/out/types/data/genBlock/genTableBlock.js.map +1 -1
- package/out/types/data/genBlock/index.d.ts +2 -0
- package/out/types/data/genBlock/index.js +2 -0
- package/out/types/data/genBlock/index.js.map +1 -1
- package/out/types/data/genBlock/utils.d.ts +7 -0
- package/out/types/data/genBlock/utils.js +38 -1
- package/out/types/data/genBlock/utils.js.map +1 -1
- package/out/types/logic/Logic.d.ts +4 -0
- package/out/types/logic/Logic.js +35 -10
- package/out/types/logic/Logic.js.map +1 -1
- package/out/types/logic/LogicItem.js +6 -8
- package/out/types/logic/LogicItem.js.map +1 -1
- package/out/types/logic/Param.js +5 -13
- package/out/types/logic/Param.js.map +1 -1
- package/out/types/logic/Return.js +3 -11
- package/out/types/logic/Return.js.map +1 -1
- package/out/types/logic/Variable.js +3 -6
- package/out/types/logic/Variable.js.map +1 -1
- package/out/types/logic/translator.js +39 -8
- package/out/types/logic/translator.js.map +1 -1
- package/out/types/page/Element.d.ts +21 -2
- package/out/types/page/Element.js +86 -5
- package/out/types/page/Element.js.map +1 -1
- package/out/types/page/Page.d.ts +4 -0
- package/out/types/page/Page.js +7 -0
- package/out/types/page/Page.js.map +1 -1
- package/out/types/page/View.d.ts +18 -0
- package/out/types/page/View.js +112 -7
- package/out/types/page/View.js.map +1 -1
- package/out/types/page/ViewVariable.js +0 -6
- package/out/types/page/ViewVariable.js.map +1 -1
- package/out/types/process/ProcessParam.js +3 -1
- package/out/types/process/ProcessParam.js.map +1 -1
- package/out/types/utils/index.d.ts +1 -0
- package/out/types/utils/index.js +16 -7
- package/out/types/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/service/app/api.js +4 -4
- package/src/service/create/errHandles.js +12 -0
- package/src/service/create/index.js +6 -0
- package/src/service/logic/logic.js +6 -0
- package/src/types/app/App.ts +32 -9
- package/src/types/app/History.ts +3 -2
- package/src/types/app/Service.ts +18 -9
- package/src/types/cacheData.ts +7 -7
- package/src/types/common/Vertex.ts +2 -1
- package/src/types/data/Entity.ts +7 -0
- package/src/types/data/EntityProperty.ts +12 -0
- package/src/types/data/GlobalLogicNode.ts +8 -1
- package/src/types/data/dataTypes.ts +1 -1
- package/src/types/data/genBlock/genCurdEditTableBlock.ts +581 -0
- package/src/types/data/genBlock/genEditTableBlock.ts +470 -0
- package/src/types/data/genBlock/genQueryComponent.ts +56 -0
- package/src/types/data/genBlock/genTableBlock.ts +14 -10
- package/src/types/data/genBlock/index.ts +2 -0
- package/src/types/data/genBlock/utils.ts +38 -0
- package/src/types/logic/Logic.ts +45 -17
- package/src/types/logic/LogicItem.ts +8 -11
- package/src/types/logic/Param.ts +25 -35
- package/src/types/logic/Return.ts +18 -26
- package/src/types/logic/Variable.ts +18 -20
- package/src/types/logic/translator.js +41 -10
- package/src/types/page/Element.ts +157 -71
- package/src/types/page/Page.ts +7 -0
- package/src/types/page/View.ts +150 -41
- package/src/types/page/ViewVariable.ts +13 -19
- package/src/types/page/dist/View.js +727 -0
- package/src/types/process/ProcessParam.ts +4 -1
- package/src/types/utils/index.ts +16 -7
- package/out/service/debugger/debugger.d.ts +0 -3
- package/out/service/debugger/debugger.js +0 -95
- package/out/service/debugger/debugger.js.map +0 -1
- package/out/test/units/config.spec.d.ts +0 -1
- package/out/test/units/config.spec.js +0 -12
- package/out/test/units/config.spec.js.map +0 -1
- package/out/types/logic/BreakPoint.d.ts +0 -42
- package/out/types/logic/BreakPoint.js +0 -155
- package/out/types/logic/BreakPoint.js.map +0 -1
- package/out/types/logic/Debugger.d.ts +0 -156
- package/out/types/logic/Debugger.js +0 -912
- package/out/types/logic/Debugger.js.map +0 -1
package/src/types/page/View.ts
CHANGED
|
@@ -59,6 +59,12 @@ export class View extends Block {
|
|
|
59
59
|
*/
|
|
60
60
|
@immutable()
|
|
61
61
|
public readonly title: string = undefined;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 标题
|
|
65
|
+
*/
|
|
66
|
+
@immutable()
|
|
67
|
+
public readonly description: string = undefined;
|
|
62
68
|
/**
|
|
63
69
|
* 面包屑
|
|
64
70
|
*/
|
|
@@ -128,6 +134,12 @@ export class View extends Block {
|
|
|
128
134
|
*/
|
|
129
135
|
@immutable()
|
|
130
136
|
public readonly moreChildrenFields: Array<string> = ['$def.params', '$def.variables', '$def.logics'];
|
|
137
|
+
/**
|
|
138
|
+
* 当前View中所有组件名的缓存
|
|
139
|
+
*/
|
|
140
|
+
@immutable()
|
|
141
|
+
public readonly elementNameSet: Set<string> = new Set();
|
|
142
|
+
|
|
131
143
|
/**
|
|
132
144
|
* @param source 需要合并的部分参数
|
|
133
145
|
*/
|
|
@@ -201,35 +213,39 @@ export class View extends Block {
|
|
|
201
213
|
})().finally(() => this.contentPromise = undefined);
|
|
202
214
|
}
|
|
203
215
|
loadAll(enableCache = true) {
|
|
216
|
+
const isGONGHANG = utils.getGlobalEnv() === 'gonghang';
|
|
217
|
+
if (isGONGHANG) {
|
|
218
|
+
enableCache = false;
|
|
219
|
+
}
|
|
204
220
|
// 如果有正在进行的 Promise,则直接返回它
|
|
205
221
|
if (this.contentPromise)
|
|
206
222
|
return this.contentPromise;
|
|
207
223
|
|
|
208
224
|
return this.contentPromise = (async () => {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
225
|
+
const result: View = await viewService.load({
|
|
226
|
+
path: {
|
|
227
|
+
id: this.id,
|
|
228
|
+
},
|
|
229
|
+
query: {
|
|
230
|
+
enableCache,
|
|
231
|
+
},
|
|
232
|
+
config: { noErrorTip: true },
|
|
233
|
+
});
|
|
234
|
+
const oldLogics = this.$def.logics;
|
|
235
|
+
Object.assign(result, {
|
|
236
|
+
children: this.children,
|
|
237
|
+
});
|
|
238
|
+
const temp = View.from(result, this.parent, this.page, this);
|
|
239
|
+
const newLogics = temp.$def.logics;
|
|
240
|
+
oldLogics.forEach((logic) => {
|
|
241
|
+
if (!newLogics.find((item) => item.id === logic.id))
|
|
242
|
+
logic.destroy();
|
|
243
|
+
});
|
|
244
|
+
this.assign(temp);
|
|
245
|
+
utils.traverse((current) => {
|
|
246
|
+
current.node.attachNodePath(true);
|
|
247
|
+
}, { node: this });
|
|
248
|
+
return this;
|
|
233
249
|
})().finally(() => this.contentPromise = undefined);
|
|
234
250
|
}
|
|
235
251
|
isContentLoaded() {
|
|
@@ -417,16 +433,16 @@ export class View extends Block {
|
|
|
417
433
|
if (!this.parent)
|
|
418
434
|
throw Error('该子页面为根节点!');
|
|
419
435
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
436
|
+
await viewService.delete({
|
|
437
|
+
headers: {
|
|
438
|
+
appId: config.defaultApp?.id,
|
|
439
|
+
operationAction: actionOptions?.actionName || 'View.delete',
|
|
440
|
+
operationDesc: actionOptions?.actionDesc || `删除子页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
|
|
441
|
+
},
|
|
442
|
+
path: {
|
|
443
|
+
id: this.id,
|
|
444
|
+
},
|
|
445
|
+
}).catch(catchFn());
|
|
430
446
|
|
|
431
447
|
const index = this.parent.children.indexOf(this);
|
|
432
448
|
~index && this.parent.children.splice(index, 1);
|
|
@@ -474,15 +490,13 @@ export class View extends Block {
|
|
|
474
490
|
async setName(name: string) {
|
|
475
491
|
const oldName = this.name;
|
|
476
492
|
const oldTempPath = this.tempPath;
|
|
477
|
-
this.
|
|
478
|
-
this.assign({
|
|
479
|
-
tempPath: this.parent ? `${this.parent.tempPath}/${name}` : `/${name}`,
|
|
480
|
-
});
|
|
493
|
+
const newTempPath = this.parent ? `${this.parent.tempPath}/${name}` : `/${name}`;
|
|
494
|
+
this.assign({ name, tempPath: newTempPath });
|
|
481
495
|
await this.update(undefined, {
|
|
482
496
|
actionDesc: `设置页面"${oldName}"的名称为"${name}"`,
|
|
483
497
|
});
|
|
484
498
|
if (this.page.rootView === this) {
|
|
485
|
-
this.page.assign({ name });
|
|
499
|
+
this.page.assign({ name, tempPath: newTempPath });
|
|
486
500
|
await this.page.update();
|
|
487
501
|
}
|
|
488
502
|
// 同步权限
|
|
@@ -490,6 +504,12 @@ export class View extends Block {
|
|
|
490
504
|
domainName: this.page.service.app.name,
|
|
491
505
|
view: this,
|
|
492
506
|
}).editResourceFromResourceValue(oldTempPath);
|
|
507
|
+
// 批量调整子页面的 tempPath 和权限
|
|
508
|
+
if (this.children.length) {
|
|
509
|
+
this.children.forEach(async (child: View) => {
|
|
510
|
+
await this.updateTempPath(child);
|
|
511
|
+
});
|
|
512
|
+
}
|
|
493
513
|
this.page.service.emit('pageTreeChange');
|
|
494
514
|
this.emit('change');
|
|
495
515
|
}
|
|
@@ -528,6 +548,27 @@ export class View extends Block {
|
|
|
528
548
|
this.page.service.emit('pageTreeChange');
|
|
529
549
|
this.emit('change');
|
|
530
550
|
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* 描述信息
|
|
554
|
+
* @param description 描述信息
|
|
555
|
+
*/
|
|
556
|
+
@action('设置子页面面包屑')
|
|
557
|
+
async setDescription(description: string) {
|
|
558
|
+
const oldDescription = this.description;
|
|
559
|
+
this.assign({ description });
|
|
560
|
+
await this.update(undefined, {
|
|
561
|
+
actionDesc: `设置页面"${oldDescription}"的描述为"${description}"`,
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
if (this.page.rootView === this) {
|
|
565
|
+
this.page.assign({ description });
|
|
566
|
+
await this.page.update();
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
this.page.service.emit('pageTreeChange');
|
|
570
|
+
this.emit('change');
|
|
571
|
+
}
|
|
531
572
|
/**
|
|
532
573
|
* 设置该子页面为默认跳转页
|
|
533
574
|
*/
|
|
@@ -820,9 +861,23 @@ export class View extends Block {
|
|
|
820
861
|
body.$html._posIndex = +posIndex;
|
|
821
862
|
}
|
|
822
863
|
|
|
864
|
+
// 生成组件名字
|
|
823
865
|
traverse((current) => {
|
|
824
|
-
|
|
825
|
-
|
|
866
|
+
const ele = current.node;
|
|
867
|
+
if (ele.level !== 'element') {
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
// 自带ref名的组件
|
|
871
|
+
if (ele.name) {
|
|
872
|
+
setNewNameIfNotUnique(ele, 'name', 'elements');
|
|
873
|
+
} else {
|
|
874
|
+
if (Element.ignoreTag.includes(ele.tag)) {
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
const tagName = ele.tag.replace(Element.TAG_NAME_PREFIX_REG, '').replace(/-/g, '_');
|
|
878
|
+
ele.name = utils.unique(tagName + '1', this.elementNameSet);
|
|
879
|
+
}
|
|
880
|
+
this.addElementName(ele.name);
|
|
826
881
|
}, { node: body.$html });
|
|
827
882
|
}
|
|
828
883
|
|
|
@@ -907,6 +962,40 @@ export class View extends Block {
|
|
|
907
962
|
// config.defaultApp?.emit('saved');
|
|
908
963
|
}
|
|
909
964
|
|
|
965
|
+
// 遍历页面缓存所有组件名
|
|
966
|
+
traverseAllElementName(): void {
|
|
967
|
+
this.elementNameSet.clear();
|
|
968
|
+
utils.traverse(({ node }) => {
|
|
969
|
+
node && this.elementNameSet.add(node.name);
|
|
970
|
+
}, { node: this.$html });
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
// 组件名是否有效
|
|
974
|
+
isValidElementName(name: string): boolean {
|
|
975
|
+
if (name) {
|
|
976
|
+
return !this.elementNameSet.has(name);
|
|
977
|
+
}
|
|
978
|
+
return false;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
// 保存组件名至缓存
|
|
982
|
+
addElementName(nameOrElement: string | Element) {
|
|
983
|
+
let name: string = nameOrElement as string;
|
|
984
|
+
if (nameOrElement instanceof Element) {
|
|
985
|
+
name = nameOrElement.name;
|
|
986
|
+
}
|
|
987
|
+
return this.elementNameSet.add(name);
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
// 在缓存中移除组件名
|
|
991
|
+
removeElementName(nameOrElement: string | Element): void {
|
|
992
|
+
let name: string = nameOrElement as string;
|
|
993
|
+
if (nameOrElement instanceof Element) {
|
|
994
|
+
name = nameOrElement.name;
|
|
995
|
+
}
|
|
996
|
+
this.elementNameSet.delete(name);
|
|
997
|
+
}
|
|
998
|
+
|
|
910
999
|
_removeDef($def: View['$def']) {
|
|
911
1000
|
const removedParams = this.$def.params.filter((param) => $def.params?.find((item) => param.id === item.id));
|
|
912
1001
|
this.$def.params = this.$def.params.filter((param) => !$def.params?.find((item) => param.id === item.id));
|
|
@@ -1038,6 +1127,26 @@ export class View extends Block {
|
|
|
1038
1127
|
this.$def.logics.push(Logic.from(logic, this));
|
|
1039
1128
|
});
|
|
1040
1129
|
}
|
|
1130
|
+
|
|
1131
|
+
// 批量调整子页面的 tempPath 和权限
|
|
1132
|
+
async updateTempPath(view: View) {
|
|
1133
|
+
const oldTempPath = view.tempPath;
|
|
1134
|
+
view.assign({
|
|
1135
|
+
tempPath: view.parent ? `${view.parent.tempPath}/${view.name}` : `/${view.name}`,
|
|
1136
|
+
});
|
|
1137
|
+
await view.update();
|
|
1138
|
+
// 同步权限
|
|
1139
|
+
new Nuims({
|
|
1140
|
+
domainName: view.page.service.app.name,
|
|
1141
|
+
view,
|
|
1142
|
+
}).editResourceFromResourceValue(oldTempPath);
|
|
1143
|
+
if (view.children.length) {
|
|
1144
|
+
view.children.forEach(async (childView: View) => {
|
|
1145
|
+
await view.updateTempPath(childView);
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1041
1150
|
/**
|
|
1042
1151
|
* 从后端 JSON 生成规范的 View 对象
|
|
1043
1152
|
* @param currentView 方便构建子对象时关联,主要在 load 中使用
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { immutable, excludedInJSON, action } from '../decorators';
|
|
2
|
-
import { config,
|
|
3
|
-
import { paramService } from '../../service/logic';
|
|
2
|
+
import { config, utils, Logic, Variable, View, Schema, ActionOptions } from '..';
|
|
4
3
|
import { viewService } from '../../service/page';
|
|
5
|
-
import { convert2RefType
|
|
4
|
+
import { convert2RefType } from '../data/dataTypeUtils';
|
|
6
5
|
import { getBasicTypeDefaultValue } from '../data/basicTypes';
|
|
7
6
|
import { schemaService } from '../../service/common';
|
|
8
7
|
import { catchFn } from './ViewParam';
|
|
@@ -43,7 +42,7 @@ export class ViewVariable extends Variable {
|
|
|
43
42
|
|
|
44
43
|
const body = this.toJSON('', ['ideVersion', 'editable']);
|
|
45
44
|
body.viewId = this.view.id;
|
|
46
|
-
|
|
45
|
+
|
|
47
46
|
utils.logger.debug('添加页面局部变量', body);
|
|
48
47
|
const result: ViewVariable = await viewService.createViewVariable({
|
|
49
48
|
headers: {
|
|
@@ -53,7 +52,6 @@ export class ViewVariable extends Variable {
|
|
|
53
52
|
},
|
|
54
53
|
body,
|
|
55
54
|
}).catch(catchFn(this.view));
|
|
56
|
-
// convert2RefType(result.schema);
|
|
57
55
|
this.deepPick(result, ['id']);
|
|
58
56
|
this.assign({ code: this.genCode() });
|
|
59
57
|
|
|
@@ -74,16 +72,16 @@ export class ViewVariable extends Variable {
|
|
|
74
72
|
config.defaultApp?.emit('saving');
|
|
75
73
|
|
|
76
74
|
if (this.id) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
await viewService.deleteViewVariable({
|
|
76
|
+
headers: {
|
|
77
|
+
appId: config.defaultApp?.id,
|
|
78
|
+
operationAction: actionOptions?.actionName || 'ViewVariable.delete',
|
|
79
|
+
operationDesc: actionOptions?.actionDesc || `删除页面"${this.view.name}"局部变量"${this.name}"`,
|
|
80
|
+
},
|
|
81
|
+
query: {
|
|
82
|
+
id: this.id,
|
|
83
|
+
},
|
|
84
|
+
}).catch(catchFn(this.view));
|
|
87
85
|
}
|
|
88
86
|
|
|
89
87
|
const { variables } = this.view.$def;
|
|
@@ -109,7 +107,6 @@ export class ViewVariable extends Variable {
|
|
|
109
107
|
delete body.ideVersion;
|
|
110
108
|
delete body.editable;
|
|
111
109
|
body.viewId = this.view.id;
|
|
112
|
-
// convert2SchemaType(body.schema);
|
|
113
110
|
utils.logger.debug('修改页面局部变量', body);
|
|
114
111
|
const result = await viewService.updateViewVariable({
|
|
115
112
|
headers: {
|
|
@@ -119,8 +116,6 @@ export class ViewVariable extends Variable {
|
|
|
119
116
|
},
|
|
120
117
|
body,
|
|
121
118
|
}).catch(catchFn(this.view));
|
|
122
|
-
// convert2RefType(result.schema);
|
|
123
|
-
// this.plainAssign(result);
|
|
124
119
|
|
|
125
120
|
await config.defaultApp?.history.load();
|
|
126
121
|
config.defaultApp?.emit('saved');
|
|
@@ -186,7 +181,6 @@ export class ViewVariable extends Variable {
|
|
|
186
181
|
typeInstantiation: undefined,
|
|
187
182
|
});
|
|
188
183
|
Object.assign(this.schema, schema);
|
|
189
|
-
// if (this.defaultValue)
|
|
190
184
|
this.assign({ defaultValue: getBasicTypeDefaultValue() });
|
|
191
185
|
try {
|
|
192
186
|
await this.update(undefined, {
|