@simitgroup/simpleapp-generator 1.1.26 → 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.
Files changed (31) hide show
  1. package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
  2. package/dist/processors/jsonschemabuilder.js +3 -4
  3. package/dist/processors/jsonschemabuilder.js.map +1 -1
  4. package/package.json +1 -1
  5. package/src/processors/jsonschemabuilder.ts +4 -4
  6. package/templates/basic/nest/processor.ts.eta +13 -1
  7. package/templates/basic/nuxt/pages.[id].vue.eta +24 -2
  8. package/templates/basic/nuxt/pages.form.vue.eta +44 -93
  9. package/templates/basic/nuxt/pages.viewer.vue.eta +17 -5
  10. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +57 -17
  11. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +9 -3
  12. package/templates/nuxt/components/header/HeaderBreadcrumb.vue.eta +2 -1
  13. package/templates/nuxt/components/renderer/RendererDate.vue.eta +2 -2
  14. package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +13 -4
  15. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +6 -4
  16. package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +1 -1
  17. package/templates/nuxt/components/simpleApp/SimpleAppForm.vue.eta +12 -21
  18. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue.eta +106 -0
  19. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +119 -100
  20. package/templates/nuxt/composables/refreshDocumentList.generate.ts.eta +1 -0
  21. package/templates/nuxt/composables/stringHelper.generate.ts.eta +3 -1
  22. package/templates/nuxt/lang/{df.ts._eta → df.ts.eta} +12 -4
  23. package/templates/nuxt/lang/more.ts._eta +3 -0
  24. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +16 -3
  25. package/templates/nuxt/types/others.ts.eta +9 -4
  26. package/templates/nuxt/types/simpleappinput.ts.eta +11 -0
  27. package/tsconfig.tsbuildinfo +1 -1
  28. /package/templates/basic/nuxt/{pages.new.vue.eta → pages.new.vue.etaxxx} +0 -0
  29. /package/templates/nuxt/components/header/{HeaderBar.vue.eta → HeaderBar.vue._eta} +0 -0
  30. /package/templates/nuxt/components/header/button/{HeaderButtonMenuPicker.vue.eta → HeaderButtonMenuPicker.vue._eta} +0 -0
  31. /package/templates/nuxt/layouts/{default.vue.eta → default.vue._eta} +0 -0
