@simitgroup/simpleapp-generator 1.5.1-alpha → 1.6.1-alpha

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 (147) hide show
  1. package/dist/buildinschemas/branch.d.ts.map +1 -1
  2. package/dist/buildinschemas/branch.js +10 -0
  3. package/dist/buildinschemas/branch.js.map +1 -1
  4. package/dist/buildinschemas/index.d.ts +2 -0
  5. package/dist/buildinschemas/index.d.ts.map +1 -1
  6. package/dist/buildinschemas/index.js +5 -1
  7. package/dist/buildinschemas/index.js.map +1 -1
  8. package/dist/buildinschemas/keyvaluepair.d.ts +3 -0
  9. package/dist/buildinschemas/keyvaluepair.d.ts.map +1 -0
  10. package/dist/buildinschemas/keyvaluepair.js +28 -0
  11. package/dist/buildinschemas/keyvaluepair.js.map +1 -0
  12. package/dist/buildinschemas/message.d.ts +3 -0
  13. package/dist/buildinschemas/message.d.ts.map +1 -0
  14. package/dist/buildinschemas/message.js +34 -0
  15. package/dist/buildinschemas/message.js.map +1 -0
  16. package/dist/buildinschemas/organization.d.ts.map +1 -1
  17. package/dist/buildinschemas/organization.js +18 -1
  18. package/dist/buildinschemas/organization.js.map +1 -1
  19. package/dist/buildinschemas/systemmessage.d.ts +3 -0
  20. package/dist/buildinschemas/systemmessage.d.ts.map +1 -0
  21. package/dist/buildinschemas/systemmessage.js +43 -0
  22. package/dist/buildinschemas/systemmessage.js.map +1 -0
  23. package/dist/framework.d.ts.map +1 -1
  24. package/dist/framework.js +4 -2
  25. package/dist/framework.js.map +1 -1
  26. package/dist/generate.d.ts.map +1 -1
  27. package/dist/generate.js +37 -9
  28. package/dist/generate.js.map +1 -1
  29. package/dist/processors/bpmnbuilder.d.ts.map +1 -1
  30. package/dist/processors/bpmnbuilder.js +23 -32
  31. package/dist/processors/bpmnbuilder.js.map +1 -1
  32. package/dist/processors/jrxmlbuilder.d.ts +3 -0
  33. package/dist/processors/jrxmlbuilder.d.ts.map +1 -0
  34. package/dist/processors/jrxmlbuilder.js +57 -0
  35. package/dist/processors/jrxmlbuilder.js.map +1 -0
  36. package/dist/type.d.ts +6 -0
  37. package/dist/type.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/src/buildinschemas/branch.ts +10 -0
  40. package/src/buildinschemas/index.ts +2 -0
  41. package/src/buildinschemas/keyvaluepair.ts +26 -0
  42. package/src/buildinschemas/organization.ts +18 -1
  43. package/src/buildinschemas/systemmessage.ts +42 -0
  44. package/src/framework.ts +4 -2
  45. package/src/generate.ts +41 -13
  46. package/src/processors/bpmnbuilder.ts +34 -38
  47. package/src/processors/jrxmlbuilder.ts +38 -0
  48. package/src/type.ts +7 -1
  49. package/templates/basic/nest/controller.ts.eta +34 -17
  50. package/templates/basic/nest/processor.ts.eta +2 -1
  51. package/templates/basic/nest/resolver.ts.eta +1 -1
  52. package/templates/basic/nest/service.ts.eta +22 -4
  53. package/templates/basic/nest/type.ts.eta +2 -2
  54. package/templates/basic/nuxt/component.select.vue.eta +5 -1
  55. package/templates/basic/nuxt/pages.form.vue.eta +1 -1
  56. package/templates/basic/nuxt/pages.mobile.landing.vue.eta +4 -61
  57. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +11 -13
  58. package/templates/nest/src/app.module.ts.eta +12 -4
  59. package/templates/nest/src/cloudapi/cloudapi.module.ts._eta +1 -1
  60. package/templates/nest/src/printapi/api/.gitignore.eta +4 -0
  61. package/templates/nest/src/printapi/api/.npmignore.eta +1 -0
  62. package/templates/nest/src/printapi/api/.openapi-generator/FILES.eta +8 -0
  63. package/templates/nest/src/printapi/api/.openapi-generator/VERSION.eta +1 -0
  64. package/templates/nest/src/printapi/api/.openapi-generator-ignore.eta +23 -0
  65. package/templates/nest/src/printapi/api/api.ts.eta +223 -0
  66. package/templates/nest/src/printapi/api/base.ts.eta +86 -0
  67. package/templates/nest/src/printapi/api/common.ts.eta +150 -0
  68. package/templates/nest/src/printapi/api/configuration.ts.eta +110 -0
  69. package/templates/nest/src/printapi/api/git_push.sh.eta +57 -0
  70. package/templates/nest/src/printapi/api/index.ts.eta +18 -0
  71. package/templates/nest/src/printapi/api/openapitools.json.eta +7 -0
  72. package/templates/nest/src/printapi/printapi.module.ts.eta +15 -0
  73. package/templates/nest/src/printapi/printapi.service.ts.eta +42 -0
  74. package/templates/nest/src/simpleapp/apischemas/index.ts._eta +11 -0
  75. package/templates/nest/src/simpleapp/generate/commons/robotuser.service.ts.eta +5 -4
  76. package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +7 -0
  77. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +10 -9
  78. package/templates/nest/src/simpleapp/generate/processors/autoinc.processor.ts.eta +73 -0
  79. package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +104 -0
  80. package/templates/nest/src/simpleapp/generate/processors/docno.processor.ts.eta +77 -0
  81. package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +115 -0
  82. package/templates/nest/src/simpleapp/generate/processors/perm.processor.ts.eta +71 -0
  83. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +77 -13
  84. package/templates/nest/src/simpleapp/generate/processors/sysmsg.processor.ts.eta +49 -0
  85. package/templates/nest/src/simpleapp/generate/processors/tenant.processor.ts.eta +52 -0
  86. package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +12 -5
  87. package/templates/nest/src/simpleapp/generate/workflow/workflow.controller.ts.eta +2 -2
  88. package/templates/nest/src/simpleapp/generate/workflow/workflow.delegate.ts.eta +33 -28
  89. package/templates/nest/src/simpleapp/generate/workflow/workflow.service.ts.eta +95 -26
  90. package/templates/nest/src/simpleapp/generate/workflow/workflow.type.ts.eta +4 -4
  91. package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +15 -0
  92. package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +3 -1
  93. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +20 -3
  94. package/templates/nest/src/simpleapp/services/sysmsg.service.ts._etaxxx +43 -0
  95. package/templates/nest/src/simpleapp/services/userresolver.service.ts._eta +70 -0
  96. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +8 -4
  97. package/templates/nest/src/simpleapp/types/index.ts._eta +5 -0
  98. package/templates/nuxt/assets/css/listview.css._eta +2 -2
  99. package/templates/nuxt/components/button/ButtonAction.vue._eta +11 -5
  100. package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +11 -2
  101. package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +1 -1
  102. package/templates/nuxt/components/form/{FormBranch.vue.eta → FormBranch.vue._eta} +1 -1
  103. package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +38 -0
  104. package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +40 -0
  105. package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +147 -0
  106. package/templates/nuxt/components/list/ListItem.vue.eta +24 -0
  107. package/templates/nuxt/components/list/ListMessages.vue.eta +89 -0
  108. package/templates/nuxt/components/list/ListView.vue.eta +9 -12
  109. package/templates/nuxt/components/renderer/RendererMoney.vue.eta +11 -12
  110. package/templates/nuxt/components/select/SelectTemplate.vue.eta +49 -20
  111. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +2 -2
  112. package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +16 -15
  113. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +92 -8
  114. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +29 -6
  115. package/templates/nuxt/components/text/TextBold.vue._eta +13 -0
  116. package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +18 -2
  117. package/templates/nuxt/composables/getUserStore.generate.ts.eta +12 -3
  118. package/templates/nuxt/composables/hotvalue.generate.ts.eta +30 -0
  119. package/templates/nuxt/composables/pusher.ts._eta +13 -0
  120. package/templates/nuxt/composables/stringHelper.generate.ts.eta +2 -3
  121. package/templates/nuxt/composables/sysmessage.generate.ts.eta +20 -0
  122. package/templates/nuxt/composables/workflow.generate.ts.eta +9 -4
  123. package/templates/nuxt/layouts/mobile.vue._eta +31 -42
  124. package/templates/nuxt/nuxt.config.ts._eta +2 -2
  125. package/templates/nuxt/othermodules.d.ts.eta +449 -0
  126. package/templates/nuxt/pages/[xorg]/mobile/organization/[id].vue._eta +40 -0
  127. package/templates/nuxt/pages/[xorg]/mobile/organization/{index.vue.eta → index.vue.aetaz} +16 -13
  128. package/templates/nuxt/pages/[xorg]/organization.vue.eta +21 -15
  129. package/templates/nuxt/plugins/40.pusher.ts.eta +18 -0
  130. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +10 -1
  131. package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +4 -1
  132. package/templates/nuxt/types/schema.ts.eta +8 -1
  133. package/templates/nuxt/types/simpleappinput.ts.eta +3 -5
  134. package/templates/printformats/template.jrxml._eta +27 -0
  135. package/templates/project/groups/admin.json.eta +6 -1
  136. package/templates/project/jsonschemas/branch.json._eta +113 -0
  137. package/templates/project/jsonschemas/invoice.json._eta +5 -1
  138. package/templates/project/jsonschemas/organization.json._eta +111 -0
  139. package/templates/project/lang/default._json +71 -150
  140. package/templates/workflow/next/listener.ts.eta +6 -3
  141. package/tsconfig.tsbuildinfo +1 -1
  142. /package/templates/nest/src/simpleapp/services/{autoinc.service.ts.eta → autoinc.service.ts.etaxx} +0 -0
  143. /package/templates/nest/src/simpleapp/services/{branch.service.ts.eta → branch.service.ts.etaxxx} +0 -0
  144. /package/templates/nest/src/simpleapp/services/{docno.service.ts.eta → docno.service.ts.etaxxx} +0 -0
  145. /package/templates/nest/src/simpleapp/services/{org.service.ts.eta → org.service.ts.etaxxx} +0 -0
  146. /package/templates/nest/src/simpleapp/services/{perm.service.ts.eta → perm.service.ts.etaxxx} +0 -0
  147. /package/templates/nest/src/simpleapp/services/{tenant.service.ts.eta → tenant.service.ts.etaxxx} +0 -0
