@simitgroup/simpleapp-generator 1.1.25 → 1.1.27
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/dist/processors/jsonschemabuilder.d.ts.map +1 -1
- package/dist/processors/jsonschemabuilder.js +3 -4
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/package.json +1 -1
- package/src/processors/jsonschemabuilder.ts +4 -4
- package/templates/basic/nest/processor.ts.eta +13 -1
- package/templates/basic/nuxt/pages.[id].vue.eta +24 -2
- package/templates/basic/nuxt/pages.form.vue.eta +44 -93
- package/templates/basic/nuxt/pages.viewer.vue.eta +17 -5
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +57 -17
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +9 -3
- package/templates/nuxt/assets/css/style.css._eta +4 -0
- package/templates/nuxt/components/header/HeaderBreadcrumb.vue.eta +2 -1
- package/templates/nuxt/components/renderer/RendererDate.vue.eta +2 -2
- package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +13 -4
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +6 -4
- package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +3 -3
- package/templates/nuxt/components/simpleApp/SimpleAppForm.vue.eta +12 -21
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue.eta +106 -0
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +157 -116
- package/templates/nuxt/composables/refreshDocumentList.generate.ts.eta +1 -0
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +3 -1
- package/templates/nuxt/lang/{df.ts._eta → df.ts.eta} +12 -4
- package/templates/nuxt/lang/more.ts._eta +3 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +16 -3
- package/templates/nuxt/types/others.ts.eta +9 -4
- package/templates/nuxt/types/simpleappinput.ts.eta +11 -0
- package/tsconfig.tsbuildinfo +1 -1
- /package/templates/basic/nuxt/{pages.new.vue.eta → pages.new.vue.etaxxx} +0 -0
- /package/templates/nuxt/components/header/{HeaderBar.vue.eta → HeaderBar.vue._eta} +0 -0
- /package/templates/nuxt/components/header/button/{HeaderButtonMenuPicker.vue.eta → HeaderButtonMenuPicker.vue._eta} +0 -0
- /package/templates/nuxt/layouts/{default.vue.eta → default.vue._eta} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonschemabuilder.d.ts","sourceRoot":"","sources":["../../src/processors/jsonschemabuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAiF,MAAM,aAAa,CAAC;AAUzH,OAAO,EAGL,WAAW,EAIZ,MAAM,SAAS,CAAC;AAIjB,eAAO,MAAM,qBAAqB,YAAmB,MAAM,eAAa,WAAW,
|
|
1
|
+
{"version":3,"file":"jsonschemabuilder.d.ts","sourceRoot":"","sources":["../../src/processors/jsonschemabuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAiF,MAAM,aAAa,CAAC;AAUzH,OAAO,EAGL,WAAW,EAIZ,MAAM,SAAS,CAAC;AAIjB,eAAO,MAAM,qBAAqB,YAAmB,MAAM,eAAa,WAAW,yBAkElF,CAAC"}
|
|
@@ -42,8 +42,7 @@ const readJsonSchemaBuilder = async (docname, orijsondata) => {
|
|
|
42
42
|
orijsondata.properties["docNoFormat"] = tmp;
|
|
43
43
|
}
|
|
44
44
|
if (schemaconfigs.allStatus && schemaconfigs.allStatus.length > 0) {
|
|
45
|
-
orijsondata.properties["
|
|
46
|
-
orijsondata.properties["documentStatus"] = { type: 'string', default: 'D' };
|
|
45
|
+
orijsondata.properties["documentStatus"] = { type: 'string', default: 'draft' };
|
|
47
46
|
}
|
|
48
47
|
//enforce format uuid for _id
|
|
49
48
|
orijsondata.properties['_id']['format'] = 'uuid';
|
|
@@ -214,8 +213,8 @@ const getField = (fieldname, obj, isrequired) => {
|
|
|
214
213
|
// oritype: obj.type,
|
|
215
214
|
required: isrequired,
|
|
216
215
|
};
|
|
217
|
-
if (obj.title)
|
|
218
|
-
|
|
216
|
+
// if (obj.title)
|
|
217
|
+
f.title = obj.title;
|
|
219
218
|
if (obj.description)
|
|
220
219
|
f.description = obj.description;
|
|
221
220
|
if (obj.format)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonschemabuilder.js","sourceRoot":"","sources":["../../src/processors/jsonschemabuilder.ts"],"names":[],"mappings":";;;;;;AAGA,oDAAsB;AAGtB,mDAAmD;AACnD,iCAAwC;AACxC,iGAA6D;AAC7D,wCAAmD;AACnD,sDAAsD;AACtD,kCAOiB;AACjB,MAAM,GAAG,GAAoB,IAAI,cAAM,EAAE,CAAC;AAC1C,MAAM,UAAU,GAAI,oBAAoB,CAAA;AACxC,MAAM,mBAAmB,GAAG,cAAc,CAAA;AACnC,MAAM,qBAAqB,GAAG,KAAK,EAAE,OAAe,EAAC,WAAuB,EACjF,EAAE;;IACF,mEAAmE;IACnE,4CAA4C;IAC5C,YAAY;IACZ,IAAG,CAAC,WAAW,CAAC,UAAU,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,YAAY,UAAU,EAAE,CAAC,CAAA;IACtE,IAAG,CAAC,WAAW,CAAC,UAAU,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,YAAY,UAAU,EAAE,CAAC,CAAA;IACtE,sEAAsE;IACtE,yEAAyE;IAEzE,IAAI,aAAa,GAAgB,WAAW,CAAC,UAAU,CAAC,CAAA;IACxD,MAAM,OAAO,GAAC,aAAa,CAAC,YAAY,CAAA;IAExC,IAAG,CAAC,aAAa,CAAC,cAAc,EAAC;QAC/B,aAAa,CAAC,YAAY,CAAA;KAC3B;IAED,IAAG,CAAC,aAAa,CAAC,WAAW,EAAC;QAC5B,aAAa,CAAC,WAAW,GAAC,EAAE,CAAA;KAC7B;IAED,IAAG,aAAa,CAAC,sBAAsB,EAAC;QACtC,MAAM,GAAG,GAAG;YACR,IAAI,EAAE,QAA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,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;KACzB;SAAM;QACL,IAAI,CAAC,CAAC,IAAI,IAAI,QAAQ;YAAE,CAAC,CAAC,OAAO,GAAG,EAAE,CAAC;aAClC,IAAI,CAAC,CAAC,IAAI,IAAI,QAAQ,IAAI,CAAC,CAAC,IAAI,IAAI,SAAS;YAAE,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC;aAC7D,IAAI,CAAC,CAAC,IAAI,IAAI,SAAS;YAAE,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC;aAC3C,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO;YAAE,CAAC,CAAC,OAAO,GAAG,EAAE,CAAC;;YACtC,CAAC,CAAC,OAAO,GAAG,EAAE,CAAC;KACrB;IACD,OAAO,CAAC,CAAC;AACX,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -50,9 +50,8 @@ export const readJsonSchemaBuilder = async (docname: string,orijsondata:JSONSche
|
|
|
50
50
|
orijsondata.properties["docNoFormat"] = tmp as JSONSchema7Definition
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
if(schemaconfigs.allStatus && schemaconfigs.allStatus.length>0){
|
|
54
|
-
orijsondata.properties["
|
|
55
|
-
orijsondata.properties["documentStatus"] = {type:'string', default:'D'}
|
|
53
|
+
if(schemaconfigs.allStatus && schemaconfigs.allStatus.length>0){
|
|
54
|
+
orijsondata.properties["documentStatus"] = {type:'string', default:'draft'}
|
|
56
55
|
}
|
|
57
56
|
//enforce format uuid for _id
|
|
58
57
|
orijsondata.properties['_id']['format']='uuid'
|
|
@@ -258,7 +257,8 @@ const getField = (
|
|
|
258
257
|
required: isrequired,
|
|
259
258
|
};
|
|
260
259
|
|
|
261
|
-
if (obj.title)
|
|
260
|
+
// if (obj.title)
|
|
261
|
+
f.title = obj.title;
|
|
262
262
|
if (obj.description) f.description = obj.description;
|
|
263
263
|
if (obj.format) f.format = obj.format;
|
|
264
264
|
if (obj.examples) f.examples = obj.examples;
|
|
@@ -49,7 +49,19 @@ export class <%= it.typename %>Processor extends SimpleAppService<<%= it.typenam
|
|
|
49
49
|
})
|
|
50
50
|
<%}%>
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
<%if(it.jsonschema.properties['readOnly'] || it.jsonschema.properties['documentStatus']){%>
|
|
53
|
+
public isReadOnly():boolean{
|
|
54
|
+
<%if(it.jsonschema.properties['readOnly']){%>
|
|
55
|
+
if(this.data.readOnly) return true
|
|
56
|
+
<%}%>
|
|
57
|
+
<%if(it.jsonschema.properties['documentStatus']){%>
|
|
58
|
+
const docstatus = this.data.documentStatus
|
|
59
|
+
const statussetting = this.jsonschema['x-simpleapp-config'].allStatus?.find((item)=>item.status==docstatus)
|
|
60
|
+
if(statussetting && statussetting.readOnly) return true
|
|
61
|
+
<%}%>
|
|
62
|
+
return false
|
|
63
|
+
}
|
|
64
|
+
<%}%>
|
|
53
65
|
|
|
54
66
|
reCalculateValue(data:<%= it.typename %>){
|
|
55
67
|
//console.log('trigger new recalculate')
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Crud :_id="_id"/>
|
|
2
|
+
<Crud :_id="_id" @after="after"/>
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script setup lang="ts">
|
|
@@ -11,5 +11,27 @@
|
|
|
11
11
|
* author: Ks Tan
|
|
12
12
|
*/
|
|
13
13
|
import Crud from './form.vue'
|
|
14
|
-
|
|
14
|
+
import {<%= it.typename %>} from '~/simpleapp/generate/types'
|
|
15
|
+
|
|
16
|
+
const doc = useNuxtApp().$<%= it.typename %>Doc()
|
|
17
|
+
|
|
18
|
+
const props = defineProps<{_id:string}>();
|
|
19
|
+
const after = (actionName: string, data: <%= it.typename %>, result: any) => {
|
|
20
|
+
switch (actionName) {
|
|
21
|
+
case "new":
|
|
22
|
+
goTo(doc.getDocName(), "new");
|
|
23
|
+
break;
|
|
24
|
+
case "create":
|
|
25
|
+
goTo(doc.getDocName(), data._id);
|
|
26
|
+
refreshDocumentList(doc.getDocName())
|
|
27
|
+
break;
|
|
28
|
+
case "update":
|
|
29
|
+
refreshDocumentList(doc.getDocName());
|
|
30
|
+
break;
|
|
31
|
+
case "delete":
|
|
32
|
+
goTo(doc.getDocName(), "new");
|
|
33
|
+
refreshDocumentList(doc.getDocName())
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
15
37
|
</script>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
(instancepath ? `:instancepath="\`${instancepath}\`"` : '') + '/>' %>
|
|
7
7
|
<template>
|
|
8
8
|
|
|
9
|
-
<SimpleAppForm #default="o" :document="doc"
|
|
9
|
+
<SimpleAppForm #default="o" :document="doc">
|
|
10
10
|
<client-only>
|
|
11
11
|
<% if(it.autocompletename){%>
|
|
12
12
|
<title v-if="id">{{ t(doc.getDocName())}}: {{ data.<%=it.autocompletename%> ?? ''}}</title>
|
|
@@ -14,25 +14,7 @@
|
|
|
14
14
|
<title v-if="id">{{ t(doc.getDocName())}}</title>
|
|
15
15
|
<%}%>
|
|
16
16
|
|
|
17
|
-
<
|
|
18
|
-
<Button class="" :disabled="disabled" @click="newData" type="button" v-if="canPerform(doc.getDocName(),'create')">New</Button>
|
|
19
|
-
<Button class="btn-primary" :disabled="disabled" @click="createData" type="button" v-if="canPerform(doc.getDocName(),'create') && doc.isNew()">Create</Button>
|
|
20
|
-
<Button class="btn-primary" :disabled="disabled" @click="updateData" type="button" v-if="canPerform(doc.getDocName(),'update') && !doc.isNew()">Update</Button>
|
|
21
|
-
<Button class="btn-danger" :disabled="disabled" @click="deleteData($event)" type="button" v-if="canPerform(doc.getDocName(),'delete') && !doc.isNew()">Delete</Button>
|
|
22
|
-
<div class="p-2">
|
|
23
|
-
<Checkbox :binary="true" v-model="ismodify" input-id="ismodify"/>
|
|
24
|
-
<label for="ismodify" class="ml-2">{{ t('modify') }}</label>
|
|
25
|
-
</div>
|
|
26
|
-
<!-- special api start-->
|
|
27
|
-
<%for(let i=0;i<it.apiSettings.length;i++){%>
|
|
28
|
-
<% let api = it.apiSettings[i] %>
|
|
29
|
-
<Button class="btn-warn" :disabled="disabled" type="button" v-if="canPerform(doc.getDocName(), 'update') && !doc.isNew()"
|
|
30
|
-
@click="run<%=capitalizeFirstLetter(api.action)%>" >{{t('<%=api.action%>')}}</Button>
|
|
31
|
-
<%}%>
|
|
32
|
-
<!-- special api end -->
|
|
33
|
-
<ProgressSpinner v-if="disabled==true" style="width: 2rem; height: 2rem" ></ProgressSpinner>
|
|
34
|
-
<ConfirmPopup></ConfirmPopup>
|
|
35
|
-
</div>
|
|
17
|
+
<SimpleAppFormToolBar :document="doc" @on="actionListener"></SimpleAppFormToolBar>
|
|
36
18
|
<div class="grid grid-cols-4 gap-4">
|
|
37
19
|
<% let isautofocus='' %>
|
|
38
20
|
<%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
|
|
@@ -164,88 +146,55 @@
|
|
|
164
146
|
* last change 2023-09-09
|
|
165
147
|
* author: Ks Tan
|
|
166
148
|
*/
|
|
167
|
-
import {SimpleAppInputType} from "~/types"
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
const ismodify = ref(false)
|
|
172
|
-
const isReadOnly = computed(()=>!ismodify.value)
|
|
173
|
-
const props = defineProps<{ _id?: string; skipRedirect?: boolean }>();
|
|
174
|
-
const {$<%= it.typename %>Doc,$event } = useNuxtApp();
|
|
175
|
-
const doc = $<%= it.typename %>Doc()
|
|
149
|
+
import { SimpleAppInputType } from "~/types";
|
|
150
|
+
|
|
151
|
+
const props = defineProps<{ _id?: string}>();
|
|
152
|
+
const doc = useNuxtApp().$<%= it.typename %>Doc()
|
|
176
153
|
const data = doc.getReactiveData();
|
|
177
|
-
const emits = defineEmits(["
|
|
154
|
+
const emits = defineEmits(["after"]);
|
|
155
|
+
const id = computed(() => props._id ?? "");
|
|
156
|
+
|
|
157
|
+
/************ start default methods ****************/
|
|
178
158
|
|
|
179
|
-
const
|
|
180
|
-
|
|
159
|
+
const newData = () => doc.setNew()
|
|
160
|
+
const createData = async () => await doc.create()
|
|
161
|
+
const updateData = async () => await doc.update()
|
|
162
|
+
const deleteData = async () => await doc.delete(data.value._id ?? "")
|
|
163
|
+
|
|
164
|
+
const getRecord = async () => {
|
|
165
|
+
if(id.value && id.value != 'new'){
|
|
166
|
+
await doc.getById(id.value)
|
|
167
|
+
}else{
|
|
168
|
+
newData()
|
|
169
|
+
}
|
|
181
170
|
}
|
|
182
171
|
|
|
183
|
-
|
|
184
|
-
|
|
172
|
+
getRecord()
|
|
173
|
+
watch(id,async ()=>getRecord())
|
|
174
|
+
/************ end default methods ****************/
|
|
185
175
|
|
|
186
|
-
const disabled = computed(()=>{
|
|
187
|
-
return false
|
|
188
|
-
})
|
|
189
176
|
|
|
190
|
-
const
|
|
191
|
-
// disabled.value=true
|
|
177
|
+
const actionListener = async (actionName: string) => {
|
|
192
178
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
})
|
|
179
|
+
let result
|
|
180
|
+
switch (actionName) {
|
|
181
|
+
case "create":
|
|
182
|
+
result =await createData()
|
|
183
|
+
break;
|
|
184
|
+
case "update":
|
|
185
|
+
result = await updateData();
|
|
186
|
+
break;
|
|
187
|
+
case "delete":
|
|
188
|
+
result =await deleteData()
|
|
189
|
+
break;
|
|
190
|
+
case "new":
|
|
191
|
+
result =await newData();
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
209
194
|
|
|
195
|
+
emits('after',actionName,data.value,doc,result)
|
|
210
196
|
};
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
confirm.require({
|
|
214
|
-
target: event.currentTarget as HTMLElement,
|
|
215
|
-
message:'Delete?',
|
|
216
|
-
icon: 'pi pi-exclamation-triangle',
|
|
217
|
-
acceptClass: 'p-button-danger',
|
|
218
|
-
accept: ()=>{
|
|
219
|
-
// disabled.value=true
|
|
220
|
-
doc.delete(data.value._id ?? "").then((res) => {
|
|
221
|
-
refresh();
|
|
222
|
-
if (!props.skipRedirect) {
|
|
223
|
-
goTo(doc.getDocName());
|
|
224
|
-
} else {
|
|
225
|
-
doc.setNew();
|
|
226
|
-
isReadOnly.value = false;
|
|
227
|
-
}
|
|
228
|
-
emits("afterDelete", res.data);
|
|
229
|
-
});
|
|
230
|
-
},
|
|
231
|
-
reject: () => {
|
|
232
|
-
console.log("Cancel delete")
|
|
233
|
-
}
|
|
234
|
-
})
|
|
235
|
-
};
|
|
236
|
-
const newData = ()=>{
|
|
237
|
-
goTo(doc.getDocName(),'new')
|
|
238
|
-
}
|
|
239
|
-
const refresh = ()=>{
|
|
240
|
-
$event('RefreshDocumentList',{documentName:doc.getDocName()})
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (id.value && id.value != 'new') {
|
|
245
|
-
fetchRecord(id.value);
|
|
246
|
-
}else{
|
|
247
|
-
isReadOnly.value=false
|
|
248
|
-
}
|
|
197
|
+
/************ start api methods ****************/
|
|
249
198
|
|
|
250
199
|
<%for(let i=0;i<it.apiSettings.length;i++){%>
|
|
251
200
|
<% let api = it.apiSettings[i] %>
|
|
@@ -270,4 +219,6 @@ if (id.value && id.value != 'new') {
|
|
|
270
219
|
|
|
271
220
|
}
|
|
272
221
|
<%}%>
|
|
222
|
+
/************ end api methods ****************/
|
|
223
|
+
|
|
273
224
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Crud _id="
|
|
2
|
+
<Crud :_id="_id" @after="after"/>
|
|
3
3
|
</template>
|
|
4
4
|
<script setup lang="ts">
|
|
5
5
|
/**
|
|
@@ -10,9 +10,21 @@
|
|
|
10
10
|
* author: Ks Tan
|
|
11
11
|
*/
|
|
12
12
|
import Crud from './form.vue'
|
|
13
|
+
import {<%= it.typename %>} from '~/simpleapp/generate/types'
|
|
14
|
+
const props = defineProps<{_id:string}>();
|
|
15
|
+
const emits = defineEmits(["afterCreate"]);
|
|
13
16
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
const after = (actionName: string, data: <%= it.typename %>, result: any) => {
|
|
18
|
+
switch (actionName) {
|
|
19
|
+
case "new":
|
|
20
|
+
break;
|
|
21
|
+
case "create":
|
|
22
|
+
emits("afterCreate", data);
|
|
23
|
+
break;
|
|
24
|
+
case "update":
|
|
25
|
+
break;
|
|
26
|
+
case "delete":
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
18
30
|
</script>
|
|
@@ -81,13 +81,25 @@ export class <%= it.typename%>Client extends SimpleAppClient<<%= it.typename%>,<
|
|
|
81
81
|
})
|
|
82
82
|
|
|
83
83
|
}
|
|
84
|
-
setNew = ()=>{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
this.setData(newdata)
|
|
84
|
+
setNew = ()=>{
|
|
85
|
+
const newdata = Default<%= it.typename%>(crypto.randomUUID())
|
|
86
|
+
this.setData(newdata)
|
|
87
|
+
return true
|
|
89
88
|
}
|
|
90
|
-
|
|
89
|
+
<%if(it.jsonschema.properties['readOnly'] || it.jsonschema.properties['documentStatus']){%>
|
|
90
|
+
public isReadOnly():boolean{
|
|
91
|
+
<%if(it.jsonschema.properties['readOnly']){%>
|
|
92
|
+
const readonly = this.data.value?.readOnly
|
|
93
|
+
if(readonly) return true
|
|
94
|
+
<%}%>
|
|
95
|
+
<%if(it.jsonschema.properties['documentStatus']){%>
|
|
96
|
+
const docstatus = this.data.value.documentStatus
|
|
97
|
+
const statussetting = this.schema['x-simpleapp-config'].allStatus?.find((item)=>item.status==docstatus)
|
|
98
|
+
if(statussetting && statussetting.readOnly) return true
|
|
99
|
+
<%}%>
|
|
100
|
+
return false
|
|
101
|
+
}
|
|
102
|
+
<%}%>
|
|
91
103
|
<%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
|
|
92
104
|
<% let obj=it.jsonschema.properties[key] %>
|
|
93
105
|
|
|
@@ -96,26 +108,54 @@ export class <%= it.typename%>Client extends SimpleAppClient<<%= it.typename%>,<
|
|
|
96
108
|
public add<%=key%> = () => {
|
|
97
109
|
|
|
98
110
|
this.getReactiveData().value.<%= key %>.push(Default<%= it.typename%><%=capitalizeFirstLetter(key)%>(crypto.randomUUID()))
|
|
111
|
+
return this.getReactiveData().value.<%= key %>.length -1
|
|
99
112
|
}
|
|
100
113
|
|
|
101
114
|
|
|
102
115
|
<%}%>
|
|
103
116
|
<%})%>
|
|
104
117
|
|
|
118
|
+
|
|
119
|
+
public getActions(){
|
|
120
|
+
const actions = super.getActions()
|
|
121
|
+
actions.docstatus=[
|
|
122
|
+
<%for(let i=0;i<it.docStatusSettings.length;i++){%>
|
|
123
|
+
<% let setting = it.docStatusSettings[i] %>
|
|
124
|
+
'<%=setting.statusName%>',
|
|
125
|
+
<%}%>
|
|
126
|
+
]
|
|
127
|
+
actions.api=[
|
|
128
|
+
<%for(let i=0;i<it.apiSettings.length;i++){%>
|
|
129
|
+
<% let api = it.apiSettings[i] %>
|
|
130
|
+
'<%=api.action%>',
|
|
131
|
+
<%}%>
|
|
132
|
+
]
|
|
133
|
+
return actions
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
105
137
|
/*****************************begin x-document-api code*****************************************/
|
|
106
138
|
|
|
107
139
|
<%for(let i=0;i<it.apiSettings.length;i++){%>
|
|
108
140
|
<% let api = it.apiSettings[i] %>
|
|
109
|
-
async run<%=capitalizeFirstLetter(api.action)%>(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
141
|
+
async run<%=capitalizeFirstLetter(api.action)%>(
|
|
142
|
+
<% if(api.entryPoint && api.entryPoint.includes(':')) {%>
|
|
143
|
+
<%let subpath = api.entryPoint.split('/')%>
|
|
144
|
+
<% for(let a=0;a<subpath.length;a++){%>
|
|
145
|
+
<%const partstr = subpath[a]%>
|
|
146
|
+
<%if(partstr.includes(':')){%>
|
|
147
|
+
<% const paraname = partstr.replace(':','') %>
|
|
148
|
+
<%=paraname%>: string,
|
|
149
|
+
<%}%>
|
|
150
|
+
<%}%>
|
|
151
|
+
<%}%>
|
|
152
|
+
<% if(api.queryPara && api.queryPara.length>0) {%>
|
|
153
|
+
<%for(let j=0; j<api.queryPara.length ; j++){%>
|
|
154
|
+
<%=api.queryPara[j]%>: string,
|
|
155
|
+
<%}%>
|
|
156
|
+
<%}%>
|
|
157
|
+
|
|
158
|
+
|
|
119
159
|
<% if(['post','put','patch'].includes(api.method)){ %>data:any<%}%>
|
|
120
160
|
){
|
|
121
161
|
//const recordid: string = this.data.value._id ?? '';
|
|
@@ -236,7 +276,7 @@ export class <%= it.typename%>Client extends SimpleAppClient<<%= it.typename%>,<
|
|
|
236
276
|
/***************************** begin document status code*****************************************/
|
|
237
277
|
<%for(let i=0;i<it.docStatusSettings.length;i++){%>
|
|
238
278
|
<% let setting = it.docStatusSettings[i] %>
|
|
239
|
-
async setStatus<%=capitalizeFirstLetter(setting.status)%>(id
|
|
279
|
+
async setStatus<%=capitalizeFirstLetter(setting.status)%>(id?:string,data:<%= it.typename%>,runValidate:boolean=false) {
|
|
240
280
|
const {$event} =useNuxtApp()
|
|
241
281
|
if(runValidate){
|
|
242
282
|
const errors = this.validateFailed();
|
|
@@ -90,6 +90,9 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
90
90
|
this.data = { ...newdata };
|
|
91
91
|
return this;
|
|
92
92
|
};
|
|
93
|
+
public isReadOnly(): boolean {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
93
96
|
reCalculateValue(data: T) {}
|
|
94
97
|
getIsolationFilter = (appuser: UserContext) => {
|
|
95
98
|
let isolationFilter = {};
|
|
@@ -506,7 +509,7 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
506
509
|
.session(dbsession);
|
|
507
510
|
appuser.addUpdatedRecordId(this.documentName, data._id);
|
|
508
511
|
await this.hook(appuser, HookType.afterUpdate, result);
|
|
509
|
-
return await this.findById(appuser,id);
|
|
512
|
+
return await this.findById(appuser, id);
|
|
510
513
|
} catch (err) {
|
|
511
514
|
throw new InternalServerErrorException(err.message);
|
|
512
515
|
}
|
|
@@ -593,8 +596,11 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
593
596
|
await this.hook(appuser, HookType.afterSetStatus, createresult);
|
|
594
597
|
return createresult;
|
|
595
598
|
} else {
|
|
596
|
-
const
|
|
597
|
-
|
|
599
|
+
const originalresult = await this.findById(appuser,id)
|
|
600
|
+
const newdata = {...originalresult,...data}
|
|
601
|
+
const updateresult = await this.findIdThenUpdate(appuser, id, newdata);
|
|
602
|
+
const finaldata = await this.findById(appuser,id)
|
|
603
|
+
await this.hook(appuser, HookType.afterSetStatus, finaldata);
|
|
598
604
|
return updateresult;
|
|
599
605
|
}
|
|
600
606
|
}
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span v-if="setting?.collection" @click="viewRecord" class="text-primary-700 hover:text-primary-500 cursor-pointer">
|
|
3
|
-
|
|
3
|
+
{{ displayText }}
|
|
4
4
|
</span>
|
|
5
|
-
<span v-else>{{
|
|
5
|
+
<span v-else>{{ displayText }}</span>
|
|
6
6
|
</template>
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
+
import { ForeignKey } from '~/types';
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
const
|
|
11
|
+
type SettingProp = {collection:string, displayField?:string}
|
|
12
|
+
const modelValue = defineModel<ForeignKey>()
|
|
13
|
+
const props = defineProps<{setting:SettingProp}>()
|
|
14
|
+
const displayText = computed(()=>{
|
|
15
|
+
const s = props.setting
|
|
16
|
+
if (!modelValue.value) return undefined
|
|
17
|
+
else if(!s.collection) return modelValue.value
|
|
18
|
+
else if(s.displayField) return modelValue.value[s.displayField]
|
|
19
|
+
else return modelValue.value.label
|
|
20
|
+
})
|
|
12
21
|
const {$event} = useNuxtApp()
|
|
13
22
|
const viewer=ref()
|
|
14
23
|
const viewRecord = () => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<AutoComplete v-model="modelValue" v-if="!readonly" ref="autocompleteinput"
|
|
3
|
-
forceSelection optionLabel="label"
|
|
3
|
+
forceSelection optionLabel="label"
|
|
4
|
+
@focus="($event.target as HTMLInputElement).select()"
|
|
4
5
|
@item-select="pickAutoComplete"
|
|
5
6
|
@complete="getListFromAutocompleteApi"
|
|
6
7
|
:placeholder="t('keyword')"
|
|
@@ -128,13 +129,14 @@ const openViewer = (readonly:boolean) =>{
|
|
|
128
129
|
const schema:SchemaType = remotedoc.docClass.getSchema()
|
|
129
130
|
const labelfield = schema['x-simpleapp-config'].documentTitle as string
|
|
130
131
|
const codefield = schema['x-simpleapp-config'].uniqueKey as string
|
|
132
|
+
const docname = props.setting.fieldsetting['x-foreignkey']
|
|
131
133
|
$event('ViewRecord',{
|
|
132
134
|
_id: modelValue.value?._id as string,
|
|
133
135
|
eventId: crypto.randomUUID(),
|
|
134
|
-
label: modelValue.value?.label as string,
|
|
136
|
+
label: (readonly ? modelValue.value?.label : `${t('new') + ' '+ t(docname) }`) as string,
|
|
135
137
|
readonly:readonly,
|
|
136
|
-
viewer : getDocument(
|
|
137
|
-
documentName:
|
|
138
|
+
viewer : getDocument(docname)?.viewer,
|
|
139
|
+
documentName: docname,
|
|
138
140
|
|
|
139
141
|
//after create, auto copy value into auto complete
|
|
140
142
|
afterCreate:(data:any)=>{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="schema" class="flex flex-col">
|
|
3
3
|
<div v-if="hidelabel"></div>
|
|
4
|
-
<label v-else-if="error" class="text-danger-600 overflow-hidden" :for="uuid">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="text-danger-600">*</span></label>
|
|
5
|
-
<label v-else :for="uuid" class="whitespace-nowrap text-gray-500 truncate">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="text-danger-600">*</span></label>
|
|
4
|
+
<label v-else-if="error" class="simpleapp-input-label text-danger-600 overflow-hidden" :for="uuid">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="text-danger-600">*</span></label>
|
|
5
|
+
<label v-else :for="uuid" class="simpleapp-input-label whitespace-nowrap text-gray-500 truncate">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="text-danger-600">*</span></label>
|
|
6
6
|
|
|
7
7
|
<!-- <div :uuid="uuid" >{{ modelValue }}</div> -->
|
|
8
8
|
<!-- <div v-if="typeof modelValue =='object' && typeof modelValue['_id']!='undefined' && typeof modelValue['label']!='undefined' && readonly ==true " :uuid="uuid" class="simpleapp-value-readonly">{{ modelValue['label'] }}</div> -->
|
|
@@ -57,7 +57,7 @@ const readonlyclass="simpleapp-value-readonly"
|
|
|
57
57
|
let schema:any
|
|
58
58
|
|
|
59
59
|
const fielddesc = computed(()=>{
|
|
60
|
-
return props.description ??
|
|
60
|
+
return props.description ?? ''
|
|
61
61
|
})
|
|
62
62
|
|
|
63
63
|
if(props.setting.fieldsetting && props.setting.fieldsetting.type){
|