@lcap/nasl 3.5.0-beta.4 → 3.6.0-alpha.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/out/bak/translator.js +39 -119
- package/out/bak/translator.js.map +1 -1
- package/out/breakpoint/generator/BreakpointNode.d.ts +0 -3
- package/out/breakpoint/generator/BreakpointNode.js +0 -9
- package/out/breakpoint/generator/BreakpointNode.js.map +1 -1
- package/out/breakpoint/shared/constants.js +0 -1
- package/out/breakpoint/shared/constants.js.map +1 -1
- package/out/breakpoint/shared/utils.js +7 -31
- package/out/breakpoint/shared/utils.js.map +1 -1
- package/out/common/BaseNode.d.ts +13 -1
- package/out/common/BaseNode.js +52 -23
- package/out/common/BaseNode.js.map +1 -1
- package/out/common/Command.js +1 -0
- package/out/common/Command.js.map +1 -1
- package/out/common/EventEmitter.d.ts +1 -1
- package/out/common/EventEmitter.js +0 -4
- package/out/common/EventEmitter.js.map +1 -1
- package/out/concepts/App__.d.ts +76 -51
- package/out/concepts/App__.js +190 -87
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/BackendVariable__.js +2 -10
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +6 -16
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +0 -1
- package/out/concepts/BindDirective__.js +4 -19
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +1 -3
- package/out/concepts/BindEvent__.js +13 -38
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/CallFunction__.js +2 -10
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +0 -2
- package/out/concepts/CallLogic__.js +27 -38
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/Constant__.js +6 -7
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +1 -1
- package/out/concepts/Destination__.js +4 -6
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +1 -2
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +1 -1
- package/out/concepts/Entity__.js +2 -0
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Event__.d.ts +0 -14
- package/out/concepts/Event__.js +0 -61
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +88 -0
- package/out/concepts/Frontend__.js +143 -1
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts +0 -5
- package/out/concepts/Identifier__.js +9 -19
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +1 -1
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +1 -3
- package/out/concepts/Logic__.js +13 -16
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +1 -1
- package/out/concepts/MemberExpression__.js +3 -3
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/Param__.js +3 -11
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +1 -9
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/Return__.js +9 -17
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Variable__.js +8 -17
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +2 -17
- package/out/concepts/ViewElement__.js +31 -143
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +6 -6
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/index__.d.ts +0 -5
- package/out/concepts/index__.js +0 -5
- package/out/concepts/index__.js.map +1 -1
- package/out/concepts/utils/asserts.d.ts +3 -258
- package/out/concepts/utils/asserts.js +13 -351
- package/out/concepts/utils/asserts.js.map +1 -1
- package/out/concepts/utils/types.d.ts +3 -20
- package/out/generator/genBundleFiles.js +11 -25
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genReleaseBody.js +3 -12
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/permission.js +3 -3
- package/out/generator/permission.js.map +1 -1
- package/out/natural/transformTSCode.js +1 -1
- package/out/natural/transformTSCode.js.map +1 -1
- package/out/server/extendBaseNode.js +22 -6
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/getLogics.js +27 -62
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +1 -6
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/naslServer.js +11 -28
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +1 -6
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +26 -2
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +6 -6
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +16 -16
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.d.ts +27 -0
- package/out/templator/genCurdMultipleKeyBlock.js +709 -37
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +4 -4
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +12 -12
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +4 -4
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genSelectBlock.js +3 -3
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.d.ts +2 -0
- package/out/templator/genTableBlock.js +124 -11
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +8 -8
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +2 -2
- package/out/templator/utils.js.map +1 -1
- package/out/translator/utils.js +18 -0
- package/out/translator/utils.js.map +1 -1
- package/out/utils/i18nInfo.js +2 -7
- package/out/utils/i18nInfo.js.map +1 -1
- package/package.json +2 -2
- package/src/bak/translator.js +43 -121
- package/src/breakpoint/generator/BreakpointNode.ts +0 -12
- package/src/breakpoint/shared/constants.ts +0 -1
- package/src/breakpoint/shared/utils.ts +10 -37
- package/src/common/BaseNode.ts +60 -22
- package/src/common/Command.ts +1 -0
- package/src/common/EventEmitter.ts +1 -6
- package/src/concepts/App__.ts +251 -139
- package/src/concepts/BackendVariable__.ts +2 -10
- package/src/concepts/BindAttribute__.ts +6 -15
- package/src/concepts/BindDirective__.ts +4 -19
- package/src/concepts/BindEvent__.ts +12 -40
- package/src/concepts/CallFunction__.ts +2 -10
- package/src/concepts/CallLogic__.ts +32 -45
- package/src/concepts/Constant__.ts +7 -5
- package/src/concepts/Destination__.ts +4 -6
- package/src/concepts/End__.ts +0 -1
- package/src/concepts/Entity__.ts +3 -1
- package/src/concepts/Event__.ts +0 -70
- package/src/concepts/Frontend__.ts +251 -3
- package/src/concepts/Identifier__.ts +13 -29
- package/src/concepts/LogicItem__.ts +0 -1
- package/src/concepts/Logic__.ts +14 -21
- package/src/concepts/MemberExpression__.ts +3 -3
- package/src/concepts/NewComposite__.ts +6 -4
- package/src/concepts/Param__.ts +3 -11
- package/src/concepts/ProcessElement__.ts +1 -8
- package/src/concepts/Return__.ts +12 -15
- package/src/concepts/Variable__.ts +9 -17
- package/src/concepts/ViewElement__.ts +54 -166
- package/src/concepts/View__.ts +6 -8
- package/src/concepts/index__.ts +0 -5
- package/src/concepts/utils/asserts.ts +4 -367
- package/src/concepts/utils/types.ts +0 -28
- package/src/generator/genBundleFiles.ts +15 -33
- package/src/generator/genReleaseBody.ts +3 -14
- package/src/generator/permission.ts +6 -8
- package/src/natural/transformTSCode.ts +1 -1
- package/src/server/extendBaseNode.ts +41 -22
- package/src/server/getLogics.ts +41 -79
- package/src/server/getMemberIdentifier.ts +1 -7
- package/src/server/naslServer.ts +12 -30
- package/src/server/translator.ts +1 -7
- package/src/service/storage/init.ts +33 -2
- package/src/templator/genCreateBlock.ts +6 -6
- package/src/templator/genCurdEditMultipleKeyBlock.ts +16 -16
- package/src/templator/genCurdMultipleKeyBlock.ts +817 -93
- package/src/templator/genGetBlock.ts +4 -4
- package/src/templator/genGridViewBlock.ts +12 -12
- package/src/templator/genListViewBlock.ts +4 -4
- package/src/templator/genSelectBlock.ts +3 -3
- package/src/templator/genTableBlock.ts +137 -12
- package/src/templator/genUpdateBlock.ts +8 -8
- package/src/templator/utils.ts +2 -2
- package/src/translator/utils.ts +20 -0
- package/src/utils/i18nInfo.ts +2 -7
- package/test/concepts/call-function/fixtures/from-string.json +59 -68
- package/test/concepts/call-function/fixtures/to-string-global-tz.json +58 -67
- package/test/concepts/call-function/fixtures/to-string-no-tz.json +48 -57
- package/test/concepts/call-function/fixtures/to-string-user-tz.json +60 -69
- package/test/concepts/call-function/fixtures/to-string-utc-tz.json +60 -69
- package/test/concepts/call-interface/fixtures/only-interface.json +72 -81
- package/test/concepts/call-interface/fixtures/with-body-complex-argument.json +214 -223
- package/test/concepts/call-interface/fixtures/with-body-no-argument.json +76 -85
- package/test/concepts/call-interface/fixtures/with-body-simple-argument.json +91 -100
- package/test/concepts/call-interface/fixtures/with-headers-no-argument.json +79 -88
- package/test/concepts/call-interface/fixtures/with-headers.json +81 -90
- package/test/concepts/call-interface/fixtures/with-query-no-argument.json +79 -88
- package/test/concepts/call-interface/fixtures/with-query.json +81 -90
- package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +2 -4
- package/test/concepts/call-logic/fixtures/entries-get-with-arguments.json +95 -104
- package/test/concepts/call-logic/fixtures/entries-update-with-arguments.json +200 -209
- package/test/concepts/call-logic/fixtures/global-logic-argument-no-expression.json +88 -97
- package/test/concepts/call-logic/fixtures/global-logic-argument-some-expression.json +115 -124
- package/test/concepts/call-logic/fixtures/json-deserialize.json +111 -120
- package/test/concepts/call-logic/fixtures/json-serialize-with-string.json +115 -124
- package/test/concepts/call-logic/fixtures/json-serialize.json +115 -124
- package/test/concepts/call-logic/fixtures/view-buildin-logic-with-argument.json +82 -91
- package/test/concepts/call-logic/fixtures/view-component-logic-no-argument.json +79 -88
- package/test/concepts/call-logic/fixtures/view-component-with-validation.json +135 -144
- package/test/concepts/identifier/fixtures/view-variable.json +136 -145
- package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +1 -1
- package/test/concepts/view-element/fixtures/default-login.json +212 -221
- package/test/concepts/view-element/fixtures/default-not-found.json +174 -183
- package/test/concepts/view-element/fixtures/with-role-auth.json +82 -91
- package/test/concepts/view-element/fixtures/with-table.json +1834 -1843
- package/test/concepts/view-element/toVue.spec.ts +0 -1
- package/ts-worker/package.json +1 -1
- package/out/concepts/BusinessComponent__.d.ts +0 -641
- package/out/concepts/BusinessComponent__.js +0 -1901
- package/out/concepts/BusinessComponent__.js.map +0 -1
- package/out/concepts/BusinessLogic__.d.ts +0 -38
- package/out/concepts/BusinessLogic__.js +0 -358
- package/out/concepts/BusinessLogic__.js.map +0 -1
- package/out/concepts/CallEvent__.d.ts +0 -97
- package/out/concepts/CallEvent__.js +0 -263
- package/out/concepts/CallEvent__.js.map +0 -1
- package/out/concepts/FrontendType__.d.ts +0 -308
- package/out/concepts/FrontendType__.js +0 -605
- package/out/concepts/FrontendType__.js.map +0 -1
- package/out/concepts/ParamWithGroup__.d.ts +0 -39
- package/out/concepts/ParamWithGroup__.js +0 -85
- package/out/concepts/ParamWithGroup__.js.map +0 -1
- package/src/concepts/BusinessComponent__.ts +0 -2669
- package/src/concepts/BusinessLogic__.ts +0 -376
- package/src/concepts/CallEvent__.ts +0 -334
- package/src/concepts/FrontendType__.ts +0 -919
- package/src/concepts/ParamWithGroup__.ts +0 -101
|
@@ -68,14 +68,14 @@ export function genH5GetTemplate(entity: Entity, nameGroup: NameGroup) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export function genGetBlock(entity: Entity, oldNode: ViewElement) {
|
|
71
|
-
const
|
|
71
|
+
const { view } = oldNode;
|
|
72
72
|
const { ns } = entity;
|
|
73
73
|
const getLogic = ns?.logics?.find((logic) => logic.name === `get`);
|
|
74
74
|
|
|
75
75
|
const nameGroup: NameGroup = {};
|
|
76
|
-
nameGroup.viewParamId =
|
|
77
|
-
nameGroup.viewVariableEntity =
|
|
78
|
-
nameGroup.viewLogicLoad =
|
|
76
|
+
nameGroup.viewParamId = view.getParamUniqueName('id');
|
|
77
|
+
nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
|
|
78
|
+
nameGroup.viewLogicLoad = view.getLogicUniqueName('load');
|
|
79
79
|
|
|
80
80
|
return `<template>
|
|
81
81
|
${config.scope === 'h5' ? genH5GetTemplate(entity, nameGroup) : genGetTemplate(entity, nameGroup)}
|
|
@@ -245,16 +245,16 @@ export function genGridViewRemoveLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
245
245
|
*/
|
|
246
246
|
// 数据网格(简)
|
|
247
247
|
export function genGridViewBlock(entity: Entity, oldNode: ViewElement) {
|
|
248
|
-
const
|
|
248
|
+
const { view } = oldNode;
|
|
249
249
|
const dataSource = entity.parentNode as DataSource;
|
|
250
250
|
const module = dataSource.app;
|
|
251
251
|
|
|
252
|
-
const viewElementMainView =
|
|
253
|
-
const nameGroup = genUniqueQueryNameGroup(module,
|
|
252
|
+
const viewElementMainView = view.getViewElementUniqueName('gridView');
|
|
253
|
+
const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
|
|
254
254
|
nameGroup.viewElementMainView = viewElementMainView;
|
|
255
|
-
nameGroup.viewVariableEntity =
|
|
256
|
-
nameGroup.viewLogicRemove =
|
|
257
|
-
nameGroup.viewVariableFilter =
|
|
255
|
+
nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
|
|
256
|
+
nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
|
|
257
|
+
nameGroup.viewVariableFilter = view.getVariableUniqueName('filter');
|
|
258
258
|
|
|
259
259
|
// 当前节点的currentName
|
|
260
260
|
nameGroup.currentName = oldNode.getCurrentName();
|
|
@@ -294,17 +294,17 @@ export function genGridViewBlock(entity: Entity, oldNode: ViewElement) {
|
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
export function genGridViewCardBlock(property: EntityProperty, oldNode: ViewElement) {
|
|
297
|
-
const
|
|
297
|
+
const { view } = oldNode;
|
|
298
298
|
const { entity } = property;
|
|
299
299
|
const dataSource = entity.parentNode as DataSource;
|
|
300
300
|
const module = dataSource.app;
|
|
301
301
|
|
|
302
|
-
const viewElementMainView =
|
|
303
|
-
const nameGroup = genUniqueQueryNameGroup(module,
|
|
302
|
+
const viewElementMainView = view.getViewElementUniqueName('gridView');
|
|
303
|
+
const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
|
|
304
304
|
nameGroup.viewElementMainView = viewElementMainView;
|
|
305
|
-
nameGroup.viewVariableEntity =
|
|
306
|
-
nameGroup.viewLogicRemove =
|
|
307
|
-
nameGroup.viewVariableFilter =
|
|
305
|
+
nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
|
|
306
|
+
nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
|
|
307
|
+
nameGroup.viewVariableFilter = view.getVariableUniqueName('filter');
|
|
308
308
|
|
|
309
309
|
// 收集所有和本实体关联的实体
|
|
310
310
|
const entitySet: Set<Entity> = new Set();
|
|
@@ -94,14 +94,14 @@ export function genLoadListViewLogic(entity: Entity, nameGroup: NameGroup, newLo
|
|
|
94
94
|
* 生成实体选择框区块
|
|
95
95
|
*/
|
|
96
96
|
export function genListViewBlock(entity: Entity, oldNode: ViewElement, property: EntityProperty) {
|
|
97
|
-
const
|
|
97
|
+
const { view } = oldNode;
|
|
98
98
|
const dataSource = entity.parentNode as DataSource;
|
|
99
99
|
const module = dataSource.app;
|
|
100
100
|
|
|
101
|
-
const viewElementMainView =
|
|
102
|
-
const nameGroup = genUniqueQueryNameGroup(module,
|
|
101
|
+
const viewElementMainView = view.getViewElementUniqueName('listView');
|
|
102
|
+
const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView, false);
|
|
103
103
|
nameGroup.viewElementMainView = viewElementMainView;
|
|
104
|
-
nameGroup.viewVariableEntity =
|
|
104
|
+
nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
|
|
105
105
|
// 当前节点的currentName
|
|
106
106
|
nameGroup.currentName = oldNode.getCurrentName();
|
|
107
107
|
const displayedProperty = property || getFirstDisplayedProperty(entity);
|
|
@@ -104,12 +104,12 @@ export function genLoadSelectLogic(entity: Entity, nameGroup: NameGroup, newLogi
|
|
|
104
104
|
* @returns
|
|
105
105
|
*/
|
|
106
106
|
export function genSelectBlock(entity: Entity, oldNode: ViewElement) {
|
|
107
|
-
const
|
|
107
|
+
const { view } = oldNode;
|
|
108
108
|
const dataSource = entity.parentNode as DataSource;
|
|
109
109
|
const module = dataSource.app;
|
|
110
110
|
|
|
111
|
-
const viewElementMainView =
|
|
112
|
-
const nameGroup = genUniqueQueryNameGroup(module,
|
|
111
|
+
const viewElementMainView = view.getViewElementUniqueName('select');
|
|
112
|
+
const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView, false);
|
|
113
113
|
nameGroup.viewElementMainView = viewElementMainView;
|
|
114
114
|
nameGroup.lowerEntity = utils.firstLowerCase(entity.name);
|
|
115
115
|
|
|
@@ -62,7 +62,7 @@ export function genTableColumnTemplate(property: EntityProperty, currentName: st
|
|
|
62
62
|
* @param entity 实体
|
|
63
63
|
* @param nameGroup 命名组
|
|
64
64
|
*/
|
|
65
|
-
export function genTableTemplate(entity: Entity, nameGroup: NameGroup,newLogic: any, modifyable?: boolean, entryFromCall?: string) {
|
|
65
|
+
export function genTableTemplate(entity: Entity, nameGroup: NameGroup, newLogic: any, modifyable?: boolean, entryFromCall?: string) {
|
|
66
66
|
const currentName = nameGroup.currentName || 'current';
|
|
67
67
|
const properties = entity.properties.filter(filterProperty('inTable'));
|
|
68
68
|
let dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size,elements.$ce.sort,elements.$ce.order)`;
|
|
@@ -198,15 +198,15 @@ export function genTableRemoveLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
198
198
|
* load_select_student -> load_someView_select_student
|
|
199
199
|
*/
|
|
200
200
|
export function genTableBlock(entity: Entity, oldNode: ViewElement) {
|
|
201
|
-
const
|
|
201
|
+
const { view } = oldNode;
|
|
202
202
|
const dataSource = entity.parentNode as DataSource;
|
|
203
203
|
const module = dataSource.app;
|
|
204
204
|
|
|
205
|
-
const viewElementMainView =
|
|
206
|
-
const nameGroup = genUniqueQueryNameGroup(module,
|
|
205
|
+
const viewElementMainView = view.getViewElementUniqueName('tableView');
|
|
206
|
+
const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
|
|
207
207
|
nameGroup.viewElementMainView = viewElementMainView;
|
|
208
|
-
nameGroup.viewVariableEntity =
|
|
209
|
-
nameGroup.viewLogicRemove =
|
|
208
|
+
nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
|
|
209
|
+
nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
|
|
210
210
|
// 当前节点的currentName
|
|
211
211
|
nameGroup.currentName = oldNode.getCurrentName();
|
|
212
212
|
// 收集所有和本实体关联的实体
|
|
@@ -245,16 +245,16 @@ export function genTableBlock(entity: Entity, oldNode: ViewElement) {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
export function genTableColumnBlock(property: EntityProperty, oldNode: ViewElement) {
|
|
248
|
-
const
|
|
248
|
+
const { view } = oldNode;
|
|
249
249
|
const { entity } = property;
|
|
250
250
|
const dataSource = entity.parentNode as DataSource;
|
|
251
251
|
const module = dataSource.app;
|
|
252
252
|
|
|
253
|
-
const viewElementMainView =
|
|
254
|
-
const nameGroup = genUniqueQueryNameGroup(module,
|
|
253
|
+
const viewElementMainView = view.getViewElementUniqueName('tableView');
|
|
254
|
+
const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
|
|
255
255
|
nameGroup.viewElementMainView = viewElementMainView;
|
|
256
|
-
nameGroup.viewVariableEntity =
|
|
257
|
-
nameGroup.viewLogicRemove =
|
|
256
|
+
nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
|
|
257
|
+
nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
|
|
258
258
|
|
|
259
259
|
// 收集所有和本实体关联的实体
|
|
260
260
|
const entitySet: Set<Entity> = new Set();
|
|
@@ -277,7 +277,9 @@ export function genTableColumnBlock(property: EntityProperty, oldNode: ViewEleme
|
|
|
277
277
|
let dataSourceValue = `(params) => ${entityLogic.name}(elements.$ce.page, elements.$ce.size,elements.$ce.sort,elements.$ce.order)`;
|
|
278
278
|
return `
|
|
279
279
|
<template>
|
|
280
|
-
<u-table-view ref="${
|
|
280
|
+
<u-table-view ref="${
|
|
281
|
+
nameGroup.viewElementMainView
|
|
282
|
+
}" :data-source="${dataSourceValue}" :pagination="true" :page-size="20" :page-number="1" :show-sizer="true" data-schema="${nameGroup.structure}">
|
|
281
283
|
${properties.map((property) => `${genTableColumnTemplate(property)}\n`).join('')}
|
|
282
284
|
</u-table-view>
|
|
283
285
|
</template>
|
|
@@ -294,3 +296,126 @@ export function genTableColumnBlock(property: EntityProperty, oldNode: ViewEleme
|
|
|
294
296
|
}
|
|
295
297
|
|
|
296
298
|
export default genTableBlock;
|
|
299
|
+
|
|
300
|
+
export function genTableTemplateTableDesigner(
|
|
301
|
+
entity: Entity,
|
|
302
|
+
nameGroup: NameGroup,
|
|
303
|
+
newLogic: any,
|
|
304
|
+
modifyable?: boolean,
|
|
305
|
+
entryFromCall?: string,
|
|
306
|
+
optionsMap?: any
|
|
307
|
+
) {
|
|
308
|
+
const currentName = nameGroup.currentName || 'current';
|
|
309
|
+
const properties = entity.properties.filter(filterProperty('inTable'));
|
|
310
|
+
let dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size,elements.$ce.sort,elements.$ce.order)`;
|
|
311
|
+
if (['genCurdMultipleKeyBlock'].includes(entryFromCall)) {
|
|
312
|
+
dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size,elements.$ce.sort,elements.$ce.order,${nameGroup.viewVariableFilter})`;
|
|
313
|
+
}
|
|
314
|
+
return `
|
|
315
|
+
<u-linear-layout style="background: #fff; padding: 15px" >
|
|
316
|
+
<u-button color="primary" @click="${nameGroup.viewLogicCreate}" style="margin-right: 5px" icon="add">新 增</u-button>
|
|
317
|
+
<u-uploader
|
|
318
|
+
style="--custom-start: auto;margin-right: 5px"
|
|
319
|
+
display="inline"
|
|
320
|
+
url="/api/${entity.name.toLowerCase()}/import"
|
|
321
|
+
url-field="filePath"
|
|
322
|
+
:limit="999"
|
|
323
|
+
max-size="50MB"
|
|
324
|
+
converter="json"
|
|
325
|
+
:file-icon-switcher="false"
|
|
326
|
+
:download-icon-switcher="false"
|
|
327
|
+
:file-size="false"
|
|
328
|
+
:show-file-list="false"
|
|
329
|
+
name="file"
|
|
330
|
+
accept=""
|
|
331
|
+
@success="${nameGroup.viewLogicReload}"
|
|
332
|
+
>
|
|
333
|
+
<template #file-list>
|
|
334
|
+
<i-ico
|
|
335
|
+
style="margin: 0px 8px 0px 0px"
|
|
336
|
+
flag="file-icon"
|
|
337
|
+
name="file-default"
|
|
338
|
+
icotype="only"
|
|
339
|
+
></i-ico>
|
|
340
|
+
<u-text
|
|
341
|
+
style="
|
|
342
|
+
margin: 0px 8px 0px 0px;
|
|
343
|
+
white-space: nowrap;
|
|
344
|
+
overflow: hidden;
|
|
345
|
+
text-overflow: ellipsis;
|
|
346
|
+
display: inherit;
|
|
347
|
+
"
|
|
348
|
+
flag="file-name"
|
|
349
|
+
text="文件名称"
|
|
350
|
+
></u-text>
|
|
351
|
+
<u-text style="margin: 0px 8px 0px 0px" flag="file-size" text="文件大小"></u-text>
|
|
352
|
+
<i-ico
|
|
353
|
+
style="margin: 0px 8px 0px 0px"
|
|
354
|
+
flag="download-icon"
|
|
355
|
+
name="download"
|
|
356
|
+
icotype="only"
|
|
357
|
+
></i-ico>
|
|
358
|
+
</template>
|
|
359
|
+
<u-button color="default" icon="upload" text="上传"></u-button
|
|
360
|
+
></u-uploader>
|
|
361
|
+
<u-button style="margin-right: 5px" icon="download" @click="${nameGroup.viewLogicExportData}">导 出</u-button>
|
|
362
|
+
<u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" data-schema="${nameGroup.structure}"
|
|
363
|
+
value-field="${nameGroup.viewVariableEntity}.id"
|
|
364
|
+
:pagination="true" :show-sizer="true" :page-size="20" :page-number="1" style="margin-top: 12px">
|
|
365
|
+
<u-table-view-column type="index" width="60"><template #title><u-text text="序号"></u-text></template><template #cell="current"></template></u-table-view-column>
|
|
366
|
+
${properties.map((property) => `${genTableColumnTemplateTableDesigner(property, currentName, optionsMap)}\n`).join('')}
|
|
367
|
+
<u-table-view-column title="操作">
|
|
368
|
+
<template #title><u-text text="操作"></u-text></template>
|
|
369
|
+
<template #cell="current">
|
|
370
|
+
<u-link style="margin-right:5px;" @click="${nameGroup.viewLogicPreview}">详情</u-link>
|
|
371
|
+
<u-link ${modifyable ? `@click="${nameGroup.viewLogicModify || 'modify'}"` : ''} style="margin-right:5px;">编辑</u-link>
|
|
372
|
+
<u-link style="margin-right:5px;" @click="${nameGroup.viewLogicOpenDelModal}">删除</u-link>
|
|
373
|
+
</template>
|
|
374
|
+
</u-table-view-column>
|
|
375
|
+
</u-table-view>
|
|
376
|
+
</u-linear-layout>
|
|
377
|
+
|
|
378
|
+
`;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export const genTableColumnTemplateTableDesigner = (property: EntityProperty, currentName: string = 'current', optionsMap?: any) => {
|
|
382
|
+
const { entity } = property;
|
|
383
|
+
const hasOptions = optionsMap?.[property.name];
|
|
384
|
+
|
|
385
|
+
const dataSource = entity.parentNode as DataSource;
|
|
386
|
+
const lowerEntityName = utils.firstLowerCase(entity.name);
|
|
387
|
+
let valueExpression = `${currentName}.item.${lowerEntityName}.${property.name}`;
|
|
388
|
+
const title = (property.label || property.name).replace(/"/g, '"');
|
|
389
|
+
const multiple = property?.typeAnnotation?.typeName === 'List';
|
|
390
|
+
|
|
391
|
+
if (property.relationEntity) {
|
|
392
|
+
const relationLowerEntityName = utils.firstLowerCase(property.relationEntity);
|
|
393
|
+
const relationEntity = dataSource?.findEntityByName(property.relationEntity);
|
|
394
|
+
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
395
|
+
valueExpression = `${currentName}.item.${relationLowerEntityName}.${displayedProperty?.name || property.relationProperty}`;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const getText = (property: EntityProperty) => {
|
|
399
|
+
if (hasOptions) {
|
|
400
|
+
const options = optionsMap[property.name];
|
|
401
|
+
return `
|
|
402
|
+
<u-select :preview="true" :value="${valueExpression}" placeholder="--" ${multiple ? 'multiple' : ''}>
|
|
403
|
+
${options.map((option: any) => `<u-select-item value="${option.value}" text="${option.label}">${option.label}</u-select-item>`)}
|
|
404
|
+
</u-select>
|
|
405
|
+
`;
|
|
406
|
+
} else if (property.typeAnnotation.typeName === 'Boolean') {
|
|
407
|
+
return `
|
|
408
|
+
<u-text v-if="${valueExpression}" text="是"></u-text>
|
|
409
|
+
<u-text v-if="!${valueExpression}" text="否"></u-text>
|
|
410
|
+
`;
|
|
411
|
+
}
|
|
412
|
+
return `<u-text :text="${valueExpression}"></u-text>`;
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
return `<u-table-view-column field="${lowerEntityName}.${property.name}">
|
|
416
|
+
<template #title><u-text text="${title}"></u-text></template>
|
|
417
|
+
<template #cell="current">
|
|
418
|
+
${getText(property)}
|
|
419
|
+
</template>
|
|
420
|
+
</u-table-view-column>`;
|
|
421
|
+
};
|
|
@@ -307,7 +307,7 @@ function genLoadLogic(getLogic: Logic, nameGroup: NameGroup) {
|
|
|
307
307
|
|
|
308
308
|
// 生成修改区块
|
|
309
309
|
export function genUpdateBlock(entity: Entity, oldNode: ViewElement) {
|
|
310
|
-
const
|
|
310
|
+
const { view } = oldNode;
|
|
311
311
|
const dataSource = entity.parentNode as DataSource;
|
|
312
312
|
const module = dataSource.app;
|
|
313
313
|
const { ns } = entity;
|
|
@@ -315,11 +315,11 @@ export function genUpdateBlock(entity: Entity, oldNode: ViewElement) {
|
|
|
315
315
|
const updateLogic = ns?.logics?.find((logic) => logic.name === `update`);
|
|
316
316
|
|
|
317
317
|
const nameGroup: NameGroup = {};
|
|
318
|
-
nameGroup.viewElementMainView =
|
|
319
|
-
nameGroup.viewVariableEntity =
|
|
320
|
-
nameGroup.viewParamId =
|
|
321
|
-
nameGroup.viewLogicLoad =
|
|
322
|
-
nameGroup.viewLogicSubmit =
|
|
318
|
+
nameGroup.viewElementMainView = view.getViewElementUniqueName('form1');
|
|
319
|
+
nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
|
|
320
|
+
nameGroup.viewParamId = view.getParamUniqueName('id');
|
|
321
|
+
nameGroup.viewLogicLoad = view.getLogicUniqueName('load');
|
|
322
|
+
nameGroup.viewLogicSubmit = view.getLogicUniqueName('submit');
|
|
323
323
|
|
|
324
324
|
// 收集所有和本实体关联的实体
|
|
325
325
|
const selectNameGroupMap: Map<string, NameGroup> = new Map();
|
|
@@ -332,8 +332,8 @@ export function genUpdateBlock(entity: Entity, oldNode: ViewElement) {
|
|
|
332
332
|
if (relationEntity) {
|
|
333
333
|
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
334
334
|
if (displayedProperty) {
|
|
335
|
-
const viewElementSelect =
|
|
336
|
-
const selectNameGroup = genUniqueQueryNameGroup(module,
|
|
335
|
+
const viewElementSelect = view.getViewElementUniqueName('select');
|
|
336
|
+
const selectNameGroup = genUniqueQueryNameGroup(module, view, viewElementSelect, false, relationEntity.name);
|
|
337
337
|
selectNameGroup.viewElementSelect = viewElementSelect;
|
|
338
338
|
// 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
|
|
339
339
|
const key = [property.name, relationEntity.name].join('-');
|
package/src/templator/utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { utils } from '..';
|
|
2
|
-
import { App, Module, Entity, EntityProperty, Logic, View, Namespace, TypeAnnotation
|
|
2
|
+
import { App, Module, Entity, EntityProperty, Logic, View, Namespace, TypeAnnotation } from '../concepts';
|
|
3
3
|
|
|
4
4
|
export const filterProperty = (key: 'inTable' | 'inFilter' | 'inForm' | 'inDetail') => (property: EntityProperty) => {
|
|
5
5
|
if (property.display) {
|
|
@@ -131,7 +131,7 @@ function capFirstLetter(word: string) {
|
|
|
131
131
|
*/
|
|
132
132
|
export function genUniqueQueryNameGroup(
|
|
133
133
|
scope: App | Module | Namespace,
|
|
134
|
-
view: View
|
|
134
|
+
view: View,
|
|
135
135
|
componentName: string = '',
|
|
136
136
|
defaultInView: boolean = true,
|
|
137
137
|
suffix: string = ''
|
package/src/translator/utils.ts
CHANGED
|
@@ -58,6 +58,22 @@ export function isSameRange(rangeA: Range, rangeB : Range) {
|
|
|
58
58
|
return rangeA.start.offset === rangeB.start.offset && rangeA.end.offset === rangeB.end.offset;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
const statementMap = [
|
|
62
|
+
"Assignment",
|
|
63
|
+
"BatchAssignment",
|
|
64
|
+
"IfStatement",
|
|
65
|
+
"ForEachStatement",
|
|
66
|
+
"SwitchStatement",
|
|
67
|
+
"WhileStatement",
|
|
68
|
+
"Match",
|
|
69
|
+
"Comment",
|
|
70
|
+
"CallLogic",
|
|
71
|
+
"CallInterface",
|
|
72
|
+
"Destination",
|
|
73
|
+
"JSBlock",
|
|
74
|
+
'JavaLogic'
|
|
75
|
+
];
|
|
76
|
+
|
|
61
77
|
/**
|
|
62
78
|
* 翻译方法修饰器
|
|
63
79
|
*
|
|
@@ -115,6 +131,10 @@ export function withSourceMap() {
|
|
|
115
131
|
end: shiftPosition(state.position, code),
|
|
116
132
|
});
|
|
117
133
|
|
|
134
|
+
if (isNatural && statementMap?.includes(this.concept) && code) {
|
|
135
|
+
before += `// nodePath: '${this.nodePath}' \n`;
|
|
136
|
+
}
|
|
137
|
+
|
|
118
138
|
return before + code;
|
|
119
139
|
};
|
|
120
140
|
|
package/src/utils/i18nInfo.ts
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
export const languageList = [
|
|
2
2
|
{
|
|
3
3
|
id: 'en-US',
|
|
4
|
-
name: 'English',
|
|
5
|
-
title: '
|
|
4
|
+
name: 'English (United States)',
|
|
5
|
+
title: '英语(美国)',
|
|
6
6
|
},
|
|
7
7
|
{
|
|
8
8
|
id: 'fr-FR',
|
|
9
9
|
name: 'Français',
|
|
10
10
|
title: '法语',
|
|
11
11
|
},
|
|
12
|
-
{
|
|
13
|
-
id: 'ko-KR',
|
|
14
|
-
name: '한국어',
|
|
15
|
-
title: '韩语',
|
|
16
|
-
},
|
|
17
12
|
{
|
|
18
13
|
id: 'zh-CN',
|
|
19
14
|
name: '中文 (简体)',
|
|
@@ -14,86 +14,77 @@
|
|
|
14
14
|
"enums": [],
|
|
15
15
|
"logics": [],
|
|
16
16
|
"interfaces": [],
|
|
17
|
-
"
|
|
17
|
+
"frontends": [
|
|
18
18
|
{
|
|
19
|
-
"concept": "
|
|
19
|
+
"concept": "Frontend",
|
|
20
20
|
"name": "pc",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
21
|
+
"title": "PC端",
|
|
22
|
+
"type": "pc",
|
|
23
|
+
"path": "/",
|
|
24
|
+
"documentTitle": null,
|
|
25
|
+
"documentIcon": null,
|
|
26
|
+
"views": [
|
|
23
27
|
{
|
|
24
|
-
"concept": "
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
28
|
+
"concept": "View",
|
|
29
|
+
"changedTime": 1691568444284,
|
|
30
|
+
"name": "test",
|
|
31
|
+
"title": "测试",
|
|
32
|
+
"crumb": null,
|
|
33
|
+
"auth": false,
|
|
34
|
+
"isIndex": true,
|
|
35
|
+
"script": "",
|
|
36
|
+
"params": [],
|
|
37
|
+
"variables": [],
|
|
38
|
+
"logics": [
|
|
32
39
|
{
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"name": "
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"logics": [
|
|
40
|
+
"__$Selected": true,
|
|
41
|
+
"concept": "CallFunction",
|
|
42
|
+
"name": "",
|
|
43
|
+
"label": "内置函数",
|
|
44
|
+
"folded": false,
|
|
45
|
+
"offsetX": 361.90234375,
|
|
46
|
+
"offsetY": 198.10546875,
|
|
47
|
+
"calleeNamespace": "nasl.util",
|
|
48
|
+
"calleeName": "FromString",
|
|
49
|
+
"typeArguments": [
|
|
44
50
|
{
|
|
45
|
-
"
|
|
46
|
-
"concept": "CallFunction",
|
|
51
|
+
"concept": "TypeAnnotation",
|
|
47
52
|
"name": "",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"typeArguments": [
|
|
55
|
-
{
|
|
56
|
-
"concept": "TypeAnnotation",
|
|
57
|
-
"name": "",
|
|
58
|
-
"typeKind": "primitive",
|
|
59
|
-
"typeNamespace": "nasl.core",
|
|
60
|
-
"typeName": "Boolean",
|
|
61
|
-
"typeArguments": null,
|
|
62
|
-
"returnType": null,
|
|
63
|
-
"properties": null
|
|
64
|
-
}
|
|
65
|
-
],
|
|
66
|
-
"arguments": [
|
|
67
|
-
{
|
|
68
|
-
"concept": "Argument",
|
|
69
|
-
"name": "",
|
|
70
|
-
"folded": false,
|
|
71
|
-
"keyword": "value",
|
|
72
|
-
"expression": {
|
|
73
|
-
"concept": "Identifier",
|
|
74
|
-
"name": "str",
|
|
75
|
-
"folded": false
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
]
|
|
53
|
+
"typeKind": "primitive",
|
|
54
|
+
"typeNamespace": "nasl.core",
|
|
55
|
+
"typeName": "Boolean",
|
|
56
|
+
"typeArguments": null,
|
|
57
|
+
"returnType": null,
|
|
58
|
+
"properties": null
|
|
79
59
|
}
|
|
80
60
|
],
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
61
|
+
"arguments": [
|
|
62
|
+
{
|
|
63
|
+
"concept": "Argument",
|
|
64
|
+
"name": "",
|
|
65
|
+
"folded": false,
|
|
66
|
+
"keyword": "value",
|
|
67
|
+
"expression": {
|
|
68
|
+
"concept": "Identifier",
|
|
69
|
+
"name": "str",
|
|
70
|
+
"folded": false
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
]
|
|
84
74
|
}
|
|
85
75
|
],
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
"name": "",
|
|
90
|
-
"title": "默认主题样式",
|
|
91
|
-
"variableMap": {}
|
|
92
|
-
},
|
|
93
|
-
"componentDependencies": []
|
|
76
|
+
"bindEvents": [],
|
|
77
|
+
"bindRoles": [],
|
|
78
|
+
"children": []
|
|
94
79
|
}
|
|
95
80
|
],
|
|
96
|
-
"
|
|
81
|
+
"variables": [],
|
|
82
|
+
"theme": {
|
|
83
|
+
"concept": "Theme",
|
|
84
|
+
"name": "",
|
|
85
|
+
"title": "默认主题样式",
|
|
86
|
+
"variableMap": {}
|
|
87
|
+
},
|
|
97
88
|
"componentDependencies": []
|
|
98
89
|
}
|
|
99
90
|
],
|