@@ -0,0 +1,38 @@
1
+ import { existsSync, mkdirSync, writeFileSync } from 'fs';
2
+ import * as constants from '../constant'
3
+ import { SchemaPrintFormat } from "../type";
4
+ import { Logger, ILogObj } from "tslog";
5
+
6
+ const log: Logger<ILogObj> = new Logger();
7
+
8
+ const { Eta } = require('eta');
9
+ export const generatePrintformat = async (configs,printFormats:SchemaPrintFormat[]) =>{
10
+
11
+ console.log("Generate printformats ",printFormats);
12
+ const generateTemplateName = `${constants.templatedir}/printformats/template.jrxml._eta`
13
+ log.info("Generate printformat ",generateTemplateName);
14
+
15
+ const eta = new Eta({
16
+ views: '/',
17
+
18
+ functionHeader: getCodeGenHelper()
19
+ });
20
+ if(configs.printFormatDir && printFormats){
21
+ mkdirSync(configs.printFormatDir,{recursive:true})
22
+ for(let i=0;i<printFormats.length; i++){
23
+ const format = printFormats[i]
24
+ const targetfile = `${configs.printFormatDir}/${format.formatId}.jrxml`;
25
+ log.info("Process jrxml:",targetfile)
26
+ if(!existsSync(targetfile)){
27
+ const filecontent = eta.render(generateTemplateName, format)
28
+ writeFileSync(targetfile,filecontent);
29
+ }
30
+
31
+ }
32
+ }
33
+ }
34
+
35
+
36
+ const getCodeGenHelper = () => 'const capitalizeFirstLetter = (str) => str.slice(0, 1).toUpperCase() + str.slice(1);' +
37
+ 'const initType=(str)=>{return ["string","number","boolean","array","object"].includes(str) ? capitalizeFirstLetter(str) : str;};' +
38
+ 'const camelCaseToWords = (s) => {const result = s.replace(/([A-Z])/g, \' $1\');return result.charAt(0).toUpperCase() + result.slice(1);}'
package/src/type.ts CHANGED
@@ -149,9 +149,15 @@ export type SchemaConfig = {
149
149
  documentType: string
150
150
  documentName: string
151
151
  collectionName?: string
152
- foreignKeys?:MyForeignKey,
152
+ foreignKeys?:MyForeignKey
153
+ printFormats?: SchemaPrintFormat[]
153
154
  }
