@lcap/nasl 0.3.12 → 0.3.14-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/create/index.js +2 -2
- package/out/service/create/index.js.map +1 -1
- package/out/service/logic/logic.d.ts +9 -0
- package/out/service/logic/logic.js +7 -0
- package/out/service/logic/logic.js.map +1 -1
- package/out/types/app/App.js +11 -2
- package/out/types/app/App.js.map +1 -1
- package/out/types/app/Service.js +44 -1
- package/out/types/app/Service.js.map +1 -1
- package/out/types/config.d.ts +1 -0
- package/out/types/config.js +1 -0
- package/out/types/config.js.map +1 -1
- package/out/types/data/Entity.d.ts +8 -0
- package/out/types/data/Entity.js +16 -0
- package/out/types/data/Entity.js.map +1 -1
- package/out/types/data/EntityProperty.d.ts +4 -0
- package/out/types/data/EntityProperty.js +7 -0
- package/out/types/data/EntityProperty.js.map +1 -1
- package/out/types/data/Interface.js +2 -1
- package/out/types/data/Interface.js.map +1 -1
- package/out/types/data/Structure.d.ts +4 -0
- package/out/types/data/Structure.js +12 -0
- package/out/types/data/Structure.js.map +1 -1
- package/out/types/data/dataTypes.d.ts +1 -1
- package/out/types/data/dataTypes.js +23 -6
- package/out/types/data/dataTypes.js.map +1 -1
- package/out/types/data/genBlock/builtInFunctions.json +15 -0
- package/out/types/data/genBlock/genCreateBlock.js +4 -5
- package/out/types/data/genBlock/genCreateBlock.js.map +1 -1
- package/out/types/data/genBlock/genListViewBlock.js +1 -1
- package/out/types/data/genBlock/genListViewBlock.js.map +1 -1
- package/out/types/data/genBlock/genTableBlock.js +2 -2
- package/out/types/data/genBlock/genTableBlock.js.map +1 -1
- package/out/types/data/genBlock/genUpdateBlock.js +4 -5
- package/out/types/data/genBlock/genUpdateBlock.js.map +1 -1
- package/out/types/data/genericTypes.d.ts +1 -1
- package/out/types/data/genericTypes.js +6 -2
- package/out/types/data/genericTypes.js.map +1 -1
- package/out/types/data/systemTypes.js +73 -0
- package/out/types/data/systemTypes.js.map +1 -1
- package/out/types/logic/Logic.d.ts +16 -0
- package/out/types/logic/Logic.js +39 -0
- package/out/types/logic/Logic.js.map +1 -1
- package/out/types/logic/LogicItem.d.ts +2 -2
- package/out/types/logic/LogicItem.js +92 -35
- package/out/types/logic/LogicItem.js.map +1 -1
- package/out/types/logic/translator.js +66 -50
- package/out/types/logic/translator.js.map +1 -1
- package/out/types/page/Element.js +21 -9
- package/out/types/page/Element.js.map +1 -1
- package/out/types/page/Page.js +7 -0
- package/out/types/page/Page.js.map +1 -1
- package/out/types/page/View.js +21 -0
- package/out/types/page/View.js.map +1 -1
- package/out/types/typeCheck.js +12 -2
- package/out/types/typeCheck.js.map +1 -1
- package/package.json +1 -1
- package/src/service/config/api.js +32 -0
- package/src/service/config/index.js +6 -0
- package/src/service/create/index.js +2 -2
- package/src/service/logic/logic.js +7 -0
- package/src/types/app/App.ts +13 -3
- package/src/types/app/Service.ts +44 -1
- package/src/types/config.ts +1 -0
- package/src/types/data/Entity.ts +15 -0
- package/src/types/data/EntityProperty.ts +5 -0
- package/src/types/data/Interface.ts +3 -1
- package/src/types/data/Structure.ts +10 -0
- package/src/types/data/dataTypes.ts +2 -2
- package/src/types/data/genBlock/builtInFunctions.json +17 -2
- package/src/types/data/genBlock/genCreateBlock.ts +4 -5
- package/src/types/data/genBlock/genListViewBlock.ts +1 -1
- package/src/types/data/genBlock/genTableBlock.ts +2 -2
- package/src/types/data/genBlock/genUpdateBlock.ts +4 -6
- package/src/types/data/genericTypes.ts +6 -2
- package/src/types/data/systemTypes.ts +73 -0
- package/src/types/logic/Logic.ts +35 -0
- package/src/types/logic/LogicItem.ts +304 -214
- package/src/types/logic/translator.js +64 -50
- package/src/types/page/Element.ts +20 -9
- package/src/types/page/Page.ts +7 -0
- package/src/types/page/View.ts +22 -0
- package/src/types/typeCheck.ts +16 -5
|
@@ -94,6 +94,7 @@ export function genH5CreateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
94
94
|
<template #input><van-cascader title="请选择${label}" placeholder="请选择${label}"
|
|
95
95
|
v-model="${nameGroup.model}.${property.name}" :data-source="${selectNameGroupMap.get(relationEntity.id).load}"
|
|
96
96
|
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}"
|
|
97
|
+
:notitleblock="true"
|
|
97
98
|
:pageable="true" :remote-paging="true"></van-cascader></template>
|
|
98
99
|
`;
|
|
99
100
|
} else
|
|
@@ -107,10 +108,9 @@ export function genH5CreateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
107
108
|
} else if (property.typeKey === '#/basicTypes/Decimal') {
|
|
108
109
|
formItem += `<template #input><van-stepper v-model="${nameGroup.model}.${property.name}" placeholder="请输入${property.label || property.name}"></van-stepper></template>`;
|
|
109
110
|
} else if (property.typeKey === '#/basicTypes/Text') {
|
|
110
|
-
formItem =
|
|
111
|
-
formItem += `<van-input v-model="${nameGroup.model}.${property.name}" placeholder="请输入${property.label || property.name}"></van-input>`;
|
|
111
|
+
formItem += `<template #input><van-fieldtextarea v-model="${nameGroup.model}.${property.name}" placeholder="请输入${property.label || property.name}"></van-fieldtextarea></template>`;
|
|
112
112
|
} else if (property.typeKey === '#/basicTypes/Date') {
|
|
113
|
-
formItem += `<template #input><van-calendar
|
|
113
|
+
formItem += `<template #input><van-calendar :defaultDate.sync="${nameGroup.model}.${property.name}" title="选择日期"></van-calendar></template>`;
|
|
114
114
|
} else if (property.typeKey === '#/basicTypes/Time') {
|
|
115
115
|
formItem += `<template #input><van-datetime-picker type="time" v-model="${nameGroup.model}.${property.name}" title="请选择${property.label || property.name}" label-field=""></van-datetime-picker></template>`;
|
|
116
116
|
} else if (property.typeKey === '#/basicTypes/DateTime') {
|
|
@@ -118,8 +118,7 @@ export function genH5CreateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
118
118
|
} else if (dataTypesMap[property.typeKey].type === 'enum') {
|
|
119
119
|
formItem += '<template #input>' + genEnumSelectBlock(dataTypesMap[property.typeKey] as Enum, `${nameGroup.model}.${property.name}`, '', `请选择${property.label || property.name}`) + '</template>';
|
|
120
120
|
} else {
|
|
121
|
-
formItem =
|
|
122
|
-
formItem += `<van-input v-model="${nameGroup.model}.${property.name}" placeholder="请输入${property.label || property.name}"></van-input>`;
|
|
121
|
+
formItem += `<template #input><van-fieldinput v-model="${nameGroup.model}.${property.name}" placeholder="请输入${property.label || property.name}"></van-fieldinput></template>`;
|
|
123
122
|
}
|
|
124
123
|
|
|
125
124
|
formItem += ` </van-field>\n`;
|
|
@@ -27,7 +27,7 @@ export function genH5ListViewTemplate(property: EntityProperty, nameGroup: NameG
|
|
|
27
27
|
text-field="${nameGroup.lowerEntity}.${property.name}"
|
|
28
28
|
value-field="${nameGroup.lowerEntity}.id" pageable="auto-more" :remote-paging="true">
|
|
29
29
|
<template #item="scope">
|
|
30
|
-
<van-cell :value="${expression}" isLink></van-cell>
|
|
30
|
+
<van-cell :value="${expression}" isLink><template #title>{{ ${expression} }}</template></van-cell>
|
|
31
31
|
</template>
|
|
32
32
|
</van-list-view>`;
|
|
33
33
|
}
|
|
@@ -38,14 +38,14 @@ export function genTableColumnTemplate(property: EntityProperty) {
|
|
|
38
38
|
if (property.typeKey === '#/basicTypes/Boolean') {
|
|
39
39
|
return `
|
|
40
40
|
<u-text v-if="${expression}" text="是"></u-text>
|
|
41
|
-
<u-text v-if="
|
|
41
|
+
<u-text v-if="${expression} == false" text="否"></u-text>
|
|
42
42
|
`;
|
|
43
43
|
} else {
|
|
44
44
|
return `<u-text :text="${expression}"></u-text>`;
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
return `<u-table-view-column title="${title}">
|
|
48
|
+
return `<u-table-view-column title="${title}" field="${lowerEntityName}.${property.name}">
|
|
49
49
|
<template #cell="scope">
|
|
50
50
|
<u-linear-layout gap="small">
|
|
51
51
|
${getText(property)}
|
|
@@ -105,6 +105,7 @@ export function genH5UpdateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
105
105
|
<template #input><van-cascader title="请选择${label}" placeholder="请选择${label}"
|
|
106
106
|
v-model="${nameGroup.model}.${property.name}" :data-source="${selectNameGroupMap.get(relationEntity.id).load}"
|
|
107
107
|
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}"
|
|
108
|
+
:notitleblock="true"
|
|
108
109
|
:pageable="true" :remote-paging="true"></van-cascader></template>
|
|
109
110
|
`;
|
|
110
111
|
} else
|
|
@@ -118,12 +119,10 @@ export function genH5UpdateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
118
119
|
} else if (property.typeKey === '#/basicTypes/Decimal') {
|
|
119
120
|
formItem += `<template #input><van-stepper v-model="${nameGroup.model}.${property.name}" placeholder="请输入${label}"></van-stepper></template>`;
|
|
120
121
|
} else if (property.typeKey === '#/basicTypes/Text') {
|
|
121
|
-
formItem =
|
|
122
|
-
formItem += `<van-input v-model="${nameGroup.model}.${property.name}" placeholder="请输入${label}"></van-input>`;
|
|
123
|
-
|
|
122
|
+
formItem += `<template #input><van-fieldtextarea v-model="${nameGroup.model}.${property.name}" placeholder="请输入${label}"></van-fieldtextarea></template>`;
|
|
124
123
|
// @TODO
|
|
125
124
|
} else if (property.typeKey === '#/basicTypes/Date') {
|
|
126
|
-
formItem += `<template #input><van-calendar clearable :
|
|
125
|
+
formItem += `<template #input><van-calendar clearable :defaultDate.sync="${nameGroup.model}.${property.name}" placeholder="请输入${label}" title="选择日期"></van-calendar></template>`;
|
|
127
126
|
} else if (property.typeKey === '#/basicTypes/Time') {
|
|
128
127
|
formItem += `<template #input><van-datetime-picker type="time" v-model="${nameGroup.model}.${property.name}" title="请选择${label}" label-field=""></van-datetime-picker></template>`;
|
|
129
128
|
} else if (property.typeKey === '#/basicTypes/DateTime') {
|
|
@@ -131,8 +130,7 @@ export function genH5UpdateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
131
130
|
} else if (dataTypesMap[property.typeKey].type === 'enum') {
|
|
132
131
|
formItem += '<template #input>' + genEnumSelectBlock(dataTypesMap[property.typeKey] as Enum, `${nameGroup.model}.${property.name}`, '', `请选择${label}`) + '</template>';
|
|
133
132
|
} else {
|
|
134
|
-
formItem =
|
|
135
|
-
formItem += `<van-input v-model="${nameGroup.model}.${property.name}" placeholder="请输入${label}"></van-input>`;
|
|
133
|
+
formItem += `<template #input><van-fieldinput v-model="${nameGroup.model}.${property.name}" placeholder="请输入${label}"></van-fieldinput></template>`;
|
|
136
134
|
}
|
|
137
135
|
|
|
138
136
|
formItem += ` </van-field>\n`;
|
|
@@ -6,10 +6,14 @@ export function getGenericTypeRef(typeName: string) {
|
|
|
6
6
|
return `#/genericTypes/${typeName}`;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export async function getGenericList() {
|
|
9
|
+
export async function getGenericList(appId: string) {
|
|
10
10
|
let list = [];
|
|
11
11
|
try {
|
|
12
|
-
list = await genericService.getGenericClassList(
|
|
12
|
+
list = await genericService.getGenericClassList({
|
|
13
|
+
headers: {
|
|
14
|
+
'request-lcpAppId': appId,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
13
17
|
} catch (err) { }
|
|
14
18
|
const genericTypeList: any = [];
|
|
15
19
|
const genericTypemap: any = {};
|
|
@@ -24,6 +24,7 @@ export const systemTypeList = [
|
|
|
24
24
|
{ kind: 'systemType', text: 'UploadErrorEvent', value: '#/systemTypes/UploadErrorEvent' },
|
|
25
25
|
{ kind: 'systemType', text: 'SortEvent', value: '#/systemTypes/SortEvent' },
|
|
26
26
|
{ kind: 'systemType', text: 'PoiInfo', value: '#/systemTypes/PoiInfo' },
|
|
27
|
+
{ kind: 'systemType', text: 'File', value: '#/systemTypes/File' },
|
|
27
28
|
];
|
|
28
29
|
|
|
29
30
|
export const systemTypeMap: { [name: string]: ObjectSchema } = {
|
|
@@ -417,6 +418,27 @@ export const systemTypeMap: { [name: string]: ObjectSchema } = {
|
|
|
417
418
|
description: '选择项相关对象',
|
|
418
419
|
isLeaf: true,
|
|
419
420
|
},
|
|
421
|
+
{
|
|
422
|
+
type: 'genericType',
|
|
423
|
+
typeKey: '#/genericTypes/List',
|
|
424
|
+
typeInstantiation: {
|
|
425
|
+
typeName: 'List',
|
|
426
|
+
typeParams: [
|
|
427
|
+
{
|
|
428
|
+
type: 'typeParam',
|
|
429
|
+
typeParamName: 'T',
|
|
430
|
+
typeParamValue: {
|
|
431
|
+
typeKey: '#/basicTypes/String',
|
|
432
|
+
type: 'string',
|
|
433
|
+
format: '',
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
],
|
|
437
|
+
},
|
|
438
|
+
name: 'items',
|
|
439
|
+
description: '所有选中项相关对象的数组',
|
|
440
|
+
isLeaf: true,
|
|
441
|
+
},
|
|
420
442
|
{
|
|
421
443
|
typeKey: '#/basicTypes/String',
|
|
422
444
|
type: 'string',
|
|
@@ -1311,6 +1333,27 @@ export const systemTypeMap: { [name: string]: ObjectSchema } = {
|
|
|
1311
1333
|
description: '选择项相关对象',
|
|
1312
1334
|
isLeaf: true,
|
|
1313
1335
|
},
|
|
1336
|
+
{
|
|
1337
|
+
type: 'genericType',
|
|
1338
|
+
typeKey: '#/genericTypes/List',
|
|
1339
|
+
typeInstantiation: {
|
|
1340
|
+
typeName: 'List',
|
|
1341
|
+
typeParams: [
|
|
1342
|
+
{
|
|
1343
|
+
type: 'typeParam',
|
|
1344
|
+
typeParamName: 'T',
|
|
1345
|
+
typeParamValue: {
|
|
1346
|
+
typeKey: '#/basicTypes/String',
|
|
1347
|
+
type: 'string',
|
|
1348
|
+
format: '',
|
|
1349
|
+
},
|
|
1350
|
+
},
|
|
1351
|
+
],
|
|
1352
|
+
},
|
|
1353
|
+
name: 'items',
|
|
1354
|
+
description: '所有选中项相关对象的数组',
|
|
1355
|
+
isLeaf: true,
|
|
1356
|
+
},
|
|
1314
1357
|
],
|
|
1315
1358
|
},
|
|
1316
1359
|
'#/systemTypes/UploadEvent': {
|
|
@@ -1559,4 +1602,34 @@ export const systemTypeMap: { [name: string]: ObjectSchema } = {
|
|
|
1559
1602
|
},
|
|
1560
1603
|
],
|
|
1561
1604
|
},
|
|
1605
|
+
'#/systemTypes/File': {
|
|
1606
|
+
name: 'File',
|
|
1607
|
+
type: 'object',
|
|
1608
|
+
propertyList: [
|
|
1609
|
+
{
|
|
1610
|
+
typeKey: '#/basicTypes/String',
|
|
1611
|
+
type: 'string',
|
|
1612
|
+
format: '',
|
|
1613
|
+
name: 'name',
|
|
1614
|
+
description: '文件名称',
|
|
1615
|
+
isLeaf: true,
|
|
1616
|
+
},
|
|
1617
|
+
{
|
|
1618
|
+
typeKey: '#/basicTypes/Integer',
|
|
1619
|
+
type: 'integer',
|
|
1620
|
+
format: 'int',
|
|
1621
|
+
name: 'size',
|
|
1622
|
+
description: '文件大小',
|
|
1623
|
+
isLeaf: true,
|
|
1624
|
+
},
|
|
1625
|
+
{
|
|
1626
|
+
typeKey: '#/basicTypes/String',
|
|
1627
|
+
type: 'string',
|
|
1628
|
+
format: '',
|
|
1629
|
+
name: 'type',
|
|
1630
|
+
description: '文件类型',
|
|
1631
|
+
isLeaf: true,
|
|
1632
|
+
},
|
|
1633
|
+
],
|
|
1634
|
+
},
|
|
1562
1635
|
};
|
package/src/types/logic/Logic.ts
CHANGED
|
@@ -162,6 +162,19 @@ export class Logic extends Vertex {
|
|
|
162
162
|
*/
|
|
163
163
|
@immutable()
|
|
164
164
|
public triggerType: string = undefined;
|
|
165
|
+
/**
|
|
166
|
+
* 事务
|
|
167
|
+
* {
|
|
168
|
+
* "enabled": "事务是否生效; true | false", // 目前只有这一个属性有使用到
|
|
169
|
+
* "propagation": "事务的传播机制",
|
|
170
|
+
* "isolation": "事务的隔离级别",
|
|
171
|
+
* "rollbackFor": ["事务需要捕获且回滚的异常"],
|
|
172
|
+
* "noRollbackFor": ["事务无需回滚的异常"]
|
|
173
|
+
*
|
|
174
|
+
* }
|
|
175
|
+
*/
|
|
176
|
+
@immutable()
|
|
177
|
+
public transactional: Record<string, unknown> = {};
|
|
165
178
|
/**
|
|
166
179
|
* 定时任务
|
|
167
180
|
*/
|
|
@@ -276,6 +289,7 @@ export class Logic extends Vertex {
|
|
|
276
289
|
config.defaultApp?.emit('saving');
|
|
277
290
|
|
|
278
291
|
const body = this.toPlainJSON();
|
|
292
|
+
// body.transactional = this.transactional;
|
|
279
293
|
utils.logger.debug('修改逻辑', body);
|
|
280
294
|
await logicService.update({
|
|
281
295
|
headers: {
|
|
@@ -518,6 +532,27 @@ export class Logic extends Vertex {
|
|
|
518
532
|
}
|
|
519
533
|
return this;
|
|
520
534
|
}
|
|
535
|
+
/**
|
|
536
|
+
* 更新事务属性
|
|
537
|
+
*/
|
|
538
|
+
@action('更新事务属性')
|
|
539
|
+
async setTransaction(transactional: Record<string, unknown>) {
|
|
540
|
+
const body = {
|
|
541
|
+
logicId: this.id,
|
|
542
|
+
id: transactional.id,
|
|
543
|
+
enabled: transactional.enabled,
|
|
544
|
+
};
|
|
545
|
+
this.assign({ transactional });
|
|
546
|
+
await logicService.updateTransactional({ body });
|
|
547
|
+
await this.update(undefined, {
|
|
548
|
+
actionDesc: '更新事务属性',
|
|
549
|
+
});
|
|
550
|
+
if (this.view) {
|
|
551
|
+
this.view.page.service.emit('pageTreeChange');
|
|
552
|
+
this.emit('change');
|
|
553
|
+
}
|
|
554
|
+
return this;
|
|
555
|
+
}
|
|
521
556
|
/**
|
|
522
557
|
* 验证表达式正确与否
|
|
523
558
|
*/
|