@simitgroup/simpleapp-generator 1.6.6-m-alpha → 1.6.6-n-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.
- package/ReleaseNote.md +4 -0
- package/dist/buildinschemas/customfield.js +1 -1
- package/dist/buildinschemas/customfield.js.map +1 -1
- package/dist/buildinschemas/index.d.ts +1 -0
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +3 -2
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +2 -1
- package/dist/framework.js.map +1 -1
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +0 -5
- package/dist/generate.js.map +1 -1
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
- package/dist/processors/jsonschemabuilder.js +75 -35
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/type.d.ts +1 -0
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js.map +1 -1
- package/package.json +1 -1
- package/reset-install.sh +2 -1
- package/src/buildinschemas/customfield.ts +47 -0
- package/src/buildinschemas/index.ts +11 -11
- package/src/framework.ts +2 -0
- package/src/processors/jsonschemabuilder.ts +268 -192
- package/src/type.ts +3 -2
- package/templates/basic/nest/apischema.ts.eta +33 -22
- package/templates/basic/nest/default.ts.eta +6 -1
- package/templates/basic/nest/type.ts.eta +9 -5
- package/templates/basic/nuxt/default.ts.eta +7 -1
- package/templates/basic/nuxt/pages.form.vue.eta +5 -3
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +70 -32
- package/templates/nest/src/enums/enums.generate.ts.eta +23 -0
- package/templates/nest/src/simpleapp/generate/apischemas/simpleapp.apischema.ts.eta +7 -1
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +7 -1
- package/templates/nuxt/components/simpleApp/SimpleAppForm.vue.eta +8 -0
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +15 -2
- package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +6 -1
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +4 -0
- package/templates/nuxt/enums/enums.generate.ts.eta +23 -0
- package/templates/nuxt/i18n/lang/cn.ts._eta +15 -0
- package/templates/nuxt/i18n/lang/en.ts.eta +19 -0
- package/templates/nuxt/lang/en.ts.eta +1 -1
- package/templates/nuxt/plugins/18.simpleapp-custom-field-store.ts.eta +38 -0
- package/templates/nuxt/plugins/19.app-plugins.ts.eta +422 -0
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +8 -1
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +249 -213
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppCustomFieldClient.ts.eta +191 -0
- package/templates/nuxt/types/schema.ts.eta +19 -2
|
@@ -8,32 +8,43 @@ import { ApiProperty } from '@nestjs/swagger';
|
|
|
8
8
|
import { Field, ObjectType,ID } from '@nestjs/graphql';
|
|
9
9
|
import GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json';
|
|
10
10
|
<%Object.keys(it.models).forEach(function(name) { %>
|
|
11
|
-
<% let schema = it.models[name].model %>
|
|
12
|
-
@ObjectType()
|
|
13
|
-
export class <%= name %>{
|
|
11
|
+
<% let schema = it.models[name].model %>
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
<% // Skip Draw Dynamic Object Class %>
|
|
14
|
+
<% if(it.models[name].type === 'object' && schema && Object.keys(schema).length === 0 ) return; %>
|
|
15
|
+
|
|
16
|
+
@ObjectType()
|
|
17
|
+
export class <%= name %> {
|
|
18
|
+
|
|
19
|
+
<% Object.keys(schema).forEach(function(key) { %>
|
|
20
|
+
<% let obj = schema[key] %>
|
|
21
|
+
<% if(typeof obj == 'string') {%>
|
|
22
|
+
<% // This Is Dynamic Object %>
|
|
23
|
+
<% if(it.models?.[obj] && it.models[obj]?.model && Object.keys(it.models[obj]?.model).length === 0) { %>
|
|
24
|
+
@Field(()=>GraphQLJSON)
|
|
25
|
+
@ApiProperty({ type:()=>Object,required: false, default: {} })
|
|
26
|
+
<%= key %>: Object;
|
|
27
|
+
<% } else { %>
|
|
18
28
|
@Field()
|
|
19
29
|
@ApiProperty({type: ()=><%=obj%>})
|
|
20
|
-
<%= key %>: <%= obj %>;
|
|
21
|
-
<%} else if(typeof obj.default !='undefined' && JSON.stringify(obj.default)=='{}'){%>
|
|
22
|
-
@Field(()=>GraphQLJSON)
|
|
23
|
-
@ApiProperty({ type:()=>Object,required: false, default: {} })
|
|
24
|
-
<%= key %>: Object;
|
|
25
|
-
<% }else if( Array.isArray( obj)){%>
|
|
26
|
-
@Field(type=>[<%=initType(obj[0]) %>])
|
|
27
|
-
@ApiProperty({type: ()=>[<%=initType(obj[0]) %>] })
|
|
28
|
-
<%= key %>: <%= obj[0] %>[];
|
|
29
|
-
|
|
30
|
-
<% }else{%>
|
|
31
|
-
@Field()
|
|
32
|
-
@ApiProperty(<%~ JSON.stringify(obj)%> )
|
|
33
|
-
<%= key %>: <%= obj.type %>;
|
|
30
|
+
<%= key %>: <%= obj %>;
|
|
34
31
|
<% } %>
|
|
35
|
-
<% })
|
|
36
|
-
|
|
32
|
+
<%} else if(typeof obj.default !='undefined' && JSON.stringify(obj.default)=='{}'){%>
|
|
33
|
+
@Field(()=>GraphQLJSON)
|
|
34
|
+
@ApiProperty({ type:()=>Object,required: false, default: {} })
|
|
35
|
+
<%= key %>: Object;
|
|
36
|
+
<% } else if( Array.isArray( obj)){%>
|
|
37
|
+
@Field(type=>[<%=initType(obj[0]) %>])
|
|
38
|
+
@ApiProperty({type: ()=>[<%=initType(obj[0]) %>] })
|
|
39
|
+
<%= key %>: <%= obj[0] %>[];
|
|
40
|
+
|
|
41
|
+
<% }else{%>
|
|
42
|
+
@Field()
|
|
43
|
+
@ApiProperty(<%~ JSON.stringify(obj)%> )
|
|
44
|
+
<%= key %>: <%= obj.type %>;
|
|
45
|
+
<% } %>
|
|
46
|
+
<% }) %>
|
|
47
|
+
}
|
|
37
48
|
<%}) %>
|
|
38
49
|
|
|
39
50
|
/*****************************customized code begin here *****************************************/
|
|
@@ -13,7 +13,12 @@ export const Default<%=modelname%> = (uuid:string)=>{
|
|
|
13
13
|
return undefined
|
|
14
14
|
<%} else{%>
|
|
15
15
|
return {
|
|
16
|
-
|
|
16
|
+
<% if(it.models?.[modelname] && it.models[modelname]?.model && Object.keys(it.models[modelname]?.model).length === 0) { %>
|
|
17
|
+
// Dynamic Object
|
|
18
|
+
<% } else { %>
|
|
19
|
+
_id : uuid,
|
|
20
|
+
<% } %>
|
|
21
|
+
|
|
17
22
|
<%Object.keys(it.models[modelname].model).forEach(function(key){%>
|
|
18
23
|
<%let field=it.models[modelname].model[key]%>
|
|
19
24
|
|
|
@@ -9,20 +9,24 @@ import {DefaultHooks} from "../types"
|
|
|
9
9
|
<%Object.keys(it.models).forEach(function(prop){ %>
|
|
10
10
|
<% let schema = it.models[prop] %>
|
|
11
11
|
export type <%= prop %> = {
|
|
12
|
-
|
|
12
|
+
<% // Dynamic Object %>
|
|
13
|
+
<% if(it.models[prop].type === 'object' && it.models[prop]?.model && Object.keys(it.models[prop].model).length === 0 ) { %>
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
<% } else { %>
|
|
13
16
|
<%Object.keys(schema.model).forEach(function(key){ %>
|
|
14
17
|
<% const obj = schema.model[key] %>
|
|
15
18
|
<% if(typeof obj == 'string') {%>
|
|
16
|
-
<%= key %> <%if(
|
|
19
|
+
<%= key %> <%if(!schema.required.includes(key)){%>?<%}%>: <%= obj %>; //child object
|
|
17
20
|
<% }else if( Array.isArray( obj)){%>
|
|
18
|
-
<%= key
|
|
21
|
+
<%= key %> <%if(!schema.required.includes(key)){%>?<%}%>: <%= obj[0] %>[]; //array 1
|
|
19
22
|
<% }else if( obj.type == 'array'){%>
|
|
20
|
-
<%= key
|
|
23
|
+
<%= key %> <%if(!schema.required.includes(key)){%>?<%}%>: <%= obj.items.type %>[]; //array 2
|
|
21
24
|
<% }else{%>
|
|
22
25
|
<%= key %> <% if(!obj.required || obj.required==false){%>?<%}%>: <%= obj.type %>; // <%~ JSON.stringify(obj) %>
|
|
23
26
|
<% } %>
|
|
24
27
|
<%})%>
|
|
25
|
-
|
|
28
|
+
|
|
29
|
+
<% } %>
|
|
26
30
|
}
|
|
27
31
|
<%})%>
|
|
28
32
|
|
|
@@ -12,7 +12,13 @@ export const Default<%=modelname%> = (uuid:string)=>{
|
|
|
12
12
|
return undefined
|
|
13
13
|
<%} else{%>
|
|
14
14
|
return {
|
|
15
|
-
|
|
15
|
+
<% if(it.models?.[modelname] && it.models[modelname]?.model && Object.keys(it.models[modelname]?.model).length === 0) { %>
|
|
16
|
+
// Dynamic Object
|
|
17
|
+
<% } else { %>
|
|
18
|
+
_id : uuid,
|
|
19
|
+
<% } %>
|
|
20
|
+
|
|
21
|
+
|
|
16
22
|
<%Object.keys(it.models[modelname].model).forEach(function(key){%>
|
|
17
23
|
<%let field=it.models[modelname].model[key]%>
|
|
18
24
|
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
<% } else {%>
|
|
59
59
|
<%~ getBasicElement('text',`#/properties/${key}`,`data.${key}`) %>
|
|
60
60
|
<% }%>
|
|
61
|
-
<% } else if(obj.type=='object' && obj.properties){ %>
|
|
61
|
+
<% } else if(obj.type=='object' && obj.properties && key !== 'more'){ %>
|
|
62
62
|
<SimpleAppValue :setting="o.getField('#/properties/<%= key %>')">
|
|
63
63
|
<%Object.keys(obj.properties).forEach(function(skey) { %>
|
|
64
64
|
<% let sobj=obj.properties[skey] %>
|
|
@@ -125,8 +125,10 @@
|
|
|
125
125
|
</Column>
|
|
126
126
|
</SimpleAppInputTable>
|
|
127
127
|
<% } else{%>
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
<% if(key !== 'more'){ %>
|
|
129
|
+
<!-- Can auto generate <%=obj.key %> -->
|
|
130
|
+
<!-- <%~ JSON.stringify(obj) %>-->
|
|
131
|
+
<% } %>
|
|
130
132
|
<%}%>
|
|
131
133
|
<%})%>
|
|
132
134
|
</div>
|
|
@@ -27,7 +27,12 @@ export type {
|
|
|
27
27
|
<%= it.typename%> ,
|
|
28
28
|
<%Object.keys(it.schema).forEach(function(key){%>
|
|
29
29
|
<% if(typeof it.schema[key]=='string' || (Array.isArray(it.schema[key]) && typeof it.schema[key][0]=='string' && it.schema[key][0]!='string')){%>
|
|
30
|
-
|
|
30
|
+
<% const typeKey = it.schema[key] %>
|
|
31
|
+
<% if(it.models?.[typeKey] && it.models?.[typeKey].type === 'object' && Object.keys(it.models?.[typeKey].model).length == 0) { %>
|
|
32
|
+
// <%= key %>, Dynamic Object
|
|
33
|
+
<% } else { %>
|
|
34
|
+
<%= it.schema[key] %>,
|
|
35
|
+
<% } %>
|
|
31
36
|
<%} else {%>
|
|
32
37
|
/*<%~ key + JSON.stringify(it.schema[key]) %>,*/
|
|
33
38
|
<%} %>
|
|
@@ -36,7 +41,7 @@ export type {
|
|
|
36
41
|
} from '../openapi'
|
|
37
42
|
|
|
38
43
|
export class <%= capitalizeFirstLetter(it.name)%>Client extends SimpleAppClient<openapi.<%= capitalizeFirstLetter(it.name)%>,openapi.<%= it.name.toUpperCase()%>Api>{
|
|
39
|
-
public readonly schema= <%~ JSON.stringify(it.jsonschema) %> as SchemaType;
|
|
44
|
+
public override readonly schema= <%~ JSON.stringify(it.jsonschema) %> as SchemaType;
|
|
40
45
|
protected documentIdentityCode='<%~ it.autocompletecode %>'
|
|
41
46
|
protected documentIdentityName='<%~ it.autocompletename %>'
|
|
42
47
|
<%if(it.jsonschema['x-simpleapp-config']['generateDocumentNumber']){%>
|
|
@@ -49,30 +54,47 @@ export class <%= capitalizeFirstLetter(it.name)%>Client extends SimpleAppClient<
|
|
|
49
54
|
xorg='MC0wLTA' //0-0-0
|
|
50
55
|
}
|
|
51
56
|
|
|
52
|
-
//const apipath = `${useRuntimeConfig().public.API_URL}/${xorg}`
|
|
53
|
-
//const apiobj = new <%= it.name.toUpperCase()%>Api(undefined,apipath,$axios)
|
|
54
57
|
const apiobj = getDocumentApi('<%=it.name %>')
|
|
55
58
|
super(apiobj,'<%= it.doctype %>','<%=it.name %>')
|
|
56
59
|
this.event=$event
|
|
57
60
|
this.listen=$listen
|
|
58
|
-
this.setNew();
|
|
61
|
+
this.setNew();
|
|
62
|
+
|
|
63
|
+
this.processCustomField();
|
|
59
64
|
}
|
|
60
65
|
|
|
61
|
-
setWatchChange = ()=>{
|
|
66
|
+
override setWatchChange = ()=>{
|
|
62
67
|
this.unwantchobj = watch(this.getData(),(newvalue)=>{
|
|
63
68
|
if(this.completeformula==true){
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
this.completeformula=false
|
|
70
|
+
this.reCalculateValue()
|
|
71
|
+
this.completeformula=true
|
|
67
72
|
}
|
|
68
|
-
},{deep:true})
|
|
73
|
+
},{deep:true})
|
|
74
|
+
|
|
75
|
+
<% if(!['Plugins', 'Plugininstallations', 'Customfield'].includes(capitalizeFirstLetter(it.name))) { %>
|
|
76
|
+
const { $customFieldStore, $appPluginsStore } = useNuxtApp();
|
|
77
|
+
if (!this._customFieldWatch) {
|
|
78
|
+
this._customFieldWatch = watch(
|
|
79
|
+
[() => $customFieldStore.data, () => $appPluginsStore.installedPlugins],
|
|
80
|
+
([newCustomField, newPlugins], [oldCustomField, oldPlugins]) => {
|
|
81
|
+
this.processCustomField();
|
|
82
|
+
},
|
|
83
|
+
{ immediate: false, deep: true },
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
<% } %>
|
|
87
|
+
|
|
69
88
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
89
|
+
|
|
90
|
+
override setNew = ()=>{
|
|
91
|
+
const newdata = Default<%= it.typename%>(randomUUID())
|
|
92
|
+
this.setData(newdata)
|
|
93
|
+
this.setWatchChange()
|
|
94
|
+
return true
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/********************************** begin document status code *********************************/
|
|
76
98
|
<%if(it.jsonschema.properties['readOnly'] || it.jsonschema.properties['documentStatus']){%>
|
|
77
99
|
public isReadOnly():boolean{
|
|
78
100
|
<%if(it.jsonschema.properties['readOnly']){%>
|
|
@@ -87,7 +109,10 @@ export class <%= capitalizeFirstLetter(it.name)%>Client extends SimpleAppClient<
|
|
|
87
109
|
return false
|
|
88
110
|
}
|
|
89
111
|
<%}%>
|
|
90
|
-
|
|
112
|
+
/*********************************** end document status code **********************************/
|
|
113
|
+
|
|
114
|
+
/*********************************** begin add function code ***********************************/
|
|
115
|
+
<%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
|
|
91
116
|
<% let obj=it.jsonschema.properties[key] %>
|
|
92
117
|
|
|
93
118
|
<% if(obj.type=='array' && obj.items && obj.items.type=='object' && obj.items['properties']){ %>
|
|
@@ -96,14 +121,12 @@ export class <%= capitalizeFirstLetter(it.name)%>Client extends SimpleAppClient<
|
|
|
96
121
|
|
|
97
122
|
this.getReactiveData().value.<%= key %>.push(Default<%= it.typename%><%=capitalizeFirstLetter(key)%>(randomUUID()))
|
|
98
123
|
return this.getReactiveData().value.<%= key %>.length -1
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
124
|
+
}
|
|
102
125
|
<%}%>
|
|
103
126
|
<%})%>
|
|
104
|
-
|
|
127
|
+
/************************************ end add function code ************************************/
|
|
105
128
|
|
|
106
|
-
public getActions(){
|
|
129
|
+
public override getActions(){
|
|
107
130
|
const actions = super.getActions()
|
|
108
131
|
actions.docstatus=[
|
|
109
132
|
<%for(let i=0;i<it.docStatusSettings.length;i++){%>
|
|
@@ -121,7 +144,7 @@ export class <%= capitalizeFirstLetter(it.name)%>Client extends SimpleAppClient<
|
|
|
121
144
|
}
|
|
122
145
|
|
|
123
146
|
|
|
124
|
-
/*****************************begin x-document-api code*****************************************/
|
|
147
|
+
/***************************** begin x-document-api code *****************************************/
|
|
125
148
|
|
|
126
149
|
<%for(let i=0;i<it.apiSettings.length;i++){%>
|
|
127
150
|
<% let api = it.apiSettings[i] %>
|
|
@@ -141,12 +164,27 @@ export class <%= capitalizeFirstLetter(it.name)%>Client extends SimpleAppClient<
|
|
|
141
164
|
<%=api.queryPara[j]%>: string,
|
|
142
165
|
<%}%>
|
|
143
166
|
<%}%>
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
)
|
|
167
|
+
|
|
168
|
+
<% if(['post','put','patch'].includes(api.method)){ %>
|
|
169
|
+
data:
|
|
170
|
+
<%
|
|
171
|
+
const convertTypes = ['Object', 'String'];
|
|
172
|
+
const openApiPrefix = convertTypes.includes(api.schema.replace('[','').replace(']','')) ? '' : 'openapi.';
|
|
173
|
+
%>
|
|
174
|
+
<%=
|
|
175
|
+
api.schema ?
|
|
176
|
+
(
|
|
177
|
+
api.schema.includes('[') ?
|
|
178
|
+
openApiPrefix + (
|
|
179
|
+
openApiPrefix == '' ?
|
|
180
|
+
api.schema.replace('[','').replace(']','').toLowerCase() :
|
|
181
|
+
api.schema.replace('[','').replace(']','')
|
|
182
|
+
) + '[]' :
|
|
183
|
+
openApiPrefix + (openApiPrefix == '' ? api.schema.toLowerCase() : api.schema)
|
|
184
|
+
)
|
|
185
|
+
: 'any' %>
|
|
186
|
+
<%}%>
|
|
187
|
+
){
|
|
150
188
|
//const recordid: string = this.data.value._id ?? '';
|
|
151
189
|
return await this.docapi.run<%=capitalizeFirstLetter(api.action)%>(
|
|
152
190
|
<% if(api.entryPoint && api.entryPoint.includes(':')) {%>
|
|
@@ -161,7 +199,7 @@ export class <%= capitalizeFirstLetter(it.name)%>Client extends SimpleAppClient<
|
|
|
161
199
|
<%}%>
|
|
162
200
|
<% if(['post','put','patch'].includes(api.method)){ %>data<%}%>
|
|
163
201
|
)
|
|
164
|
-
.then((res
|
|
202
|
+
.then((res) => {
|
|
165
203
|
if(this.event){this.event('info:<%=api.action%>',res.data)}
|
|
166
204
|
return res.data;
|
|
167
205
|
}).catch((res:any)=>{
|
|
@@ -173,7 +211,7 @@ export class <%= capitalizeFirstLetter(it.name)%>Client extends SimpleAppClient<
|
|
|
173
211
|
|
|
174
212
|
|
|
175
213
|
|
|
176
|
-
reCalculateValue(){
|
|
214
|
+
override reCalculateValue(){
|
|
177
215
|
//console.log('trigger new recalculate')
|
|
178
216
|
const $data = this.getData()
|
|
179
217
|
|
|
@@ -280,7 +318,7 @@ export class <%= capitalizeFirstLetter(it.name)%>Client extends SimpleAppClient<
|
|
|
280
318
|
return await Promise.reject(errors);
|
|
281
319
|
}
|
|
282
320
|
}
|
|
283
|
-
return await this.docapi.<%=it.name %>ControllerSetStatus<%=capitalizeFirstLetter(setting.status)%>(id,data).then((res
|
|
321
|
+
return await this.docapi.<%=it.name %>ControllerSetStatus<%=capitalizeFirstLetter(setting.status)%>(id,data).then((res)=>{
|
|
284
322
|
$event('Notification',{
|
|
285
323
|
documentName:this.getDocName(),
|
|
286
324
|
summary:t('setStatus<%=capitalizeFirstLetter(setting.status)%>Success'),
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2025-06-09
|
|
5
|
+
*/
|
|
6
|
+
<% it.modules.forEach(function(module) { %>
|
|
7
|
+
<% if (module.schema && module.schema.properties) { %>
|
|
8
|
+
<% Object.entries(module.schema.properties).forEach(function([propName, prop]) { %>
|
|
9
|
+
<% if (prop.enum) { %>
|
|
10
|
+
export enum <%= module.docname %><%= propName.charAt(0).toUpperCase() + propName.slice(1) + 'Enum' %> {
|
|
11
|
+
<% prop.enum.forEach(function(enumValue, index) { %>
|
|
12
|
+
<% if (enumValue === '') { %>
|
|
13
|
+
EMPTY = ''<%= index < prop.enum.length - 1 ? ',' : '' %>
|
|
14
|
+
<% } else { %>
|
|
15
|
+
<%= enumValue.replace(/([A-Z])/g, '_$1').replace(/^_/, '').toUpperCase().replace(/-/g, '_') %> = '<%= enumValue %>'<%= index < prop.enum.length - 1 ? ',' : '' %>
|
|
16
|
+
<% } %>
|
|
17
|
+
<% }); %>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
<% } %>
|
|
21
|
+
<% }); %>
|
|
22
|
+
<% } %>
|
|
23
|
+
<% }); %>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
8
|
+
import { ApiProperty, ApiExtraModels } from '@nestjs/swagger';
|
|
9
9
|
export class ApiKeyValuePair {
|
|
10
10
|
@ApiProperty({
|
|
11
11
|
type: Object,
|
|
@@ -54,3 +54,9 @@ export class ApiSearchBody {
|
|
|
54
54
|
@ApiProperty({ type: () => Object, required: false })
|
|
55
55
|
lookup: Object;
|
|
56
56
|
}
|
|
57
|
+
|
|
58
|
+
@ApiExtraModels()
|
|
59
|
+
export class NoParam {}
|
|
60
|
+
|
|
61
|
+
@ApiExtraModels()
|
|
62
|
+
export class DynamicParam {}
|
|
@@ -290,4 +290,10 @@ export type SchemaFields = {
|
|
|
290
290
|
readOnly?: boolean | undefined;
|
|
291
291
|
writeOnly?: boolean | undefined;
|
|
292
292
|
example?: JSONSchema7Type | undefined;
|
|
293
|
-
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export type NoParam = {}
|
|
296
|
+
|
|
297
|
+
export type DynamicParam = {
|
|
298
|
+
[key: string]: any;
|
|
299
|
+
}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<form class="simpleapp-form" @submit.prevent="true">
|
|
3
3
|
<slot name="default" :data="document.getData()" :getField="getField"></slot>
|
|
4
|
+
<slot name="customField">
|
|
5
|
+
<!-- TODO: TS Error -->
|
|
6
|
+
<SimpleAppCustomFieldFormSection
|
|
7
|
+
:customFieldJsonSchema="document.schema.properties.more"
|
|
8
|
+
:data="document.getData().more"
|
|
9
|
+
:handleGetField="getField"
|
|
10
|
+
/>
|
|
11
|
+
</slot>
|
|
4
12
|
</form>
|
|
5
13
|
</template>
|
|
6
14
|
<script setup lang="ts">
|
|
@@ -249,11 +249,24 @@
|
|
|
249
249
|
v-else-if="inputType == SimpleAppInputType.chip"
|
|
250
250
|
v-model="modelValue"
|
|
251
251
|
:type="type"
|
|
252
|
-
:pt="
|
|
252
|
+
:pt="
|
|
253
|
+
pt ?? {
|
|
254
|
+
root: {
|
|
255
|
+
class: 'min-h-[2.35rem]',
|
|
256
|
+
},
|
|
257
|
+
input: {
|
|
258
|
+
class: 'flex flex-wrap items-center gap-2',
|
|
259
|
+
},
|
|
260
|
+
inputitemfield: {
|
|
261
|
+
class: 'focus:outline-none focus:ring-0',
|
|
262
|
+
},
|
|
263
|
+
}
|
|
264
|
+
"
|
|
253
265
|
:disabled="isReadonly"
|
|
254
266
|
:input-id="slotprops.uuid"
|
|
255
267
|
:path="setting.instancepath"
|
|
256
268
|
:placeholder="placeholder"
|
|
269
|
+
class="w-full flex leading-none m-0 py-0.5 px-3 rounded-md text-surface-800 dark:text-white/80 placeholder:text-surface-400 dark:placeholder:text-surface-500 bg-surface-0 dark:bg-surface-950 border border-surface-300 dark:border-surface-700 invalid:focus:ring-red-200 invalid:hover:border-red-500 hover:border-surface-400 dark:hover:border-surface-600 focus:outline-none focus:outline-offset-0 focus:ring-1 focus:ring-primary-500 dark:focus:ring-primary-400 focus:z-10 appearance-none transition-colors duration-200"
|
|
257
270
|
v-bind="componentProps"
|
|
258
271
|
@update:model-value="onChange"
|
|
259
272
|
/>
|
|
@@ -481,7 +494,7 @@ const emits = defineEmits([
|
|
|
481
494
|
]);
|
|
482
495
|
|
|
483
496
|
const onChange = () => {
|
|
484
|
-
if (props.setting
|
|
497
|
+
if (props.setting?.document?.isReady()) {
|
|
485
498
|
pt.value = undefined;
|
|
486
499
|
resetcount.value++;
|
|
487
500
|
emits("change", modelValue.value);
|
|
@@ -55,7 +55,12 @@ const modelValue = defineModel<any[]>();
|
|
|
55
55
|
|
|
56
56
|
const addNew = () => {
|
|
57
57
|
const field = props.setting.path.split("/").at(-1);
|
|
58
|
-
props.setting.document[`add${field}`]
|
|
58
|
+
if (props.setting.document[`add${field}`]) {
|
|
59
|
+
props.setting.document[`add${field}`]();
|
|
60
|
+
} else {
|
|
61
|
+
console.log("customfield", modelValue.value);
|
|
62
|
+
modelValue.value?.push({});
|
|
63
|
+
}
|
|
59
64
|
};
|
|
60
65
|
/**
|
|
61
66
|
* 1. support array with field to label
|
|
@@ -56,6 +56,10 @@ export const haveAccess = (resource:string):boolean =>{
|
|
|
56
56
|
return getUserStore().haveAccess(upperFirst(resource))
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
export const checkHasHighPrivilege = ():boolean =>{
|
|
60
|
+
return getUserStore().checkHasHighPrivilege()
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
|
|
60
64
|
|
|
61
65
|
export const getProfileEmail = () => getUserProfile()?.email
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2025-06-09
|
|
5
|
+
*/
|
|
6
|
+
<% it.modules.forEach(function(module) { %>
|
|
7
|
+
<% if (module.schema && module.schema.properties) { %>
|
|
8
|
+
<% Object.entries(module.schema.properties).forEach(function([propName, prop]) { %>
|
|
9
|
+
<% if (prop.enum) { %>
|
|
10
|
+
export enum <%= module.docname %><%= propName.charAt(0).toUpperCase() + propName.slice(1) + 'Enum' %> {
|
|
11
|
+
<% prop.enum.forEach(function(enumValue, index) { %>
|
|
12
|
+
<% if (enumValue === '') { %>
|
|
13
|
+
EMPTY = ''<%= index < prop.enum.length - 1 ? ',' : '' %>
|
|
14
|
+
<% } else { %>
|
|
15
|
+
<%= enumValue.replace(/([A-Z])/g, '_$1').replace(/^_/, '').toUpperCase().replace(/-/g, '_') %> = '<%= enumValue %>'<%= index < prop.enum.length - 1 ? ',' : '' %>
|
|
16
|
+
<% } %>
|
|
17
|
+
<% }); %>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
<% } %>
|
|
21
|
+
<% }); %>
|
|
22
|
+
<% } %>
|
|
23
|
+
<% }); %>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator during initialization. It is changable.
|
|
3
|
+
* --remove-this-line-to-prevent-override--
|
|
4
|
+
* last change 2024-02-22
|
|
5
|
+
* author: Ks Tan
|
|
6
|
+
*/
|
|
7
|
+
export default {
|
|
8
|
+
welcome:'欢迎',
|
|
9
|
+
welcomeSimpleApp: '你好,欢迎来到 SimpleApp',
|
|
10
|
+
changeHomePageMsg: '改了这面',
|
|
11
|
+
category: '类别',
|
|
12
|
+
/*manually fix from df.ts.eta*/
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// or
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
export default {
|
|
3
|
+
//auto generate from lang/default.ts
|
|
4
|
+
<%let langkeys = Object.keys(it.lang) %>
|
|
5
|
+
<% for(let l=0; l< langkeys.length; l++){ %>
|
|
6
|
+
<% let key = langkeys[l] %>
|
|
7
|
+
"<%=key%>" : <% if (typeof it.lang[key] === 'object') { %><%~ JSON.stringify(it.lang[key], null, 2) %><% } else { %>"<%~ it.lang[key] %>"<% } %>,
|
|
8
|
+
<%}%>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
//auto generate from schema
|
|
12
|
+
<% for(let i=0; i< it.allfields.length; i++){ %>
|
|
13
|
+
<% let f = it.allfields[i] %>
|
|
14
|
+
<% if(!it.lang[f]){%>
|
|
15
|
+
'<%= f %>' : '<%= camelCaseToWords(f) %>',
|
|
16
|
+
<%}%>
|
|
17
|
+
<%}%>
|
|
18
|
+
|
|
19
|
+
}
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
<%let langkeys = Object.keys(it.lang) %>
|
|
5
5
|
<% for(let l=0; l< langkeys.length; l++){ %>
|
|
6
6
|
<% let key = langkeys[l] %>
|
|
7
|
-
|
|
7
|
+
"<%=key%>" : <% if (typeof it.lang[key] === 'object') { %><%~ JSON.stringify(it.lang[key], null, 2) %><% } else { %>"<%~ it.lang[key] %>"<% } %>,
|
|
8
8
|
<%}%>
|
|
9
9
|
|
|
10
10
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ShallowRef } from "vue";
|
|
2
|
+
import { Customfield, CUSTOMFIELDApi } from "~/simpleapp/generate/openapi";
|
|
3
|
+
|
|
4
|
+
type CustomFieldStoreData = Pick<Customfield, "_id" | "collectionName" | "form">[];
|
|
5
|
+
|
|
6
|
+
type CustomFieldStore = {
|
|
7
|
+
data: ShallowRef<CustomFieldStoreData>;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default defineNuxtPlugin(async (nuxtApp) => {
|
|
11
|
+
const useCustomFieldStore = defineStore("custom-field-store", {
|
|
12
|
+
state: (): CustomFieldStore => ({
|
|
13
|
+
data: shallowRef([]),
|
|
14
|
+
}),
|
|
15
|
+
actions: {
|
|
16
|
+
async fetchList() {
|
|
17
|
+
const config = getAxiosConfig();
|
|
18
|
+
const api = new CUSTOMFIELDApi(config);
|
|
19
|
+
const resp = await api.runSearch({
|
|
20
|
+
filter: {},
|
|
21
|
+
fields: ["_id", "collectionName", "form"],
|
|
22
|
+
});
|
|
23
|
+
// setTimeout(() => {
|
|
24
|
+
this.$patch({ data: resp.data ?? [] });
|
|
25
|
+
// }, 10000);
|
|
26
|
+
},
|
|
27
|
+
findByCollectionName(collectionName: string) {
|
|
28
|
+
return this.data.find((item) => item.collectionName === collectionName) ?? null;
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
provide: {
|
|
35
|
+
customFieldStore: useCustomFieldStore(),
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
});
|