154
155
 
156
+ export type SchemaPrintFormat = {
157
+ formatName: string
158
+ formatId: string
159
+ description?: string
160
+ }
155
161
 
156
162
  export type SchemaFields = {
157
163
  _id: SimpleAppJSONSchema7
@@ -1,3 +1,4 @@
1
+ <%let simpleappconfig = it.jsonschema['x-simpleapp-config'] %>
1
2
  /**
2
3
  * This file was automatically generated by simpleapp generator. Every
3
4
  * MODIFICATION OVERRIDE BY GENERATEOR
@@ -34,12 +35,13 @@ import { Response } from 'express';
34
35
  import {AppUser} from '../commons/decorators/appuser.decorator'
35
36
  import {UserContext} from '../commons/user.context'
36
37
 
38
+
37
39
  <% const getFieldType =(proptype, typename)=>{
38
40
  const systemtypes = ['Boolean','boolean','string','String','number','Number','object','Object','integer','Integer']
39
41
  let tmptypename = typename.replace('[','').replace(']','')
40
42
 
41
43
  if(systemtypes.includes(tmptypename)){
42
-
44
+ if(proptype=='type' ) tmptypename =tmptypename.toLowerCase();
43
45
  }else if(proptype=='schema'){
44
46
  tmptypename= 'schemas.'+tmptypename
45
47
  }else{ //type
@@ -68,20 +70,19 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
68
70
 
69
71
  @Get()
70
72
  <%if(superadmindoctype.includes(it.doctype)){%>
71
- @Roles(Role.SuperAdmin,Role.<%= `${it.typename}_search`%>)
73
+ @Roles(Role.SuperAdmin,Role.<%= `${it.typename}_access`%>)
72
74
  <%}else{%>
73
- @Roles(Role.SuperAdmin,Role.SuperUser,Role.<%= `${it.typename}_search`%>)
75
+ @Roles(Role.SuperAdmin,Role.SuperUser,Role.<%= `${it.typename}_access`%>)
74
76
  <%}%>
75
77
  @HttpCode(200)
76
78
  @ApiResponse({
77
79
  status: 200,
78
- description: 'Found',
79
- type: String
80
+ description: 'Found',
80
81
  })
81
82
  @ApiResponse({ status: 500, description: 'Internal error' })
82
- @ApiOperation({ operationId: 'runHello', description:"Say hello only" })
83
- async hello(@AppUser() appuser: UserContext) {
84
- return `Hello, welcome to ${ this.service.getDocumentName()}`//this._list(appuser);
83
+ @ApiOperation({ operationId: 'runDefault', description:"Run default behavior like say hello" })
84
+ async runDefault(@AppUser() appuser: UserContext) {
85
+ return await this.service.runDefault(appuser)
85
86
  }
86
87
  //autocomplete shall above :id
87
88
  @Post('/autocomplete')
@@ -168,11 +169,8 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
168
169
  <%}%>
169
170
  <% if(['post','put','patch'].includes(api.method)){ %>
170
171
  @ApiBody({ description: 'Request Body',
171
- type:
172
- <%= api.schema
173
- ? (api.schema.includes('[') ? '[schemas.'+api.schema.replace('[','').replace(']','') + ']' : 'schemas.'+api.schema )
174
- : 'Object'
175
- %>
172
+ type: <%= getFieldType('schema',api.schema)%>
173
+
176
174
  })
177
175
  <%}%>
178
176
  @ApiResponse({status: 200,description: '<%=api.description%>'
@@ -187,9 +185,7 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
187
185
  async <%=capitalizeFirstLetter(api.action) %>(
188
186
  @AppUser() appuser: UserContext,
189
187
  <%if(['post','put','patch'].includes(api.method.toLowerCase())){%>
190
- @Body() data:<%= api.schema
191
- ? (api.schema.includes('[') ? 'types.'+api.schema.replace('[','').replace(']','') + '[]' : 'types.'+api.schema )
192
- : 'Object'%>,
188
+ @Body() data:<%= getFieldType('type',api.schema)%>,
193
189
  //@Body() data:any,
194
190
  <%}%>
195
191
  <% if(api.entryPoint && api.entryPoint.includes(':')) {%>
@@ -325,5 +321,26 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
325
321
  async delete(@AppUser() appuser: UserContext,@Param('id') id: string) {
326
322
  return this._delete(appuser,id);
327
323
  }
328
-
324
+
325
+ <% if(simpleappconfig?.printFormats){%>
326
+ @Get(':id/print/:formatid')
327
+ @Roles(Role.SuperAdmin, Role.SuperUser, Role.<%= `${it.typename}_print`%>)
328
+ @ApiResponse({
329
+ status: 200,
330
+ description: 'return base64 pdf string',
331
+ type: String,
332
+ })
333
+ @ApiResponse({ status: 404, description: 'Document not found' })
334
+ @ApiResponse({ status: 500, description: 'Internal error' })
335
+ @ApiOperation({ operationId: 'runPrint' })
336
+ async print(@AppUser() appuser: UserContext, @Param('id') id: string, @Param('formatid') formatid: string) {
337
+ const data = await this.service.print(appuser, id,formatid);
338
+ if (!data) {
339
+ throw new NotFoundException(`${id} not found`, 'not found');
340
+ } else {
341
+ return data;
342
+ }
343
+ }
344
+
345
+ <%}%>
329
346
  }
@@ -64,6 +64,7 @@ export class <%= it.typename %>Processor extends SimpleAppService<<%= it.typenam
64
64
 
65
65
  reCalculateValue(data:<%= it.typename %>){
66
66
  //console.log('trigger new recalculate')
67
+ const $data = data;
67
68
  const jsopbj= new jsonpath['JSONPath']()
68
69
  <% if(it.jsonschema['x-simpleapp-config']['formulas']){ %>
69
70
  <%Object.keys(it.jsonschema['x-simpleapp-config']['formulas']).forEach(function(index) { %>
@@ -71,7 +72,7 @@ export class <%= it.typename %>Processor extends SimpleAppService<<%= it.typenam
71
72
  // <%~ JSON.stringify(fml) %>
72
73
  //const tmp = jsopbj.query(vdata,fieldpath).filter((item:string)=>item!='')
73
74
 
74
- jsopbj.apply(data, '<%~ fml.jsonPath %>', function(value:any) { return <%~fml.formula %> });
75
+ jsopbj.apply($data, '<%~ fml.jsonPath %>', function($item:any) { return <%~fml.formula %> });
75
76
 
76
77
  <%}) %>
77
78
  <%} %>
@@ -19,7 +19,7 @@ import { Request } from '@nestjs/common';
19
19
  let tmptypename = typename.replace('[','').replace(']','')
20
20
 
21
21
  if(systemtypes.includes(tmptypename)){
22
-
22
+ if(proptype=='type' ) tmptypename =tmptypename.toLowerCase();
23
23
  }else if(proptype=='schema'){
24
24
  tmptypename= 'schemas.'+tmptypename
25
25
  }else{ //type
@@ -13,14 +13,32 @@ import { <%= it.typename %>Processor } from '../generate/processors/<%= it.docty
13
13
  //import { <%= it.typename %>,<%= it.typename %>Hooks} from '../generate/types';
14
14
  import * as types from '../generate/types';
15
15
  export { <%= it.typename %>} from '../generate/types';
16
+ <% const getFieldType =(proptype, typename)=>{
17
+ const systemtypes = ['Boolean','boolean','string','String','number','Number','object','Object','integer','Integer']
18
+ let tmptypename = typename.replace('[','').replace(']','')
19
+
20
+ if(systemtypes.includes(tmptypename)){
21
+ if(proptype=='type' ) tmptypename =tmptypename.toLowerCase();
22
+ }else if(proptype=='schema'){
23
+ tmptypename= 'schemas.'+tmptypename
24
+ }else{ //type
25
+ tmptypename= 'types.'+tmptypename
26
+ }
16
27
 
28
+ if(typename.includes('[')){
29
+ return proptype=='schema' ? `[${tmptypename}]` : `${tmptypename}[]`
30
+ }else{
31
+ return tmptypename
32
+ }
33
+ }
34
+ %>
17
35
 
18
36
  @Injectable()
19
37
  export class <%= it.typename %>Service extends <%= it.typename %>Processor {
20
38
  <% const config = it.jsonschema['x-simpleapp-config']%>
21
39
  <%if(config['loseDataIsolation']){%>protected strictIsolation = false;<%}%>
22
40
 
23
- public hooks: types.<%= it.typename %>Hooks = {}
41
+ //protected hooks: types.<%= it.typename %>Hooks = {}
24
42
  constructor(
25
43
  @InjectModel('<%= it.typename %>') mydoc: Model<types.<%= it.typename %>>
26
44
  ){
@@ -28,6 +46,7 @@ export class <%= it.typename %>Service extends <%= it.typename %>Processor {
28
46
  }
29
47
 
30
48
  /***************************** begin x-document-api definitions *****************************************/
49
+ /*
31
50
  <% for(let i=0;i<it.apiSettings.length;i++){%>
32
51
  <% let api = it.apiSettings[i] %>
33
52
  async run<%= capitalizeFirstLetter(api.action) %>(
@@ -50,9 +69,7 @@ export class <%= it.typename %>Service extends <%= it.typename %>Processor {
50
69
  <%}%>
51
70
 
52
71
  <%if(['post','put','patch'].includes(api.method.toLowerCase())){%>
53
- data:<%= api.schema
54
- ? (api.schema.includes('[') ? 'types.'+api.schema.replace('[','').replace(']','') + '[]' : 'types.'+api.schema )
55
- : 'any'%>,
72
+ data:<%= getFieldType('schema',api.schema)%>,
56
73
  <%}%>
57
74
 
58
75
  ){
@@ -63,6 +80,7 @@ export class <%= it.typename %>Service extends <%= it.typename %>Processor {
63
80
  <%}%>
64
81
  }
65
82
  <%}%>
83
+ */
66
84
 
67
85
  /***************************** end x-document-api definitions *****************************************/
68
86
  }