@@ -0,0 +1,106 @@
1
+ <template>
2
+ <div class="simpleapp-tool-bar flex flex-row text-left gap-4">
3
+ <div v-for="(menu,index) in menus" :key="index">
4
+ <div>
5
+ <Button v-if="showMenuButton(menu)" @click="emitEvent(menu,$event)">{{ menu.label }}</Button>
6
+ </div>
7
+
8
+ </div>
9
+ <div v-for="(menu,index) in getDocActions()" :key="index">
10
+ <div>
11
+ <Button @click="emitEvent(menu,$event)">{{ menu.label }}</Button>
12
+ </div>
13
+
14
+ </div>
15
+ <ConfirmPopup></ConfirmPopup>
16
+ </div>
17
+ </template>
18
+ <script setup lang="ts">
19
+
20
+ import { SimpleAppClient } from '~/simpleapp/generate/clients/SimpleAppClient';
21
+ import { useConfirm } from "primevue/useconfirm";
22
+ const confirm = useConfirm();
23
+ import {FormActions,FormMenu} from '~/types'
24
+
25
+ const ismodify = ref(false)
26
+ const props = defineProps<{
27
+ document: SimpleAppClient<any,any>,
28
+ disableaction? : string[]
29
+ }>()
30
+
31
+ const emits = defineEmits(['on'])
32
+ const doc = props.document
33
+ const data = doc.getReactiveData()
34
+
35
+ const menus = ref<FormMenu[]>([])
36
+
37
+
38
+ const getActions = () => {
39
+ const actions = doc.getActions()
40
+
41
+ // Object.keys(actions).forEach((key)=>{ //crud, api, docstatus
42
+ actions['crud'].forEach((item)=>{
43
+ if(props.disableaction && props.disableaction.includes(item)){/*skip this item*/}
44
+ else{
45
+ menus.value.push({
46
+ action: item,
47
+ label: t(item),
48
+ type: 'crud'
49
+ })
50
+ }
51
+ })
52
+ // })
53
+ return actions
54
+ }
55
+
56
+ getActions()
57
+
58
+ const emitEvent = (menu:FormMenu, clickEvent:any)=>{
59
+ if(menu.action=='delete'){
60
+ confirm.require({
61
+ target: clickEvent.currentTarget as HTMLElement,
62
+ message: `${t("delete")}?`,
63
+ icon: "pi pi-exclamation-triangle",
64
+ acceptClass: "p-button-danger",
65
+ accept: () => emits('on',menu.action)
66
+ });
67
+ }else{
68
+ emits('on',menu.action)
69
+ }
70
+
71
+ }
72
+
73
+
74
+ const getDocActions = () =>{
75
+ const docstatus:string = data.value.documentStatus
76
+ const allstatus = doc.getSchema()['x-simpleapp-config'].allStatus
77
+ let docactionmenus:FormMenu[] = []
78
+ type stringlist = {[key:string]:string}
79
+ const statusNames:stringlist = {}
80
+ allstatus?.forEach(item=>{
81
+ statusNames[item.status]=t(item.statusName)
82
+ })
83
+ if(allstatus){
84
+ const stateconfig = allstatus.find((item)=>item.status===docstatus)
85
+ docactionmenus = stateconfig?.actions.map(item=>({
86
+ action: item,
87
+ label: statusNames[item],
88
+ type: 'docstatus'
89
+ })) ?? []
90
+ }
91
+ return docactionmenus
92
+
93
+ }
94
+ const showMenuButton = (menu:FormMenu)=>{
95
+
96
+ if(!canPerform(doc.getDocName(),menu.action)) return false
97
+ if(doc.isNew() && menu.action == 'create') return true
98
+ if(!doc.isNew() && menu.action == 'new') return true
99
+ if(!doc.isNew() && menu.action == 'update') return true
100
+ if(!doc.isNew() && menu.action == 'delete') return true
101
+
102
+ if(menu.type == 'api' ) return false
103
+ return false
104
+ }
105
+
106
+ </script>
@@ -2,45 +2,60 @@
2
2
  <SimpleAppFieldContainer :hidelabel="hidelabel" v-model="modelValue"
3
3
  :label="label" :description="description" :pt="pt"
4
4
  :setting="setting" :instancepath="instancepath" :error="error" #default="slotprops">
5
- <!-- binary input -->
6
- <component :is="inputComponent" :readonly="isReadonly" :pt="pt"
7
- v-if="[SimpleAppInputType.checkbox,SimpleAppInputType.switch ].includes(inputType)"
5
+ <Checkbox v-if="inputType ==SimpleAppInputType.checkbox" :readonly="isReadonly" :pt="pt"
8
6
  :inputId="slotprops.uuid" :path="setting.instancepath"
9
7
  v-model="modelValue" :binary="true"
10
- v-bind="componentProps"/>
8
+ v-bind="(componentProps as CheckboxProps)"/>
9
+ <InputSwitch v-else-if="inputType ==SimpleAppInputType.switch" :readonly="isReadonly" :pt="pt"
10
+ :inputId="slotprops.uuid" :path="setting.instancepath"
11
+ v-model="modelValue as boolean" :binary="true"
12
+ v-bind="(componentProps as InputSwitchProps)"/>
11
13
 
12
- <!-- date component -->
13
- <component :is="inputComponent" type="date" :pt="pt"
14
+ <InputText type="date" :pt="pt"
14
15
  v-else-if="inputType == SimpleAppInputType.date"
15
16
  :inputId="slotprops.uuid" :path="setting.instancepath"
