@lcap/nasl 2.13.0-beta.1 → 2.13.0-beta.2

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.
Files changed (112) hide show
  1. package/out/bak/translator.js +1 -6
  2. package/out/bak/translator.js.map +1 -1
  3. package/out/common/BaseNode.js +1 -1
  4. package/out/common/BaseNode.js.map +1 -1
  5. package/out/concepts/BindAttribute__.d.ts +65 -12
  6. package/out/concepts/BindAttribute__.js +72 -7
  7. package/out/concepts/BindAttribute__.js.map +1 -1
  8. package/out/concepts/BindDirective__.d.ts +55 -0
  9. package/out/concepts/BindDirective__.js +69 -0
  10. package/out/concepts/BindDirective__.js.map +1 -1
  11. package/out/concepts/BindEvent__.d.ts +2 -94
  12. package/out/concepts/BindEvent__.js +55 -347
  13. package/out/concepts/BindEvent__.js.map +1 -1
  14. package/out/concepts/CallQueryComponent__.d.ts +102 -26
  15. package/out/concepts/CallQueryComponent__.js +104 -28
  16. package/out/concepts/CallQueryComponent__.js.map +1 -1
  17. package/out/concepts/CompletionProperty__.d.ts +1 -0
  18. package/out/concepts/CompletionProperty__.js +1 -0
  19. package/out/concepts/CompletionProperty__.js.map +1 -1
  20. package/out/concepts/Destination__.d.ts +1 -0
  21. package/out/concepts/Destination__.js +5 -1
  22. package/out/concepts/Destination__.js.map +1 -1
  23. package/out/concepts/Function__.d.ts +1 -2
  24. package/out/concepts/Function__.js +28 -0
  25. package/out/concepts/Function__.js.map +1 -1
  26. package/out/concepts/Logic__.d.ts +1 -7
  27. package/out/concepts/Logic__.js +10 -76
  28. package/out/concepts/Logic__.js.map +1 -1
  29. package/out/concepts/Param__.d.ts +0 -1
  30. package/out/concepts/Param__.js +0 -6
  31. package/out/concepts/Param__.js.map +1 -1
  32. package/out/concepts/ProcessElement__.d.ts +0 -86
  33. package/out/concepts/ProcessElement__.js +0 -130
  34. package/out/concepts/ProcessElement__.js.map +1 -1
  35. package/out/concepts/Process__.d.ts +0 -93
  36. package/out/concepts/Process__.js +0 -141
  37. package/out/concepts/Process__.js.map +1 -1
  38. package/out/concepts/ViewElement__.d.ts +8 -0
  39. package/out/concepts/ViewElement__.js +35 -47
  40. package/out/concepts/ViewElement__.js.map +1 -1
  41. package/out/concepts/View__.d.ts +8 -9
  42. package/out/concepts/View__.js +26 -72
  43. package/out/concepts/View__.js.map +1 -1
  44. package/out/concepts/basics/stdlib/nasl.ui.js +0 -4
  45. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  46. package/out/index.d.ts +1 -1
  47. package/out/index.js +3 -1
  48. package/out/index.js.map +1 -1
  49. package/out/server/createUiTs.d.ts +0 -9
  50. package/out/server/createUiTs.js +1 -28
  51. package/out/server/createUiTs.js.map +1 -1
  52. package/out/server/getMemberIdentifier.d.ts +1 -16
  53. package/out/server/getMemberIdentifier.js +29 -94
  54. package/out/server/getMemberIdentifier.js.map +1 -1
  55. package/out/server/getProcesses.d.ts +3 -3
  56. package/out/server/getProcesses.js +27 -28
  57. package/out/server/getProcesses.js.map +1 -1
  58. package/out/server/index.js +0 -3
  59. package/out/server/index.js.map +1 -1
  60. package/out/server/naslServer.js +7 -19
  61. package/out/server/naslServer.js.map +1 -1
  62. package/out/server/translator.js +5 -13
  63. package/out/server/translator.js.map +1 -1
  64. package/out/service/storage/init.d.ts +8 -0
  65. package/out/service/storage/init.js +5 -7
  66. package/out/service/storage/init.js.map +1 -1
  67. package/out/service/storage/service.d.ts +11 -2
  68. package/out/service/storage/service.js +26 -1
  69. package/out/service/storage/service.js.map +1 -1
  70. package/out/templator/genCurdEditMultipleKeyBlock.js +2 -4
  71. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  72. package/out/templator/genCurdMultipleKeyBlock.d.ts +0 -11
  73. package/out/templator/genCurdMultipleKeyBlock.js +19 -29
  74. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  75. package/out/templator/genEditTableBlock.js +30 -2
  76. package/out/templator/genEditTableBlock.js.map +1 -1
  77. package/out/templator/genGridViewBlock.js +15 -1
  78. package/out/templator/genGridViewBlock.js.map +1 -1
  79. package/out/templator/genTableBlock.js +15 -1
  80. package/out/templator/genTableBlock.js.map +1 -1
  81. package/package.json +1 -1
  82. package/src/bak/translator.js +1 -8
  83. package/src/common/BaseNode.ts +1 -1
  84. package/src/concepts/BindAttribute__.ts +153 -19
  85. package/src/concepts/BindDirective__.ts +139 -0
  86. package/src/concepts/BindEvent__.ts +57 -422
  87. package/src/concepts/CallQueryComponent__.ts +253 -56
  88. package/src/concepts/CompletionProperty__.ts +1 -0
  89. package/src/concepts/Destination__.ts +6 -1
  90. package/src/concepts/Function__.ts +1 -15
  91. package/src/concepts/Logic__.ts +11 -77
  92. package/src/concepts/Param__.ts +0 -6
  93. package/src/concepts/ProcessElement__.ts +1 -227
  94. package/src/concepts/Process__.ts +1 -237
  95. package/src/concepts/ViewElement__.ts +36 -48
  96. package/src/concepts/View__.ts +27 -72
  97. package/src/concepts/basics/stdlib/nasl.ui.ts +0 -4
  98. package/src/index.ts +1 -1
  99. package/src/server/createUiTs.ts +2 -26
  100. package/src/server/getMemberIdentifier.ts +28 -88
  101. package/src/server/getProcesses.ts +30 -31
  102. package/src/server/index.ts +0 -4
  103. package/src/server/naslServer.ts +7 -20
  104. package/src/server/translator.ts +6 -13
  105. package/src/service/storage/init.ts +5 -6
  106. package/src/service/storage/service.ts +28 -1
  107. package/src/templator/genCurdEditMultipleKeyBlock.ts +2 -5
  108. package/src/templator/genCurdMultipleKeyBlock.ts +16 -27
  109. package/src/templator/genEditTableBlock.ts +27 -0
  110. package/src/templator/genGridViewBlock.ts +13 -0
  111. package/src/templator/genTableBlock.ts +13 -0
  112. package/src/server/events.yaml +0 -89