@@ -15,9 +15,9 @@ import {DefaultHooks} from "../types"
15
15
  <% if(typeof obj == 'string') {%>
16
16
  <%= key %> <%if(obj.required){%>?<%}%>: <%= obj %>; //child object
17
17
  <% }else if( Array.isArray( obj)){%>
18
- <%= key %><%if(obj.required){%>?<%}%>: <%= obj[0] %>[]; //array
18
+ <%= key %>?: <%= obj[0] %>[]; //array 1
19
19
  <% }else if( obj.type == 'array'){%>
20
- <%= key %><%if(obj.required){%>?<%}%>: <%= obj.items.type %>[]; //array
20
+ <%= key %><%if(obj.required){%>?<%}%>: <%= obj.items.type %>[]; //array 2
21
21
  <% }else{%>
22
22
  <%= key %> <% if(!obj.required || obj.required==false){%>?<%}%>: <%= obj.type %>; // <%~ JSON.stringify(obj) %>
23
23
  <% } %>
@@ -7,6 +7,8 @@
7
7
  :showNull="showNull"
8
8
  :allowAddNew="allowAddNew"
9
9
  :filter ="filter"
10
+ :multiple="multiple"
11
+ :hideLabel="hideLabel"
10
12
  />
11
13
  </template>
12
14
  <script setup lang="ts">
