@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
package/src/concepts/App__.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { queryNodeByPath } from '../service/storage/jsoner';
|
|
2
2
|
import { getNaslNodeByNodeCallee, getNodeByNodeCallee } from '../automate/engine/utils';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import type Frontend from './Frontend__';
|
|
3
|
+
import ConfigProperty from './ConfigProperty__';
|
|
4
|
+
import TypeAnnotation from './TypeAnnotation__';
|
|
5
|
+
import View from './View__';
|
|
6
|
+
import AuthInterface from './AuthInterface__';
|
|
7
|
+
import Interface from './Interface__';
|
|
9
8
|
import { CUSTOM_CONNECTOR_EDITABLE_SUFFIX } from './basics/constants';
|
|
10
9
|
|
|
10
|
+
// import CallLogic from './CallLogic__';
|
|
11
|
+
|
|
11
12
|
export interface AssetsInfo {
|
|
12
13
|
js: Array<string>;
|
|
13
14
|
css: Array<string>;
|
|
@@ -33,6 +34,13 @@ interface compilerInfoMapProps {
|
|
|
33
34
|
js?: { prefix: string };
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
type composeCacheType = {
|
|
38
|
+
[key: string]: composeCacheType,
|
|
39
|
+
} & {
|
|
40
|
+
nodes?: any[];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
|
|
36
44
|
//================================================================================
|
|
37
45
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
38
46
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -51,7 +59,7 @@ import type Enum from './Enum__';
|
|
|
51
59
|
import type Logic from './Logic__';
|
|
52
60
|
import type OverriddenLogic from './OverriddenLogic__';
|
|
53
61
|
import type AbstractInterface from './AbstractInterface__';
|
|
54
|
-
import type
|
|
62
|
+
import type Frontend from './Frontend__';
|
|
55
63
|
import Backend from './Backend__';
|
|
56
64
|
import type Process from './Process__';
|
|
57
65
|
import type Role from './Role__';
|
|
@@ -198,14 +206,14 @@ export class App extends BaseNode {
|
|
|
198
206
|
interfaces: Array<AbstractInterface> = [];
|
|
199
207
|
|
|
200
208
|
/**
|
|
201
|
-
*
|
|
209
|
+
* 前端列表
|
|
202
210
|
*/
|
|
203
211
|
@property({
|
|
204
|
-
objectRef: '
|
|
212
|
+
objectRef: 'Frontend',
|
|
205
213
|
isArray: true,
|
|
206
214
|
defaultValue: [],
|
|
207
215
|
})
|
|
208
|
-
|
|
216
|
+
frontends: Array<Frontend> = [];
|
|
209
217
|
|
|
210
218
|
/**
|
|
211
219
|
* 后端
|
|
@@ -1463,158 +1471,156 @@ export class App extends BaseNode {
|
|
|
1463
1471
|
return utils.unique(name, this.getAbstractInterfaceExistingNames(), undefined, true);
|
|
1464
1472
|
}
|
|
1465
1473
|
|
|
1466
|
-
|
|
1474
|
+
getFrontendExistingNames(excludedList: Array<Frontend> = []) {
|
|
1467
1475
|
const excludedSet = new Set(excludedList);
|
|
1468
|
-
return ((this.
|
|
1469
|
-
.filter((item) => !excludedSet.has(item))
|
|
1470
|
-
.map((item) => item?.name);
|
|
1476
|
+
return ((this.frontends as Frontend[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
|
|
1471
1477
|
}
|
|
1472
|
-
|
|
1473
|
-
return utils.unique(name, this.
|
|
1478
|
+
getFrontendUniqueName(name = 'frontend1') {
|
|
1479
|
+
return utils.unique(name, this.getFrontendExistingNames(), undefined, true);
|
|
1474
1480
|
}
|
|
1475
1481
|
|
|
1476
1482
|
/**
|
|
1477
|
-
*
|
|
1483
|
+
* 插入前端
|
|
1478
1484
|
* @internal
|
|
1479
|
-
* @param name
|
|
1485
|
+
* @param name 前端名称,如果不填会自动生成一个唯一名称
|
|
1480
1486
|
*/
|
|
1481
|
-
|
|
1487
|
+
_insertFrontendAt(name: string, index: number): Frontend;
|
|
1482
1488
|
|
|
1483
1489
|
/**
|
|
1484
|
-
*
|
|
1490
|
+
* 插入前端
|
|
1485
1491
|
* @internal
|
|
1486
|
-
* @param
|
|
1492
|
+
* @param frontendOptions 前端参数
|
|
1487
1493
|
*/
|
|
1488
|
-
|
|
1494
|
+
_insertFrontendAt(frontendOptions: Partial<Frontend>, index: number): Frontend;
|
|
1489
1495
|
|
|
1490
1496
|
/**
|
|
1491
|
-
*
|
|
1497
|
+
* 插入前端
|
|
1492
1498
|
* @internal
|
|
1493
|
-
* @param
|
|
1499
|
+
* @param frontend 已有的前端实例
|
|
1494
1500
|
*/
|
|
1495
|
-
|
|
1501
|
+
_insertFrontendAt(frontend: Frontend, index: number): Frontend;
|
|
1496
1502
|
|
|
1497
|
-
|
|
1498
|
-
const
|
|
1499
|
-
const relationOptions = { parentNode: this, parentKey: '
|
|
1500
|
-
const
|
|
1501
|
-
let
|
|
1503
|
+
_insertFrontendAt(options: string | Partial<Frontend> | Frontend, index: number) {
|
|
1504
|
+
const frontendOptions: any = {};
|
|
1505
|
+
const relationOptions = { parentNode: this, parentKey: 'frontends' };
|
|
1506
|
+
const Frontend = getConceptConstructor('Frontend');
|
|
1507
|
+
let frontend: Frontend;
|
|
1502
1508
|
if (!options) {
|
|
1503
|
-
|
|
1509
|
+
frontend = Frontend.from(
|
|
1504
1510
|
{
|
|
1505
|
-
...
|
|
1506
|
-
name: this.
|
|
1511
|
+
...frontendOptions,
|
|
1512
|
+
name: this.getFrontendUniqueName(),
|
|
1507
1513
|
},
|
|
1508
1514
|
this,
|
|
1509
|
-
'
|
|
1515
|
+
'frontends',
|
|
1510
1516
|
);
|
|
1511
1517
|
} else if (typeof options === 'string') {
|
|
1512
|
-
|
|
1518
|
+
frontend = Frontend.from(
|
|
1513
1519
|
{
|
|
1514
|
-
...
|
|
1520
|
+
...frontendOptions,
|
|
1515
1521
|
name: options,
|
|
1516
1522
|
},
|
|
1517
1523
|
this,
|
|
1518
|
-
'
|
|
1524
|
+
'frontends',
|
|
1519
1525
|
);
|
|
1520
|
-
} else if (asserts.
|
|
1526
|
+
} else if (asserts.isFrontend(options)) {
|
|
1521
1527
|
options.ensureDelete(); // 同一实例不支持多处存在
|
|
1522
|
-
|
|
1523
|
-
Object.assign(
|
|
1528
|
+
frontend = options;
|
|
1529
|
+
Object.assign(frontend, relationOptions);
|
|
1524
1530
|
} else {
|
|
1525
|
-
|
|
1531
|
+
frontend = Frontend.from(
|
|
1526
1532
|
{
|
|
1527
|
-
...
|
|
1533
|
+
...frontendOptions,
|
|
1528
1534
|
...options,
|
|
1529
1535
|
},
|
|
1530
1536
|
this,
|
|
1531
|
-
'
|
|
1537
|
+
'frontends',
|
|
1532
1538
|
);
|
|
1533
1539
|
}
|
|
1534
|
-
this.
|
|
1535
|
-
return
|
|
1540
|
+
this.frontends.splice(index, 0, frontend);
|
|
1541
|
+
return frontend;
|
|
1536
1542
|
}
|
|
1537
1543
|
|
|
1538
1544
|
/**
|
|
1539
|
-
*
|
|
1540
|
-
* @param name
|
|
1545
|
+
* 插入前端
|
|
1546
|
+
* @param name 前端名称,如果不填会自动生成一个唯一名称
|
|
1541
1547
|
*/
|
|
1542
|
-
|
|
1548
|
+
insertFrontendAt(name: string, index: number): Frontend;
|
|
1543
1549
|
|
|
1544
1550
|
/**
|
|
1545
|
-
*
|
|
1546
|
-
* @param
|
|
1551
|
+
* 插入前端
|
|
1552
|
+
* @param frontendOptions 前端参数
|
|
1547
1553
|
*/
|
|
1548
|
-
|
|
1554
|
+
insertFrontendAt(frontendOptions: Partial<Frontend>, index: number): Frontend;
|
|
1549
1555
|
|
|
1550
1556
|
/**
|
|
1551
|
-
*
|
|
1552
|
-
* @param
|
|
1557
|
+
* 插入前端
|
|
1558
|
+
* @param frontend 已有的前端实例
|
|
1553
1559
|
*/
|
|
1554
|
-
|
|
1560
|
+
insertFrontendAt(frontend: Frontend, index: number): Frontend;
|
|
1555
1561
|
|
|
1556
|
-
|
|
1557
|
-
const node = this.
|
|
1562
|
+
insertFrontendAt(options: string | Partial<Frontend> | Frontend, index: number) {
|
|
1563
|
+
const node = this._insertFrontendAt(options as any, index);
|
|
1558
1564
|
node.create({
|
|
1559
1565
|
index,
|
|
1560
1566
|
parentNode: this,
|
|
1561
|
-
parentKey: '
|
|
1567
|
+
parentKey: 'frontends',
|
|
1562
1568
|
});
|
|
1563
1569
|
return node;
|
|
1564
1570
|
}
|
|
1565
1571
|
|
|
1566
1572
|
/**
|
|
1567
|
-
*
|
|
1573
|
+
* 添加前端
|
|
1568
1574
|
* @internal
|
|
1569
|
-
* @param name
|
|
1575
|
+
* @param name 前端名称,如果不填会自动生成一个唯一名称
|
|
1570
1576
|
*/
|
|
1571
|
-
|
|
1577
|
+
_addFrontend(name?: string): Frontend;
|
|
1572
1578
|
|
|
1573
1579
|
/**
|
|
1574
|
-
*
|
|
1580
|
+
* 添加前端
|
|
1575
1581
|
* @internal
|
|
1576
|
-
* @param
|
|
1582
|
+
* @param frontendOptions 前端参数
|
|
1577
1583
|
*/
|
|
1578
|
-
|
|
1584
|
+
_addFrontend(frontendOptions: Partial<Frontend>): Frontend;
|
|
1579
1585
|
|
|
1580
1586
|
/**
|
|
1581
|
-
*
|
|
1587
|
+
* 添加前端
|
|
1582
1588
|
* @internal
|
|
1583
|
-
* @param
|
|
1589
|
+
* @param frontend 已有的前端实例
|
|
1584
1590
|
*/
|
|
1585
|
-
|
|
1591
|
+
_addFrontend(frontend: Frontend): Frontend;
|
|
1586
1592
|
|
|
1587
|
-
|
|
1588
|
-
const index = this.
|
|
1589
|
-
return this.
|
|
1593
|
+
_addFrontend(options?: string | Partial<Frontend> | Frontend) {
|
|
1594
|
+
const index = this.frontends.length;
|
|
1595
|
+
return this._insertFrontendAt(options as any, index);
|
|
1590
1596
|
}
|
|
1591
1597
|
|
|
1592
1598
|
/**
|
|
1593
|
-
*
|
|
1599
|
+
* 添加前端
|
|
1594
1600
|
* @internal
|
|
1595
|
-
* @param name
|
|
1601
|
+
* @param name 前端名称,如果不填会自动生成一个唯一名称
|
|
1596
1602
|
*/
|
|
1597
|
-
|
|
1603
|
+
addFrontend(name?: string): Frontend;
|
|
1598
1604
|
|
|
1599
1605
|
/**
|
|
1600
|
-
*
|
|
1601
|
-
* @param
|
|
1606
|
+
* 添加前端
|
|
1607
|
+
* @param frontendOptions 前端参数
|
|
1602
1608
|
*/
|
|
1603
|
-
|
|
1609
|
+
addFrontend(frontendOptions: Partial<Frontend>): Frontend;
|
|
1604
1610
|
|
|
1605
1611
|
/**
|
|
1606
|
-
*
|
|
1607
|
-
* @param
|
|
1612
|
+
* 添加前端
|
|
1613
|
+
* @param frontend 已有的前端实例
|
|
1608
1614
|
*/
|
|
1609
|
-
|
|
1615
|
+
addFrontend(frontend: Frontend): Frontend;
|
|
1610
1616
|
|
|
1611
|
-
|
|
1612
|
-
const node = this.
|
|
1613
|
-
const index = this.
|
|
1617
|
+
addFrontend(options?: string | Partial<Frontend> | Frontend) {
|
|
1618
|
+
const node = this._addFrontend(options as any);
|
|
1619
|
+
const index = this.frontends.indexOf(node);
|
|
1614
1620
|
node.create({
|
|
1615
1621
|
index,
|
|
1616
1622
|
parentNode: this,
|
|
1617
|
-
parentKey: '
|
|
1623
|
+
parentKey: 'frontends',
|
|
1618
1624
|
});
|
|
1619
1625
|
return node;
|
|
1620
1626
|
}
|
|
@@ -3232,45 +3238,45 @@ export class App extends BaseNode {
|
|
|
3232
3238
|
}
|
|
3233
3239
|
|
|
3234
3240
|
/**
|
|
3235
|
-
*
|
|
3236
|
-
* @param name
|
|
3241
|
+
* 删除前端
|
|
3242
|
+
* @param name 前端名称
|
|
3237
3243
|
*/
|
|
3238
|
-
|
|
3244
|
+
removeFrontend(name: string): void;
|
|
3239
3245
|
|
|
3240
3246
|
/**
|
|
3241
|
-
*
|
|
3242
|
-
* @param
|
|
3247
|
+
* 删除前端
|
|
3248
|
+
* @param frontend 已有的前端实例
|
|
3243
3249
|
*/
|
|
3244
|
-
|
|
3250
|
+
removeFrontend(frontend: Frontend): void;
|
|
3245
3251
|
|
|
3246
|
-
|
|
3247
|
-
let
|
|
3252
|
+
removeFrontend(options: string | Frontend) {
|
|
3253
|
+
let frontend: Frontend;
|
|
3248
3254
|
if (typeof options === 'string') {
|
|
3249
|
-
|
|
3250
|
-
if (!
|
|
3251
|
-
throw new Error('
|
|
3255
|
+
frontend = (this.frontends as Frontend[]).find((item) => item.name === options);
|
|
3256
|
+
if (!frontend) {
|
|
3257
|
+
throw new Error('找不到前端 ' + options);
|
|
3252
3258
|
}
|
|
3253
3259
|
} else {
|
|
3254
|
-
|
|
3260
|
+
frontend = options;
|
|
3255
3261
|
}
|
|
3256
|
-
return
|
|
3262
|
+
return frontend.delete();
|
|
3257
3263
|
}
|
|
3258
3264
|
|
|
3259
|
-
|
|
3260
|
-
const parentKey =
|
|
3265
|
+
__removeFrontend(frontend: Frontend) {
|
|
3266
|
+
const parentKey = frontend.parentKey;
|
|
3261
3267
|
const params: Params = {
|
|
3262
3268
|
parentNode: this,
|
|
3263
3269
|
parentKey,
|
|
3264
3270
|
index: -1,
|
|
3265
3271
|
object: null,
|
|
3266
|
-
oldObject:
|
|
3272
|
+
oldObject: frontend,
|
|
3267
3273
|
};
|
|
3268
3274
|
if (parentKey) {
|
|
3269
3275
|
params.parentKey = parentKey;
|
|
3270
3276
|
// @ts-ignore
|
|
3271
3277
|
const t = this.__v_raw || this;
|
|
3272
3278
|
// @ts-ignore
|
|
3273
|
-
const n =
|
|
3279
|
+
const n = frontend.__v_raw || frontend;
|
|
3274
3280
|
if (Array.isArray((t as any)[parentKey])) {
|
|
3275
3281
|
// @ts-ignore
|
|
3276
3282
|
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
@@ -3926,6 +3932,105 @@ export class App extends BaseNode {
|
|
|
3926
3932
|
@property()
|
|
3927
3933
|
preferenceMap: Record<string, string> = {};
|
|
3928
3934
|
|
|
3935
|
+
/**
|
|
3936
|
+
* 组合节点缓存
|
|
3937
|
+
*/
|
|
3938
|
+
composeCache: composeCacheType = {};
|
|
3939
|
+
|
|
3940
|
+
|
|
3941
|
+
/**
|
|
3942
|
+
* 获取组合节点
|
|
3943
|
+
*/
|
|
3944
|
+
getComposeNodes(path: string[]) {
|
|
3945
|
+
let compose = this.composeCache;
|
|
3946
|
+
path.forEach((key) => {
|
|
3947
|
+
compose = compose?.[key];
|
|
3948
|
+
});
|
|
3949
|
+
return compose?.nodes || [];
|
|
3950
|
+
}
|
|
3951
|
+
|
|
3952
|
+
/**
|
|
3953
|
+
* 往组合内添加节点
|
|
3954
|
+
*/
|
|
3955
|
+
addComposeNodes(path: string[], node: BaseNode | BaseNode[]) {
|
|
3956
|
+
let compose = this.composeCache;
|
|
3957
|
+
path.forEach((key, index) => {
|
|
3958
|
+
if (index === path.length - 1) {
|
|
3959
|
+
if (compose?.[key]?.nodes) {
|
|
3960
|
+
if (Array.isArray(node)) {
|
|
3961
|
+
compose[key].nodes.push(...node);
|
|
3962
|
+
} else {
|
|
3963
|
+
compose[key].nodes.push(node);
|
|
3964
|
+
}
|
|
3965
|
+
} else {
|
|
3966
|
+
if (!compose?.[key]) {
|
|
3967
|
+
compose[key] = {};
|
|
3968
|
+
}
|
|
3969
|
+
compose[key].nodes = Array.isArray(node) ? node : [node];
|
|
3970
|
+
}
|
|
3971
|
+
} else {
|
|
3972
|
+
if (!compose?.[key]) {
|
|
3973
|
+
compose[key] = {};
|
|
3974
|
+
}
|
|
3975
|
+
compose = compose[key];
|
|
3976
|
+
}
|
|
3977
|
+
});
|
|
3978
|
+
}
|
|
3979
|
+
|
|
3980
|
+
/**
|
|
3981
|
+
* 删除分组, 包括子集
|
|
3982
|
+
*/
|
|
3983
|
+
deleteCompose(path: string[]) {
|
|
3984
|
+
if (!Array.isArray(path)) return;
|
|
3985
|
+
let compose = this.composeCache;
|
|
3986
|
+
|
|
3987
|
+
const delNodes = (_compose: composeCacheType) => {
|
|
3988
|
+
if (_compose?.nodes) {
|
|
3989
|
+
for(let key in _compose) {
|
|
3990
|
+
if (key !== 'nodes') {
|
|
3991
|
+
delNodes(_compose[key]);
|
|
3992
|
+
}
|
|
3993
|
+
}
|
|
3994
|
+
_compose.nodes.forEach((node) => {
|
|
3995
|
+
node.delete();
|
|
3996
|
+
})
|
|
3997
|
+
_compose.nodes = [];
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
|
|
4001
|
+
this.emit('collect:start', {
|
|
4002
|
+
actionMsg: '删除同一分组节点',
|
|
4003
|
+
});
|
|
4004
|
+
path.forEach((key, index) => {
|
|
4005
|
+
if (index === path.length - 1) {
|
|
4006
|
+
delNodes(compose?.[key]);
|
|
4007
|
+
} else {
|
|
4008
|
+
compose = compose[key];
|
|
4009
|
+
}
|
|
4010
|
+
});
|
|
4011
|
+
this.emit('collect:end');
|
|
4012
|
+
}
|
|
4013
|
+
|
|
4014
|
+
/**
|
|
4015
|
+
* 释放分组内所有节点
|
|
4016
|
+
*/
|
|
4017
|
+
releaseComposeNode(path: string[]) {
|
|
4018
|
+
if (!Array.isArray(path)) return;
|
|
4019
|
+
let compose = this.composeCache;
|
|
4020
|
+
path.forEach((key, index) => {
|
|
4021
|
+
if (index === path.length - 1) {
|
|
4022
|
+
const nodes = compose?.[key]?.nodes || [];
|
|
4023
|
+
nodes.forEach((node) => {
|
|
4024
|
+
node.update({
|
|
4025
|
+
composedBy: [],
|
|
4026
|
+
});
|
|
4027
|
+
})
|
|
4028
|
+
} else {
|
|
4029
|
+
compose = compose[key];
|
|
4030
|
+
}
|
|
4031
|
+
});
|
|
4032
|
+
}
|
|
4033
|
+
|
|
3929
4034
|
/**
|
|
3930
4035
|
* 获取命名空间
|
|
3931
4036
|
*/
|
|
@@ -3998,21 +4103,23 @@ export class App extends BaseNode {
|
|
|
3998
4103
|
}
|
|
3999
4104
|
|
|
4000
4105
|
loadPackageInfo(scope: string) {
|
|
4001
|
-
const
|
|
4106
|
+
const materialConfig = (window as any).globalData.materialConfig || {};
|
|
4107
|
+
const { framework, ui } = materialConfig;
|
|
4108
|
+
|
|
4002
4109
|
const packageInfo = {
|
|
4003
4110
|
template: { name: '', version: '', scope },
|
|
4004
4111
|
ui: { name: '', version: '', scope },
|
|
4005
4112
|
scope,
|
|
4006
4113
|
};
|
|
4007
4114
|
|
|
4008
|
-
packageInfo.template.name = scope === 'h5' ?
|
|
4009
|
-
packageInfo.template.version =
|
|
4010
|
-
|
|
4011
|
-
packageInfo.ui.name = scope === 'h5' ?
|
|
4012
|
-
packageInfo.ui.version =
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4115
|
+
packageInfo.template.name = scope === 'h5' ? framework.h5 : framework.pc;
|
|
4116
|
+
packageInfo.template.version = framework.version;
|
|
4117
|
+
|
|
4118
|
+
packageInfo.ui.name = scope === 'h5' ? ui.h5.name : ui.pc.name;
|
|
4119
|
+
packageInfo.ui.version = scope === 'h5'
|
|
4120
|
+
? ui.h5.version
|
|
4121
|
+
: ui.pc.version;
|
|
4122
|
+
|
|
4016
4123
|
return packageInfo;
|
|
4017
4124
|
}
|
|
4018
4125
|
|
|
@@ -4047,21 +4154,13 @@ export class App extends BaseNode {
|
|
|
4047
4154
|
`${prefix}/packages/vue@2/dist/vue.min.js`,
|
|
4048
4155
|
// `${prefix}/packages/vue-router@3/dist/vue-router.min.js`,
|
|
4049
4156
|
|
|
4050
|
-
|
|
4051
|
-
? `${prefix}/packages/@lcap/mobile-ui@${packageInfo.ui.version}/dist-theme/index.js`
|
|
4052
|
-
: `${prefix}/packages/cloud-ui.vusion@${packageInfo.ui.version}/dist-theme/index.js`,
|
|
4157
|
+
`${prefix}/packages/${packageInfo.ui.name}@${packageInfo.ui.version}/dist-theme/index.js`,
|
|
4053
4158
|
|
|
4054
|
-
|
|
4055
|
-
? `${prefix}/packages/@lcap/mobile-template@${packageInfo.template.version}/cloudAdminDesigner.umd.min.js`
|
|
4056
|
-
: `${prefix}/packages/lcap-pc-template@${packageInfo.template.version}/cloudAdminDesigner.umd.min.js`,
|
|
4159
|
+
`${prefix}/packages/${packageInfo.template.name}@${packageInfo.template.version}/cloudAdminDesigner.umd.min.js`,
|
|
4057
4160
|
],
|
|
4058
4161
|
css: [
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
: `${prefix}/packages/cloud-ui.vusion@${packageInfo.ui.version}/dist-theme/index.css`,
|
|
4062
|
-
scope === 'h5'
|
|
4063
|
-
? `${prefix}/packages/@lcap/mobile-template@${packageInfo.template.version}/cloudAdminDesigner.css`
|
|
4064
|
-
: `${prefix}/packages/lcap-pc-template@${packageInfo.template.version}/cloudAdminDesigner.css`,
|
|
4162
|
+
`${prefix}/packages/${packageInfo.ui.name}@${packageInfo.ui.version}/dist-theme/index.css`,
|
|
4163
|
+
`${prefix}/packages/${packageInfo.template.name}@${packageInfo.template.version}/cloudAdminDesigner.css`,
|
|
4065
4164
|
],
|
|
4066
4165
|
},
|
|
4067
4166
|
custom: {
|
|
@@ -4070,10 +4169,10 @@ export class App extends BaseNode {
|
|
|
4070
4169
|
names: [],
|
|
4071
4170
|
},
|
|
4072
4171
|
};
|
|
4073
|
-
const
|
|
4172
|
+
const frontends = this.frontends.filter((frontend) => frontend.type === scope);
|
|
4074
4173
|
const existingSet = new Set();
|
|
4075
|
-
|
|
4076
|
-
|
|
4174
|
+
frontends.forEach((frontend) => {
|
|
4175
|
+
frontend.componentDependencies.forEach((dep) => {
|
|
4077
4176
|
const { name, version } = dep;
|
|
4078
4177
|
const jsName = `${prefix}/packages/${name}@${version}/dist-theme/index.js`;
|
|
4079
4178
|
if (!existingSet.has(jsName)) {
|
|
@@ -4180,11 +4279,7 @@ export class App extends BaseNode {
|
|
|
4180
4279
|
structureCount: this.structures.length,
|
|
4181
4280
|
enumCount: this.enums.length,
|
|
4182
4281
|
logicCount: this.logics.length,
|
|
4183
|
-
viewCount: sum(
|
|
4184
|
-
this.frontendTypes.map((frontendType) =>
|
|
4185
|
-
sum(frontendType.frontends.map((frontend) => countView(frontend.views))),
|
|
4186
|
-
),
|
|
4187
|
-
),
|
|
4282
|
+
viewCount: sum(this.frontends.map((frontend) => countView(frontend.views))),
|
|
4188
4283
|
processCount: this.processes.length,
|
|
4189
4284
|
};
|
|
4190
4285
|
}
|
|
@@ -4356,19 +4451,35 @@ export class App extends BaseNode {
|
|
|
4356
4451
|
return errorList;
|
|
4357
4452
|
}
|
|
4358
4453
|
|
|
4454
|
+
addFrontendForType(options?: string | Partial<Frontend> | Frontend) {
|
|
4455
|
+
let insertIndex = -1;
|
|
4456
|
+
this.frontends.forEach((frontend, index) => {
|
|
4457
|
+
if (frontend.type === (options as any).type) {
|
|
4458
|
+
insertIndex = index;
|
|
4459
|
+
}
|
|
4460
|
+
});
|
|
4461
|
+
if ((options as any).type === 'h5' && insertIndex === -1) {
|
|
4462
|
+
insertIndex = this.frontends.length;
|
|
4463
|
+
}
|
|
4464
|
+
const node = this._insertFrontendAt(options as any, insertIndex + 1);
|
|
4465
|
+
const index = this.frontends.indexOf(node);
|
|
4466
|
+
node.create({
|
|
4467
|
+
index,
|
|
4468
|
+
parentNode: this,
|
|
4469
|
+
parentKey: 'frontends',
|
|
4470
|
+
});
|
|
4471
|
+
return node;
|
|
4472
|
+
}
|
|
4473
|
+
|
|
4359
4474
|
getFrontendExistingTitles(excludedList: Array<Frontend> = []) {
|
|
4360
4475
|
const excludedSet = new Set(excludedList);
|
|
4361
|
-
return (this.
|
|
4362
|
-
.map((frontendType) => frontendType.frontends?.filter((item) => !excludedSet.has(item)).map((item) => item.title))
|
|
4363
|
-
.flat(2);
|
|
4476
|
+
return ((this.frontends as Frontend[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.title);
|
|
4364
4477
|
}
|
|
4365
4478
|
|
|
4366
4479
|
getExtensionsCallbackLogics() {
|
|
4367
4480
|
let resultLogics: string[] = [];
|
|
4368
|
-
this.
|
|
4369
|
-
|
|
4370
|
-
resultLogics = [...resultLogics, ...frontend.getExtensionsCallbackLogics()];
|
|
4371
|
-
});
|
|
4481
|
+
this.frontends.forEach((frontend) => {
|
|
4482
|
+
resultLogics = [...resultLogics, ...frontend.getExtensionsCallbackLogics()];
|
|
4372
4483
|
});
|
|
4373
4484
|
return Array.from(new Set(resultLogics));
|
|
4374
4485
|
}
|
|
@@ -4382,6 +4493,7 @@ export class App extends BaseNode {
|
|
|
4382
4493
|
}
|
|
4383
4494
|
|
|
4384
4495
|
genAllCustomComponents() {
|
|
4496
|
+
const { frontends } = this;
|
|
4385
4497
|
const compMap: {
|
|
4386
4498
|
pc: Array<any>;
|
|
4387
4499
|
h5: Array<any>;
|
|
@@ -4390,12 +4502,12 @@ export class App extends BaseNode {
|
|
|
4390
4502
|
h5: [],
|
|
4391
4503
|
};
|
|
4392
4504
|
const existingSet = new Set();
|
|
4393
|
-
|
|
4394
|
-
if (
|
|
4395
|
-
|
|
4505
|
+
frontends.forEach((frontend) => {
|
|
4506
|
+
if (frontend.componentDependencies) {
|
|
4507
|
+
frontend.componentDependencies.forEach((dep) => {
|
|
4396
4508
|
const { name } = dep;
|
|
4397
4509
|
if (!existingSet.has(name)) {
|
|
4398
|
-
compMap[
|
|
4510
|
+
compMap[frontend.type].push(dep);
|
|
4399
4511
|
}
|
|
4400
4512
|
});
|
|
4401
4513
|
}
|
|
@@ -321,20 +321,12 @@ export class BackendVariable extends BaseNode {
|
|
|
321
321
|
toJS(state?: TranslatorState): string {
|
|
322
322
|
const context = this.view ? 'this' : 'Vue.prototype';
|
|
323
323
|
const typeAnnotation = this.typeAnnotation || this.__TypeAnnotation;
|
|
324
|
-
let { sortedTypeKey, typeKind, typeName, typeNamespace } = typeAnnotation || {};
|
|
325
|
-
if (typeNamespace?.endsWith('.metadataTypes')) {
|
|
326
|
-
const referenceNode = this.app.findNodeByCompleteName(typeNamespace + '.' + typeName) || {};
|
|
327
|
-
const typeAn = referenceNode.typeAnnotation || {};
|
|
328
|
-
sortedTypeKey = `${typeAn.typeNamespace}.${typeAn.typeName}`;
|
|
329
|
-
typeKind = typeAn.typeKind;
|
|
330
|
-
typeName = typeAn.typeName;
|
|
331
|
-
}
|
|
332
324
|
const needGenInitFromSchema =
|
|
333
325
|
typeAnnotation &&
|
|
334
|
-
(!['primitive', 'union'].includes(typeKind) || typeName === 'DateTime');
|
|
326
|
+
(!['primitive', 'union'].includes(typeAnnotation.typeKind) || typeAnnotation.typeName === 'DateTime');
|
|
335
327
|
let code = `${this.name} =`;
|
|
336
328
|
if (needGenInitFromSchema) {
|
|
337
|
-
code += `${context}.$genInitFromSchema('${sortedTypeKey}',`;
|
|
329
|
+
code += `${context}.$genInitFromSchema('${typeAnnotation?.sortedTypeKey}',`;
|
|
338
330
|
}
|
|
339
331
|
|
|
340
332
|
if (this.defaultValue?.expression) {
|