@@ -1,3 +1,4 @@
1
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState, embeddedTSEmitter } from '../translator';
1
2
  import { ElementToVueOptions } from './ViewElement__';
2
3
  //================================================================================
3
4
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -69,6 +70,12 @@ export class BindDirective extends BaseNode {
69
70
  @property()
70
71
  modifiers: string = undefined;
71
72
 
73
+ /**
74
+ * 草稿态
75
+ */
76
+ @property('LogicItem')
77
+ playground: Array<LogicItem> = [];
78
+
72
79
  /**
73
80
  * 祖先 ViewElement
74
81
  */
@@ -137,6 +144,111 @@ export class BindDirective extends BaseNode {
137
144
 
138
145
 
139
146
 
147
+ /**
148
+ * 插入逻辑项
149
+ * @internal
150
+ * @param logicItemOptions 逻辑项参数
151
+ */
152
+ _insertItemInPlaygroundAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
153
+
154
+ /**
155
+ * 插入逻辑项
156
+ * @internal
157
+ * @param logicItem 已有的逻辑项实例
158
+ */
159
+ _insertItemInPlaygroundAt(logicItem: LogicItem, index: number): LogicItem;
160
+
161
+ _insertItemInPlaygroundAt(options: Partial<LogicItem> | LogicItem, index: number) {
162
+ const logicItemOptions: any = {};
163
+ const relationOptions = { parentNode: this, parentKey: 'playground' };
164
+ let logicItem: LogicItem;
165
+ if (options instanceof LogicItem) {
166
+ options.ensureDelete(); // 同一实例不支持多处存在
167
+ logicItem = options;
168
+ Object.assign(logicItem, relationOptions);
169
+ } else {
170
+ logicItem = LogicItem.from({
171
+ ...logicItemOptions,
172
+ ...options,
173
+ }, this, 'playground');
174
+ }
175
+ this.playground.splice(index, 0, logicItem);
176
+ return logicItem;
177
+ }
178
+
179
+
180
+
181
+ /**
182
+ * 插入逻辑项
183
+ * @param logicItemOptions 逻辑项参数
184
+ */
185
+ insertItemInPlaygroundAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
186
+
187
+ /**
188
+ * 插入逻辑项
189
+ * @param logicItem 已有的逻辑项实例
190
+ */
191
+ insertItemInPlaygroundAt(logicItem: LogicItem, index: number): LogicItem;
192
+
193
+ insertItemInPlaygroundAt(options: Partial<LogicItem> | LogicItem, index: number) {
194
+ const node = this._insertItemInPlaygroundAt(options as any, index);
195
+ node.create({
196
+ index,
197
+ parentNode: this,
198
+ parentKey: 'playground',
199
+ });
200
+ return node;
201
+ }
202
+
203
+
204
+
205
+ /**
206
+ * 添加逻辑项
207
+ * @internal
208
+ * @param logicItemOptions 逻辑项参数
209
+ */
210
+ _addItemInPlayground(logicItemOptions: Partial<LogicItem>): LogicItem;
211
+
212
+ /**
213
+ * 添加逻辑项
214
+ * @internal
215
+ * @param logicItem 已有的逻辑项实例
216
+ */
217
+ _addItemInPlayground(logicItem: LogicItem): LogicItem;
218
+
219
+ _addItemInPlayground(options?: Partial<LogicItem> | LogicItem) {
220
+ const index = this.playground.length;
221
+ return this._insertItemInPlaygroundAt(options as any, index);
222
+ }
223
+
224
+
225
+
226
+ /**
227
+ * 添加逻辑项
228
+ * @param logicItemOptions 逻辑项参数
229
+ */
230
+ addItemInPlayground(logicItemOptions: Partial<LogicItem>): LogicItem;
231
+
232
+ /**
233
+ * 添加逻辑项
234
+ * @param logicItem 已有的逻辑项实例
235
+ */
236
+ addItemInPlayground(logicItem: LogicItem): LogicItem;
237
+
238
+ addItemInPlayground(options?: Partial<LogicItem> | LogicItem) {
239
+ const node = this._addItemInPlayground(options as any);
240
+ const index = this.playground.indexOf(node);
241
+ node.create({
242
+ index,
243
+ parentNode: this,
244
+ parentKey: 'playground',
245
+ });
246
+ return node;
247
+ }
248
+
249
+
250
+
251
+
140
252
  /**
141
253
  * 删除逻辑项
142
254
  * @param name 逻辑项名称
@@ -162,6 +274,19 @@ export class BindDirective extends BaseNode {
162
274
  return expression.delete();
163
275
  }
164
276
 
277
+
278
+
279
+ /**
280
+ * 删除逻辑项
281
+ * @param logicItem 已有的逻辑项实例
282
+ */
283
+ removeItemInPlayground(logicItem: LogicItem): void;
284
+
285
+ removeItemInPlayground(options: LogicItem) {
286
+ let logicItem: LogicItem = options;
287
+ return logicItem.delete();
288
+ }
289
+
165
290
  __removeLogicItem(logicItem: LogicItem) {
166
291
  const parentKey = logicItem.parentKey;
167
292
  const params: Params = {
@@ -253,6 +378,20 @@ export class BindDirective extends BaseNode {
253
378
  return value !== '' && value !== undefined && value !== null ? `v-${this.name}${modifiersString}${this.arg ? ':' + this.arg : ''}="${value}"` : '';
254
379
  }
255
380
 
381
+ @withSourceMap()
382
+ toEmbeddedTS(state?: TranslatorState): string {
383
+ let code = '';
384
+ if (this.expression) {
385
+ code += this.expression.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
386
+ }
387
+ this.playground?.forEach((item, index) => {
388
+ code += item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
389
+ if (index !== this.playground.length - 1)
390
+ code += ',\n';
391
+ });
392
+ return code;
393
+ }
394
+
256
395
  //================================================================================
257
396
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
258
397
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