@@ -19,12 +21,14 @@
19
21
  import { ForeignKey } from '~/types';
20
22
  import { <%= it.typename %> } from "~/simpleapp/generate/openapi";
21
23
  const emits = defineEmits(["change"]);
22
- const modelValue = defineModel<string>();
24
+ const modelValue = defineModel<string|string[]>();
23
25
  const props = defineProps<{
24
26
  placeholder?: string;
25
27
  showNull?:boolean;
26
28
  allowAddNew?: boolean;
27
29
  filter?: <%= it.typename %>;
30
+ multiple?:boolean;
31
+ hideLabel?:boolean;
28
32
  }>()
29
33
  const change = (id:string,data:ForeignKey) =>{
30
34
  emits('change',id,data)
@@ -7,7 +7,7 @@
7
7
  <template>
8
8
  <div>
9
9
  <% if(it.autocompletename){%>
10
- <title v-if="id">{{ data.<%=it.autocompletename%> ?? data.<%=it.autocompletecode%>}}</title>
10
+ <title v-if="id">{{ data.<%=it.autocompletename%> }}</title>
11
11
  <%}else{%>
12
12
  <title v-if="id">{{ t(doc.getDocName())}}</title>
13
13
  <%}%>
@@ -1,69 +1,12 @@
1
- <% const skipcolumns = ['_id','createdBy','created','updatedBy','updated','orgId','branchId','tenantId','doctype'] %>
2
1
  <template>
3
-
4
- <PageDocList :document="doc" :columns="columns" :data="docdata" :sorts="sorts">
5
- <template #mobileList="{index,item}">
6
- </template>
7
- <template #dataTableColumns>
8
- <%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
9
- <%let obj=it.jsonschema.properties[key] %>
10
- <%let config=it.jsonschema['x-simpleapp-config'] %>
11
- <%if(skipcolumns.indexOf(key)>=0){%>
12
- <%} else if(config['uniqueKey'] && (config['uniqueKey']==key || config['documentTitle']==key) ){%>
13
- <Column #body="{index,data}" :header="t('<%=key%>')">
14
- <RendererLink :value="data" :setting="{path:'<%=it.name%>'}" :fields="['<%=key%>']">{{ data.<%=key%> }}</RendererLink>
15
- </Column>
16
-
17
- <%} else if(['string','number','integer','boolean'].indexOf(obj.type)>=0){%>
18
- <Column #body="{index,data}" :header="t('<%=key%>')">
19
- {{data.<%=key%>}}
20
- </Column>
21
- <%} else if(obj.type =='object' && obj['x-foreignkey'] ){%>
22
- <Column #body="{index,data}" :header="t('<%=key%>')">
23
- <RendererViewer :value="data.<%=key%>" :setting="{documentName:'<%=obj["x-foreignkey"]%>'}" :fields="['<%=key%>']">{{ data.label }}</RendererViewer>
24
- </Column>
25
- <%}%>
26
- <%})%>
27
- </template>
28
- <template #default><div><NuxtPage :_id="id ?? 'new'"/></div></template>
29
- </PageDocList>
2
+ <LadingPage/>
30
3
  </template>
