@lcap/nasl 0.3.12-beta.1 → 0.3.12-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 (61) hide show
  1. package/out/service/logic/checktypeSocket.d.ts +5 -0
  2. package/out/service/logic/checktypeSocket.js +55 -0
  3. package/out/service/logic/checktypeSocket.js.map +1 -0
  4. package/out/service/logic/index.d.ts +3 -0
  5. package/out/service/logic/index.js +4 -1
  6. package/out/service/logic/index.js.map +1 -1
  7. package/out/types/app/App.d.ts +3 -1
  8. package/out/types/app/App.js +17 -0
  9. package/out/types/app/App.js.map +1 -1
  10. package/out/types/app/Service.d.ts +1 -0
  11. package/out/types/app/Service.js +36 -3
  12. package/out/types/app/Service.js.map +1 -1
  13. package/out/types/data/Entity.d.ts +5 -0
  14. package/out/types/data/Entity.js +13 -0
  15. package/out/types/data/Entity.js.map +1 -1
  16. package/out/types/data/Enum.d.ts +4 -0
  17. package/out/types/data/Enum.js +7 -0
  18. package/out/types/data/Enum.js.map +1 -1
  19. package/out/types/data/Module.d.ts +34 -0
  20. package/out/types/data/Module.js +53 -0
  21. package/out/types/data/Module.js.map +1 -0
  22. package/out/types/data/Structure.d.ts +4 -0
  23. package/out/types/data/Structure.js +7 -0
  24. package/out/types/data/Structure.js.map +1 -1
  25. package/out/types/data/genBlock/index.d.ts +0 -2
  26. package/out/types/data/genBlock/index.js +0 -2
  27. package/out/types/data/genBlock/index.js.map +1 -1
  28. package/out/types/index.d.ts +2 -0
  29. package/out/types/index.js +5 -2
  30. package/out/types/index.js.map +1 -1
  31. package/out/types/logic/Logic.d.ts +4 -0
  32. package/out/types/logic/Logic.js +7 -0
  33. package/out/types/logic/Logic.js.map +1 -1
  34. package/out/types/logic/LogicItem.js +17 -10
  35. package/out/types/logic/LogicItem.js.map +1 -1
  36. package/out/types/logic/Param.js +1 -1
  37. package/out/types/logic/Param.js.map +1 -1
  38. package/out/types/logic/translator.js +8 -1
  39. package/out/types/logic/translator.js.map +1 -1
  40. package/out/types/process/ProcessParam.js +1 -1
  41. package/out/types/process/ProcessParam.js.map +1 -1
  42. package/package.json +1 -1
  43. package/src/service/logic/checktypeSocket.js +49 -0
  44. package/src/service/logic/index.js +3 -0
  45. package/src/service/modules/api.js +20 -0
  46. package/src/service/modules/index.js +6 -0
  47. package/src/types/app/App.ts +17 -2
  48. package/src/types/app/Service.ts +39 -4
  49. package/src/types/data/Entity.ts +17 -6
  50. package/src/types/data/Enum.ts +5 -0
  51. package/src/types/data/Module.ts +51 -0
  52. package/src/types/data/Structure.ts +5 -0
  53. package/src/types/data/genBlock/index.ts +0 -2
  54. package/src/types/index.ts +2 -0
  55. package/src/types/logic/Logic.ts +5 -0
  56. package/src/types/logic/LogicItem.ts +20 -13
  57. package/src/types/logic/Param.ts +1 -1
  58. package/src/types/logic/translator.js +8 -1
  59. package/src/types/process/ProcessParam.ts +1 -1
  60. package/src/types/data/genBlock/genCurdBlock.ts +0 -654
  61. package/src/types/data/genBlock/genCurdEditTableBlock.ts +0 -581
