@lcap/nasl 1.0.2 → 2.12.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/automate/engine/index.js +11 -0
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/uniqueName.js +1 -1
- package/out/automate/engine/uniqueName.js.map +1 -1
- package/out/automate/engine/utils.d.ts +1 -0
- package/out/automate/engine/utils.js +89 -67
- package/out/automate/engine/utils.js.map +1 -1
- package/out/concepts/App__.d.ts +51 -49
- package/out/concepts/App__.js +86 -54
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js +1 -1
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.js +1 -1
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/Assignment__.js +1 -1
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.js +1 -1
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +1 -1
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +3 -3
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +1 -1
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.js +11 -6
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.js +1 -1
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.js +8 -3
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +1 -1
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +23 -21
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +9 -8
- package/out/concepts/CallQueryComponent__.js +89 -79
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +2 -2
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js +1 -1
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.d.ts +1 -0
- package/out/concepts/ConfigGroup__.js +8 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigPropertyValue__.js +1 -1
- package/out/concepts/ConfigPropertyValue__.js.map +1 -1
- package/out/concepts/ConfigProperty__.d.ts +1 -0
- package/out/concepts/ConfigProperty__.js +4 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.d.ts +1 -0
- package/out/concepts/Configuration__.js +4 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Constant__.js +1 -1
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataElement__.js +1 -1
- package/out/concepts/DataElement__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +143 -0
- package/out/concepts/DataSource__.js +316 -0
- package/out/concepts/DataSource__.js.map +1 -0
- package/out/concepts/Destination__.js +8 -8
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +3 -3
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +5 -0
- package/out/concepts/EntityIndex__.js +7 -1
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +9 -0
- package/out/concepts/EntityProperty__.js +20 -3
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +5 -0
- package/out/concepts/Entity__.js +21 -11
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.js +1 -1
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.js +11 -5
- 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 +3 -3
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.d.ts +18 -0
- package/out/concepts/Function__.js +96 -1
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +3 -13
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +9 -9
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.js +1 -1
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js +19 -12
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.js +1 -1
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/LogicItem__.js +1 -1
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.js +41 -42
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +1 -1
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +1 -85
- package/out/concepts/Module__.js +6 -107
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +0 -86
- package/out/concepts/Namespace__.js +1 -108
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NullLiteral__.js +1 -1
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js +1 -1
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/Param__.d.ts +2 -1
- package/out/concepts/Param__.js +1 -1
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Point__.js +1 -1
- package/out/concepts/Point__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +1 -1
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +26 -11
- 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__.js +17 -10
- 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/QueryFieldExpression__.js +9 -2
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.d.ts +4 -0
- package/out/concepts/QueryFromExpression__.js +14 -3
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.js +1 -1
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.d.ts +4 -0
- package/out/concepts/QueryJoinExpression__.js +15 -4
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.js +1 -1
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.js +1 -1
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Rect__.js +1 -1
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.js +1 -1
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.js +11 -4
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/Slot__.js +1 -1
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +10 -0
- package/out/concepts/SqlQueryComponent__.js +32 -5
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.js +1 -1
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringLiteral__.js +1 -1
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js +1 -1
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +20 -13
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +6 -6
- 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/Theme__.js +1 -1
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.js +1 -1
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +8 -0
- package/out/concepts/TypeAnnotation__.js +46 -4
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.js +1 -1
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +1 -1
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.js +1 -1
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/UseComponent__.js +1 -1
- package/out/concepts/UseComponent__.js.map +1 -1
- package/out/concepts/ValidationRule__.js +1 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +1 -1
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.js +1 -1
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.js +18 -18
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +25 -23
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +5 -5
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +278 -0
- package/out/concepts/basics/stdlib/nasl.util.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/generator/genBundleFiles.js +8 -3
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.js +13 -12
- package/out/generator/genMetaData.js.map +1 -1
- package/out/server/createUiTs.js +1 -0
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/getLogics.js +9 -1
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getProcesses.d.ts +3 -0
- package/out/server/getProcesses.js +61 -1
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/naslServer.js +128 -6
- package/out/server/naslServer.js.map +1 -1
- package/out/server/process2LogicNamespace.js +10 -1
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.js +19 -1
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +2 -2
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +15 -11
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +15 -12
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +25 -21
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +12 -12
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +21 -20
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +6 -3
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genQueryComponent.js +5 -5
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genSelectBlock.js +8 -7
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +17 -15
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +15 -11
- 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/test/integration/connect-file.js +6 -6
- package/out/test/integration/connect-file.js.map +1 -1
- package/out/translator/index.js +1 -1
- package/out/translator/index.js.map +1 -1
- package/out/utils/index.d.ts +4 -0
- package/out/utils/index.js +32 -1
- package/out/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/automate/engine/index.js +12 -1
- package/src/automate/engine/uniqueName.js +1 -1
- package/src/automate/engine/utils.js +92 -67
- package/src/concepts/App__.ts +165 -95
- package/src/concepts/Argument__.ts +1 -1
- package/src/concepts/Assignee__.ts +1 -1
- package/src/concepts/Assignment__.ts +1 -1
- package/src/concepts/Attribute__.ts +1 -1
- package/src/concepts/BinaryExpression__.ts +1 -1
- package/src/concepts/BindAttribute__.ts +3 -3
- package/src/concepts/BindDirective__.ts +1 -1
- package/src/concepts/BindEvent__.ts +10 -6
- package/src/concepts/BooleanLiteral__.ts +1 -1
- package/src/concepts/CallFunction__.ts +19 -16
- package/src/concepts/CallInterface__.ts +1 -1
- package/src/concepts/CallLogic__.ts +23 -23
- package/src/concepts/CallQueryComponent__.ts +96 -113
- package/src/concepts/Comment__.ts +2 -2
- package/src/concepts/CompletionProperty__.ts +1 -1
- package/src/concepts/ConfigGroup__.ts +4 -2
- package/src/concepts/ConfigPropertyValue__.ts +1 -1
- package/src/concepts/ConfigProperty__.ts +5 -1
- package/src/concepts/Configuration__.ts +4 -1
- package/src/concepts/Constant__.ts +1 -1
- package/src/concepts/DataElement__.ts +1 -1
- package/src/concepts/DataSource__.ts +389 -0
- package/src/concepts/Destination__.ts +24 -8
- package/src/concepts/End__.ts +3 -3
- package/src/concepts/EntityIndex__.ts +8 -1
- package/src/concepts/EntityProperty__.ts +21 -3
- package/src/concepts/Entity__.ts +24 -12
- package/src/concepts/EnumItem__.ts +1 -1
- package/src/concepts/Enum__.ts +24 -5
- package/src/concepts/Event__.ts +1 -1
- package/src/concepts/ForEachStatement__.ts +3 -3
- package/src/concepts/Function__.ts +97 -3
- package/src/concepts/Identifier__.ts +12 -13
- package/src/concepts/IfStatement__.ts +10 -10
- package/src/concepts/InterfaceParam__.ts +1 -1
- package/src/concepts/Interface__.ts +20 -12
- package/src/concepts/JSBlock__.ts +1 -1
- package/src/concepts/LogicItem__.ts +1 -1
- package/src/concepts/Logic__.ts +41 -39
- package/src/concepts/MemberExpression__.ts +1 -1
- package/src/concepts/Module__.ts +9 -204
- package/src/concepts/Namespace__.ts +1 -204
- package/src/concepts/NullLiteral__.ts +1 -1
- package/src/concepts/NumericLiteral__.ts +1 -1
- package/src/concepts/Param__.ts +3 -2
- package/src/concepts/Point__.ts +1 -1
- package/src/concepts/ProcessComponent__.ts +1 -1
- package/src/concepts/ProcessElement__.ts +29 -13
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/Process__.ts +17 -11
- package/src/concepts/QueryAggregateExpression__.ts +1 -1
- package/src/concepts/QueryFieldExpression__.ts +10 -2
- package/src/concepts/QueryFromExpression__.ts +14 -3
- package/src/concepts/QueryGroupByExpression__.ts +1 -1
- package/src/concepts/QueryJoinExpression__.ts +15 -4
- package/src/concepts/QueryLimitExpression__.ts +1 -1
- package/src/concepts/QueryOrderByExpression__.ts +1 -1
- package/src/concepts/QuerySelectExpression__.ts +1 -1
- package/src/concepts/Rect__.ts +1 -1
- package/src/concepts/Return__.ts +1 -1
- package/src/concepts/Role__.ts +11 -5
- package/src/concepts/Slot__.ts +1 -1
- package/src/concepts/SqlQueryComponent__.ts +30 -11
- package/src/concepts/Start__.ts +1 -1
- package/src/concepts/StringLiteral__.ts +1 -1
- package/src/concepts/StructureProperty__.ts +1 -1
- package/src/concepts/Structure__.ts +20 -12
- package/src/concepts/SwitchCase__.ts +6 -6
- package/src/concepts/SwitchStatement__.ts +1 -1
- package/src/concepts/Theme__.ts +1 -1
- package/src/concepts/Transactional__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +45 -23
- package/src/concepts/TypeParam__.ts +1 -1
- package/src/concepts/UnaryExpression__.ts +1 -1
- package/src/concepts/Unparsed__.ts +1 -1
- package/src/concepts/UseComponent__.ts +1 -1
- package/src/concepts/ValidationRule__.ts +1 -1
- package/src/concepts/Variable__.ts +1 -1
- package/src/concepts/ViewComponent__.ts +1 -1
- package/src/concepts/ViewElement__.ts +19 -19
- package/src/concepts/View__.ts +25 -23
- package/src/concepts/WhileStatement__.ts +5 -5
- package/src/concepts/basics/stdlib/nasl.util.ts +279 -0
- package/src/concepts/index__.ts +1 -0
- package/src/generator/genBundleFiles.ts +8 -3
- package/src/generator/genMetaData.ts +13 -13
- package/src/server/createUiTs.ts +1 -0
- package/src/server/getLogics.ts +11 -3
- package/src/server/getProcesses.ts +61 -0
- package/src/server/naslServer.ts +124 -6
- package/src/server/process2LogicNamespace.ts +29 -19
- package/src/server/translator.ts +22 -1
- package/src/service/storage/init.ts +2 -2
- package/src/templator/genCreateBlock.ts +16 -13
- package/src/templator/genCurdEditMultipleKeyBlock.ts +16 -13
- package/src/templator/genCurdMultipleKeyBlock.ts +26 -22
- package/src/templator/genEditTableBlock.ts +14 -13
- package/src/templator/genGridViewBlock.ts +22 -21
- package/src/templator/genListViewBlock.ts +9 -5
- package/src/templator/genQueryComponent.ts +6 -6
- package/src/templator/genSelectBlock.ts +9 -8
- package/src/templator/genTableBlock.ts +18 -16
- package/src/templator/genUpdateBlock.ts +16 -12
- package/src/templator/utils.ts +2 -2
- package/src/test/integration/connect-file.ts +6 -6
- package/src/translator/index.ts +1 -1
- package/src/utils/index.ts +32 -0
package/src/concepts/App__.ts
CHANGED
|
@@ -14,7 +14,7 @@ import * as utils from '../utils';
|
|
|
14
14
|
import { v4 as uuidv4 } from 'uuid';
|
|
15
15
|
import BaseNode from '../common/BaseNode';
|
|
16
16
|
import classMap from '../common/classMap';
|
|
17
|
-
import
|
|
17
|
+
import DataSource from './DataSource__';
|
|
18
18
|
import Structure from './Structure__';
|
|
19
19
|
import Enum from './Enum__';
|
|
20
20
|
import Logic from './Logic__';
|
|
@@ -110,10 +110,10 @@ export class App extends BaseNode {
|
|
|
110
110
|
hasAuth: boolean = undefined;
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
*
|
|
113
|
+
* 数据源列表
|
|
114
114
|
*/
|
|
115
|
-
@property('
|
|
116
|
-
|
|
115
|
+
@property('DataSource')
|
|
116
|
+
dataSources: Array<DataSource> = [];
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
119
|
* 数据结构列表
|
|
@@ -187,6 +187,8 @@ export class App extends BaseNode {
|
|
|
187
187
|
@property('Module')
|
|
188
188
|
componentDependencies: Array<Module> = [];
|
|
189
189
|
|
|
190
|
+
|
|
191
|
+
|
|
190
192
|
/**
|
|
191
193
|
* @param source 需要合并的部分参数
|
|
192
194
|
*/
|
|
@@ -235,147 +237,148 @@ export class App extends BaseNode {
|
|
|
235
237
|
});
|
|
236
238
|
}
|
|
237
239
|
|
|
238
|
-
|
|
240
|
+
getDataSourceExistingNames(excludedList: Array<DataSource> = []) {
|
|
239
241
|
const excludedSet = new Set(excludedList);
|
|
240
|
-
return (this.
|
|
242
|
+
return (this.dataSources || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
241
243
|
}
|
|
242
|
-
|
|
243
|
-
return utils.unique(name, this.
|
|
244
|
+
getDataSourceUniqueName(name = 'DataSource1') {
|
|
245
|
+
return utils.unique(name, this.getDataSourceExistingNames(), undefined, true);
|
|
244
246
|
}
|
|
245
247
|
|
|
246
248
|
/**
|
|
247
|
-
*
|
|
249
|
+
* 插入数据源
|
|
248
250
|
* @internal
|
|
249
|
-
* @param name
|
|
251
|
+
* @param name 数据源名称,如果不填会自动生成一个唯一名称
|
|
250
252
|
*/
|
|
251
|
-
|
|
253
|
+
_insertDataSourceAt(name: string, index: number): DataSource;
|
|
252
254
|
|
|
253
255
|
/**
|
|
254
|
-
*
|
|
256
|
+
* 插入数据源
|
|
255
257
|
* @internal
|
|
256
|
-
* @param
|
|
258
|
+
* @param dataSourceOptions 数据源参数
|
|
257
259
|
*/
|
|
258
|
-
|
|
260
|
+
_insertDataSourceAt(dataSourceOptions: Partial<DataSource>, index: number): DataSource;
|
|
259
261
|
|
|
260
262
|
/**
|
|
261
|
-
*
|
|
263
|
+
* 插入数据源
|
|
262
264
|
* @internal
|
|
263
|
-
* @param
|
|
265
|
+
* @param dataSource 已有的数据源实例
|
|
264
266
|
*/
|
|
265
|
-
|
|
267
|
+
_insertDataSourceAt(dataSource: DataSource, index: number): DataSource;
|
|
266
268
|
|
|
267
|
-
|
|
268
|
-
const
|
|
269
|
-
const relationOptions = { parentNode: this, parentKey: '
|
|
270
|
-
let
|
|
269
|
+
_insertDataSourceAt(options: string | Partial<DataSource> | DataSource, index: number) {
|
|
270
|
+
const dataSourceOptions: any = {};
|
|
271
|
+
const relationOptions = { parentNode: this, parentKey: 'dataSources' };
|
|
272
|
+
let dataSource: DataSource;
|
|
271
273
|
if (!options) {
|
|
272
|
-
|
|
273
|
-
...
|
|
274
|
-
name: this.
|
|
275
|
-
}, this, '
|
|
274
|
+
dataSource = DataSource.from({
|
|
275
|
+
...dataSourceOptions,
|
|
276
|
+
name: this.getDataSourceUniqueName(),
|
|
277
|
+
}, this, 'dataSources');
|
|
276
278
|
} else if (typeof options === 'string') {
|
|
277
|
-
|
|
278
|
-
...
|
|
279
|
+
dataSource = DataSource.from({
|
|
280
|
+
...dataSourceOptions,
|
|
279
281
|
name: options,
|
|
280
|
-
}, this, '
|
|
281
|
-
} else if (options instanceof
|
|
282
|
+
}, this, 'dataSources');
|
|
283
|
+
} else if (options instanceof DataSource) {
|
|
282
284
|
options.ensureDelete(); // 同一实例不支持多处存在
|
|
283
|
-
|
|
284
|
-
Object.assign(
|
|
285
|
+
dataSource = options;
|
|
286
|
+
Object.assign(dataSource, relationOptions);
|
|
285
287
|
} else {
|
|
286
|
-
|
|
287
|
-
...
|
|
288
|
+
dataSource = DataSource.from({
|
|
289
|
+
...dataSourceOptions,
|
|
288
290
|
...options,
|
|
289
|
-
}, this, '
|
|
291
|
+
}, this, 'dataSources');
|
|
290
292
|
}
|
|
291
|
-
this.
|
|
292
|
-
return
|
|
293
|
+
this.dataSources.splice(index, 0, dataSource);
|
|
294
|
+
return dataSource;
|
|
293
295
|
}
|
|
294
296
|
|
|
295
297
|
/**
|
|
296
|
-
*
|
|
297
|
-
* @param name
|
|
298
|
+
* 插入数据源
|
|
299
|
+
* @param name 数据源名称,如果不填会自动生成一个唯一名称
|
|
298
300
|
*/
|
|
299
|
-
|
|
301
|
+
insertDataSourceAt(name: string, index: number): DataSource;
|
|
300
302
|
|
|
301
303
|
/**
|
|
302
|
-
*
|
|
303
|
-
* @param
|
|
304
|
+
* 插入数据源
|
|
305
|
+
* @param dataSourceOptions 数据源参数
|
|
304
306
|
*/
|
|
305
|
-
|
|
307
|
+
insertDataSourceAt(dataSourceOptions: Partial<DataSource>, index: number): DataSource;
|
|
306
308
|
|
|
307
309
|
/**
|
|
308
|
-
*
|
|
309
|
-
* @param
|
|
310
|
+
* 插入数据源
|
|
311
|
+
* @param dataSource 已有的数据源实例
|
|
310
312
|
*/
|
|
311
|
-
|
|
313
|
+
insertDataSourceAt(dataSource: DataSource, index: number): DataSource;
|
|
312
314
|
|
|
313
|
-
|
|
314
|
-
const node = this.
|
|
315
|
+
insertDataSourceAt(options: string | Partial<DataSource> | DataSource, index: number) {
|
|
316
|
+
const node = this._insertDataSourceAt(options as any, index);
|
|
315
317
|
node.create({
|
|
316
318
|
index,
|
|
317
319
|
parentNode: this,
|
|
318
|
-
parentKey: '
|
|
320
|
+
parentKey: 'dataSources',
|
|
319
321
|
});
|
|
320
322
|
return node;
|
|
321
323
|
}
|
|
322
324
|
|
|
323
325
|
/**
|
|
324
|
-
*
|
|
326
|
+
* 添加数据源
|
|
325
327
|
* @internal
|
|
326
|
-
* @param name
|
|
328
|
+
* @param name 数据源名称,如果不填会自动生成一个唯一名称
|
|
327
329
|
*/
|
|
328
|
-
|
|
330
|
+
_addDataSource(name?: string): DataSource;
|
|
329
331
|
|
|
330
332
|
/**
|
|
331
|
-
*
|
|
333
|
+
* 添加数据源
|
|
332
334
|
* @internal
|
|
333
|
-
* @param
|
|
335
|
+
* @param dataSourceOptions 数据源参数
|
|
334
336
|
*/
|
|
335
|
-
|
|
337
|
+
_addDataSource(dataSourceOptions: Partial<DataSource>): DataSource;
|
|
336
338
|
|
|
337
339
|
/**
|
|
338
|
-
*
|
|
340
|
+
* 添加数据源
|
|
339
341
|
* @internal
|
|
340
|
-
* @param
|
|
342
|
+
* @param dataSource 已有的数据源实例
|
|
341
343
|
*/
|
|
342
|
-
|
|
344
|
+
_addDataSource(dataSource: DataSource): DataSource;
|
|
343
345
|
|
|
344
|
-
|
|
345
|
-
const index =
|
|
346
|
-
return this.
|
|
346
|
+
_addDataSource(options?: string | Partial<DataSource> | DataSource) {
|
|
347
|
+
const index = this.dataSources.length;
|
|
348
|
+
return this._insertDataSourceAt(options as any, index);
|
|
347
349
|
}
|
|
348
350
|
|
|
349
351
|
/**
|
|
350
|
-
*
|
|
352
|
+
* 添加数据源
|
|
351
353
|
* @internal
|
|
352
|
-
* @param name
|
|
354
|
+
* @param name 数据源名称,如果不填会自动生成一个唯一名称
|
|
353
355
|
*/
|
|
354
|
-
|
|
356
|
+
addDataSource(name?: string): DataSource;
|
|
355
357
|
|
|
356
358
|
/**
|
|
357
|
-
*
|
|
358
|
-
* @param
|
|
359
|
+
* 添加数据源
|
|
360
|
+
* @param dataSourceOptions 数据源参数
|
|
359
361
|
*/
|
|
360
|
-
|
|
362
|
+
addDataSource(dataSourceOptions: Partial<DataSource>): DataSource;
|
|
361
363
|
|
|
362
364
|
/**
|
|
363
|
-
*
|
|
364
|
-
* @param
|
|
365
|
+
* 添加数据源
|
|
366
|
+
* @param dataSource 已有的数据源实例
|
|
365
367
|
*/
|
|
366
|
-
|
|
368
|
+
addDataSource(dataSource: DataSource): DataSource;
|
|
367
369
|
|
|
368
|
-
|
|
369
|
-
const node = this.
|
|
370
|
-
const index = this.
|
|
370
|
+
addDataSource(options?: string | Partial<DataSource> | DataSource) {
|
|
371
|
+
const node = this._addDataSource(options as any);
|
|
372
|
+
const index = this.dataSources.indexOf(node);
|
|
371
373
|
node.create({
|
|
372
374
|
index,
|
|
373
375
|
parentNode: this,
|
|
374
|
-
parentKey: '
|
|
376
|
+
parentKey: 'dataSources',
|
|
375
377
|
});
|
|
376
378
|
return node;
|
|
377
379
|
}
|
|
378
380
|
|
|
381
|
+
|
|
379
382
|
getStructureExistingNames(excludedList: Array<Structure> = []) {
|
|
380
383
|
const excludedSet = new Set(excludedList);
|
|
381
384
|
return (this.structures || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -517,6 +520,7 @@ export class App extends BaseNode {
|
|
|
517
520
|
return node;
|
|
518
521
|
}
|
|
519
522
|
|
|
523
|
+
|
|
520
524
|
getEnumExistingNames(excludedList: Array<Enum> = []) {
|
|
521
525
|
const excludedSet = new Set(excludedList);
|
|
522
526
|
return (this.enums || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -658,6 +662,7 @@ export class App extends BaseNode {
|
|
|
658
662
|
return node;
|
|
659
663
|
}
|
|
660
664
|
|
|
665
|
+
|
|
661
666
|
getLogicExistingNames(excludedList: Array<Logic> = []) {
|
|
662
667
|
const excludedSet = new Set(excludedList);
|
|
663
668
|
return (this.logics || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -799,6 +804,7 @@ export class App extends BaseNode {
|
|
|
799
804
|
return node;
|
|
800
805
|
}
|
|
801
806
|
|
|
807
|
+
|
|
802
808
|
getInterfaceExistingNames(excludedList: Array<Interface> = []) {
|
|
803
809
|
const excludedSet = new Set(excludedList);
|
|
804
810
|
return (this.interfaces || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -940,6 +946,7 @@ export class App extends BaseNode {
|
|
|
940
946
|
return node;
|
|
941
947
|
}
|
|
942
948
|
|
|
949
|
+
|
|
943
950
|
getViewExistingNames(excludedList: Array<View> = []) {
|
|
944
951
|
const excludedSet = new Set(excludedList);
|
|
945
952
|
return (this.views || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -1081,6 +1088,7 @@ export class App extends BaseNode {
|
|
|
1081
1088
|
return node;
|
|
1082
1089
|
}
|
|
1083
1090
|
|
|
1091
|
+
|
|
1084
1092
|
getProcessExistingNames(excludedList: Array<Process> = []) {
|
|
1085
1093
|
const excludedSet = new Set(excludedList);
|
|
1086
1094
|
return (this.processes || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -1222,6 +1230,7 @@ export class App extends BaseNode {
|
|
|
1222
1230
|
return node;
|
|
1223
1231
|
}
|
|
1224
1232
|
|
|
1233
|
+
|
|
1225
1234
|
getRoleExistingNames(excludedList: Array<Role> = []) {
|
|
1226
1235
|
const excludedSet = new Set(excludedList);
|
|
1227
1236
|
return (this.roles || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -1363,6 +1372,7 @@ export class App extends BaseNode {
|
|
|
1363
1372
|
return node;
|
|
1364
1373
|
}
|
|
1365
1374
|
|
|
1375
|
+
|
|
1366
1376
|
getModuleExistingNames(excludedList: Array<Module> = []) {
|
|
1367
1377
|
const excludedSet = new Set(excludedList);
|
|
1368
1378
|
return (this.dependencies || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -1770,47 +1780,50 @@ export class App extends BaseNode {
|
|
|
1770
1780
|
return node;
|
|
1771
1781
|
}
|
|
1772
1782
|
|
|
1783
|
+
|
|
1784
|
+
|
|
1785
|
+
|
|
1773
1786
|
/**
|
|
1774
|
-
*
|
|
1775
|
-
* @param name
|
|
1787
|
+
* 删除数据源
|
|
1788
|
+
* @param name 数据源名称
|
|
1776
1789
|
*/
|
|
1777
|
-
|
|
1790
|
+
removeDataSource(name: string): void;
|
|
1778
1791
|
|
|
1779
1792
|
/**
|
|
1780
|
-
*
|
|
1781
|
-
* @param
|
|
1793
|
+
* 删除数据源
|
|
1794
|
+
* @param dataSource 已有的数据源实例
|
|
1782
1795
|
*/
|
|
1783
|
-
|
|
1796
|
+
removeDataSource(dataSource: DataSource): void;
|
|
1784
1797
|
|
|
1785
|
-
|
|
1786
|
-
let
|
|
1798
|
+
removeDataSource(options: string | DataSource) {
|
|
1799
|
+
let dataSource: DataSource;
|
|
1787
1800
|
if (typeof options === 'string') {
|
|
1788
|
-
|
|
1789
|
-
if (!
|
|
1790
|
-
throw new Error('
|
|
1801
|
+
dataSource = this.dataSources.find((item) => item.name === options);
|
|
1802
|
+
if (!dataSource) {
|
|
1803
|
+
throw new Error('找不到数据源 ' + options);
|
|
1791
1804
|
}
|
|
1792
1805
|
} else {
|
|
1793
|
-
|
|
1806
|
+
dataSource = options;
|
|
1794
1807
|
}
|
|
1795
|
-
return
|
|
1808
|
+
return dataSource.delete();
|
|
1796
1809
|
}
|
|
1797
1810
|
|
|
1798
|
-
|
|
1799
|
-
const parentKey =
|
|
1811
|
+
__removeDataSource(dataSource: DataSource) {
|
|
1812
|
+
const parentKey = dataSource.parentKey;
|
|
1800
1813
|
const params: Params = {
|
|
1801
1814
|
parentNode: this,
|
|
1802
1815
|
parentKey,
|
|
1803
1816
|
index: -1,
|
|
1804
1817
|
object: null,
|
|
1805
|
-
oldObject:
|
|
1818
|
+
oldObject: dataSource,
|
|
1806
1819
|
};
|
|
1807
1820
|
if (parentKey) {
|
|
1808
1821
|
params.parentKey = parentKey;
|
|
1809
1822
|
if (Array.isArray((this as any)[parentKey])) {
|
|
1810
|
-
const index = (this as any)[parentKey].indexOf(
|
|
1823
|
+
const index = (this as any)[parentKey].indexOf(dataSource);
|
|
1811
1824
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
1812
1825
|
params.index = index;
|
|
1813
|
-
} else if ((this as any)[parentKey] ===
|
|
1826
|
+
} else if ((this as any)[parentKey] === dataSource) {
|
|
1814
1827
|
params.index = 0;
|
|
1815
1828
|
(this as any)[parentKey] = undefined;
|
|
1816
1829
|
}
|
|
@@ -1818,6 +1831,8 @@ export class App extends BaseNode {
|
|
|
1818
1831
|
return params;
|
|
1819
1832
|
}
|
|
1820
1833
|
|
|
1834
|
+
|
|
1835
|
+
|
|
1821
1836
|
/**
|
|
1822
1837
|
* 删除数据结构
|
|
1823
1838
|
* @param name 数据结构名称
|
|
@@ -1866,6 +1881,8 @@ export class App extends BaseNode {
|
|
|
1866
1881
|
return params;
|
|
1867
1882
|
}
|
|
1868
1883
|
|
|
1884
|
+
|
|
1885
|
+
|
|
1869
1886
|
/**
|
|
1870
1887
|
* 删除枚举
|
|
1871
1888
|
* @param name 枚举名称
|
|
@@ -1914,6 +1931,8 @@ export class App extends BaseNode {
|
|
|
1914
1931
|
return params;
|
|
1915
1932
|
}
|
|
1916
1933
|
|
|
1934
|
+
|
|
1935
|
+
|
|
1917
1936
|
/**
|
|
1918
1937
|
* 删除逻辑
|
|
1919
1938
|
* @param name 逻辑名称
|
|
@@ -1962,6 +1981,8 @@ export class App extends BaseNode {
|
|
|
1962
1981
|
return params;
|
|
1963
1982
|
}
|
|
1964
1983
|
|
|
1984
|
+
|
|
1985
|
+
|
|
1965
1986
|
/**
|
|
1966
1987
|
* 删除接口
|
|
1967
1988
|
* @param name 接口名称
|
|
@@ -2010,6 +2031,8 @@ export class App extends BaseNode {
|
|
|
2010
2031
|
return params;
|
|
2011
2032
|
}
|
|
2012
2033
|
|
|
2034
|
+
|
|
2035
|
+
|
|
2013
2036
|
/**
|
|
2014
2037
|
* 删除页面
|
|
2015
2038
|
* @param name 页面名称
|
|
@@ -2058,6 +2081,8 @@ export class App extends BaseNode {
|
|
|
2058
2081
|
return params;
|
|
2059
2082
|
}
|
|
2060
2083
|
|
|
2084
|
+
|
|
2085
|
+
|
|
2061
2086
|
/**
|
|
2062
2087
|
* 删除流程
|
|
2063
2088
|
* @param name 流程名称
|
|
@@ -2106,6 +2131,8 @@ export class App extends BaseNode {
|
|
|
2106
2131
|
return params;
|
|
2107
2132
|
}
|
|
2108
2133
|
|
|
2134
|
+
|
|
2135
|
+
|
|
2109
2136
|
/**
|
|
2110
2137
|
* 删除角色
|
|
2111
2138
|
* @param name 角色名称
|
|
@@ -2154,6 +2181,8 @@ export class App extends BaseNode {
|
|
|
2154
2181
|
return params;
|
|
2155
2182
|
}
|
|
2156
2183
|
|
|
2184
|
+
|
|
2185
|
+
|
|
2157
2186
|
/**
|
|
2158
2187
|
* 删除主题
|
|
2159
2188
|
* @param name 主题名称
|
|
@@ -2202,6 +2231,8 @@ export class App extends BaseNode {
|
|
|
2202
2231
|
return params;
|
|
2203
2232
|
}
|
|
2204
2233
|
|
|
2234
|
+
|
|
2235
|
+
|
|
2205
2236
|
/**
|
|
2206
2237
|
* 删除配置管理
|
|
2207
2238
|
* @param name 配置管理名称
|
|
@@ -2250,6 +2281,8 @@ export class App extends BaseNode {
|
|
|
2250
2281
|
return params;
|
|
2251
2282
|
}
|
|
2252
2283
|
|
|
2284
|
+
|
|
2285
|
+
|
|
2253
2286
|
/**
|
|
2254
2287
|
* 删除模块
|
|
2255
2288
|
* @param name 模块名称
|
|
@@ -2275,6 +2308,8 @@ export class App extends BaseNode {
|
|
|
2275
2308
|
return module.delete();
|
|
2276
2309
|
}
|
|
2277
2310
|
|
|
2311
|
+
|
|
2312
|
+
|
|
2278
2313
|
/**
|
|
2279
2314
|
* 删除模块
|
|
2280
2315
|
* @param name 模块名称
|
|
@@ -2300,6 +2335,8 @@ export class App extends BaseNode {
|
|
|
2300
2335
|
return module.delete();
|
|
2301
2336
|
}
|
|
2302
2337
|
|
|
2338
|
+
|
|
2339
|
+
|
|
2303
2340
|
/**
|
|
2304
2341
|
* 删除模块
|
|
2305
2342
|
* @param name 模块名称
|
|
@@ -2356,8 +2393,12 @@ export class App extends BaseNode {
|
|
|
2356
2393
|
return this.componentDependencies.find((componentDependency) => componentDependency.name === name);
|
|
2357
2394
|
}
|
|
2358
2395
|
|
|
2359
|
-
|
|
2360
|
-
return this.
|
|
2396
|
+
findDataSourceByName(name: string) {
|
|
2397
|
+
return this.dataSources.find((dataSourceItem) => dataSourceItem.name === name);
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
get defaultDS() {
|
|
2401
|
+
return this.dataSources?.find((dataSource) => dataSource.name === 'defaultDS');
|
|
2361
2402
|
}
|
|
2362
2403
|
|
|
2363
2404
|
findEnumByName(name: string) {
|
|
@@ -2430,7 +2471,7 @@ export class App extends BaseNode {
|
|
|
2430
2471
|
* 获取命名空间
|
|
2431
2472
|
*/
|
|
2432
2473
|
getNamespace() {
|
|
2433
|
-
return
|
|
2474
|
+
return 'app';
|
|
2434
2475
|
}
|
|
2435
2476
|
|
|
2436
2477
|
getTsNamespace() {
|
|
@@ -2461,6 +2502,35 @@ export class App extends BaseNode {
|
|
|
2461
2502
|
return node;
|
|
2462
2503
|
}
|
|
2463
2504
|
|
|
2505
|
+
findNodeByCompleteName(completeName: string) {
|
|
2506
|
+
const nameArr = completeName?.split('.') || [];
|
|
2507
|
+
const start = nameArr.shift();
|
|
2508
|
+
let node: any = this;
|
|
2509
|
+
const mod = 0;
|
|
2510
|
+
const modulesMap: any = {
|
|
2511
|
+
extensions: node.dependencies,
|
|
2512
|
+
apis: node.interfaceDependencies,
|
|
2513
|
+
};
|
|
2514
|
+
const modules = modulesMap[start];
|
|
2515
|
+
if (Array.isArray(modules)) {
|
|
2516
|
+
const moduleName = nameArr.shift();
|
|
2517
|
+
node = modules.find((moduleItem) => moduleItem.name === moduleName);
|
|
2518
|
+
}
|
|
2519
|
+
for (let index = 0; index < nameArr.length; index++) {
|
|
2520
|
+
if (!node) {
|
|
2521
|
+
return null;
|
|
2522
|
+
}
|
|
2523
|
+
const nameItem = nameArr[index];
|
|
2524
|
+
const isKeyword = index % 2 === mod;
|
|
2525
|
+
if (!isKeyword && Array.isArray(node)) {
|
|
2526
|
+
node = node.find(({ name }) => name === nameItem);
|
|
2527
|
+
} else {
|
|
2528
|
+
node = node[nameItem];
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
return node;
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2464
2534
|
/**
|
|
2465
2535
|
* @param path 路径
|
|
2466
2536
|
* path 为要查找路径:如 /dashboard/student/list、/dashboard/student/list
|
|
@@ -2567,7 +2637,7 @@ ${keys.map((key) => ` ${key}: ${this.theme?.variableMap[key]};`).join('\n')}
|
|
|
2567
2637
|
//================================================================================
|
|
2568
2638
|
}
|
|
2569
2639
|
|
|
2570
|
-
classMap
|
|
2640
|
+
classMap['App'] = App;
|
|
2571
2641
|
export default App;
|
|
2572
2642
|
//================================================================================
|
|
2573
2643
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -209,7 +209,7 @@ export class Argument extends LogicItem {
|
|
|
209
209
|
//================================================================================
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
classMap
|
|
212
|
+
classMap.Argument = Argument;
|
|
213
213
|
export default Argument;
|
|
214
214
|
//================================================================================
|
|
215
215
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -459,7 +459,7 @@ export class Assignee extends LogicItem {
|
|
|
459
459
|
//================================================================================
|
|
460
460
|
}
|
|
461
461
|
|
|
462
|
-
classMap
|
|
462
|
+
classMap.Assignee = Assignee;
|
|
463
463
|
export default Assignee;
|
|
464
464
|
//================================================================================
|
|
465
465
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -231,7 +231,7 @@ export class Assignment extends LogicItem {
|
|
|
231
231
|
//================================================================================
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
classMap
|
|
234
|
+
classMap.Assignment = Assignment;
|
|
235
235
|
export default Assignment;
|
|
236
236
|
//================================================================================
|
|
237
237
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -244,7 +244,7 @@ export class Attribute extends BaseNode {
|
|
|
244
244
|
//================================================================================
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
classMap
|
|
247
|
+
classMap.Attribute = Attribute;
|
|
248
248
|
export default Attribute;
|
|
249
249
|
//================================================================================
|
|
250
250
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -281,7 +281,7 @@ export class BinaryExpression extends LogicItem {
|
|
|
281
281
|
//================================================================================
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
classMap
|
|
284
|
+
classMap.BinaryExpression = BinaryExpression;
|
|
285
285
|
export default BinaryExpression;
|
|
286
286
|
//================================================================================
|
|
287
287
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -548,9 +548,9 @@ export class BindAttribute extends BaseNode {
|
|
|
548
548
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
549
549
|
let code = '';
|
|
550
550
|
if (this.name === 'destination') {
|
|
551
|
-
code += this.destination.toEmbeddedTS(shiftState(state, code, { tabSize: state
|
|
551
|
+
code += this.destination.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
552
552
|
} else if (this.expression) {
|
|
553
|
-
code += this.expression.toEmbeddedTS(shiftState(state, code, { tabSize: state
|
|
553
|
+
code += this.expression.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
554
554
|
}
|
|
555
555
|
return code;
|
|
556
556
|
}
|
|
@@ -560,7 +560,7 @@ export class BindAttribute extends BaseNode {
|
|
|
560
560
|
//================================================================================
|
|
561
561
|
}
|
|
562
562
|
|
|
563
|
-
classMap
|
|
563
|
+
classMap.BindAttribute = BindAttribute;
|
|
564
564
|
export default BindAttribute;
|
|
565
565
|
//================================================================================
|
|
566
566
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -253,7 +253,7 @@ export class BindDirective extends BaseNode {
|
|
|
253
253
|
//================================================================================
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
classMap
|
|
256
|
+
classMap.BindDirective = BindDirective;
|
|
257
257
|
export default BindDirective;
|
|
258
258
|
//================================================================================
|
|
259
259
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -339,10 +339,10 @@ export class BindEvent extends BaseNode {
|
|
|
339
339
|
return `${this.calleeKey}();`;
|
|
340
340
|
}
|
|
341
341
|
let code = `${this.toHump(this.name) || '__IDENTIFIER__'}: (event) => [\n`;
|
|
342
|
-
code += indent(state
|
|
342
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
343
343
|
code += `() => {${this.calleeKey}()}`;
|
|
344
344
|
code += '\n';
|
|
345
|
-
code += indent(state
|
|
345
|
+
code += indent((state?.tabSize || 0));
|
|
346
346
|
code += '],\n';
|
|
347
347
|
return code;
|
|
348
348
|
}
|
|
@@ -354,10 +354,10 @@ export class BindEvent extends BaseNode {
|
|
|
354
354
|
// let code = '';
|
|
355
355
|
// if (this.name) {
|
|
356
356
|
// code = `function ${this.name || '__IDENTIFIER__'} () {\n`;
|
|
357
|
-
// code += indent(state
|
|
357
|
+
// code += indent((state?.tabSize || 0) + 1);
|
|
358
358
|
// code += `${this.calleeKey}()`;
|
|
359
359
|
// code += '\n';
|
|
360
|
-
// code += indent(state
|
|
360
|
+
// code += indent((state?.tabSize || 0));
|
|
361
361
|
// code += '};\n';
|
|
362
362
|
// }
|
|
363
363
|
// return code;
|
|
@@ -367,8 +367,12 @@ export class BindEvent extends BaseNode {
|
|
|
367
367
|
* 设置callee
|
|
368
368
|
*/
|
|
369
369
|
setCallee(logic: Logic) {
|
|
370
|
+
let calleeNamespace = logic.getNamespace();
|
|
371
|
+
if (logic.parentNode instanceof View) {
|
|
372
|
+
calleeNamespace = '';
|
|
373
|
+
}
|
|
370
374
|
const object = {
|
|
371
|
-
calleeNamespace
|
|
375
|
+
calleeNamespace,
|
|
372
376
|
calleeName: logic.name,
|
|
373
377
|
};
|
|
374
378
|
this.update({
|
|
@@ -436,7 +440,7 @@ export class BindEvent extends BaseNode {
|
|
|
436
440
|
//================================================================================
|
|
437
441
|
}
|
|
438
442
|
|
|
439
|
-
classMap
|
|
443
|
+
classMap.BindEvent = BindEvent;
|
|
440
444
|
export default BindEvent;
|
|
441
445
|
//================================================================================
|
|
442
446
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|