31
- <script setup lang="ts">
4
+ <script lang="ts" setup>
32
5
  /**
33
6
  * This file was automatically generated by simpleapp generator.
34
7
  * --remove-this-line-to-prevent-override--
35
8
  * last change 2023-09-09
36
9
  * author: Ks Tan
37
10
  */
38
- import { <%= it.typename %> } from '~/simpleapp/generate/openapi';
39
-
40
- const {$<%= it.typename %>Doc,$listen } = useNuxtApp();
41
- const doc = $<%= it.typename %>Doc()
42
- const docdata = doc.getReactiveData();
43
- type <%= it.typename %>Key = keyof <%= it.typename %>
44
- definePageMeta({
45
- menuPath:'nocategory/<%= it.name %>'
46
- });
47
-
48
- const columns: <%= it.typename %>Key[] = [<%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
49
- <%let obj=it.jsonschema.properties[key] %>
50
- <%let config=it.jsonschema['x-simpleapp-config'] %>
51
- <%if(skipcolumns.indexOf(key)>=0){%>
52
- <%}else if(['string','number','integer','boolean'].indexOf(obj.type)>=0){%>'<%=key%>',
53
- <%} %>
54
- <%})%>]
55
-
56
-
57
-
58
-
59
-
60
- const sorts:string[][] = [
61
- <%if(it.jsonschema['x-simpleapp-config'] && it.jsonschema['x-simpleapp-config']['uniqueKey']){%>
62
- ['<%=it.jsonschema['x-simpleapp-config']['uniqueKey']%>','asc'],
63
- <%}%>
64
- ]
65
-
66
- const id=computed(()=>useRoute().params.id)
67
- </script>
68
-
69
-
11
+ import LadingPage from '../../<%= it.name %>.vue'
12
+ </script>
@@ -53,25 +53,23 @@ export class <%= it.typename%>Client extends SimpleAppClient<openapi.<%= it.type
53
53
  const apiobj = getDocumentApi('<%=it.name %>')