16
- v-model="datevalue" @update:modelValue="updateDate" :readonly="isReadonly"
17
- v-bind="componentProps"/>
17
+ v-model="(datevalue as string)" @update:modelValue="updateDate" :readonly="isReadonly"
18
+ :placeholder="placeholder"
19
+ v-bind="(componentProps as InputTextProps)"/>
18
20
  <!-- calendar component -->
19
- <component :is="inputComponent" type="date" :pt="pt" :class="'flex flex-col yyy-'+modelValue+ ' xxx-'+datevalue"
21
+ <Calendar type="date" :pt="pt" class="flex flex-col"
20
22
  v-else-if="SimpleAppInputType.calendar==inputType"
21
23
  :inputId="slotprops.uuid" :path="setting.instancepath"
22
- v-model="datevalue" @update:modelValue="updateDate" :readonly="isReadonly"
23
- v-bind="componentProps"/>
24
+ v-model="(datevalue as string)" @update:modelValue="updateDate" :readonly="isReadonly"
25
+ :placeholder="placeholder"
26
+ v-bind="(componentProps as CalendarProps)"/>
24
27
  <!-- time component -->
25
- <component :is="inputComponent" :pt="pt"
28
+ <InputText :pt="pt"
26
29
  v-else-if="inputType == SimpleAppInputType.time"
27
30
  :inputId="slotprops.uuid" :path="setting.instancepath"
28
- v-model="modelValue" :readonly="isReadonly"
29
- v-bind="componentProps"/>
31
+ v-model="(modelValue as string)" :readonly="isReadonly"
32
+ :placeholder="placeholder"
33
+ v-bind="(componentProps as InputTextProps)"/>
30
34
  <!-- select/list component -->
31
- <component :is="inputComponent" v-model="modelValue" :pt="pt"
32
- v-else-if="[SimpleAppInputType.select,SimpleAppInputType.list].includes(inputType)"
35
+ <Listbox v-model="modelValue" :pt="pt"
36
+ v-else-if="SimpleAppInputType.list==inputType"
33
37
  :inputId="slotprops.uuid" :path="setting.instancepath"
34
38
  :readonly="isReadonly"
35
39
  class="w w-full lg:w-full"
36
40
  :disabled="isReadonly"
37
41
  :options="getListOptions()" optionLabel="label" optionValue="value"
42
+ :placeholder="placeholder"
43
+ v-bind="(componentProps as ListboxProps)"/>
44
+
45
+ <Dropdown v-model="modelValue" :pt="pt"
46
+ v-else-if="SimpleAppInputType.select == inputType"
47
+ :inputId="slotprops.uuid" :path="setting.instancepath"
48
+ :readonly="isReadonly"
49
+ class="w w-full lg:w-full"
50
+ :disabled="isReadonly"
51
+ :options="getListOptions()" optionLabel="label" optionValue="value"
52
+ :placeholder="placeholder"
38
53
  v-bind="componentProps"/>
39
54
 
40
55
  <!-- radio component -->
41
56
  <div v-else-if="inputType == SimpleAppInputType.radio" >
42
57
  <div v-for="(item,index) in getListOptions()">
43
- <component :pt="pt" :is="inputComponent" v-model="modelValue"
58
+ <RadioButton :pt="pt" v-model="modelValue"
44
59
  :inputId="setting.key+'-'+index" name="smaple" :value="item.value"
45
60
  :readonly="isReadonly"
46
61
  /> {{ ' ' }}
@@ -50,18 +65,19 @@
50
65
 
51
66
  <!-- autocomplete, need do more enterprise grade component-->
52
67
  <SimpleAppAutocomplete v-else-if="inputType==SimpleAppInputType.autocomplete"
53
- v-model="modelValue"
68
+ v-model="(modelValue as autocompletetype)"
54
69
  :pt="pt"
55
70
  :setting="setting"
56
71
  :disabled="isReadonly"
57
72
  :inputId="slotprops.uuid"
58
73
  :path="setting.instancepath"
59
74
  :readonly="isReadonly"
