@lcap/nasl 3.2.0-beta.3 → 3.2.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/automate/engine/utils.js +4 -0
- package/out/automate/engine/utils.js.map +1 -1
- package/out/common/BaseNode.d.ts +1 -1
- package/out/common/BaseNode.js +7 -4
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.js +5 -3
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Assignment__.js +1 -1
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +1 -10
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindEvent__.js +55 -13
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/CallInterface__.js +50 -62
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +4 -1
- package/out/concepts/CallLogic__.js +59 -115
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js +8 -1
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/Logic__.js +1 -1
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Module__.d.ts +4 -0
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +1 -0
- package/out/concepts/ViewElement__.js +49 -63
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +41 -6
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/basics/stdlib/index.js +17 -1
- package/out/concepts/basics/stdlib/index.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.browser.js +36 -0
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.event.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.event.js +23 -0
- package/out/concepts/basics/stdlib/nasl.event.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.ui.js +45 -0
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +6 -22
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/generator/permission.js +18 -19
- package/out/generator/permission.js.map +1 -1
- package/out/server/event.d.ts +12 -0
- package/out/server/event.js +52 -28
- package/out/server/event.js.map +1 -1
- package/out/server/getLogics.js +30 -1
- package/out/server/getLogics.js.map +1 -1
- package/out/server/naslServer.js +5 -4
- package/out/server/naslServer.js.map +1 -1
- package/out/server/naslStdlibMap.js +2 -0
- package/out/server/naslStdlibMap.js.map +1 -1
- package/out/templator/genCreateBlock.js +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +4 -4
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +4 -4
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.d.ts +1 -1
- package/out/templator/genEditTableBlock.js +3 -7
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.d.ts +2 -2
- package/out/templator/genGridViewBlock.js +8 -14
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.d.ts +2 -2
- package/out/templator/genListViewBlock.js +5 -9
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genSelectBlock.d.ts +2 -2
- package/out/templator/genSelectBlock.js +9 -15
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.d.ts +1 -1
- package/out/templator/genTableBlock.js +3 -7
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +1 -1
- package/out/templator/utils.d.ts +7 -0
- package/out/templator/utils.js +1 -0
- package/out/templator/utils.js.map +1 -1
- package/package.json +14 -16
- package/sandbox/stdlib/nasl.browser.ts +1 -0
- package/sandbox/stdlib/nasl.event.ts +4 -0
- package/sandbox/stdlib/nasl.ui.ts +11 -0
- package/src/automate/engine/utils.js +3 -0
- package/src/common/BaseNode.ts +10 -5
- package/src/concepts/App__.ts +6 -4
- package/src/concepts/Assignment__.ts +2 -1
- package/src/concepts/BindAttribute__.ts +3 -8
- package/src/concepts/BindEvent__.ts +64 -19
- package/src/concepts/CallInterface__.ts +57 -61
- package/src/concepts/CallLogic__.ts +92 -124
- package/src/concepts/CompletionProperty__.ts +6 -1
- package/src/concepts/ConfigPropertyValue__.ts +2 -2
- package/src/concepts/Logic__.ts +1 -1
- package/src/concepts/Module__.ts +4 -1
- package/src/concepts/ViewElement__.ts +72 -74
- package/src/concepts/View__.ts +45 -8
- package/src/concepts/basics/stdlib/index.ts +17 -1
- package/src/concepts/basics/stdlib/nasl.browser.ts +36 -0
- package/src/concepts/basics/stdlib/nasl.event.ts +18 -0
- package/src/concepts/basics/stdlib/nasl.ui.ts +45 -0
- package/src/concepts/basics/stdlib/nasl.util.ts +6 -22
- package/src/generator/permission.ts +22 -22
- package/src/server/event.js +52 -28
- package/src/server/getLogics.ts +34 -1
- package/src/server/naslServer.ts +8 -4
- package/src/server/naslStdlibMap.ts +2 -0
- package/src/templator/genCreateBlock.ts +1 -1
- package/src/templator/genCurdEditMultipleKeyBlock.ts +4 -4
- package/src/templator/genCurdMultipleKeyBlock.ts +4 -4
- package/src/templator/genEditTableBlock.ts +4 -7
- package/src/templator/genGridViewBlock.ts +8 -14
- package/src/templator/genListViewBlock.ts +5 -10
- package/src/templator/genSelectBlock.ts +10 -15
- package/src/templator/genTableBlock.ts +4 -7
- package/src/templator/genUpdateBlock.ts +1 -1
- package/src/templator/utils.ts +2 -0
- package/test/concepts/call-interface/__snapshots__/toEmbeddedTS.spec.ts.snap +71 -0
- package/test/concepts/call-interface/__snapshots__/toJS.spec.ts.snap +140 -0
- package/test/concepts/call-interface/constant.ts +5 -0
- package/test/concepts/call-interface/fixtures/only-interface.json +158 -0
- package/test/concepts/call-interface/fixtures/with-body-complex-argument.json +455 -0
- package/test/concepts/call-interface/fixtures/with-body-no-argument.json +187 -0
- package/test/concepts/call-interface/fixtures/with-body-simple-argument.json +225 -0
- package/test/concepts/call-interface/fixtures/with-headers-no-argument.json +213 -0
- package/test/concepts/call-interface/fixtures/with-headers.json +192 -0
- package/test/concepts/call-interface/fixtures/with-query-no-argument.json +213 -0
- package/test/concepts/call-interface/fixtures/with-query.json +192 -0
- package/test/concepts/call-interface/toEmbeddedTS.spec.ts +14 -0
- package/test/concepts/call-interface/toJS.spec.ts +14 -0
- package/test/concepts/call-logic/__snapshots__/toEmbeddedTS.spec.ts.snap +74 -0
- package/test/concepts/call-logic/__snapshots__/toJS.spec.ts.snap +141 -0
- package/test/concepts/call-logic/constant.ts +5 -0
- package/test/concepts/call-logic/fixtures/entries-get-with-arguments.json +223 -0
- package/test/concepts/call-logic/fixtures/entries-update-with-arguments.json +359 -0
- package/test/concepts/call-logic/fixtures/global-logic-argument-no-expression.json +209 -0
- package/test/concepts/call-logic/fixtures/global-logic-argument-some-expression.json +311 -0
- package/test/concepts/call-logic/fixtures/only-call-logic.json +10 -0
- package/test/concepts/call-logic/fixtures/view-buildin-logic-with-argument.json +128 -0
- package/test/concepts/call-logic/fixtures/view-component-logic-no-argument.json +126 -0
- package/test/concepts/call-logic/fixtures/view-component-with-validation.json +244 -0
- package/test/concepts/call-logic/toEmbeddedTS.spec.ts +14 -0
- package/test/concepts/call-logic/toJS.spec.ts +14 -0
- package/test/concepts/utils.ts +76 -3
- package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +3 -3
- package/test/concepts/validation-rule/__snapshots__/toJS.spec.ts.snap +16 -0
- package/test/concepts/validation-rule/constant.ts +5 -0
- package/test/concepts/validation-rule/toEmbeddedTS.spec.ts +10 -17
- package/test/concepts/validation-rule/toJS.spec.ts +14 -0
- package/test/concepts/view-element/__snapshots__/toEmbeddedTS.spec.ts.snap +68 -0
- package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +44 -0
- package/test/concepts/view-element/constant.ts +5 -0
- package/test/concepts/view-element/fixtures/default-not-found.json +322 -0
- package/test/concepts/view-element/toEmbeddedTS.spec.ts +14 -0
- package/test/concepts/view-element/toVue.spec.ts +14 -0
- package/test/setup.ts +6 -0
- package/bin/naslc +0 -3
|
@@ -114,7 +114,7 @@ function findResourcesOfUI(view: View | ViewElement) {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
function optimizeResourceData(resources: ResourceNode[][]) {
|
|
117
|
-
|
|
117
|
+
const res = removeRedundantResourceData(resources);
|
|
118
118
|
return res
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -240,28 +240,25 @@ function findUploaders(app: App) {
|
|
|
240
240
|
return map;
|
|
241
241
|
}
|
|
242
242
|
function checkUploadAuth(uploaders: Map<string, ViewElement[]>) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
})
|
|
260
|
-
return res;
|
|
243
|
+
const res: { key: string, authValue: ResourceNode[] }[] = [];
|
|
244
|
+
// 如果开启控制权限-component,没开启权限-page
|
|
245
|
+
uploaders.forEach((value, key) => {
|
|
246
|
+
const authValue: ResourceNode[] = []
|
|
247
|
+
value.map(node => {
|
|
248
|
+
if (node instanceof ViewElement) {
|
|
249
|
+
const path = node.auth ? node.authPath : `${node.view.path}`;
|
|
250
|
+
const type = node.auth ? 'component' : 'page';
|
|
251
|
+
authValue.push({ path, type });
|
|
252
|
+
}
|
|
253
|
+
return null;
|
|
254
|
+
});
|
|
255
|
+
res.push({ key, authValue });
|
|
256
|
+
});
|
|
257
|
+
return res;
|
|
261
258
|
}
|
|
262
|
-
function checkPageAndUploadAuth(uploaders: Map<string, ViewElement[]
|
|
259
|
+
function checkPageAndUploadAuth(uploaders: Map<string, ViewElement[]>, key: string) {
|
|
263
260
|
let flag: number = -1;
|
|
264
|
-
flag = uploaders.get(
|
|
261
|
+
flag = uploaders.get(key)?.findIndex(node => {
|
|
265
262
|
if (node.getAncestor('View') instanceof View) {
|
|
266
263
|
// 当前页面未开启权限且文件上传组件也未开启权限
|
|
267
264
|
if (!(node.getAncestor('View') as View).auth && node instanceof ViewElement && !node.auth) {
|
|
@@ -287,7 +284,10 @@ export async function genPermissionData(app: App) {
|
|
|
287
284
|
}
|
|
288
285
|
const authValue = checkUploadAuth(uploaders);
|
|
289
286
|
if (authValue?.length) {
|
|
290
|
-
|
|
287
|
+
authValue.forEach((item) => {
|
|
288
|
+
const {key, authValue} = item;
|
|
289
|
+
logicPageResourceDtoList[`${key}:POST`] = [checkPageAndUploadAuth(uploaders, key) !== -1 ? [] : authValue];
|
|
290
|
+
});
|
|
291
291
|
}
|
|
292
292
|
closeCache();
|
|
293
293
|
// console.timeEnd('xxx');
|
package/src/server/event.js
CHANGED
|
@@ -8,9 +8,9 @@ export const trigger = [
|
|
|
8
8
|
name: '$event',
|
|
9
9
|
type: 'MouseEvent',
|
|
10
10
|
description: '鼠标事件对象',
|
|
11
|
-
schema: { $ref: '#/systemTypes/MouseEvent' }
|
|
12
|
-
}
|
|
13
|
-
]
|
|
11
|
+
schema: { $ref: '#/systemTypes/MouseEvent' },
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
name: 'dblclick',
|
|
@@ -21,9 +21,9 @@ export const trigger = [
|
|
|
21
21
|
name: '$event',
|
|
22
22
|
type: 'MouseEvent',
|
|
23
23
|
description: '鼠标事件对象',
|
|
24
|
-
schema: { $ref: '#/systemTypes/MouseEvent' }
|
|
25
|
-
}
|
|
26
|
-
]
|
|
24
|
+
schema: { $ref: '#/systemTypes/MouseEvent' },
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
name: 'contextmenu',
|
|
@@ -34,9 +34,9 @@ export const trigger = [
|
|
|
34
34
|
name: '$event',
|
|
35
35
|
type: 'MouseEvent',
|
|
36
36
|
description: '鼠标事件对象',
|
|
37
|
-
schema: { $ref: '#/systemTypes/MouseEvent' }
|
|
38
|
-
}
|
|
39
|
-
]
|
|
37
|
+
schema: { $ref: '#/systemTypes/MouseEvent' },
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
name: 'mousedown',
|
|
@@ -47,9 +47,9 @@ export const trigger = [
|
|
|
47
47
|
name: '$event',
|
|
48
48
|
type: 'MouseEvent',
|
|
49
49
|
description: '鼠标事件对象',
|
|
50
|
-
schema: { $ref: '#/systemTypes/MouseEvent' }
|
|
51
|
-
}
|
|
52
|
-
]
|
|
50
|
+
schema: { $ref: '#/systemTypes/MouseEvent' },
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
name: 'mouseup',
|
|
@@ -60,9 +60,9 @@ export const trigger = [
|
|
|
60
60
|
name: '$event',
|
|
61
61
|
type: 'MouseEvent',
|
|
62
62
|
description: '鼠标事件对象',
|
|
63
|
-
schema: { $ref: '#/systemTypes/MouseEvent' }
|
|
64
|
-
}
|
|
65
|
-
]
|
|
63
|
+
schema: { $ref: '#/systemTypes/MouseEvent' },
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
name: 'mouseenter',
|
|
@@ -73,9 +73,9 @@ export const trigger = [
|
|
|
73
73
|
name: '$event',
|
|
74
74
|
type: 'MouseEvent',
|
|
75
75
|
description: '鼠标事件对象',
|
|
76
|
-
schema: { $ref: '#/systemTypes/MouseEvent' }
|
|
77
|
-
}
|
|
78
|
-
]
|
|
76
|
+
schema: { $ref: '#/systemTypes/MouseEvent' },
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
name: 'mouseleave',
|
|
@@ -86,9 +86,9 @@ export const trigger = [
|
|
|
86
86
|
name: '$event',
|
|
87
87
|
type: 'MouseEvent',
|
|
88
88
|
description: '鼠标事件对象',
|
|
89
|
-
schema: { $ref: '#/systemTypes/MouseEvent' }
|
|
90
|
-
}
|
|
91
|
-
]
|
|
89
|
+
schema: { $ref: '#/systemTypes/MouseEvent' },
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
name: 'focus',
|
|
@@ -99,9 +99,9 @@ export const trigger = [
|
|
|
99
99
|
name: '$event',
|
|
100
100
|
type: 'FocusEvent',
|
|
101
101
|
description: '焦点事件对象',
|
|
102
|
-
schema: { $ref: '#/systemTypes/FocusEvent' }
|
|
103
|
-
}
|
|
104
|
-
]
|
|
102
|
+
schema: { $ref: '#/systemTypes/FocusEvent' },
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
107
|
name: 'blur',
|
|
@@ -112,12 +112,36 @@ export const trigger = [
|
|
|
112
112
|
name: '$event',
|
|
113
113
|
type: 'FocusEvent',
|
|
114
114
|
description: '焦点事件对象',
|
|
115
|
-
schema: { $ref: '#/systemTypes/FocusEvent' }
|
|
116
|
-
}
|
|
117
|
-
]
|
|
115
|
+
schema: { $ref: '#/systemTypes/FocusEvent' },
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'keydown',
|
|
121
|
+
title: '键盘按下时',
|
|
122
|
+
params: [
|
|
123
|
+
{
|
|
124
|
+
name: '$event',
|
|
125
|
+
type: 'KeyboardEvent',
|
|
126
|
+
description: '键盘事件对象',
|
|
127
|
+
schema: { $ref: '#/systemTypes/KeyboardEvent' },
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: 'keyup',
|
|
133
|
+
title: '键盘松开时',
|
|
134
|
+
params: [
|
|
135
|
+
{
|
|
136
|
+
name: '$event',
|
|
137
|
+
type: 'KeyboardEvent',
|
|
138
|
+
description: '键盘事件对象',
|
|
139
|
+
schema: { $ref: '#/systemTypes/KeyboardEvent' },
|
|
140
|
+
},
|
|
141
|
+
],
|
|
118
142
|
},
|
|
119
143
|
{ name: 'created', title: '进入时' },
|
|
120
144
|
{ name: 'mounted', title: '进入后' },
|
|
121
145
|
{ name: 'updated', title: '更新时' },
|
|
122
|
-
{ name: 'destroyed', title: '离开时' }
|
|
146
|
+
{ name: 'destroyed', title: '离开时' },
|
|
123
147
|
];
|
package/src/server/getLogics.ts
CHANGED
|
@@ -223,6 +223,8 @@ export async function getLogics(node: CallLogic | BindEvent| Identifier | Logic,
|
|
|
223
223
|
});
|
|
224
224
|
tree.expanded = false;
|
|
225
225
|
result.push(tree);
|
|
226
|
+
const filteredBrowserLogics = stdlibNamespace.findChild('browser').logics.filter(item => item.name !== 'compareKeyboardInput');
|
|
227
|
+
const compareKeyboardInput = stdlibNamespace.findChild('browser').logics.find(item => item.name === 'compareKeyboardInput');
|
|
226
228
|
const systemTree = new Namespace({
|
|
227
229
|
name: 'category',
|
|
228
230
|
path: `nasl`,
|
|
@@ -233,7 +235,7 @@ export async function getLogics(node: CallLogic | BindEvent| Identifier | Logic,
|
|
|
233
235
|
name: 'category',
|
|
234
236
|
path: `browser`,
|
|
235
237
|
title: '浏览器',
|
|
236
|
-
logics: node?.frontend?.type === 'h5' ?
|
|
238
|
+
logics: node?.frontend?.type === 'h5' ? filteredBrowserLogics.filter((item) => ['getDistance', 'getLocation', 'getIsMiniApp'].includes(item.name)) : filteredBrowserLogics.filter((item) => !['getDistance', 'getLocation', 'getIsMiniApp', 'navigateToUserInfo', 'getWeChatHeadImg', 'getWeChatNickName', 'getWeChatOpenid'].includes(item.name)),
|
|
237
239
|
expanded: false,
|
|
238
240
|
}),
|
|
239
241
|
new Namespace({
|
|
@@ -253,6 +255,37 @@ export async function getLogics(node: CallLogic | BindEvent| Identifier | Logic,
|
|
|
253
255
|
],
|
|
254
256
|
expanded: false,
|
|
255
257
|
});
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* start
|
|
261
|
+
* 系统逻辑 - 事件逻辑
|
|
262
|
+
* 在绑定事件中,且event中支持事件逻辑时
|
|
263
|
+
*/
|
|
264
|
+
// FIXME 先用白名单的方式支持
|
|
265
|
+
const { parentNode } = node;
|
|
266
|
+
const grandParentNode = parentNode?.parentNode;
|
|
267
|
+
if (grandParentNode.concept === 'BindEvent' && parentNode.concept === 'Logic'
|
|
268
|
+
&& parentNode.virtualParams?.length
|
|
269
|
+
&& ['KeyboardEvent'].includes(parentNode.virtualParams[0]?.__TypeAnnotation?.typeName)) {
|
|
270
|
+
systemTree.children[1].logics.push(compareKeyboardInput)
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (grandParentNode.concept === 'BindEvent' && parentNode.concept === 'Logic'
|
|
274
|
+
&& parentNode.virtualParams?.length
|
|
275
|
+
&& ['MouseEvent', 'KeyboardEvent'].includes(parentNode.virtualParams[0]?.__TypeAnnotation?.typeName)
|
|
276
|
+
) {
|
|
277
|
+
systemTree.children.push(new Namespace({
|
|
278
|
+
name: 'category',
|
|
279
|
+
path: `event`,
|
|
280
|
+
title: '事件逻辑',
|
|
281
|
+
logics: stdlibNamespace.findChild('event').logics,
|
|
282
|
+
expanded: false,
|
|
283
|
+
}))
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* end
|
|
287
|
+
*/
|
|
288
|
+
|
|
256
289
|
if (node?.frontend?.type === 'h5') {
|
|
257
290
|
systemTree.children.push(new Namespace({
|
|
258
291
|
name: 'category',
|
package/src/server/naslServer.ts
CHANGED
|
@@ -3707,11 +3707,15 @@ class NaslServer {
|
|
|
3707
3707
|
line: lsp2tspNumber(item.range.start.line),
|
|
3708
3708
|
offset: lsp2tspNumber(item.range.start.character),
|
|
3709
3709
|
};
|
|
3710
|
+
|
|
3710
3711
|
// 位置计算偏移
|
|
3711
|
-
if (
|
|
3712
|
-
fileDetail.
|
|
3713
|
-
|
|
3714
|
-
|
|
3712
|
+
if ('getQuickInfoOffset' in node) {
|
|
3713
|
+
Object.assign(fileDetail, (node as any).getQuickInfoOffset(fileDetail, item.code));
|
|
3714
|
+
}
|
|
3715
|
+
|
|
3716
|
+
// 位置计算偏移2
|
|
3717
|
+
// TODO: 之后考虑把这些偏移量计算全都挪到节点内部去
|
|
3718
|
+
if (
|
|
3715
3719
|
node.concept === 'BinaryExpression' ||
|
|
3716
3720
|
node.concept === 'CallLogic' ||
|
|
3717
3721
|
node.concept === 'CallFunction' ||
|
|
@@ -19,6 +19,7 @@ if (globalThis.process) { // For TS build
|
|
|
19
19
|
'nasl.logging.ts': fs.readFileSync(require.resolve('../../sandbox/stdlib/nasl.logging.ts'), 'utf8'),
|
|
20
20
|
'nasl.io.ts': fs.readFileSync(require.resolve('../../sandbox/stdlib/nasl.io.ts'), 'utf8'),
|
|
21
21
|
'nasl.oql.ts': fs.readFileSync(require.resolve('../../sandbox/stdlib/nasl.oql.ts'), 'utf8'),
|
|
22
|
+
'nasl.event.ts': fs.readFileSync(require.resolve('../../sandbox/stdlib/nasl.event.ts'), 'utf8'),
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
/// #endif
|
|
@@ -41,6 +42,7 @@ if (globalThis.window) { // For TS build
|
|
|
41
42
|
'nasl.logging.ts': require('!!raw-loader!../../sandbox/stdlib/nasl.logging.ts').default,
|
|
42
43
|
'nasl.io.ts': require('!!raw-loader!../../sandbox/stdlib/nasl.io.ts').default,
|
|
43
44
|
'nasl.oql.ts': require('!!raw-loader!../../sandbox/stdlib/nasl.oql.ts').default,
|
|
45
|
+
'nasl.event.ts': require('!!raw-loader!../../sandbox/stdlib/nasl.event.ts').default,
|
|
44
46
|
};
|
|
45
47
|
}
|
|
46
48
|
/// #endif
|
|
@@ -70,7 +70,7 @@ export function genCreateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
|
|
|
70
70
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
71
71
|
} else if (propertyTypeName === 'Decimal') {
|
|
72
72
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
73
|
-
} else if (propertyTypeName === 'String' && propertyTypeMaxLength >
|
|
73
|
+
} else if (propertyTypeName === 'String' && propertyTypeMaxLength > 256) {
|
|
74
74
|
formItem += `<u-textarea v-model="${vModel}" placeholder="请输入${label}"></u-textarea>`;
|
|
75
75
|
} else if (propertyTypeName === 'Date') {
|
|
76
76
|
formItem += `<u-date-picker clearable :value.sync="${vModel}" placeholder="请输入${label}"></u-date-picker>`;
|
|
@@ -74,7 +74,7 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
74
74
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
75
75
|
} else if (propertyTypeName === 'Decimal') {
|
|
76
76
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
77
|
-
} else if (propertyTypeName === 'String' && propertyTypeMaxLength >
|
|
77
|
+
} else if (propertyTypeName === 'String' && propertyTypeMaxLength > 256) {
|
|
78
78
|
formItem += `<u-textarea v-model="${vModel}" placeholder="请输入${label}"></u-textarea>`;
|
|
79
79
|
} else if (propertyTypeName === 'Date') {
|
|
80
80
|
formItem += `<u-date-picker clearable :value.sync="${vModel}" placeholder="请输入${label}"></u-date-picker>`;
|
|
@@ -173,7 +173,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
173
173
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
174
174
|
} else if (propertyTypeName === 'Decimal') {
|
|
175
175
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
176
|
-
} else if (propertyTypeName === 'String' && propertyTypeMaxLength >
|
|
176
|
+
} else if (propertyTypeName === 'String' && propertyTypeMaxLength > 256) {
|
|
177
177
|
formItem += `<u-textarea v-model="${vModel}" placeholder="请输入${label}"></u-textarea>`;
|
|
178
178
|
} else if (propertyTypeName === 'Date') {
|
|
179
179
|
formItem += `<u-date-picker clearable :value.sync="${vModel}" placeholder="请输入${label}"></u-date-picker>`;
|
|
@@ -318,7 +318,7 @@ export function genCurdEditMultipleKeyBlock(entity: Entity, oldNode: ViewElement
|
|
|
318
318
|
return `<template>
|
|
319
319
|
<u-linear-layout direction="vertical">
|
|
320
320
|
${genFilterTemplate(entity, nameGroup, selectNameGroupMap)}
|
|
321
|
-
${genEditTableTemplate(entity, nameGroup,
|
|
321
|
+
${genEditTableTemplate(entity, nameGroup, selectNameGroupMap)}
|
|
322
322
|
${genSaveModalTemplate(entity, nameGroup, selectNameGroupMap)}
|
|
323
323
|
</u-linear-layout>
|
|
324
324
|
</template>
|
|
@@ -438,7 +438,7 @@ export function genEditTableColumnComponent(app:App, entity: Entity, property: E
|
|
|
438
438
|
formItem = `<u-number-input :value.sync="${valueExpression}" :precision="0" :step="0" placeholder="请输入${label}" :autofocus="true" @blur="${nameGroup.viewLogicBlurUpdate}"></u-number-input>`;
|
|
439
439
|
} else if (propertyTypeName === 'Decimal') {
|
|
440
440
|
formItem = `<u-number-input :value.sync="${valueExpression}" :precision="0" :step="0" placeholder="请输入${label}" :autofocus="true" @blur="${nameGroup.viewLogicBlurUpdate}"></u-number-input>`;
|
|
441
|
-
} else if (propertyTypeName === 'String' && propertyTypeMaxLength >
|
|
441
|
+
} else if (propertyTypeName === 'String' && propertyTypeMaxLength > 256) {
|
|
442
442
|
formItem = `<u-validator placement="bottom" display="appear" @blur-valid="${nameGroup.viewLogicBlurUpdate}" style="width:100%">
|
|
443
443
|
<u-textarea :value.sync="${valueExpression}" placeholder="请输入${label}" :autofocus="true" size="full"></u-textarea>
|
|
444
444
|
</u-validator>`;
|
|
@@ -68,7 +68,7 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
68
68
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
69
69
|
} else if (propertyTypeName === 'Decimal') {
|
|
70
70
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
71
|
-
} else if (propertyTypeName === 'String' && propertyTypeMaxLength >
|
|
71
|
+
} else if (propertyTypeName === 'String' && propertyTypeMaxLength > 256) {
|
|
72
72
|
formItem += `<u-textarea v-model="${vModel}" placeholder="请输入${label}"></u-textarea>`;
|
|
73
73
|
} else if (propertyTypeName === 'Date') {
|
|
74
74
|
formItem += `<u-date-picker clearable :value.sync="${vModel}" placeholder="请输入${label}"></u-date-picker>`;
|
|
@@ -174,7 +174,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
174
174
|
} else if (propertyTypeName === 'Decimal') {
|
|
175
175
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}" ${property.primaryKey ? `:disabled="${nameGroup.viewVariableIsUpdate}"` : ''
|
|
176
176
|
}></u-number-input>`;
|
|
177
|
-
} else if (propertyTypeName === 'String' && propertyTypeMaxLength >
|
|
177
|
+
} else if (propertyTypeName === 'String' && propertyTypeMaxLength > 256) {
|
|
178
178
|
formItem += `<u-textarea v-model="${vModel}" placeholder="请输入${label}" ${property.primaryKey ? `:disabled="${nameGroup.viewVariableIsUpdate}"` : ''}></u-textarea>`;
|
|
179
179
|
} else if (propertyTypeName === 'Date') {
|
|
180
180
|
formItem += `<u-date-picker clearable :value.sync="${vModel}" placeholder="请输入${label}" ${property.primaryKey ? `:disabled="${nameGroup.viewVariableIsUpdate}"` : ''}></u-date-picker>`;
|
|
@@ -485,7 +485,7 @@ export function genCurdMultipleKeyBlock(entity: Entity, oldNode: ViewElement) {
|
|
|
485
485
|
return `<template>
|
|
486
486
|
<u-linear-layout direction="vertical">
|
|
487
487
|
${genFilterTemplate(entity, nameGroup, selectNameGroupMap)}
|
|
488
|
-
${genTableTemplate(entity, nameGroup,
|
|
488
|
+
${genTableTemplate(entity, nameGroup, true)}
|
|
489
489
|
${genSaveModalTemplate(entity, nameGroup, selectNameGroupMap)}
|
|
490
490
|
</u-linear-layout>
|
|
491
491
|
</template>
|
|
@@ -609,7 +609,7 @@ export function genGridViewMultipleKeyBlock(entity: Entity, oldNode: ViewElement
|
|
|
609
609
|
return `<template>
|
|
610
610
|
<u-linear-layout direction="vertical">
|
|
611
611
|
${genFilterTemplate(entity, nameGroup, selectNameGroupMap)}
|
|
612
|
-
${genGridViewTemplate(entity, nameGroup,
|
|
612
|
+
${genGridViewTemplate(entity, nameGroup, true)}
|
|
613
613
|
${genSaveModalTemplate(entity, nameGroup, selectNameGroupMap)}
|
|
614
614
|
</u-linear-layout>
|
|
615
615
|
</template>
|
|
@@ -70,7 +70,7 @@ export function genEditTableColumnTemplate(entity: Entity, property: EntityPrope
|
|
|
70
70
|
formItem = `<u-number-input :value.sync="${valueExpression}" :precision="0" :step="0" placeholder="请输入${label}" :autofocus="true" @blur="${nameGroup.viewLogicBlurUpdate}"></u-number-input>`;
|
|
71
71
|
} else if (propertyTypeName === 'Decimal') {
|
|
72
72
|
formItem = `<u-number-input :value.sync="${valueExpression}" :precision="0" :step="0" placeholder="请输入${label}" :autofocus="true" @blur="${nameGroup.viewLogicBlurUpdate}"></u-number-input>`;
|
|
73
|
-
} else if (propertyTypeName === 'String' && propertyTypeMaxLength >
|
|
73
|
+
} else if (propertyTypeName === 'String' && propertyTypeMaxLength > 256) {
|
|
74
74
|
formItem = `<u-validator placement="bottom" display="appear" @blur-valid="${nameGroup.viewLogicBlurUpdate}" style="width:100%">
|
|
75
75
|
<u-textarea :value.sync="${valueExpression}" placeholder="请输入${label}" :autofocus="true" size="full"></u-textarea>
|
|
76
76
|
</u-validator>`;
|
|
@@ -122,13 +122,10 @@ export function genEditTableColumnTemplate(entity: Entity, property: EntityPrope
|
|
|
122
122
|
* @param entity 实体
|
|
123
123
|
* @param nameGroup 命名组
|
|
124
124
|
*/
|
|
125
|
-
export function genEditTableTemplate(entity: Entity, nameGroup: NameGroup,
|
|
125
|
+
export function genEditTableTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroupMap?: Map<string, NameGroup>) {
|
|
126
126
|
const properties = entity.properties.filter(filterProperty('inTable'));
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
dataSourceValue = `(params) => ${newLogic.name}(params.page,params.size,params.sort,params.order,filter)`;
|
|
130
|
-
}
|
|
131
|
-
return `<u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" data-schema="${nameGroup.structure}"
|
|
127
|
+
|
|
128
|
+
return `<u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
|
|
132
129
|
value-field="${nameGroup.viewVariableEntity}.id"
|
|
133
130
|
:pagination="true" :show-sizer="true" :default-column-width="300" editable>
|
|
134
131
|
<u-table-view-column type="index" width="60"><template #title><u-text text="序号"></u-text></template><template #cell="current"></template></u-table-view-column>
|
|
@@ -99,13 +99,10 @@ export function genH5GridViewCardTemplate(property: EntityProperty, nameGroup?:
|
|
|
99
99
|
* @param entity 实体
|
|
100
100
|
* @param nameGroup 命名组
|
|
101
101
|
*/
|
|
102
|
-
export function genGridViewTemplate(entity: Entity, nameGroup: NameGroup,
|
|
102
|
+
export function genGridViewTemplate(entity: Entity, nameGroup: NameGroup, modifyable?: boolean) {
|
|
103
|
+
const currentName = nameGroup.currentName || 'current';
|
|
103
104
|
const properties = entity.properties.filter(filterProperty('inTable'));
|
|
104
|
-
|
|
105
|
-
if (['genCurdMultipleKeyBlock'].includes(entryFromCall)) {
|
|
106
|
-
dataSourceValue = `(params) => ${newLogic.name}(params.page, params.size,params.sort,params.order,filter)`;
|
|
107
|
-
}
|
|
108
|
-
return `<u-grid-view ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" data-schema="${nameGroup.structure}"
|
|
105
|
+
return `<u-grid-view ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
|
|
109
106
|
value-field="${nameGroup.viewVariableEntity}.id"
|
|
110
107
|
:page-size="20"
|
|
111
108
|
:pageable="true"
|
|
@@ -131,13 +128,10 @@ export function genGridViewTemplate(entity: Entity, nameGroup: NameGroup, newLog
|
|
|
131
128
|
`;
|
|
132
129
|
}
|
|
133
130
|
|
|
134
|
-
export function genH5GridViewTemplate(entity: Entity, nameGroup: NameGroup
|
|
131
|
+
export function genH5GridViewTemplate(entity: Entity, nameGroup: NameGroup) {
|
|
132
|
+
const currentName = nameGroup.currentName || 'current';
|
|
135
133
|
const properties = entity.properties.filter(filterProperty('inTable'));
|
|
136
|
-
|
|
137
|
-
if (['genCurdMultipleKeyBlock'].includes(entryFromCall)) {
|
|
138
|
-
dataSourceValue = `(params) => ${newLogic.name}(params.page, params.size,params.sort,params.order,filter)`;
|
|
139
|
-
}
|
|
140
|
-
return `<van-grid-view ref="gridView" :data-source="${dataSourceValue}" data-schema="${nameGroup.structure}"
|
|
134
|
+
return `<van-grid-view ref="gridView" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
|
|
141
135
|
pageable="auto-more"
|
|
142
136
|
:remote-paging="true"
|
|
143
137
|
:col="2"
|
|
@@ -281,7 +275,7 @@ export function genGridViewBlock(entity: Entity, oldNode: ViewElement) {
|
|
|
281
275
|
|
|
282
276
|
return `
|
|
283
277
|
<template>
|
|
284
|
-
${config.scope === 'h5' ? genH5GridViewTemplate(entity, nameGroup
|
|
278
|
+
${config.scope === 'h5' ? genH5GridViewTemplate(entity, nameGroup) : genGridViewTemplate(entity, nameGroup)}
|
|
285
279
|
</template>
|
|
286
280
|
<definition>
|
|
287
281
|
{
|
|
@@ -329,7 +323,7 @@ export function genGridViewCardBlock(property: EntityProperty, oldNode: ViewElem
|
|
|
329
323
|
|
|
330
324
|
return `
|
|
331
325
|
<template>
|
|
332
|
-
${genGridViewTemplate(entity, nameGroup
|
|
326
|
+
${genGridViewTemplate(entity, nameGroup)}
|
|
333
327
|
</template>
|
|
334
328
|
<definition>
|
|
335
329
|
{
|
|
@@ -6,13 +6,12 @@ import {
|
|
|
6
6
|
NameGroup, NaslUITypeAnnotation, NaslLogicItem, NaslNode,
|
|
7
7
|
} from './utils';
|
|
8
8
|
|
|
9
|
-
export function genListViewTemplate(property: EntityProperty, nameGroup: NameGroup
|
|
9
|
+
export function genListViewTemplate(property: EntityProperty, nameGroup: NameGroup) {
|
|
10
10
|
const entity = property.entity;
|
|
11
11
|
const lowerEntityName = utils.firstLowerCase(entity.name);
|
|
12
12
|
const currentName = nameGroup.currentName || 'current';
|
|
13
13
|
const valueExpression = `${currentName}.item.${lowerEntityName}.${property.name}`;
|
|
14
|
-
|
|
15
|
-
return `<u-list-view ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" data-schema="${nameGroup.structure}"
|
|
14
|
+
return `<u-list-view ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
|
|
16
15
|
text-field="${nameGroup.viewVariableEntity}.${property.name}"
|
|
17
16
|
value-field="${nameGroup.viewVariableEntity}.id" :pageable="true" :remote-paging="true">
|
|
18
17
|
<template #item="current">
|
|
@@ -23,13 +22,12 @@ export function genListViewTemplate(property: EntityProperty, nameGroup: NameGro
|
|
|
23
22
|
</u-list-view>`;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
export function genH5ListViewTemplate(property: EntityProperty, nameGroup: NameGroup
|
|
25
|
+
export function genH5ListViewTemplate(property: EntityProperty, nameGroup: NameGroup) {
|
|
27
26
|
const entity = property.entity;
|
|
28
27
|
const lowerEntityName = utils.firstLowerCase(entity.name);
|
|
29
28
|
const currentName = nameGroup.currentName || 'current';
|
|
30
29
|
const valueExpression = `${currentName}.item.${lowerEntityName}.${property.name}`;
|
|
31
|
-
|
|
32
|
-
return `<van-list-view ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" data-schema="${nameGroup.structure}"
|
|
30
|
+
return `<van-list-view ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
|
|
33
31
|
text-field="${nameGroup.viewVariableEntity}.${property.name}"
|
|
34
32
|
value-field="${nameGroup.viewVariableEntity}.id" pageable="auto-more" :remote-paging="true">
|
|
35
33
|
<template #item="current">
|
|
@@ -109,11 +107,8 @@ export function genListViewBlock(entity: Entity, oldNode: ViewElement, property:
|
|
|
109
107
|
|
|
110
108
|
const newLogics: Array<any> = [];
|
|
111
109
|
|
|
112
|
-
const parentNode = entity.parentNode as App | Module | Namespace;
|
|
113
|
-
const entityLogic = genQueryLogic([entity], nameGroup, false, false, parentNode);
|
|
114
|
-
|
|
115
110
|
return `<template>
|
|
116
|
-
${config.scope === 'h5' ? genH5ListViewTemplate(displayedProperty, nameGroup
|
|
111
|
+
${config.scope === 'h5' ? genH5ListViewTemplate(displayedProperty, nameGroup) : genListViewTemplate(displayedProperty, nameGroup)}
|
|
117
112
|
</template>
|
|
118
113
|
|
|
119
114
|
<definition>
|
|
@@ -13,15 +13,11 @@ import {
|
|
|
13
13
|
* @param nameGroup
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
|
-
export function genSelectTemplate(property: EntityProperty, nameGroup: NameGroup
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
data-schema="${nameGroup.structure}"
|
|
22
|
-
text-field="${nameGroup.lowerEntity}.${property.name}"
|
|
23
|
-
value-field="${nameGroup.lowerEntity}.id" :pageable="true" :remote-paging="true">
|
|
24
|
-
</u-select>`;
|
|
16
|
+
export function genSelectTemplate(property: EntityProperty, nameGroup: NameGroup) {
|
|
17
|
+
return `<u-select clearable placeholder="请选择" ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
|
|
18
|
+
text-field="${nameGroup.lowerEntity}.${property.name}"
|
|
19
|
+
value-field="${nameGroup.lowerEntity}.id" :pageable="true" :remote-paging="true">
|
|
20
|
+
</u-select>`;
|
|
25
21
|
}
|
|
26
22
|
|
|
27
23
|
/**
|
|
@@ -30,10 +26,9 @@ export function genSelectTemplate(property: EntityProperty, nameGroup: NameGroup
|
|
|
30
26
|
* @param nameGroup
|
|
31
27
|
* @returns
|
|
32
28
|
*/
|
|
33
|
-
export function genH5SelectTemplate(property: EntityProperty, nameGroup: NameGroup
|
|
29
|
+
export function genH5SelectTemplate(property: EntityProperty, nameGroup: NameGroup) {
|
|
34
30
|
const label = property.label || property.name;
|
|
35
|
-
|
|
36
|
-
return `<van-pickerson type="list" :show-toolbar="true" title="请选择" placeholder="请选择" ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" data-schema="${nameGroup.structure}"
|
|
31
|
+
return `<van-pickerson type="list" :show-toolbar="true" title="请选择" placeholder="请选择" ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
|
|
37
32
|
text-field="${nameGroup.lowerEntity}.${property.name}"
|
|
38
33
|
value-field="${nameGroup.lowerEntity}.id" :pageable="true" :remote-paging="true">
|
|
39
34
|
<template #title>${label}</template>
|
|
@@ -48,7 +43,7 @@ export function genLoadSelectLogic(entity: Entity, nameGroup: NameGroup, newLogi
|
|
|
48
43
|
genLogicParam(`${newLogic.params[1].name}`, 'params.size'),
|
|
49
44
|
];
|
|
50
45
|
return NaslNode.Logic({
|
|
51
|
-
name:
|
|
46
|
+
name: nameGroup.viewLogicLoad,
|
|
52
47
|
params: [
|
|
53
48
|
NaslNode.Param({
|
|
54
49
|
name: 'params',
|
|
@@ -105,9 +100,9 @@ export function genSelectBlock(entity: Entity, oldNode: ViewElement) {
|
|
|
105
100
|
const newLogics: Array<any> = [
|
|
106
101
|
newLogic,
|
|
107
102
|
];
|
|
103
|
+
|
|
108
104
|
return `<template>
|
|
109
|
-
|
|
110
|
-
${config.scope === 'h5' ? genH5SelectTemplate(displayedProperty, nameGroup, newLogic) : genSelectTemplate(displayedProperty, nameGroup, newLogic)}
|
|
105
|
+
${config.scope === 'h5' ? genH5SelectTemplate(displayedProperty, nameGroup) : genSelectTemplate(displayedProperty, nameGroup)}
|
|
111
106
|
</template>
|
|
112
107
|
|
|
113
108
|
<definition>
|
|
@@ -57,14 +57,11 @@ export function genTableColumnTemplate(property: EntityProperty, currentName: st
|
|
|
57
57
|
* @param entity 实体
|
|
58
58
|
* @param nameGroup 命名组
|
|
59
59
|
*/
|
|
60
|
-
export function genTableTemplate(entity: Entity, nameGroup: NameGroup,
|
|
60
|
+
export function genTableTemplate(entity: Entity, nameGroup: NameGroup, modifyable?: boolean) {
|
|
61
61
|
const currentName = nameGroup.currentName || 'current';
|
|
62
62
|
const properties = entity.properties.filter(filterProperty('inTable'));
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
dataSourceValue = `(params) => ${newLogic.name}(params.page, params.size,params.sort,params.order,filter)`;
|
|
66
|
-
}
|
|
67
|
-
return `<u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" data-schema="${nameGroup.structure}"
|
|
63
|
+
|
|
64
|
+
return `<u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
|
|
68
65
|
value-field="${nameGroup.viewVariableEntity}.id"
|
|
69
66
|
:pagination="true" :show-sizer="true">
|
|
70
67
|
<u-table-view-column type="index" width="60"><template #title><u-text text="序号"></u-text></template><template #cell="current"></template></u-table-view-column>
|
|
@@ -212,7 +209,7 @@ export function genTableBlock(entity: Entity, oldNode: ViewElement) {
|
|
|
212
209
|
|
|
213
210
|
return `
|
|
214
211
|
<template>
|
|
215
|
-
${genTableTemplate(entity, nameGroup
|
|
212
|
+
${genTableTemplate(entity, nameGroup)}
|
|
216
213
|
</template>
|
|
217
214
|
<definition>
|
|
218
215
|
{
|
|
@@ -70,7 +70,7 @@ export function genUpdateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
|
|
|
70
70
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
71
71
|
} else if (propertyTypeName === 'Decimal') {
|
|
72
72
|
formItem += `<u-number-input v-model="${vModel}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
|
|
73
|
-
} else if (propertyTypeName === 'String' && propertyTypeMaxLength >
|
|
73
|
+
} else if (propertyTypeName === 'String' && propertyTypeMaxLength > 256) {
|
|
74
74
|
formItem += `<u-textarea v-model="${vModel}" placeholder="请输入${label}"></u-textarea>`;
|
|
75
75
|
} else if (propertyTypeName === 'Date') {
|
|
76
76
|
formItem += `<u-date-picker clearable :value.sync="${vModel}" placeholder="请输入${label}"></u-date-picker>`;
|
package/src/templator/utils.ts
CHANGED
|
@@ -227,6 +227,8 @@ export const NaslUITypeAnnotation = {
|
|
|
227
227
|
SortEvent: genNaslUITypeAnnotation('SortEvent'),
|
|
228
228
|
PoiInfo: genNaslUITypeAnnotation('PoiInfo'),
|
|
229
229
|
File: genNaslUITypeAnnotation('File'),
|
|
230
|
+
KeyboardEvent: genNaslUITypeAnnotation('KeyboardEvent'),
|
|
231
|
+
|
|
230
232
|
Current: genNaslUIGenericTypeAnnotation('Current'),
|
|
231
233
|
DragAndDropEvent: genNaslUIGenericTypeAnnotation('DragAndDropEvent'),
|
|
232
234
|
ExpandEvent: genNaslUIGenericTypeAnnotation('ExpandEvent'),
|