@@ -1,581 +0,0 @@
1
- import { dataTypesMap, vertexsMap, utils, Entity, View, EntityProperty, Enum, LEVEL_ENUM } from '../..';
2
- import {
3
- filterProperty, NameGroup, genUniqueQueryNameGroup, getFirstDisplayedProperty, getParamFromResolver, genGenericTypeSchema, genVariable, genInterParam, genCallComponentLogic, genCallInterface, genQueryInterface, genQueryStructure,
4
- genEnumSelectBlock, genEditTableTemplate, genEditTableLoadLogic, genTableRemoveLogic, genLoadSelectLogic,
5
- genEditQueryStructure,
6
- genBlurUpdateLogic,
7
- } from '.';
8
- import builtInFunctions = require('./builtInFunctions.json');
9
-
10
- function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroupMap: Map<string, NameGroup>, tableRefName = 'tableView') {
11
- const propertyList = entity.propertyList
12
- .filter(filterProperty('inFilter'));
13
-
14
- return `
15
- <u-linear-layout justify="space-between">
16
- <u-form layout="inline" label-size="auto">
17
- ${propertyList.map((property) => {
18
- const label = property.label || property.name;
19
- let formItem = `<u-form-item label="${label}">`;
20
-
21
- if (property.$relationEntity) { // 有外键关联
22
- const relationEntity = vertexsMap.get(property.$relationEntity) as Entity;
23
- if (relationEntity) {
24
- const relationProperty = vertexsMap.get(property.$relationProperty) as EntityProperty;
25
- const displayedProperty = getFirstDisplayedProperty(relationEntity, 'inFilter');
26
- if (displayedProperty) {
27
- const lowerEntityName = utils.firstLowerCase(relationEntity.name);
28
- formItem += `
29
- <u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroupMap.get(relationEntity.id).load}"
30
- text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pageable="true" :remote-paging="true" v-model="filter.${property.name}">
31
- </u-select>
32
- `;
33
- } else
34
- return '';
35
- } else
36
- return '';
37
- } else if (property.typeKey === '#/basicTypes/Boolean') {
38
- formItem += `
39
- <u-select clearable v-model="filter.${property.name}" placeholder="请输入${label}">
40
- <u-select-item :value="true">是</u-select-item>
41
- <u-select-item :value="false">否</u-select-item>
42
- </u-select>
43
- `;
44
- } else if (property.typeKey === '#/basicTypes/Integer' || property.typeKey === '#/basicTypes/Long') {
45
- formItem += `<u-number-input v-model="filter.${property.name}" placeholder="请输入${label}"></u-number-input>`;
46
- } else if (property.typeKey === '#/basicTypes/Decimal') {
47
- formItem += `<u-number-input v-model="filter.${property.name}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
48
- } else if (property.typeKey === '#/basicTypes/Text') {
49
- formItem += `<u-textarea v-model="filter.${property.name}" placeholder="请输入${label}"></u-textarea>`;
50
- } else if (property.typeKey === '#/basicTypes/Date') {
51
- formItem += `<u-date-picker clearable :date.sync="filter.${property.name}" placeholder="请输入${label}"></u-date-picker>`;
52
- } else if (property.typeKey === '#/basicTypes/Time') {
53
- formItem += `<u-time-picker :time.sync="filter.${property.name}" placeholder="请输入${label}"></u-time-picker>`;
54
- } else if (property.typeKey === '#/basicTypes/DateTime') {
55
- formItem += `<u-date-time-picker clearable :date.sync="filter.${property.name}" placeholder="请输入${label}"></u-date-time-picker>`;
56
- } else if (dataTypesMap[property.typeKey].type === 'enum') {
57
- formItem += genEnumSelectBlock(dataTypesMap[property.typeKey] as Enum, `filter.${property.name}`, '', `请选择${label}`);
58
- } else {
59
- formItem += `<u-input v-model="filter.${property.name}" placeholder="请输入${label}"></u-input>`;
60
- }
61
-
62
- formItem += `</u-form-item>`;
63
- return formItem;
64
- }).join('')}
65
-
66
- <u-form-item>
67
- <u-button color="primary" @click="$refs.${tableRefName}.reload()">查询</u-button>
68
- </u-form-item>
69
- </u-form>
70
-
71
- <u-button color="primary" @click="${nameGroup.create}($event)">创建</u-button>
72
- </u-linear-layout>
73
- `;
74
- }
75
-
76
- function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroupMap: Map<string, NameGroup>) {
77
- const propertyList = entity.propertyList
78
- .filter(filterProperty('inForm'));
79
-
80
- const idProperty = entity.propertyList.find((item) => item.primaryKey || item.name === 'id');
81
-
82
- return `
83
- <u-modal ref="saveModal">
84
- <template #title>
85
- <div v-if="input.${idProperty.name}">修改</div>
86
- <div v-if="input.${idProperty.name} == undefined">创建</div>
87
- </template>
88
- <template #body>
89
- <u-form ref="form1">
90
- ${propertyList.map((property) => {
91
- const label = property.label || property.name;
92
- const required = !!property.required;
93
- const rules = [];
94
- if (property.rules && property.rules.length) {
95
- property.rules.forEach((rule) => rules.push(rule));
96
- }
97
- if (required)
98
- rules.push('required');
99
- const rulesStr = rules.join(' | ');
100
-
101
- let formItem = `<u-form-item
102
- label="${label}"
103
- ${required ? 'required' : ''}
104
- ${rulesStr.length ? `rules="${rulesStr}"` : ''}
105
- >`;
106
-
107
- if (property.$relationEntity) { // 有外键关联
108
- const relationEntity = vertexsMap.get(property.$relationEntity) as Entity;
109
- if (relationEntity) {
110
- const relationProperty = vertexsMap.get(property.$relationProperty) as EntityProperty;
111
- const displayedProperty = getFirstDisplayedProperty(relationEntity, 'inForm');
112
- if (displayedProperty) {
113
- const lowerEntityName = utils.firstLowerCase(relationEntity.name);
114
- formItem += `
115
- <u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroupMap.get(relationEntity.id).load}"
116
- text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pageable="true" :remote-paging="true" v-model="input.${property.name}">
117
- </u-select>
118
- `;
119
- } else
120
- return '';
121
- } else
122
- return '';
123
- } else if (property.typeKey === '#/basicTypes/Boolean') {
124
- formItem += `
125
- <u-select clearable v-model="input.${property.name}" placeholder="请输入${label}">
126
- <u-select-item :value="true">是</u-select-item>
127
- <u-select-item :value="false">否</u-select-item>
128
- </u-select>`;
129
- } else if (property.typeKey === '#/basicTypes/Integer' || property.typeKey === '#/basicTypes/Long') {
130
- formItem += `<u-number-input v-model="input.${property.name}" placeholder="请输入${label}"></u-number-input>`;
131
- } else if (property.typeKey === '#/basicTypes/Decimal') {
132
- formItem += `<u-number-input v-model="input.${property.name}" :precision="0" :step="0" placeholder="请输入${label}"></u-number-input>`;
133
- } else if (property.typeKey === '#/basicTypes/Text') {
134
- formItem += `<u-textarea v-model="input.${property.name}" placeholder="请输入${label}"></u-textarea>`;
135
- } else if (property.typeKey === '#/basicTypes/Date') {
136
- formItem += `<u-date-picker clearable :date.sync="input.${property.name}" placeholder="请输入${label}"></u-date-picker>`;
137
- } else if (property.typeKey === '#/basicTypes/Time') {
138
- formItem += `<u-time-picker :time.sync="input.${property.name}" placeholder="请输入${label}"></u-time-picker>`;
139
- } else if (property.typeKey === '#/basicTypes/DateTime') {
140
- formItem += `<u-date-time-picker clearable :date.sync="input.${property.name}" placeholder="请输入${label}"></u-date-time-picker>`;
141
- } else if (dataTypesMap[property.typeKey].type === 'enum') {
142
- formItem += genEnumSelectBlock(dataTypesMap[property.typeKey] as Enum, `input.${property.name}`, '', `请选择${label}`, true);
143
- } else {
144
- formItem += `<u-input v-model="input.${property.name}" placeholder="请输入${label}"></u-input>`;
145
- }
146
-
147
- formItem += `</u-form-item>\n`;
148
-
149
- return formItem;
150
- }).join('')}
151
- </u-form>
152
- </template>
153
- <template #foot>
154
- <u-linear-layout>
155
- <u-button color="primary" @click="${nameGroup.submit}()" v-if="input.${idProperty.name}">提交修改</u-button>
156
- <u-button color="primary" @click="${nameGroup.submit}()" v-if="input.${idProperty.name} == undefined">立即创建</u-button>
157
- </u-linear-layout>
158
- </template>
159
- </u-modal>`;
160
- }
161
-
162
- function genInitLogic(entity: Entity, nameGroup: NameGroup) {
163
- return {
164
- level: 'logic',
165
- expanded: false,
166
- name: nameGroup.init,
167
- description: '',
168
- params: [] as Array<any>,
169
- returns: [] as Array<any>,
170
- variables: [] as Array<any>,
171
- body: [
172
- {
173
- level: 'logicNode',
174
- type: 'Start',
175
- label: '开始',
176
- },
177
- {
178
- level: 'expressionNode',
179
- type: 'BuiltInFunction',
180
- label: '内置函数',
181
- calleeCode: 'Clear',
182
- builtInFuncParams: [
183
- {
184
- parentAttr: 'builtInFuncParams',
185
- level: 'expressionNode',
186
- type: 'BuiltInFuncParam',
187
- name: 'obj',
188
- builtInFuncParamValue: {
189
- parentAttr: 'builtInFuncParamValue',
190
- level: 'expressionNode',
191
- type: 'Identifier',
192
- name: 'filter',
193
- },
194
- schema: builtInFunctions.Clear.params[0].schema,
195
- },
196
- ],
197
- },
198
- {
199
- level: 'logicNode',
200
- type: 'End',
201
- label: '结束',
202
- },
203
- ],
204
- playground: [] as Array<any>,
205
- };
206
- }
207
-
208
- function genCreateLogic(entity: Entity, nameGroup: NameGroup) {
209
- return {
210
- level: 'logic',
211
- expanded: false,
212
- name: nameGroup.create,
213
- description: '',
214
- params: [] as Array<any>,
215
- returns: [] as Array<any>,
216
- variables: [] as Array<any>,
217
- body: [
218
- {
219
- level: 'logicNode',
220
- type: 'Start',
221
- label: '开始',
222
- },
223
- {
224
- level: 'logicNode',
225
- type: 'AssignmentExpression',
226
- label: '赋值',
227
- operator: '=',
228
- left: {
229
- level: 'expressionNode',
230
- type: 'Identifier',
231
- name: 'input',
232
- },
233
- right: {
234
- parentAttr: 'right',
235
- level: 'expressionNode',
236
- type: 'BuiltInFunction',
237
- label: '内置函数',
238
- calleeCode: 'Clone',
239
- builtInFuncParams: [
240
- {
241
- parentAttr: 'builtInFuncParams',
242
- level: 'expressionNode',
243
- type: 'BuiltInFuncParam',
244
- name: 'obj',
245
- builtInFuncParamValue: {
246
- parentAttr: 'builtInFuncParamValue',
247
- level: 'expressionNode',
248
- type: 'Identifier',
249
- name: nameGroup.lowerEntity,
250
- },
251
- schema: builtInFunctions.Clone.params[0].schema,
252
- },
253
- ],
254
- },
255
- },
256
- genCallComponentLogic('saveModal', 'open'),
257
- {
258
- level: 'logicNode',
259
- type: 'End',
260
- label: '结束',
261
- },
262
- ],
263
- playground: [] as Array<any>,
264
- };
265
- }
266
-
267
- function genModifyLogic(entity: Entity, nameGroup: NameGroup) {
268
- const scopeStructureSchema = genGenericTypeSchema('ScopeOf', { T: { $ref: nameGroup.structure } });
269
-
270
- return {
271
- level: 'logic',
272
- expanded: false,
273
- name: nameGroup.modify,
274
- description: '',
275
- params: [
276
- {
277
- level: 'param',
278
- type: 'Identifier',
279
- name: 'event',
280
- schema: {
281
- type: 'string',
282
- format: '',
283
- },
284
- },
285
- {
286
- level: 'param',
287
- name: 'scope',
288
- schema: scopeStructureSchema,
289
- },
290
- ],
291
- returns: [] as Array<any>,
292
- variables: [] as Array<any>,
293
- body: [
294
- {
295
- level: 'logicNode',
296
- type: 'Start',
297
- label: '开始',
298
- },
299
- {
300
- level: 'logicNode',
301
- type: 'AssignmentExpression',
302
- label: '赋值',
303
- operator: '=',
304
- left: {
305
- level: 'expressionNode',
306
- type: 'Identifier',
307
- name: 'input',
308
- },
309
- right: {
310
- parentAttr: 'right',
311
- level: 'expressionNode',
312
- type: 'BuiltInFunction',
313
- label: '内置函数',
314
- calleeCode: 'Clone',
315
- builtInFuncParams: [
316
- {
317
- parentAttr: 'builtInFuncParams',
318
- level: 'expressionNode',
319
- type: 'BuiltInFuncParam',
320
- name: 'obj',
321
- builtInFuncParamValue: {
322
- parentAttr: 'builtInFuncParamValue',
323
- level: 'expressionNode',
324
- type: 'MemberExpression',
325
- object: {
326
- parentAttr: 'builtInFuncParamValue',
327
- level: 'expressionNode',
328
- type: 'MemberExpression',
329
- object: {
330
- parentAttr: 'object',
331
- level: 'expressionNode',
332
- type: 'Identifier',
333
- name: 'scope',
334
- },
335
- property: {
336
- parentAttr: 'property',
337
- level: 'expressionNode',
338
- type: 'Identifier',
339
- name: 'item',
340
- schemaRef: '',
341
- code: 'item',
342
- },
343
- code: '',
344
- },
345
- property: {
346
- parentAttr: 'property',
347
- level: 'expressionNode',
348
- type: 'Identifier',
349
- name: nameGroup.lowerEntity,
350
- schemaRef: `${nameGroup.structure}.${nameGroup.lowerEntity}`,
351
- code: '',
352
- },
353
- code: '',
354
- },
355
- schema: builtInFunctions.Clone.params[0].schema,
356
- },
357
- ],
358
- },
359
- },
360
- genCallComponentLogic('saveModal', 'open'),
361
- {
362
- level: 'logicNode',
363
- type: 'End',
364
- label: '结束',
365
- },
366
- ],
367
- playground: [] as Array<any>,
368
- };
369
- }
370
-
371
- function genSubmitLogic(entity: Entity, nameGroup: NameGroup, tableRefName = 'tableView') {
372
- const updateResolver = entity.resolvers.find((item) => item.name === 'update');
373
- const createResolver = entity.resolvers.find((item) => item.name === 'create');
374
- const updateBodyParam = getParamFromResolver(updateResolver, 'body');
375
- const createBodyparam = getParamFromResolver(createResolver, 'body');
376
-
377
- const idProperty = entity.propertyList.find((item) => item.primaryKey || item.name === 'id');
378
-
379
- return {
380
- level: 'logic',
381
- name: nameGroup.submit,
382
- params: [] as Array<any>,
383
- returns: [] as Array<any>,
384
- variables: [
385
- genVariable('validateResult', '#/systemTypes/ValidateEvent', LEVEL_ENUM.variable),
386
- ],
387
- body: [
388
- {
389
- level: 'logicNode',
390
- type: 'Start',
391
- label: '开始',
392
- },
393
- {
394
- level: 'logicNode',
395
- type: 'AssignmentExpression',
396
- label: '赋值',
397
- operator: '=',
398
- left: {
399
- level: 'expressionNode',
400
- type: 'Identifier',
401
- name: 'validateResult',
402
- },
403
- right: genCallComponentLogic('form1', 'validate'),
404
- },
405
- {
406
- level: 'logicNode',
407
- type: 'IfStatement',
408
- label: '条件分支',
409
- test: {
410
- level: 'expressionNode',
411
- type: 'MemberExpression',
412
- name: 'name',
413
- hide: false,
414
- object: {
415
- level: 'expressionNode',
416
- type: 'Identifier',
417
- name: 'validateResult',
418
- },
419
- property: {
420
- level: 'expressionNode',
421
- type: 'Identifier',
422
- name: 'valid',
423
- },
424
- },
425
- consequent: [
426
- {
427
- level: 'logicNode',
428
- type: 'IfStatement',
429
- label: '条件分支',
430
- test: {
431
- parentAttr: 'test',
432
- level: 'expressionNode',
433
- type: 'BuiltInFunction',
434
- label: '内置函数',
435
- calleeCode: 'Convert',
436
- builtInFuncParams: [
437
- {
438
- parentAttr: 'builtInFuncParams',
439
- level: 'expressionNode',
440
- type: 'BuiltInFuncParam',
441
- name: 'value',
442
- builtInFuncParamValue: {
443
- level: 'expressionNode',
444
- type: 'MemberExpression',
445
- object: {
446
- level: 'expressionNode',
447
- type: 'Identifier',
448
- name: 'input',
449
- },
450
- property: {
451
- level: 'expressionNode',
452
- type: 'Identifier',
453
- name: 'id',
454
- schemaRef: idProperty.id,
455
- code: `ID_${idProperty.id}`,
456
- },
457
- },
458
- schema: builtInFunctions.Convert.params[0].schema,
459
- },
460
- {
461
- parentAttr: 'builtInFuncParams',
462
- level: 'expressionNode',
463
- type: 'BuiltInFuncParam',
464
- name: 'convertTo',
465
- builtInFuncParamValue: {
466
- level: 'expressionNode',
467
- type: 'TypeNote',
468
- schema: {
469
- format: '',
470
- type: 'boolean',
471
- },
472
- },
473
- schema: builtInFunctions.Convert.params[1].schema,
474
- },
475
- ],
476
- },
477
- consequent: [
478
- genCallInterface(updateResolver.interface, [
479
- genInterParam(updateBodyParam.id, 'input'),
480
- ]),
481
- ],
482
- alternate: [
483
- genCallInterface(createResolver.interface, [
484
- genInterParam(createBodyparam.id, 'input'),
485
- ]),
486
- ],
487
- },
488
- genCallComponentLogic('saveModal', 'close'),
489
- genCallComponentLogic(tableRefName, 'reload'),
490
- ],
491
- alternate: [] as Array<any>,
492
- },
493
- {
494
- level: 'logicNode',
495
- type: 'End',
496
- label: '结束',
497
- },
498
- ],
499
- playground: [] as Array<any>,
500
- expanded: false,
501
- };
502
- }
503
-
504
- export function genCurdEditTableBlock(entity: Entity, view: View) {
505
- const existingNameSets = {
506
- viewLogic: new Set(view.$def.logics.map((logic) => logic.name)),
507
- interface: new Set(entity.dataNode.service.interfaces.map((itface) => itface.name)),
508
- structure: new Set(entity.dataNode.structures.map((structure) => structure.name)),
509
- };
510
-
511
- const nameGroup = genUniqueQueryNameGroup(existingNameSets, view.name, 'tableView');
512
- nameGroup.remove = utils.unique('remove', existingNameSets.viewLogic);
513
- nameGroup.init = utils.unique('init', existingNameSets.viewLogic);
514
- nameGroup.create = utils.unique('create', existingNameSets.viewLogic);
515
- // nameGroup.modify = utils.unique('modify', existingNameSets.viewLogic);
516
- nameGroup.submit = utils.unique('submit', existingNameSets.viewLogic);
517
- nameGroup.lowerEntity = utils.firstLowerCase(entity.name);
518
- nameGroup.blurUpdate = utils.unique('blurUpdate', existingNameSets.viewLogic);
519
-
520
- // 收集所有和本实体关联的实体
521
- const allEntities = [entity];
522
- entity.propertyList.forEach((property) => {
523
- if (property.$relationEntity) { // 有外键关联
524
- const relationEntity = vertexsMap.get(property.$relationEntity) as Entity;
525
- if (relationEntity) {
526
- const displayedProperty = getFirstDisplayedProperty(relationEntity);
527
- if (displayedProperty && !allEntities.includes(relationEntity))
528
- allEntities.push(relationEntity);
529
- }
530
- }
531
- });
532
-
533
- const newStructures: Array<any> = [genEditQueryStructure(allEntities, nameGroup)];
534
- const newInterfaces: Array<any> = [genQueryInterface(allEntities, nameGroup, true, true)];
535
-
536
- const selectNameGroupMap: Map<string, NameGroup> = new Map();
537
- const loadSelectLogics = allEntities.slice(1).map((entity) => {
538
- const selectNameGroup = genUniqueQueryNameGroup(existingNameSets, view.name, 'select', false, entity.name);
539
- selectNameGroupMap.set(entity.id, selectNameGroup);
540
- return genLoadSelectLogic(entity, selectNameGroup, newStructures, newInterfaces);
541
- });
542
-
543
- return `<template>
544
- <u-linear-layout direction="vertical">
545
- ${genFilterTemplate(entity, nameGroup, selectNameGroupMap)}
546
- ${genEditTableTemplate(entity, nameGroup, selectNameGroupMap)}
547
- ${genSaveModalTemplate(entity, nameGroup, selectNameGroupMap)}
548
- </u-linear-layout>
549
- </template>
550
-
551
- <definition>
552
- {
553
- "variables": [
554
- ${JSON.stringify(genVariable(utils.firstLowerCase(entity.name), entity.schemaRef, LEVEL_ENUM.variable))},
555
- ${JSON.stringify(genVariable('input', entity.schemaRef, LEVEL_ENUM.variable))},
556
- ${JSON.stringify(genVariable('filter', entity.schemaRef, LEVEL_ENUM.variable))}
557
- ],
558
- "lifecycles": [
559
- {
560
- "level": "lifecycle",
561
- "name": "created",
562
- "logicId": "${nameGroup.init}"
563
- }
564
- ],
565
- "logics": [
566
- ${JSON.stringify(genEditTableLoadLogic(entity, nameGroup, newStructures, newInterfaces, true))},
567
- ${JSON.stringify(genTableRemoveLogic(entity, nameGroup))},
568
- ${JSON.stringify(genInitLogic(entity, nameGroup))},
569
- ${JSON.stringify(genCreateLogic(entity, nameGroup))},
570
- ${JSON.stringify(genSubmitLogic(entity, nameGroup))},
571
- ${JSON.stringify(genBlurUpdateLogic(entity, nameGroup))}
572
- ${loadSelectLogics.map((logic) => ',' + JSON.stringify(logic)).join('\n')}
573
- ],
574
- "interfaces": ${JSON.stringify(newInterfaces)},
575
- "structures": ${JSON.stringify(newStructures)}
576
- }
577
- </definition>
578
- `;
579
- }
580
-
581
- export default genCurdEditTableBlock;