75
+ :placeholder="placeholder"
60
76
  />
61
77
  <!-- v-bind:attributes="componentProps" -->
62
78
  <!-- document no input-->
63
79
  <SimpleAppDocumentNo v-else-if="inputType == SimpleAppInputType.documentno"
64
- :setting="setting" v-model="modelValue" :inputId="slotprops.uuid"
80
+ :setting="setting" v-model="(modelValue as string)" :inputId="slotprops.uuid"
65
81
  :readonly="isReadonly" @update:docNoFormat="triggerDocNoFormatChange"
66
82
  :pt="pt"
67
83
  :path="setting.instancepath"
@@ -69,47 +85,51 @@
69
85
 
70
86
 
71
87
  <!-- password -->
72
- <component :is="inputComponent"
88
+ <Password
73
89
  v-else-if="inputType == SimpleAppInputType.password"
74
- :type="type" v-model="modelValue" :pt="pt"
90
+ :type="type" v-model="(modelValue as string)" :pt="pt"
75
91
  :readonly="isReadonly" class="flex flex-col"
76
92
  :inputId="slotprops.uuid" :path="setting.instancepath"
77
- v-bind="componentProps"/>
93
+ :placeholder="placeholder"
94
+ v-bind="(componentProps as PasswordProps)"/>
78
95
 
79
96
  <!-- rating -->
80
- <component v-else-if="inputType == SimpleAppInputType.rating"
81
- :type="type" v-model="modelValue" :pt="pt"
97
+ <Rating v-else-if="inputType == SimpleAppInputType.rating"
98
+ :type="type" v-model="(modelValue as number)" :pt="pt"
82
99
  :readonly="isReadonly"
83
100
  :inputId="slotprops.uuid" :path="setting.instancepath"
84
- v-bind="componentProps"/>
101
+ v-bind="(componentProps as RatingProps)"/>
85
102
 
86
103
  <!-- chip -->
87
- <component v-else-if="inputType == SimpleAppInputType.chip"
88
- :is="inputComponent" :type="type" v-model="modelValue"
104
+ <Chips v-else-if="inputType == SimpleAppInputType.chip"
105
+ :type="type" v-model="(modelValue as string[])"
89
106
  :pt="pt"
90
107
  :disabled="isReadonly"
91
108
  :inputId="slotprops.uuid" :path="setting.instancepath"
92
- v-bind="componentProps"
109
+ :placeholder="placeholder"
110
+ v-bind="(componentProps as ChipsProps)"
93
111
  />
94
112
  <!-- simple component -->
95
- <InputNumber v-else-if="inputType == SimpleAppInputType.number"
96
- :type="type" v-model="modelValue"
113
+ <InputNumber v-else-if="inputType == SimpleAppInputType.number"
114
+ :type="type" v-model="(modelValue as number)"
97
115
  :readonly="isReadonly"
98
116
  :pt="pt"
99
117
  :class="!pt ? 'w-full flex flex-col' :''"
100
118
  :inputId="slotprops.uuid" :path="setting.instancepath"
101
- v-bind="componentProps"
119
+ v-bind="(componentProps as InputNumber)"
120
+ :placeholder="placeholder"
102
121
  />
103
122
 
104
- <component v-else
105
- v-model="modelValue"
106
- :is="inputComponent"
123
+ <InputText v-else
124
+ v-model="(modelValue as string)"
107
125
  :readonly="isReadonly"
108
126
  :pt="pt"
109
127
  :type="type"
110
128
  class="w-full flex flex-col"
111
- :inputId="slotprops.uuid" :path="setting.instancepath"
112
- v-bind="componentProps"
129
+ :inputId="slotprops.uuid"
130
+ :path="setting.instancepath"
131
+ :placeholder="placeholder"
132
+ v-bind="(componentProps as InputTextProps)"
113
133
  />
114
134
 
115
135
 
@@ -119,6 +139,7 @@
119
139
  </template>
120
140
 
121
141
  <script lang="ts" setup>