54
54
  super(apiobj,'<%= it.doctype %>','<%=it.name %>')
55
55
  this.event=$event
56
- this.listen=$listen
57
-
58
- this.setNew();
59
- watch(this.getData(),(newvalue)=>{
60
- //console.log("Something change",this.completeformula)
56
+ this.listen=$listen
57
+ this.setNew();
58
+ }
59
+
60
+ setWatchChange = ()=>{
61
+ this.unwantchobj = watch(this.getData(),(newvalue)=>{
61
62
  if(this.completeformula==true){
62
- // console.log("Trigger caclculate")
63
63
  this.completeformula=false
64
64
  this.reCalculateValue()
65
65
  this.completeformula=true
66
- }else{
67
- //console.log("avoid unlimited loop")
68
- }
69
- })
70
-
66
+ }
67
+ },{deep:true})
71
68
  }
72
69
  setNew = ()=>{
73
70
  const newdata = Default<%= it.typename%>(randomUUID())
74
71
  this.setData(newdata)
72
+ this.setWatchChange()
75
73
  return true
76
74
  }
77
75
  <%if(it.jsonschema.properties['readOnly'] || it.jsonschema.properties['documentStatus']){%>
@@ -176,7 +174,7 @@ export class <%= it.typename%>Client extends SimpleAppClient<openapi.<%= it.type
176
174
 
177
175
  reCalculateValue(){
178
176
  //console.log('trigger new recalculate')
179
- const data = this.getData()
177
+ const $data = this.getData()
180
178
 
181
179
  <% if(it.jsonschema['x-simpleapp-config']['formulas']){ %>
182
180
  <%Object.keys(it.jsonschema['x-simpleapp-config']['formulas']).forEach(function(index) { %>
@@ -184,7 +182,7 @@ export class <%= it.typename%>Client extends SimpleAppClient<openapi.<%= it.type
184
182
  // <%~ JSON.stringify(fml) %>
185
183
  //const tmp = jsonpath.query(vdata,fieldpath).filter((item:string)=>item!='')
186
184
 
187
- jsonpath.apply(data, '<%~ fml.jsonPath %>', function(value) { return <%~fml.formula %> });
185
+ jsonpath.apply($data, '<%~ fml.jsonPath %>', function($item) { return <%~fml.formula %> });
188
186
 
189
187
  <%}) %>
190
188
  <%} %>
@@ -9,7 +9,12 @@ import { Module, MiddlewareConsumer, NestModule, Provider } from '@nestjs/common
9
9
  import { MongooseModule,MongooseModuleOptions } from '@nestjs/mongoose';
10
10
  import { GraphQLModule } from '@nestjs/graphql';
11
11
  import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
12
-
12
+ import {GenerateModule} from './simpleapp/simpleapp.module'
13
+ <% const nestmodules = it.configs.additionalNestModules%>
14
+ <% for(let i=0; i<nestmodules.length;i++){ %>
15
+ <% const modulename = capitalizeFirstLetter(nestmodules[i]) %>
16
+ import {<%= modulename %>Module } from './<%=nestmodules[i]%>/<%=nestmodules[i]%>.module';
17
+ <%}%>
13
18
  import { APP_GUARD,APP_INTERCEPTOR,APP_FILTER } from '@nestjs/core';
14
19
  import { ResponseInterceptor } from './simpleapp/generate/commons/interceptors/response.interceptor'
15
20
  import {
@@ -28,8 +33,6 @@ import { AppResolver } from './app.resolver';
28
33
  import { TenantMiddleware } from './simpleapp/generate/commons/middlewares/tenant.middleware';
29
34
  import { AppController } from './app.controller';
30
35
  import { AppService } from './app.service';
31
- import {GenerateModule} from './simpleapp/simpleapp.module'
32
- import { CloudApiModule } from './cloudapi/cloudapi.module';
33
36
  import { UserMongoSchema } from './simpleapp/generate/models/user.model';
34
37
  import { PermissionMongoSchema } from './simpleapp/generate/models/perm.model';
35
38
  import { ApiEventMongoSchema } from './simpleapp/generate/models/apievent.model';
@@ -76,7 +79,12 @@ import { EventEmitterModule } from '@nestjs/event-emitter';
76
79
  tokenValidation: TokenValidation.ONLINE,
77
80
  }),
78
81
  GenerateModule,
79
- CloudApiModule,
82
+
83
+ <% for(let i=0; i<nestmodules.length;i++){ %>
84
+ <% const modulename = capitalizeFirstLetter(nestmodules[i]) %>
85
+ <%= modulename %>Module,
86
+ <%}%>
87
+
80
88
  MongooseModule.forFeature([
81
89
  { name: 'User', schema: UserMongoSchema },
82
90
  { name: 'Permission', schema: PermissionMongoSchema },
@@ -12,4 +12,4 @@ import { CloudApiService } from './cloudapi.service';
12
12
  providers: [CloudApiService],
13
13
  exports: [CloudApiService],
14
14
  })
15
- export class CloudApiModule {}
15
+ export class CloudapiModule {}
@@ -0,0 +1,4 @@
1
+ wwwroot/*.js
2
+ node_modules
3
+ typings
4
+ dist
@@ -0,0 +1 @@
1
+ # empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
@@ -0,0 +1,8 @@
1
+ .gitignore
2
+ .npmignore
3
+ api.ts
4
+ base.ts
5
+ common.ts
6
+ configuration.ts
7
+ git_push.sh
8
+ index.ts
@@ -0,0 +1,23 @@
1
+ # OpenAPI Generator Ignore
2
+ # Generated by openapi-generator https://github.com/openapitools/openapi-generator
3
+
4
+ # Use this file to prevent files from being overwritten by the generator.
5
+ # The patterns follow closely to .gitignore or .dockerignore.
6
+
7
+ # As an example, the C# client generator defines ApiClient.cs.
8
+ # You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9
+ #ApiClient.cs
10
+
11
+ # You can match any string of characters against a directory, file or extension with a single asterisk (*):
12
+ #foo/*/qux
13
+ # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14
+
15
+ # You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16
+ #foo/**/qux
17
+ # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18
+
19
+ # You can also negate patterns with an exclamation (!).
20
+ # For example, you can ignore all files in a docs folder with the file extension .md:
21
+ #docs/*.md
22
+ # Then explicitly reverse the ignore rule for a single file:
23
+ #!docs/README.md