@lcap/nasl 1.0.0-alpha.13 → 1.0.0-alpha.16
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/automate/engine/index.d.ts +1 -1
- package/out/automate/engine/index.js +73 -25
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/utils.js +7 -6
- package/out/automate/engine/utils.js.map +1 -1
- package/out/common/BaseNode.d.ts +5 -4
- package/out/common/BaseNode.js +48 -41
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +18 -1
- package/out/concepts/App__.js +64 -24
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js +2 -2
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.d.ts +190 -0
- package/out/concepts/Assignee__.js +264 -0
- package/out/concepts/Assignee__.js.map +1 -0
- package/out/concepts/BinaryExpression__.js +6 -6
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +19 -0
- package/out/concepts/BindAttribute__.js +36 -2
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +21 -1
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +1 -0
- package/out/concepts/BindEvent__.js +38 -14
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/CallFunction__.js +20 -7
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +11 -8
- package/out/concepts/CallInterface__.js +160 -23
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +1 -0
- package/out/concepts/CallLogic__.js +17 -7
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +5 -1
- package/out/concepts/CallQueryComponent__.js +15 -11
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +6 -2
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js +1 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +1 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js +1 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +11 -0
- package/out/concepts/Destination__.js +59 -19
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +10 -2
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +7 -0
- package/out/concepts/EntityProperty__.js +60 -3
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +4 -1
- package/out/concepts/Entity__.js +29 -12
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +4 -0
- package/out/concepts/Enum__.js +9 -6
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js +1 -1
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +8 -12
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.js +5 -5
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +26 -24
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +2 -0
- package/out/concepts/InterfaceParam__.js +41 -21
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +3 -0
- package/out/concepts/Interface__.js +105 -9
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +2 -1
- package/out/concepts/LogicItem__.js +14 -0
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +3 -0
- package/out/concepts/Logic__.js +57 -16
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +13 -6
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +6 -0
- package/out/concepts/Module__.js +18 -8
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +4 -0
- package/out/concepts/Namespace__.js +23 -12
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/Param__.d.ts +2 -1
- package/out/concepts/Param__.js +35 -22
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +2 -2
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +20 -18
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js +1 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/Process__.d.ts +6 -1
- package/out/concepts/Process__.js +18 -14
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js +1 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +2 -2
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.d.ts +1 -0
- package/out/concepts/Return__.js +38 -25
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js +1 -1
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +1 -1
- package/out/concepts/StringLiteral__.js +2 -2
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +5 -4
- package/out/concepts/StructureProperty__.js +54 -31
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +1 -0
- package/out/concepts/Structure__.js +18 -5
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +3 -3
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +1 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +3 -5
- package/out/concepts/TypeAnnotation__.js +36 -14
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +4 -2
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +1 -0
- package/out/concepts/ValidationRule__.js +27 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +1 -0
- package/out/concepts/Variable__.js +38 -25
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.js +5 -5
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +7 -1
- package/out/concepts/ViewElement__.js +154 -117
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +4 -0
- package/out/concepts/View__.js +38 -25
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +1 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/index.js +3 -1
- package/out/concepts/basics/stdlib/index.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.auth.js +30 -0
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.js +70 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser.js +6 -35
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.configuration.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js +25 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.util.js +49 -41
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.validation.js +26 -20
- package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
- package/out/concepts/basics/types/coreTypeList.js +11 -11
- package/out/concepts/basics/types/coreTypeList.js.map +1 -1
- package/out/concepts/index__.d.ts +1 -0
- package/out/concepts/index__.js +1 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/enums/KEYWORDS.js +1 -1
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +1 -0
- package/out/generator/genBundleFiles.js +122 -93
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/manager/diagnostic.d.ts +1 -1
- package/out/server/createUiTs.d.ts +1 -0
- package/out/server/createUiTs.js +19 -2
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/entity2LogicNamespace.js +24 -9
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/getExtensionModules.js +2 -0
- package/out/server/getExtensionModules.js.map +1 -1
- package/out/server/getLogics.js +40 -56
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.d.ts +4 -0
- package/out/server/getMemberIdentifier.js +90 -48
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +2 -2
- package/out/server/getProcesses.js +34 -11
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/index.js +4 -0
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +11 -30
- package/out/server/naslServer.js +410 -199
- package/out/server/naslServer.js.map +1 -1
- package/out/server/process2LogicNamespace.d.ts +10 -0
- package/out/server/process2LogicNamespace.js +16 -0
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.d.ts +22 -3
- package/out/server/translator.js +336 -130
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +29 -15
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +5 -5
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +9 -13
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +7 -7
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +2 -2
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +4 -2
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.d.ts +1 -1
- package/out/templator/genGridViewBlock.js +3 -3
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genQueryComponent.d.ts +2 -0
- package/out/templator/genQueryComponent.js +1 -0
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genTableBlock.d.ts +1 -1
- package/out/templator/genTableBlock.js +3 -3
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +7 -7
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +3 -1
- package/out/templator/utils.js +2 -1
- package/out/templator/utils.js.map +1 -1
- package/out/utils/index.d.ts +6 -0
- package/out/utils/index.js +20 -1
- package/out/utils/index.js.map +1 -1
- package/package.json +2 -1
- package/src/automate/engine/index.js +73 -25
- package/src/automate/engine/utils.js +7 -6
- package/src/common/BaseNode.ts +51 -42
- package/src/concepts/App__.ts +104 -26
- package/src/concepts/Argument__.ts +3 -2
- package/src/concepts/Assignee__.ts +437 -0
- package/src/concepts/BinaryExpression__.ts +7 -6
- package/src/concepts/BindAttribute__.ts +51 -2
- package/src/concepts/BindDirective__.ts +20 -1
- package/src/concepts/BindEvent__.ts +39 -16
- package/src/concepts/CallFunction__.ts +21 -8
- package/src/concepts/CallInterface__.ts +161 -42
- package/src/concepts/CallLogic__.ts +21 -9
- package/src/concepts/CallQueryComponent__.ts +15 -13
- package/src/concepts/Comment__.ts +6 -2
- package/src/concepts/ConfigGroup__.ts +1 -1
- package/src/concepts/ConfigProperty__.ts +1 -1
- package/src/concepts/Configuration__.ts +1 -1
- package/src/concepts/Destination__.ts +57 -19
- package/src/concepts/End__.ts +9 -11
- package/src/concepts/EntityProperty__.ts +56 -3
- package/src/concepts/Entity__.ts +33 -20
- package/src/concepts/Enum__.ts +8 -7
- package/src/concepts/Event__.ts +1 -1
- package/src/concepts/ForEachStatement__.ts +8 -13
- package/src/concepts/Function__.ts +5 -5
- package/src/concepts/Identifier__.ts +31 -26
- package/src/concepts/IfStatement__.ts +2 -2
- package/src/concepts/InterfaceParam__.ts +39 -20
- package/src/concepts/Interface__.ts +103 -9
- package/src/concepts/LogicItem__.ts +16 -1
- package/src/concepts/Logic__.ts +60 -18
- package/src/concepts/MemberExpression__.ts +18 -6
- package/src/concepts/Module__.ts +19 -8
- package/src/concepts/Namespace__.ts +24 -12
- package/src/concepts/Param__.ts +34 -23
- package/src/concepts/ProcessComponent__.ts +2 -2
- package/src/concepts/ProcessElement__.ts +51 -50
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/Process__.ts +32 -28
- package/src/concepts/QueryAggregateExpression__.ts +1 -1
- package/src/concepts/QueryFromExpression__.ts +1 -1
- package/src/concepts/QueryJoinExpression__.ts +2 -2
- package/src/concepts/QuerySelectExpression__.ts +1 -1
- package/src/concepts/Return__.ts +35 -25
- package/src/concepts/SqlQueryComponent__.ts +1 -1
- package/src/concepts/StringLiteral__.ts +2 -2
- package/src/concepts/StructureProperty__.ts +49 -29
- package/src/concepts/Structure__.ts +17 -5
- package/src/concepts/SwitchCase__.ts +3 -3
- package/src/concepts/SwitchStatement__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +34 -12
- package/src/concepts/UnaryExpression__.ts +4 -2
- package/src/concepts/ValidationRule__.ts +24 -1
- package/src/concepts/Variable__.ts +35 -24
- package/src/concepts/ViewComponent__.ts +5 -5
- package/src/concepts/ViewElement__.ts +168 -113
- package/src/concepts/View__.ts +44 -25
- package/src/concepts/WhileStatement__.ts +1 -1
- package/src/concepts/basics/stdlib/index.ts +3 -1
- package/src/concepts/basics/stdlib/nasl.auth.ts +26 -0
- package/src/concepts/basics/stdlib/nasl.browser.ts +7 -41
- package/src/concepts/basics/stdlib/nasl.configuration.ts +21 -0
- package/src/concepts/basics/stdlib/nasl.util.ts +49 -41
- package/src/concepts/basics/stdlib/nasl.validation.ts +17 -11
- package/src/concepts/basics/types/coreTypeList.ts +11 -11
- package/src/concepts/index__.ts +1 -0
- package/src/enums/KEYWORDS.ts +1 -1
- package/src/generator/genBundleFiles.ts +131 -112
- package/src/manager/diagnostic.ts +1 -1
- package/src/server/createUiTs.ts +22 -4
- package/src/server/entity2LogicNamespace.ts +25 -9
- package/src/server/getExtensionModules.ts +2 -0
- package/src/server/getLogics.ts +42 -58
- package/src/server/getMemberIdentifier.ts +88 -46
- package/src/server/getProcesses.ts +32 -9
- package/src/server/index.ts +12 -1
- package/src/server/naslServer.ts +422 -215
- package/src/server/process2LogicNamespace.ts +17 -1
- package/src/server/translator.ts +392 -134
- package/src/service/storage/init.ts +27 -16
- package/src/templator/genCreateBlock.ts +5 -5
- package/src/templator/genCurdEditMultipleKeyBlock.ts +25 -26
- package/src/templator/genCurdMultipleKeyBlock.ts +7 -7
- package/src/templator/genEditTableBlock.ts +2 -2
- package/src/templator/genGetBlock.ts +5 -7
- package/src/templator/genGridViewBlock.ts +4 -7
- package/src/templator/genQueryComponent.ts +1 -0
- package/src/templator/genTableBlock.ts +4 -7
- package/src/templator/genUpdateBlock.ts +7 -8
- package/src/templator/utils.ts +2 -1
- package/src/utils/index.ts +19 -0
|
@@ -65,13 +65,14 @@ function getStatement(state: any, app: any, diffLogicList: string[]) {
|
|
|
65
65
|
break;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
return logicItems;
|
|
68
|
+
return logicItems.filter((item: LogicItem) => !!item);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* 执行更新
|
|
73
73
|
*/
|
|
74
74
|
async function doAction(app: any, actionItem: any) {
|
|
75
|
+
app.emit('saving');
|
|
75
76
|
let hasFrontEnd = false;
|
|
76
77
|
let hasBackEnd = false;
|
|
77
78
|
const actionList: any[] = [];
|
|
@@ -80,11 +81,10 @@ async function doAction(app: any, actionItem: any) {
|
|
|
80
81
|
list.forEach((event) => {
|
|
81
82
|
const emitTarget = event?.originEvent?.target;
|
|
82
83
|
const _path: string = event.originEvent.path;
|
|
83
|
-
const _root = _path.split('.')[1];
|
|
84
|
-
if (['entities', 'processes', 'logics'].some((item) => _root.startsWith(item))) {
|
|
84
|
+
const _root = _path.split('.')?.[1] || '';
|
|
85
|
+
if (['entities', 'processes', 'logics', 'enums', 'structures', 'interfaces'].some((item) => _root.startsWith(item))) {
|
|
85
86
|
hasBackEnd = true;
|
|
86
87
|
}
|
|
87
|
-
// console.log(emitTarget, action, actionItem);
|
|
88
88
|
const itemloop = (_i: LogicItem, app: any, diffArr: string[]) => {
|
|
89
89
|
const _l = getStatement(_i, app, diffArr);
|
|
90
90
|
if (_l.length) {
|
|
@@ -173,16 +173,22 @@ async function doAction(app: any, actionItem: any) {
|
|
|
173
173
|
} else if (hasBackEnd) {
|
|
174
174
|
ChangedNASLType = 'backend';
|
|
175
175
|
}
|
|
176
|
+
let err;
|
|
176
177
|
if (config.storage.protocol === 'http') {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
178
|
+
try {
|
|
179
|
+
await storageService.batchAction({
|
|
180
|
+
body: actionList,
|
|
181
|
+
headers: {
|
|
182
|
+
appId: app.id,
|
|
183
|
+
ChangedNASLType,
|
|
184
|
+
'request-appBaseVersion': (window as any).appData?.baseVersion || '',
|
|
185
|
+
'request-versionChangedTime': (window as any).appData?.versionChangedTime || '',
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
} catch (error) {
|
|
189
|
+
err = error;
|
|
190
|
+
app.emit('refresh');
|
|
191
|
+
}
|
|
186
192
|
} else if (config.storage.protocol === 'mock') {
|
|
187
193
|
// Do nothing
|
|
188
194
|
} else {
|
|
@@ -192,7 +198,7 @@ async function doAction(app: any, actionItem: any) {
|
|
|
192
198
|
spaces: 4,
|
|
193
199
|
});
|
|
194
200
|
}
|
|
195
|
-
|
|
201
|
+
app.emit('saved', err);
|
|
196
202
|
if (!app._historying) {
|
|
197
203
|
if (app._historyIndex !== app._historyList.length) {
|
|
198
204
|
app._historyList = app._historyList.splice(0, app._historyIndex);
|
|
@@ -233,9 +239,11 @@ function handleApp(app: any) {
|
|
|
233
239
|
* 开启收集
|
|
234
240
|
*/
|
|
235
241
|
app.on('collect:start', (event: any) => {
|
|
242
|
+
if (!app._isCollectingCount) {
|
|
243
|
+
app._actionMsg = event?.actionMsg;
|
|
244
|
+
app._action = event?.action;
|
|
245
|
+
}
|
|
236
246
|
app._isCollectingCount++;
|
|
237
|
-
app._actionMsg = event?.actionMsg;
|
|
238
|
-
app._action = event?.action;
|
|
239
247
|
});
|
|
240
248
|
|
|
241
249
|
/**
|
|
@@ -258,6 +266,9 @@ function handleApp(app: any) {
|
|
|
258
266
|
app._collectingList = [];
|
|
259
267
|
app._actionMsg = '';
|
|
260
268
|
app._action = '';
|
|
269
|
+
} else if (app._isCollectingCount < 0) {
|
|
270
|
+
app._isCollectingCount = 0;
|
|
271
|
+
throw Error('关闭收集有问题,请排查');
|
|
261
272
|
}
|
|
262
273
|
});
|
|
263
274
|
|
|
@@ -59,7 +59,7 @@ export function genCreateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
|
|
|
59
59
|
formItem += `<u-checkbox v-model="${vModel}"></u-checkbox>`;
|
|
60
60
|
} else if (propertyTypeName === 'Integer' || propertyTypeName === 'Long') {
|
|
61
61
|
formItem += `<u-number-input v-model="${vModel}" placeholder="请输入${label}"></u-number-input>`;
|
|
62
|
-
} else if (propertyTypeName === '
|
|
62
|
+
} else if (propertyTypeName === 'Double') {
|
|
63
63
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
64
64
|
} else if (propertyTypeName === 'Text') {
|
|
65
65
|
formItem += `<u-textarea v-model="${vModel}" placeholder="请输入${label}"></u-textarea>`;
|
|
@@ -122,6 +122,7 @@ export function genH5CreateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
122
122
|
<template #input><van-cascader title="请选择${label}" placeholder="请选择${label}"
|
|
123
123
|
v-model="${vModel}" :data-source="${selectNameGroup.viewLogicLoad}"
|
|
124
124
|
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}"
|
|
125
|
+
:notitleblock="true"
|
|
125
126
|
:pageable="true" :remote-paging="true"></van-cascader></template>
|
|
126
127
|
`;
|
|
127
128
|
} else
|
|
@@ -132,13 +133,12 @@ export function genH5CreateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
132
133
|
formItem += `<template #input><van-switch v-model="${vModel}"></van-switch></template>`;
|
|
133
134
|
} else if (propertyTypeName === 'Integer' || propertyTypeName === 'Long') {
|
|
134
135
|
formItem += `<template #input><van-stepper v-model="${vModel}" placeholder="请输入${property.label || property.name}"></van-stepper></template>`;
|
|
135
|
-
} else if (propertyTypeName === '
|
|
136
|
+
} else if (propertyTypeName === 'Double') {
|
|
136
137
|
formItem += `<template #input><van-stepper v-model="${vModel}" placeholder="请输入${property.label || property.name}"></van-stepper></template>`;
|
|
137
138
|
} else if (propertyTypeName === 'Text') {
|
|
138
|
-
formItem =
|
|
139
|
-
formItem += `<template #input><van-input v-model="${vModel}" placeholder="请输入${property.label || property.name}"></van-input></template>`;
|
|
139
|
+
formItem += `<template #input><van-fieldtextarea v-model="${vModel}" placeholder="请输入${property.label || property.name}"></van-fieldtextarea></template>`;
|
|
140
140
|
} else if (propertyTypeName === 'Date') {
|
|
141
|
-
formItem += `<template #input><van-calendar
|
|
141
|
+
formItem += `<template #input><van-calendar :default-date.sync="${vModel}" title="选择日期"></van-calendar></template>`;
|
|
142
142
|
} else if (propertyTypeName === 'Time') {
|
|
143
143
|
formItem += `<template #input><van-datetime-picker type="time" v-model="${vModel}" title="请选择${property.label || property.name}" label-field=""></van-datetime-picker></template>`;
|
|
144
144
|
} else if (propertyTypeName === 'DateTime') {
|
|
@@ -5,14 +5,23 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as utils from '../utils';
|
|
7
7
|
import { App, Namespace, Entity, View, Enum } from '../concepts';
|
|
8
|
+
import { NaslCoreTypeAnnotation, NaslUITypeAnnotation, NaslTypeAnnotation, NaslLogicItem, NaslNode } from './utils';
|
|
8
9
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
genQueryLogic,
|
|
15
|
-
|
|
10
|
+
filterProperty,
|
|
11
|
+
NameGroup,
|
|
12
|
+
genUniqueQueryNameGroup,
|
|
13
|
+
getFirstDisplayedProperty,
|
|
14
|
+
genCallComponentLogic,
|
|
15
|
+
genQueryLogic,
|
|
16
|
+
genEditTableTemplate,
|
|
17
|
+
genEditTableLoadLogic,
|
|
18
|
+
genTableRemoveLogic,
|
|
19
|
+
genEnumSelectBlock,
|
|
20
|
+
genLoadSelectLogic,
|
|
21
|
+
genBlurUpdateLogic,
|
|
22
|
+
genEditQueryStructure,
|
|
23
|
+
genQueryStructure,
|
|
24
|
+
genLogicParam,
|
|
16
25
|
} from '.';
|
|
17
26
|
|
|
18
27
|
function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroupMap: Map<string, NameGroup>) {
|
|
@@ -29,10 +38,7 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
29
38
|
let formItem = `<u-form-item label="${label}">`;
|
|
30
39
|
|
|
31
40
|
const { typeAnnotation } = property || {};
|
|
32
|
-
const {
|
|
33
|
-
typeName: propertyTypeName,
|
|
34
|
-
typeNamespace: propertyTypeNamespace,
|
|
35
|
-
} = typeAnnotation || {};
|
|
41
|
+
const { typeName: propertyTypeName, typeNamespace: propertyTypeNamespace } = typeAnnotation || {};
|
|
36
42
|
if (property.relationEntity) {
|
|
37
43
|
// 有外键关联
|
|
38
44
|
const relationEntity = parentNode?.findEntityByName(property.relationEntity);
|
|
@@ -60,7 +66,7 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
60
66
|
`;
|
|
61
67
|
} else if (propertyTypeName === 'Integer' || propertyTypeName === 'Long') {
|
|
62
68
|
formItem += `<u-number-input v-model="${vModel}" placeholder="请输入${label}"></u-number-input>`;
|
|
63
|
-
} else if (propertyTypeName === '
|
|
69
|
+
} else if (propertyTypeName === 'Double') {
|
|
64
70
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
65
71
|
} else if (propertyTypeName === 'Text') {
|
|
66
72
|
formItem += `<u-textarea v-model="${vModel}" placeholder="请输入${label}"></u-textarea>`;
|
|
@@ -90,7 +96,7 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
90
96
|
</u-form-item>
|
|
91
97
|
</u-form>
|
|
92
98
|
|
|
93
|
-
<u-button color="primary" @click="${nameGroup.viewLogicCreate}
|
|
99
|
+
<u-button color="primary" @click="${nameGroup.viewLogicCreate}">创建</u-button>
|
|
94
100
|
</u-linear-layout>
|
|
95
101
|
`;
|
|
96
102
|
}
|
|
@@ -127,10 +133,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
127
133
|
>`;
|
|
128
134
|
|
|
129
135
|
const { typeAnnotation } = property || {};
|
|
130
|
-
const {
|
|
131
|
-
typeName: propertyTypeName,
|
|
132
|
-
typeNamespace: propertyTypeNamespace,
|
|
133
|
-
} = typeAnnotation || {};
|
|
136
|
+
const { typeName: propertyTypeName, typeNamespace: propertyTypeNamespace } = typeAnnotation || {};
|
|
134
137
|
if (property.relationEntity) {
|
|
135
138
|
// 有外键关联
|
|
136
139
|
const relationEntity = parentNode?.findEntityByName(property.relationEntity);
|
|
@@ -157,7 +160,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
157
160
|
</u-select>`;
|
|
158
161
|
} else if (propertyTypeName === 'Integer' || propertyTypeName === 'Long') {
|
|
159
162
|
formItem += `<u-number-input v-model="${vModel}" placeholder="请输入${label}"></u-number-input>`;
|
|
160
|
-
} else if (propertyTypeName === '
|
|
163
|
+
} else if (propertyTypeName === 'Double') {
|
|
161
164
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
162
165
|
} else if (propertyTypeName === 'Text') {
|
|
163
166
|
formItem += `<u-textarea v-model="${vModel}" placeholder="请输入${label}"></u-textarea>`;
|
|
@@ -306,18 +309,14 @@ function genSubmitLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
306
309
|
NaslLogicItem.CallLogic({
|
|
307
310
|
calleeNamespace: updateLogic.getNamespace(),
|
|
308
311
|
calleeName: updateLogic.name,
|
|
309
|
-
arguments: [
|
|
310
|
-
genLogicParam(`${updateLogic.params[0].name}`, nameGroup.viewVariableInput),
|
|
311
|
-
],
|
|
312
|
+
arguments: [genLogicParam(`${updateLogic.params[0].name}`, nameGroup.viewVariableInput)],
|
|
312
313
|
}),
|
|
313
314
|
],
|
|
314
315
|
alternate: [
|
|
315
316
|
NaslLogicItem.CallLogic({
|
|
316
317
|
calleeNamespace: createLogic.getNamespace(),
|
|
317
318
|
calleeName: createLogic.name,
|
|
318
|
-
arguments: [
|
|
319
|
-
genLogicParam(`${createLogic.params[0].name}`, nameGroup.viewVariableInput),
|
|
320
|
-
],
|
|
319
|
+
arguments: [genLogicParam(`${createLogic.params[0].name}`, nameGroup.viewVariableInput)],
|
|
321
320
|
}),
|
|
322
321
|
],
|
|
323
322
|
}),
|
|
@@ -382,7 +381,7 @@ export function genCurdEditMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
382
381
|
const entityLogic = genQueryLogic(allEntities, nameGroup, true, true, parentNode);
|
|
383
382
|
newLogics.push(entityLogic);
|
|
384
383
|
|
|
385
|
-
console.log(entityStructure);
|
|
384
|
+
// console.log(entityStructure);
|
|
386
385
|
|
|
387
386
|
return `<template>
|
|
388
387
|
<u-linear-layout direction="vertical">
|
|
@@ -439,7 +438,7 @@ export function genCurdEditMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
439
438
|
"concept": "BindEvent",
|
|
440
439
|
"arguments": [],
|
|
441
440
|
"name": "created",
|
|
442
|
-
"calleeNamespace": "
|
|
441
|
+
"calleeNamespace": "",
|
|
443
442
|
"calleeName": "${nameGroup.viewLogicInit}"
|
|
444
443
|
}
|
|
445
444
|
],
|
|
@@ -61,7 +61,7 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
61
61
|
`;
|
|
62
62
|
} else if (propertyTypeName === 'Integer' || propertyTypeName === 'Long') {
|
|
63
63
|
formItem += `<u-number-input v-model="${vModel}" placeholder="请输入${label}"></u-number-input>`;
|
|
64
|
-
} else if (propertyTypeName === '
|
|
64
|
+
} else if (propertyTypeName === 'Double') {
|
|
65
65
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
66
66
|
} else if (propertyTypeName === 'Text') {
|
|
67
67
|
formItem += `<u-textarea v-model="${vModel}" placeholder="请输入${label}"></u-textarea>`;
|
|
@@ -91,7 +91,7 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
91
91
|
</u-form-item>
|
|
92
92
|
</u-form>
|
|
93
93
|
|
|
94
|
-
<u-button color="primary" @click="${nameGroup.viewLogicCreate}
|
|
94
|
+
<u-button color="primary" @click="${nameGroup.viewLogicCreate}">创建</u-button>
|
|
95
95
|
</u-linear-layout>
|
|
96
96
|
`;
|
|
97
97
|
}
|
|
@@ -159,7 +159,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
159
159
|
</u-select>`;
|
|
160
160
|
} else if (propertyTypeName === 'Integer' || propertyTypeName === 'Long') {
|
|
161
161
|
formItem += `<u-number-input v-model="${vModel}" placeholder="请输入${label}" ${property.primaryKey ? `:disabled="${nameGroup.viewVariableIsUpdate}"` : ''}></u-number-input>`;
|
|
162
|
-
} else if (propertyTypeName === '
|
|
162
|
+
} else if (propertyTypeName === 'Double') {
|
|
163
163
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}" ${
|
|
164
164
|
property.primaryKey ? `:disabled="${nameGroup.viewVariableIsUpdate}"` : ''
|
|
165
165
|
}></u-number-input>`;
|
|
@@ -459,7 +459,7 @@ export function genCurdMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
459
459
|
return `<template>
|
|
460
460
|
<u-linear-layout direction="vertical">
|
|
461
461
|
${genFilterTemplate(entity, nameGroup, selectNameGroupMap)}
|
|
462
|
-
${genTableTemplate(entity, nameGroup)}
|
|
462
|
+
${genTableTemplate(entity, nameGroup, true)}
|
|
463
463
|
${genSaveModalTemplate(entity, nameGroup, selectNameGroupMap)}
|
|
464
464
|
</u-linear-layout>
|
|
465
465
|
</template>
|
|
@@ -511,7 +511,7 @@ export function genCurdMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
511
511
|
"concept": "BindEvent",
|
|
512
512
|
"arguments": [],
|
|
513
513
|
"name": "created",
|
|
514
|
-
"calleeNamespace": "
|
|
514
|
+
"calleeNamespace": "",
|
|
515
515
|
"calleeName": "${nameGroup.viewLogicInit}"
|
|
516
516
|
}
|
|
517
517
|
],
|
|
@@ -581,7 +581,7 @@ export function genGridViewMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
581
581
|
return `<template>
|
|
582
582
|
<u-linear-layout direction="vertical">
|
|
583
583
|
${genFilterTemplate(entity, nameGroup, selectNameGroupMap)}
|
|
584
|
-
${genGridViewTemplate(entity, nameGroup)}
|
|
584
|
+
${genGridViewTemplate(entity, nameGroup, true)}
|
|
585
585
|
${genSaveModalTemplate(entity, nameGroup, selectNameGroupMap)}
|
|
586
586
|
</u-linear-layout>
|
|
587
587
|
</template>
|
|
@@ -633,7 +633,7 @@ export function genGridViewMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
633
633
|
"concept": "BindEvent",
|
|
634
634
|
"arguments": [],
|
|
635
635
|
"name": "created",
|
|
636
|
-
"calleeNamespace": "
|
|
636
|
+
"calleeNamespace": "",
|
|
637
637
|
"calleeName": "${nameGroup.viewLogicInit}"
|
|
638
638
|
}
|
|
639
639
|
],
|
|
@@ -70,7 +70,7 @@ export function genEditTableColumnTemplate(entity: Entity, property: EntityPrope
|
|
|
70
70
|
</u-select>`;
|
|
71
71
|
} else if (propertyTypeName === 'Integer' || propertyTypeName === 'Long') {
|
|
72
72
|
formItem = `<u-number-input :value.sync="${valueExpression}" placeholder="请输入${label}" :autofocus="true" @blur="${nameGroup.viewLogicBlurUpdate}"></u-number-input>`;
|
|
73
|
-
} else if (propertyTypeName === '
|
|
73
|
+
} else if (propertyTypeName === 'Double') {
|
|
74
74
|
formItem = `<u-number-input :value.sync="${valueExpression}" :precision="0" :step="0" placeholder="请输入${label}" :autofocus="true" @blur="${nameGroup.viewLogicBlurUpdate}"></u-number-input>`;
|
|
75
75
|
} else if (propertyTypeName === 'Text') {
|
|
76
76
|
formItem = `<u-validator placement="bottom" display="appear" @blur-valid="${nameGroup.viewLogicBlurUpdate}" style="width:100%">
|
|
@@ -122,7 +122,7 @@ export function genEditTableTemplate(entity: Entity, nameGroup: NameGroup, selec
|
|
|
122
122
|
<u-table-view-column title="操作">
|
|
123
123
|
<template #cell="scope">
|
|
124
124
|
<u-linear-layout gap="small">
|
|
125
|
-
<u-link @click="${nameGroup.viewLogicRemove}
|
|
125
|
+
<u-link @click="${nameGroup.viewLogicRemove}">删除</u-link>
|
|
126
126
|
</u-linear-layout>
|
|
127
127
|
</template>
|
|
128
128
|
</u-table-view-column>
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { config } from '../config';
|
|
2
2
|
import * as utils from '../utils';
|
|
3
3
|
import { Entity, Logic, View } from '../concepts';
|
|
4
|
-
import {
|
|
5
|
-
NaslCoreTypeAnnotation, NaslTypeAnnotation, NaslLogicItem,
|
|
6
|
-
NaslNode,
|
|
7
|
-
} from './utils';
|
|
4
|
+
import { NaslCoreTypeAnnotation, NaslTypeAnnotation, NaslLogicItem, NaslNode } from './utils';
|
|
8
5
|
import { NameGroup, filterProperty, getExpression, genLogicParam } from '.';
|
|
9
6
|
|
|
10
7
|
export function genGetTemplate(entity: Entity, nameGroup: NameGroup) {
|
|
@@ -58,10 +55,11 @@ export function genH5GetTemplate(entity: Entity, nameGroup: NameGroup) {
|
|
|
58
55
|
return `<van-cell-group>
|
|
59
56
|
${properties
|
|
60
57
|
.map((property) => {
|
|
61
|
-
|
|
58
|
+
const temptitle = property.label || property.name;
|
|
59
|
+
let formItem = ` <van-cell isLink`;
|
|
62
60
|
|
|
63
61
|
formItem += ' :value="' + getExpression(property, `${nameGroup.viewVariableEntity}.${property.name}`) + '">';
|
|
64
|
-
|
|
62
|
+
formItem += `<template #title>${temptitle}</template>`;
|
|
65
63
|
formItem += `<template>{{ ${getExpression(property, `${nameGroup.viewVariableEntity}.${property.name}`)} }}</template> </van-cell>\n`;
|
|
66
64
|
return formItem;
|
|
67
65
|
})
|
|
@@ -109,7 +107,7 @@ export function genGetBlock(entity: Entity, view: View) {
|
|
|
109
107
|
"concept": "BindEvent",
|
|
110
108
|
"arguments": [],
|
|
111
109
|
"name": "created",
|
|
112
|
-
"calleeNamespace": "
|
|
110
|
+
"calleeNamespace": "",
|
|
113
111
|
"calleeName": "${nameGroup.viewLogicLoad}"
|
|
114
112
|
}
|
|
115
113
|
]
|
|
@@ -13,10 +13,7 @@ import {
|
|
|
13
13
|
genQueryLogic,
|
|
14
14
|
genQueryStructure,
|
|
15
15
|
} from '.';
|
|
16
|
-
import {
|
|
17
|
-
NaslCoreTypeAnnotation, NaslUITypeAnnotation, NaslCollectionTypeAnnotation,
|
|
18
|
-
NaslTypeAnnotation, NaslLogicItem, NaslNode,
|
|
19
|
-
} from './utils';
|
|
16
|
+
import { NaslCoreTypeAnnotation, NaslUITypeAnnotation, NaslCollectionTypeAnnotation, NaslTypeAnnotation, NaslLogicItem, NaslNode } from './utils';
|
|
20
17
|
|
|
21
18
|
/**
|
|
22
19
|
* 根据实体属性生成表格列模板
|
|
@@ -102,7 +99,7 @@ export function genH5GridViewCardTemplate(property: EntityProperty) {
|
|
|
102
99
|
* @param entity 实体
|
|
103
100
|
* @param nameGroup 命名组
|
|
104
101
|
*/
|
|
105
|
-
export function genGridViewTemplate(entity: Entity, nameGroup: NameGroup) {
|
|
102
|
+
export function genGridViewTemplate(entity: Entity, nameGroup: NameGroup, modifyable?: boolean) {
|
|
106
103
|
const properties = entity.properties.filter(filterProperty('inTable'));
|
|
107
104
|
|
|
108
105
|
return `<u-grid-view ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
|
|
@@ -121,8 +118,8 @@ export function genGridViewTemplate(entity: Entity, nameGroup: NameGroup) {
|
|
|
121
118
|
<u-linear-layout direction="vertical" gap="small">
|
|
122
119
|
${properties.map((property) => genGridViewCardTemplate(property) + '\n').join('')}
|
|
123
120
|
<u-linear-layout gap="small">
|
|
124
|
-
<u-link
|
|
125
|
-
<u-link @click="${nameGroup.viewLogicRemove}
|
|
121
|
+
<u-link ${modifyable ? `@click="${nameGroup.viewLogicModify || 'modify'}"` : ''}>修改</u-link>
|
|
122
|
+
<u-link @click="${nameGroup.viewLogicRemove}">删除</u-link>
|
|
126
123
|
</u-linear-layout>
|
|
127
124
|
</u-linear-layout>
|
|
128
125
|
</u-card>
|
|
@@ -6,6 +6,7 @@ export function genQueryStructure(allEntities: Array<Entity>, nameGroup: NameGro
|
|
|
6
6
|
allEntities = Array.from(new Set(allEntities));
|
|
7
7
|
return NaslNode.Structure({
|
|
8
8
|
name: nameGroup.structure,
|
|
9
|
+
origin: 'CallQueryComponent',
|
|
9
10
|
properties: allEntities.map((entity) =>
|
|
10
11
|
NaslNode.StructureProperty({
|
|
11
12
|
name: utils.firstLowerCase(entity.name),
|
|
@@ -12,10 +12,7 @@ import {
|
|
|
12
12
|
genQueryStructure,
|
|
13
13
|
genLogicParam,
|
|
14
14
|
} from '.';
|
|
15
|
-
import {
|
|
16
|
-
NaslCoreTypeAnnotation, NaslCollectionTypeAnnotation, NaslUITypeAnnotation,
|
|
17
|
-
NaslTypeAnnotation, NaslLogicItem, NaslNode,
|
|
18
|
-
} from './utils';
|
|
15
|
+
import { NaslCoreTypeAnnotation, NaslCollectionTypeAnnotation, NaslUITypeAnnotation, NaslTypeAnnotation, NaslLogicItem, NaslNode } from './utils';
|
|
19
16
|
|
|
20
17
|
/**
|
|
21
18
|
* 根据实体属性生成表格列模板
|
|
@@ -59,7 +56,7 @@ export function genTableColumnTemplate(property: EntityProperty) {
|
|
|
59
56
|
* @param entity 实体
|
|
60
57
|
* @param nameGroup 命名组
|
|
61
58
|
*/
|
|
62
|
-
export function genTableTemplate(entity: Entity, nameGroup: NameGroup) {
|
|
59
|
+
export function genTableTemplate(entity: Entity, nameGroup: NameGroup, modifyable?: boolean) {
|
|
63
60
|
const properties = entity.properties.filter(filterProperty('inTable'));
|
|
64
61
|
|
|
65
62
|
return `<u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
|
|
@@ -72,8 +69,8 @@ export function genTableTemplate(entity: Entity, nameGroup: NameGroup) {
|
|
|
72
69
|
<u-table-view-column title="操作">
|
|
73
70
|
<template #cell="scope">
|
|
74
71
|
<u-linear-layout gap="small">
|
|
75
|
-
<u-link
|
|
76
|
-
<u-link @click="${nameGroup.viewLogicRemove}
|
|
72
|
+
<u-link ${modifyable ? `@click="${nameGroup.viewLogicModify || 'modify'}"` : ''}>修改</u-link>
|
|
73
|
+
<u-link @click="${nameGroup.viewLogicRemove}">删除</u-link>
|
|
77
74
|
</u-linear-layout>
|
|
78
75
|
</template>
|
|
79
76
|
</u-table-view-column>
|
|
@@ -59,7 +59,7 @@ export function genUpdateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
|
|
|
59
59
|
formItem += `<u-checkbox v-model="${vModel}"></u-checkbox>`;
|
|
60
60
|
} else if (propertyTypeName === 'Integer' || propertyTypeName === 'Long') {
|
|
61
61
|
formItem += `<u-number-input v-model="${vModel}" placeholder="请输入${label}"></u-number-input>`;
|
|
62
|
-
} else if (propertyTypeName === '
|
|
62
|
+
} else if (propertyTypeName === 'Double') {
|
|
63
63
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
64
64
|
} else if (propertyTypeName === 'Text') {
|
|
65
65
|
formItem += `<u-textarea v-model="${vModel}" placeholder="请输入${label}"></u-textarea>`;
|
|
@@ -124,6 +124,7 @@ export function genH5UpdateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
124
124
|
<template #input><van-cascader title="请选择${label}" placeholder="请选择${label}"
|
|
125
125
|
v-model="${vModel}" :data-source="${selectNameGroup.viewLogicLoad}"
|
|
126
126
|
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}"
|
|
127
|
+
:notitleblock="true"
|
|
127
128
|
:pageable="true" :remote-paging="true"></van-cascader></template>
|
|
128
129
|
`;
|
|
129
130
|
} else
|
|
@@ -134,15 +135,13 @@ export function genH5UpdateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
134
135
|
formItem += `<template #input><van-switch v-model="${vModel}"></van-switch></template>`;
|
|
135
136
|
} else if (propertyTypeName === 'Integer' || propertyTypeName === 'Long') {
|
|
136
137
|
formItem += `<template #input><van-stepper v-model="${vModel}" placeholder="请输入${label}"></van-stepper></template>`;
|
|
137
|
-
} else if (propertyTypeName === '
|
|
138
|
+
} else if (propertyTypeName === 'Double') {
|
|
138
139
|
formItem += `<template #input><van-stepper v-model="${vModel}" placeholder="请输入${label}"></van-stepper></template>`;
|
|
139
140
|
} else if (propertyTypeName === 'Text') {
|
|
140
|
-
formItem =
|
|
141
|
-
formItem += `<van-input v-model="${vModel}" placeholder="请输入${label}"></van-input>`;
|
|
142
|
-
|
|
141
|
+
formItem += `<template #input><van-fieldtextarea v-model="${vModel}" placeholder="请输入${label}"></van-fieldtextarea></template>`;
|
|
143
142
|
// @TODO
|
|
144
143
|
} else if (propertyTypeName === 'Date') {
|
|
145
|
-
formItem += `<template #input><van-calendar clearable :date.sync="${vModel}" placeholder="请输入${label}"></van-calendar></template>`;
|
|
144
|
+
formItem += `<template #input><van-calendar clearable :default-date.sync="${vModel}" placeholder="请输入${label}"></van-calendar></template>`;
|
|
146
145
|
} else if (propertyTypeName === 'Time') {
|
|
147
146
|
formItem += `<template #input><van-datetime-picker type="time" v-model="${vModel}" title="请选择${label}" label-field=""></van-datetime-picker></template>`;
|
|
148
147
|
} else if (propertyTypeName === 'DateTime') {
|
|
@@ -151,7 +150,7 @@ export function genH5UpdateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
151
150
|
const namespaceArr = propertyTypeNamespace.split('.');
|
|
152
151
|
const type = namespaceArr.pop();
|
|
153
152
|
if (type === 'enums') {
|
|
154
|
-
formItem += genEnumSelectBlock(parentNode.findEnumByName(propertyTypeName) as Enum, `${vModel}`, '', `请选择${label}`, true);
|
|
153
|
+
formItem += '<template #input>' + genEnumSelectBlock(parentNode.findEnumByName(propertyTypeName) as Enum, `${vModel}`, '', `请选择${label}`, true) + '</template>';
|
|
155
154
|
} else {
|
|
156
155
|
formItem += `<template #input><van-fieldinput v-model="${vModel}" placeholder="请输入${label}"></van-fieldinput></template>`;
|
|
157
156
|
}
|
|
@@ -323,7 +322,7 @@ export function genUpdateBlock(entity: Entity, view: View) {
|
|
|
323
322
|
"concept": "BindEvent",
|
|
324
323
|
"arguments": [],
|
|
325
324
|
"name": "created",
|
|
326
|
-
"calleeNamespace": "
|
|
325
|
+
"calleeNamespace": "",
|
|
327
326
|
"calleeName": "${nameGroup.viewLogicLoad}"
|
|
328
327
|
}
|
|
329
328
|
],
|
package/src/templator/utils.ts
CHANGED
|
@@ -497,10 +497,11 @@ export const NaslNode = {
|
|
|
497
497
|
description,
|
|
498
498
|
playground,
|
|
499
499
|
}),
|
|
500
|
-
Structure: ({ name, properties }: { name: string; properties?: any[] }) => ({
|
|
500
|
+
Structure: ({ name, properties, origin }: { name: string; properties?: any[], origin?: 'CallQueryComponent' }) => ({
|
|
501
501
|
concept: 'Structure',
|
|
502
502
|
name,
|
|
503
503
|
properties,
|
|
504
|
+
origin,
|
|
504
505
|
}),
|
|
505
506
|
StructureProperty: ({ name, typeAnnotation }: { name: string; typeAnnotation?: any }) => ({
|
|
506
507
|
concept: 'StructureProperty',
|
package/src/utils/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './string';
|
|
|
2
2
|
export * from './traverse';
|
|
3
3
|
export * from './logger';
|
|
4
4
|
|
|
5
|
+
import { compare } from 'compare-versions';
|
|
5
6
|
import { traverse } from './traverse';
|
|
6
7
|
|
|
7
8
|
export function getGlobalEnv() {
|
|
@@ -34,6 +35,24 @@ export function clearObjectDeep(obj: any) {
|
|
|
34
35
|
|
|
35
36
|
export const waitPromise = (wait: number) => new Promise((res) => setTimeout(() => res(wait), wait));
|
|
36
37
|
|
|
38
|
+
// 官方扩展组件暂时不包含 css 文件
|
|
39
|
+
export const officialCustoms = [
|
|
40
|
+
'lcap-login',
|
|
41
|
+
'lcap-video',
|
|
42
|
+
'lcap-amap-nav',
|
|
43
|
+
'lcap-amap-poi',
|
|
44
|
+
'lcap-echarts-bar',
|
|
45
|
+
'lcap-echarts-line',
|
|
46
|
+
'lcap-echarts-pie',
|
|
47
|
+
'lcap-report',
|
|
48
|
+
'lcap-h5-iframe',
|
|
49
|
+
'lcap-wang-editor',
|
|
50
|
+
];
|
|
51
|
+
// 特殊官方组件,部分低版本有 css,高版本没有 css
|
|
52
|
+
export const specialOfficialCustoms = [{ name: 'lcap-rich-text-editor', version: '1.3.10' }];
|
|
53
|
+
export const shouldLoadCss = (name: string, version: string): boolean => (!officialCustoms.includes(name)
|
|
54
|
+
&& !specialOfficialCustoms.find((extra) => extra.name === name && compare(version, extra.version, '>=')));
|
|
55
|
+
|
|
37
56
|
// https://github.com/Microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
38
57
|
export type IfEquals<X, Y, A, B> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? A : B;
|
|
39
58
|
|