142
+ import {autocompletetype} from '~/types'
122
143
  import moment from 'moment'
123
144
  import AutoComplete,{ AutoCompleteProps } from 'primevue/autocomplete';
124
145
  import Calendar,{ CalendarProps } from 'primevue/calendar';
@@ -140,9 +161,6 @@ import Textarea, { TextareaProps } from 'primevue/textarea';
140
161
  import {SimpleAppInputType} from '~/types'
141
162
 
142
163
 
143
- let inputComponent :Component
144
-
145
-
146
164
  const datevalue = ref('')
147
165
  const modelValue = defineModel()
148
166
 
@@ -162,72 +180,73 @@ const props = withDefaults( defineProps<{
162
180
  hidelabel?: boolean
163
181
  readonly?: boolean
164
182
  pt?:any,
183
+ placeholder?:string
165
184
  componentProps?: InputNumberProps | InputSwitchProps | InputTextProps | TextareaProps | DropdownProps | CalendarProps | RatingProps
166
185
 
167
186
  }>(),{type:'text'})
168
187
 
169
188
 
170
- switch(props.inputType){
171
- case SimpleAppInputType.text:
172
- inputComponent = InputText
173
- break;
174
- case SimpleAppInputType.textarea:
175
- inputComponent = Textarea
176
- break;
177
- case SimpleAppInputType.number:
178
- inputComponent = InputNumber
179
- break
180
- case SimpleAppInputType.date:
181
- inputComponent = InputText
182
- break;
183
- case SimpleAppInputType.time:
184
- inputComponent = InputText
185
- break;
186
- case SimpleAppInputType.calendar:
187
- inputComponent = Calendar
188
- break;
189
- case SimpleAppInputType.autocomplete:
190
- inputComponent = AutoComplete
191
- break;
192
- case SimpleAppInputType.autocompletemultiple: //*
193
- inputComponent = AutoComplete
194
- break;
195
- case SimpleAppInputType.selectmultiple: //*
196
- inputComponent = MultiSelect
197
- break;
198
- case SimpleAppInputType.listmultiple: //*
199
- break;
200
- case SimpleAppInputType.radio: //*
201
- inputComponent = RadioButton
202
- break;
203
- case SimpleAppInputType.select: //*
204
- inputComponent = Dropdown
205
- break;
206
- case SimpleAppInputType.list: //*
207
- inputComponent = Listbox
208
- break;
209
- case SimpleAppInputType.chip: //*
210
- inputComponent = Chips
211
- break;
212
- case SimpleAppInputType.checkbox:
213
- inputComponent = Checkbox
214
- break;
215
- case SimpleAppInputType.switch:
216
- inputComponent = InputSwitch
217
- break;
218
- case SimpleAppInputType.documentno: //*
219
- break;
220
- case SimpleAppInputType.password:
221
- inputComponent = Password
222
- break;
223
- case SimpleAppInputType.rating:
224
- inputComponent = Rating
225
- break;
226
- case SimpleAppInputType.slider:
227
- inputComponent = Slider
228
- break;
189
+ // switch(props.inputType){
190
+ // case SimpleAppInputType.text:
191
+ // inputComponent = InputText
192
+ // break;
193
+ // case SimpleAppInputType.textarea:
194
+ // inputComponent = Textarea
195
+ // break;
196
+ // case SimpleAppInputType.number:
197
+ // inputComponent = InputNumber
198
+ // break
199
+ // case SimpleAppInputType.date:
200
+ // inputComponent = InputText
201
+ // break;
202
+ // case SimpleAppInputType.time:
203
+ // inputComponent = InputText
204
+ // break;
205
+ // case SimpleAppInputType.calendar:
206
+ // inputComponent = Calendar
207
+ // break;
208
+ // case SimpleAppInputType.autocomplete:
209
+ // inputComponent = AutoComplete
210
+ // break;
211
+ // case SimpleAppInputType.autocompletemultiple: //*
212
+ // inputComponent = AutoComplete
213
+ // break;
214
+ // case SimpleAppInputType.selectmultiple: //*
215
+ // inputComponent = MultiSelect
216
+ // break;
217
+ // case SimpleAppInputType.listmultiple: //*
218
+ // break;
219
+ // case SimpleAppInputType.radio: //*
220
+ // inputComponent = RadioButton
221
+ // break;
222
+ // case SimpleAppInputType.select: //*
223
+ // inputComponent = Dropdown
224
+ // break;
225
+ // case SimpleAppInputType.list: //*
226
+ // inputComponent = Listbox
227
+ // break;
228
+ // case SimpleAppInputType.chip: //*
229
+ // inputComponent = Chips
230
+ // break;
231
+ // case SimpleAppInputType.checkbox:
232
+ // inputComponent = Checkbox
233
+ // break;
234
+ // case SimpleAppInputType.switch:
235
+ // inputComponent = InputSwitch
236
+ // break;
237
+ // case SimpleAppInputType.documentno: //*
238
+ // break;
239
+ // case SimpleAppInputType.password:
240
+ // inputComponent = Password
241
+ // break;
242
+ // case SimpleAppInputType.rating:
243
+ // inputComponent = Rating
244
+ // break;
245
+ // case SimpleAppInputType.slider:
246
+ // inputComponent = Slider
247
+ // break;
229
248
 
230
- }
249
+ // }
231
250
  const isReadonly = computed(()=>{
232
251
  if(props.readonly){
233
252
  return props.readonly
@@ -267,7 +286,7 @@ const getListOptions = () =>{
267
286
  const emits = defineEmits(['change','update:modelValue','update:docNoFormat'])
268
287
 
269
288
  watch(modelValue ,(newvalue:any)=>{
270
-
289
+
271
290
  if([SimpleAppInputType.date,SimpleAppInputType.calendar].includes(props.inputType)){
272
291
  if(modelValue.value){
273
292
  datevalue.value = moment(modelValue.value as string ).format('YYYY-MM-DD')
@@ -0,0 +1 @@
1
+ export const refreshDocumentList = (docName:string)=>useNuxtApp().$event('RefreshDocumentList',{documentName:docName})
@@ -17,4 +17,6 @@ export const getAvatarLink = (email:string, size:number):string=>{
17
17
  export const toLocalDate = (dateiso8601:string)=> new Date(String(dateiso8601)).toLocaleDateString()
18
18
  export const t = (txt:string,options?:any):string => useNuxtApp().$i18n.t(txt,options)
19
19
  export const today = () => moment().format('YYYY-MM-DD')
20
-
20
+ export const dateToString = (date:Date) => moment(date).format('YYYY-MM-DD')
21
+ export const getMoment = (startTime:string)=> moment(startTime)
22
+ export const lastDateOfMonth = (datestr:string) => moment(datestr).endOf('month').format('YYYY-MM-DD');
@@ -1,6 +1,14 @@
1
- export default {
1
+ import more from './more'
2
+ export default ()=> ({
3
+ ...more,
2
4
  welcome: 'Welcome',
3
5
  create: 'Create',
6
+ update: 'Update',
7
+ delete:'Delete',
8
+ modify: 'Modify',
9
+ confirm:'Confirm',
10
+ void:'Void',
11
+ draft:'Draft',
4
12
  profile: 'Profile',
5
13
  logout: 'logout',
6
14
  language: 'Language',
@@ -26,12 +34,12 @@ export default {
26
34
  decision: 'Decision',
27
35
  simpleApproveMessage: 'Approve or reject',
28
36
  suspendcustomer:"Suspend Customer",
29
- formKeyNotFound:'Formkey not found "{formKey}"',
30
-
37
+ formKeyNotFound:'Formkey not found "{formKey}"',
38
+ selectAll:'Select All',
31
39
  //auto generate from schema
32
40
  <% for(let i=0; i< it.allfields.length; i++){ %>
33
41
  <% let f = it.allfields[i] %>
34
42
  <%=f%> : '<%= camelCaseToWords(f) %>',
35
43
  <%}%>
36
44
 
37
- }
45
+ })
@@ -0,0 +1,3 @@
1
+ export default {
2
+
3
+ }
@@ -10,7 +10,7 @@ import addErrors from 'ajv-errors';
10
10
  import { ref } from 'vue';
11
11
  import type { Ref } from 'vue';
12
12
  import type { AxiosResponse } from 'axios';
13
- import {SearchBody,Notification,NotificationStatus,SchemaType} from '~/types'
13
+ import {SearchBody,Notification,NotificationStatus,SchemaType,FormActions} from '~/types'
14
14
 
15
15
  // import { useToast, } from 'primevue/usetoast';
16
16
  // import type { ToastMessageOptions } from 'primevue/toast';
@@ -37,6 +37,7 @@ export class SimpleAppClient<
37
37
  protected docname = '';
38
38
  protected errorlist = ref({});
39
39
  protected completeformula = true;
40
+
40
41
  constructor(apiobj: TApi,doctype:string,docname:string) {
41
42
  this.docapi = apiobj;
42
43
  this.doctype=doctype
@@ -54,12 +55,13 @@ export class SimpleAppClient<
54
55
  getApi = () =>this.docapi;
55
56
  getReactiveData = () => this.data;
56
57
  public reCalculateValue (){}
58
+ public isReadOnly():boolean{return false} //if there is readonly attribute in data, will override it at processor and client
57
59
  setData = (data: any) => {
58
60
  // this.data.value = data;
59
61
  Object.assign(this.data.value, data);
60
62
  };
61
63
 
62
- async getById(id: string) {
64
+ async getById(id?: string) {
63
65
  return await this.docapi.runFindOne(id,{timeout:this.defaultTimeOut})
64
66
  .then((res: AxiosResponse) => {
65
67
  // if(this.event){this.event('info:getById',res.data)}
@@ -152,7 +154,10 @@ export class SimpleAppClient<
152
154
  });
153
155
  }
154
156
  }
155
- async delete(id: string) {
157
+ async delete(id?: string) {
158
+ if(!id){
159
+ id = this.data.value._id ?? ''
160
+ }
156
161
  const {$event} =useNuxtApp()
157
162
  return await this.docapi.runDelete(id,{timeout:this.defaultTimeOut})
158
163
  .then((res:AxiosResponse)=>{
@@ -233,4 +238,12 @@ export class SimpleAppClient<
233
238
  }
234
239
  }
235
240
 
241
+ public getActions():FormActions{
242
+ const data:FormActions = {
243
+ crud:['new','create','update','delete',],
244
+ docstatus:[],
245
+ api:[]
246
+ }
247
+ return data
248
+ }
236
249
  }
@@ -1,6 +1,15 @@
1
+
1
2
  import {SimpleAppClient} from '~/simpleapp/generate/clients/SimpleAppClient'
2
3
  import {CellSetting} from './documentlist'
3
4
  import { Component } from 'vue'
5
+
6
+ export type ForeignKey = {
7
+ _id: string;
8
+ label: string;
9
+ code?: string
10
+ [key:string]: any
11
+ };
12
+
4
13
  export type DocumentMetaData = {
5
14
  docName:string
6
15
  docType:string
@@ -28,10 +37,6 @@ import { Component } from 'vue'
28
37
  sample:string
29
38
  }
30
39
 
31
- export type ForeignKey = {
32
- _id : string
33
- label: string
34
- }
35
40
 
36
41
 
37
42
  export type SearchBody = {
@@ -38,4 +38,15 @@ export type autocompletetype={
38
38
  label:string
39
39
  code:string
40
40
  [key:string]:any
41
+ }
42
+
43
+ export type FormActions = {
44
+ [key:string]:string[]
45
+ }
46
+
47
+ export type FormMenu = {
48
+ type:string
49
+ action:string
50
+ label:string
51
+ command? : Function
41
52
  }