@simitgroup/simpleapp-generator 1.3.4-alpha → 1.4.0-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 (85) hide show
  1. package/dist/buildinschemas/permission.d.ts.map +1 -1
  2. package/dist/buildinschemas/permission.js +10 -6
  3. package/dist/buildinschemas/permission.js.map +1 -1
  4. package/dist/buildinschemas/user.d.ts.map +1 -1
  5. package/dist/buildinschemas/user.js +22 -2
  6. package/dist/buildinschemas/user.js.map +1 -1
  7. package/dist/generate.js +20 -6
  8. package/dist/generate.js.map +1 -1
  9. package/dist/type.d.ts +2 -0
  10. package/dist/type.d.ts.map +1 -1
  11. package/dist/type.js.map +1 -1
  12. package/package.json +1 -1
  13. package/src/buildinschemas/permission.ts +10 -6
  14. package/src/buildinschemas/user.ts +23 -3
  15. package/src/generate.ts +19 -6
  16. package/src/type.ts +3 -1
  17. package/templates/basic/nest/controller.ts.eta +1 -1
  18. package/templates/basic/nest/service.ts.eta +7 -3
  19. package/templates/basic/nuxt/pages.[id].vue.eta +4 -4
  20. package/templates/basic/nuxt/pages.mobile.[id].vue.eta +39 -0
  21. package/templates/basic/nuxt/pages.mobile.landing.vue.eta +69 -0
  22. package/templates/nest/.gitignore.eta +6 -1
  23. package/templates/nest/src/simpleapp/apischemas/index.ts._eta +29 -0
  24. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +22 -12
  25. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +26 -1
  26. package/templates/nest/src/simpleapp/generate/workflow/workflow.service.ts.eta +1 -1
  27. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +1 -1
  28. package/templates/nest/src/simpleapp/profile/profile.types.ts.eta +1 -1
  29. package/templates/nest/src/simpleapp/services/perm.service.ts.eta +5 -7
  30. package/templates/nest/src/simpleapp/services/user.service.ts.eta.old +118 -0
  31. package/templates/nest/src/simpleapp/types/index.ts._eta +8 -0
  32. package/templates/nuxt/app.vue._eta +31 -17
  33. package/templates/nuxt/assets/css/style.css._eta +4 -4
  34. package/templates/nuxt/assets/primevue/passthrough.ts._eta +10 -4
  35. package/templates/nuxt/components/calendar/CalendarByResource.vue.eta +181 -163
  36. package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +8 -6
  37. package/templates/nuxt/components/form/FormDocnoformat.vue.eta +174 -0
  38. package/templates/nuxt/components/form/FormUser.vue._eta +91 -0
  39. package/templates/nuxt/components/form/user/FormUserPermission.vue.eta +83 -0
  40. package/templates/nuxt/components/header/HeaderBar.vue._eta +43 -39
  41. package/templates/nuxt/components/header/button/HeaderButtonMenuPicker.vue._eta +46 -38
  42. package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +9 -9
  43. package/templates/nuxt/components/mobile/MobileToolbar.vue.eta +12 -8
  44. package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +1 -1
  45. package/templates/nuxt/components/page/PageDocList.vue.eta +6 -4
  46. package/templates/nuxt/components/renderer/RendererDateTime.vue.eta +13 -0
  47. package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +6 -3
  48. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +3 -4
  49. package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +20 -7
  50. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +2 -5
  51. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +56 -12
  52. package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +2 -6
  53. package/templates/nuxt/composables/date.generate.ts.eta +3 -1
  54. package/templates/nuxt/composables/goTo.generate.ts.eta +4 -1
  55. package/templates/nuxt/composables/refreshDocumentList.generate.ts.eta +13 -2
  56. package/templates/nuxt/layouts/mobile.vue._eta +26 -12
  57. package/templates/nuxt/nuxt.config.ts._eta +27 -20
  58. package/templates/nuxt/pages/[xorg]/{user/index.vue.eta → docnoformat/[id].vue.eta} +11 -9
  59. package/templates/nuxt/pages/[xorg]/docnoformat.vue.eta +51 -20
  60. package/templates/nuxt/pages/[xorg]/mobile/docnoformat/index.vue.eta +59 -0
  61. package/templates/nuxt/pages/[xorg]/mobile/index.vue._eta +19 -0
  62. package/templates/nuxt/pages/[xorg]/mobile/organization/index.vue.eta +138 -0
  63. package/templates/nuxt/pages/[xorg]/mobile/pickgroup.vue._eta +35 -0
  64. package/templates/nuxt/pages/[xorg]/mobile/user/index.vue.eta +231 -0
  65. package/templates/nuxt/pages/[xorg]/organization.vue.eta +80 -61
  66. package/templates/nuxt/pages/[xorg]/pickgroup.vue._eta +35 -0
  67. package/templates/nuxt/pages/[xorg]/user.vue.eta +91 -74
  68. package/templates/nuxt/pages/profile.vue.eta +7 -7
  69. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +14 -3
  70. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +18 -16
  71. package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +1 -1
  72. package/templates/nuxt/types/events.ts.eta +1 -0
  73. package/templates/nuxt/types/simpleappinput.ts.eta +3 -2
  74. package/templates/nuxt/types/user.ts.eta +2 -1
  75. package/templates/project/lang/default._json +150 -67
  76. package/tsconfig.tsbuildinfo +1 -1
  77. package/templates/nest/src/simpleapp/services/user.service.ts.etax +0 -66
  78. package/templates/nuxt/pages/[xorg]/docnoformat/[doctype]/[id].vue.eta +0 -13
  79. package/templates/nuxt/pages/[xorg]/docnoformat/[doctype]/new.vue.eta +0 -229
  80. package/templates/nuxt/pages/[xorg]/docnoformat/[doctype].vue.eta +0 -38
  81. package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +0 -11
  82. package/templates/nuxt/pages/[xorg]/user/[id].vue.eta +0 -39
  83. package/templates/nuxt/pages/[xorg]/user/form.vue.eta +0 -334
  84. package/templates/nuxt/pages/[xorg]/user/new.vue.eta +0 -18
  85. package/templates/nuxt/pages/[xorg]/user/viewer.vue.eta +0 -29
@@ -0,0 +1,91 @@
1
+ <template>
2
+ <SimpleAppForm #default="o" :document="doc">
3
+ <SimpleAppFormToolBar
4
+ :document="doc"
5
+ @on="actionListener"
6
+ ></SimpleAppFormToolBar>
7
+ <title v-if="id">{{ data.fullName ?? data.email }}</title>
8
+ <TabView lazy>
9
+ <TabPanel :header="t('profile')">
10
+ <div
11
+ class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 p-2"
12
+ >
13
+ <SimpleAppInput
14
+ :input-type="SimpleAppInputType.text"
15
+ :setting="o.getField('#/properties/fullName')"
16
+ v-model="data.fullName"
17
+ />
18
+
19
+ <SimpleAppInput
20
+ :input-type="SimpleAppInputType.text"
21
+ :setting="o.getField('#/properties/email')"
22
+ v-model="data.email"
23
+ readonly
24
+ type="email"
25
+ />
26
+
27
+ <SimpleAppInput
28
+ :input-type="SimpleAppInputType.checkbox"
29
+ :setting="o.getField('#/properties/active')"
30
+ v-model="data.active"
31
+ />
32
+
33
+ <SimpleAppInput
34
+ :input-type="SimpleAppInputType.text"
35
+ :setting="o.getField('#/properties/description')"
36
+ v-model="data.description"
37
+ />
38
+ </div>
39
+
40
+ <DebugDocumentData v-model="data" :label="doc.getDocName()" />
41
+ </TabPanel>
42
+ <TabPanel :header="t('permission')">
43
+ <!-- <UserButtonPermissionInfo></UserButtonPermissionInfo> -->
44
+ <form-user-permission :id="id"></form-user-permission>
45
+ </TabPanel>
46
+ </TabView>
47
+ </SimpleAppForm>
48
+ </template>
49
+
50
+ <script setup lang="ts">
51
+ /**
52
+ * This file was automatically generated by simpleapp generator.
53
+ * --remove-this-line-to-prevent-override--
54
+ * last change 2024-02-16
55
+ * Author: Ks Tan
56
+ */
57
+ import { SimpleAppInputType, FormCrudEvent } from "~/types";
58
+ import { User } from "~/simpleapp/generate/types";
59
+ import { UserDoc } from "~/simpleapp/docs/UserDoc";
60
+
61
+ const props = defineProps<{ _id?: string; doc?: UserDoc; paras?: User }>();
62
+ const doc = props.doc ?? useNuxtApp().$UserDoc();
63
+ const data = doc.getReactiveData();
64
+ const emits = defineEmits(["after"]);
65
+ const id = computed(() => props._id ?? "");
66
+
67
+ /************ start default methods ****************/
68
+
69
+ const newData = () => doc.setNew();
70
+
71
+ const getRecord = async () => {
72
+ if (id.value && id.value != "new") {
73
+ await doc.getById(id.value);
74
+ } else {
75
+ newData();
76
+ }
77
+ };
78
+
79
+ getRecord();
80
+ watch(id, async () => await getRecord());
81
+ /************ end default methods ****************/
82
+
83
+ const actionListener = async (actionName: string) => {
84
+ emits("after", actionName, data.value);
85
+ };
86
+
87
+ onMounted(async () => await actionListener(FormCrudEvent.mount));
88
+ /************ start api methods ****************/
89
+
90
+ /************ end api methods ****************/
91
+ </script>
@@ -0,0 +1,83 @@
1
+ <template>
2
+ <div class=" w-full">
3
+ <div v-for="(b, index) in branchList" :key="index" class="flex flex-col">
4
+ <div>{{ b.branchName }}</div>
5
+ <div>
6
+ <SelectButton :options="grouplist" v-model="permdata[b.branchId??0].groups"
7
+ @update:model-value="updatePermission($event,b.branchId ??0)"
8
+ multiple option-value="value" option-label="label"/>
9
+ </div>
10
+ </div>
11
+ </div>
12
+ </template>
13
+ <script lang="ts" setup>
14
+ import { Branch, Permission, UserPermission } from "~/simpleapp/generate/openapi";
15
+ import _ from 'lodash'
16
+ const props = defineProps<{ id: string }>();
17
+ const perm = useNuxtApp().$PermissionDoc();
18
+ const branchList = ref<Branch[]>()
19
+ const branch = useNuxtApp().$BranchDoc()
20
+ const grouplist = getAllGroups().map((item) => {
21
+ return { value: item, label: _.capitalize(item) };
22
+ });
23
+ const orgs = ref<UserPermission[]>();
24
+ const selectedGroup=ref()
25
+ type PermDataType = {[key:number]: {groups?:string[],permId?:string}}
26
+ const permdata=ref<PermDataType>({})
27
+ const loadBranches = async ()=>{
28
+ branchList.value=await branch.search({
29
+ filter:{orgId:getUserProfile()?.orgId},
30
+ fields:['branchCode','branchName','active','branchId'],
31
+ sorts:[['branchCode','asc']]
32
+ })
33
+
34
+ branchList.value?.forEach(b=>{
35
+ const branchId:number = b.branchId ?? 0
36
+ permdata.value[branchId] ={groups:[],permId:''}
37
+ })
38
+ }
39
+ const loadPermission = async () => {
40
+ const permissions:Permission[] = await perm.search({
41
+ filter:{userId:props.id},
42
+ fields:['groups','userId','uid','branchId']
43
+ })
44
+ console.log("load permissions" , permissions)
45
+ permissions.forEach(p=>{
46
+ console.log("PPP",p)
47
+ if(p.branchId && permdata.value[p.branchId]){
48
+ permdata.value[p.branchId].groups = p.groups ??[]
49
+ permdata.value[p.branchId].permId = p._id
50
+ }
51
+ })
52
+ };
53
+ const updatePermission = async (newgroups:string[],branchId:number)=>{
54
+ const data =perm.getReactiveData()
55
+ if(permdata.value[branchId] && permdata.value[branchId].permId){
56
+ await perm.getById(permdata.value[branchId].permId)
57
+ }else{
58
+ data.value._id=randomUUID()
59
+ data.value.userId=props.id
60
+ }
61
+ data.value.groups=newgroups
62
+
63
+
64
+ if(permdata.value[branchId] && permdata.value[branchId].permId){
65
+ await perm.update()
66
+ }else{
67
+ await perm.create()
68
+ }
69
+ await loadPermission()
70
+ }
71
+ onMounted(async () => {
72
+ await loadBranches()
73
+ await loadPermission()
74
+
75
+ });
76
+ watch(
77
+ () => props.id,
78
+ async () => {
79
+ await loadPermission()
80
+
81
+ }
82
+ );
83
+ </script>
@@ -1,62 +1,66 @@
1
1
  <template>
2
- <!-- <header> -->
3
- <!-- <MegaMenu :model="getMenus()" orientation="horizontal" /> -->
4
-
5
- <div >
6
- <client-only>
7
-
8
- <div class="flex-1 flex flex-row gap-2 p-2">
9
- <!-- <div class="">
2
+ <!-- <header> -->
3
+ <!-- <MegaMenu :model="getMenus()" orientation="horizontal" /> -->
4
+
5
+ <div>
6
+ <client-only>
7
+ <div class="flex-1 flex flex-row gap-2 p-2">
8
+ <!-- <div class="">
10
9
  <HeaderButtonMenuPicker/>
11
10
  </div> -->
12
-
13
- <!-- <div class="">
11
+
12
+ <!-- <div class="">
14
13
  <HeaderButtonHome/>
15
14
  </div> -->
16
- <div v-if="isMobile()" class="dark:text-white max-w-[15rem] truncate ...">
17
- <div v-if="useRoute().fullPath.split('/').length<=3">{{ t('home') }}</div>
18
- <div v-else>{{ _.last(useRoute().fullPath.split('/')) }}</div>
19
- </div>
20
- <div v-else>
21
- <HeaderBreadcrumb class="hidden md:block" v-if="useRoute().fullPath!='/'"></HeaderBreadcrumb>
22
- </div>
23
-
15
+ <div
16
+ v-if="isMobile()"
17
+ class="dark:text-white max-w-[15rem] truncate ..."
18
+ >
19
+ <div v-if="useRoute().fullPath.split('/').length <= 3">
20
+ {{ t("home") }}
21
+ </div>
22
+ <div v-else>{{ _.last(useRoute().fullPath.split("/")) }}</div>
24
23
  </div>
25
- <div class="flex-1 flex flex-row-reverse gap-2 p-2">
26
- <!--
24
+ <div v-else>
25
+ <HeaderBreadcrumb
26
+ class="hidden md:block"
27
+ v-if="useRoute().fullPath != '/'"
28
+ ></HeaderBreadcrumb>
29
+ </div>
30
+ </div>
31
+ <!-- <div class="flex-1 flex flex-row-reverse gap-2 p-2">
32
+
27
33
  <div class=" text-right" v-if="!isMobile()">
28
34
  <HeaderButtonProfile/>
29
35
  </div>
30
36
  <div class=" text-right">
31
37
  <HeaderButtonTaskList/>
32
- </div> -->
33
- <!-- <div class="">
38
+ </div>
39
+ <div class="">
34
40
  <HeaderSelectBranch/>
35
- </div> -->
36
- </div>
41
+ </div>
42
+ </div>-->
43
+ </client-only>
44
+ </div>
37
45
 
38
-
39
- </client-only>
40
- </div>
41
-
42
- <!-- </header> -->
46
+ <!-- </header> -->
43
47
  </template>
44
48
  <script setup lang="ts">
45
49
  /**
46
50
  * This file was automatically generated by simpleapp generator during initialization. It is changable.
47
51
  * --remove-this-line-to-prevent-override--
48
- * last change 2024-02-22
52
+ * last change 2024-04-10
49
53
  * author: Ks Tan
50
54
  */
51
-
52
- import _ from 'lodash'
55
+
56
+ import _ from "lodash";
53
57
  //import ButtonMenuPicker from "./ButtonMenuPicker.vue"
54
58
 
55
59
  //import ButtonProfile from './ButtonProfile.vue';
56
- const pageTitle = ref<string>('')
57
- onMounted(()=>{
58
- // useNuxtApp().$listen('SetTitle',(title:string)=>{
59
- // pageTitle.value = title
60
- // })
61
- })
62
- </script>
60
+ const pageTitle = ref<string>("");
61
+ onMounted(() => {
62
+ // useNuxtApp().$listen('SetTitle',(title:string)=>{
63
+ // pageTitle.value = title
64
+ // })
65
+ });
66
+ </script>
@@ -5,52 +5,60 @@
5
5
  * last change 2024-02-22
6
6
  * author: Ks Tan
7
7
  */
8
-
9
- import Dialog from 'primevue/dialog';
10
- // import {ref} from 'vue'
11
- import {MenuData} from '~/types'
12
- const visible = defineModel<boolean>({default:true,required:true})
13
8
 
14
- // const emit = defineEmits(['select'])
15
- const selectMenu = (menuname:{name:string,children:any}) =>{
16
- goTo(menuname.name)
17
- visible.value=false
18
- }
9
+ import { MenuData } from "~/types";
10
+ const visible = defineModel<boolean>({ default: true, required: true });
19
11
 
12
+ // const emit = defineEmits(['select'])
13
+ const selectMenu = (menuname: { name: string; children: any }) => {
14
+ goTo(menuname.name);
15
+ visible.value = false;
16
+ };
20
17
 
21
- const m = getMenustFromPageMeta()
22
- let treemenu:any[] = []
18
+ const m = getMenustFromPageMeta();
19
+ let treemenu: any[] = [];
23
20
 
24
- getMenustFromPageMeta().reduce((r, item) => {
25
- item.split('/').
26
- reduce((o, name) => {
27
- var temp = (o.children = o.children || []).find(q => q.name === name);
28
- if (!temp) o.children.push(temp = { name });
29
- return temp;
21
+ getMenustFromPageMeta().reduce(
22
+ (r, item) => {
23
+ item.split("/").reduce((o, name) => {
24
+ var temp = (o.children = o.children || []).find((q) => q.name === name);
25
+ if (!temp) o.children.push((temp = { name }));
26
+ return temp;
30
27
  }, r);
31
28
  return r;
32
- }, { children: treemenu })
29
+ },
30
+ { children: treemenu },
31
+ );
33
32
 
34
- treemenu = treemenu.sort((a,b)=>a.name<b.name ?-1:1)
33
+ treemenu = treemenu.sort((a, b) => (a.name < b.name ? -1 : 1));
35
34
  </script>
36
35
  <template>
37
-
38
- <!-- <button class="text-center border-none cursor-pointer pi pi-bars dark:text-white" v-if="getCurrentXorg()" @click="visible=true"> -->
39
- <Dialog v-model:visible="visible" modal :header="t('pickDocument')" :pt="{dialog:{ class:' bg-primary-800 ' }}">
40
- <div class="">
41
-
42
- <div v-for="m in treemenu.sort()" class="m-4">
43
-
44
- <h3>{{ t(m.name) }}</h3>
45
- <div class="grid md:grid-cols-2 lg:grid-cols-6 gap-4">
46
- <ButtonPrimary v-for="submenu in m.children.sort((a:any,b:any)=>a.name<b.name ?-1:1)" class="border rounded-lg p-2" @click="selectMenu(submenu)">
47
- {{ t(submenu.name) }}
48
- </ButtonPrimary>
49
- </div>
50
-
51
- </div>
52
-
36
+ <!-- <button class="text-center border-none cursor-pointer pi pi-bars dark:text-white" v-if="getCurrentXorg()" @click="visible=true"> -->
37
+ <Dialog
38
+ v-model:visible="visible"
39
+ modal
40
+ dismissableMask
41
+ position="top"
42
+ :header="t('pickDocument')"
43
+ :pt="{root:{class:'h-6/7',},}"
44
+ :pt-options="{mergeProps:true,mergeSections:true}"
45
+ >
46
+ <div class="">
47
+ <div v-for="(m,index) in treemenu.sort()" class="m-4" :key="index">
48
+ <h3>{{ t(m.name) }}</h3>
49
+ <div class="grid md:grid-cols-2 lg:grid-cols-6 gap-4">
50
+ <ButtonPrimary
51
+ v-for="(submenu,menuindex) in m.children.sort((a: any, b: any) =>
52
+ a.name < b.name ? -1 : 1,
53
+ )"
54
+ class="border rounded-lg p-2"
55
+ :key="menuindex"
56
+ @click="selectMenu(submenu)"
57
+ >
58
+ {{ t(submenu.name) }}
59
+ </ButtonPrimary>
53
60
  </div>
54
- </Dialog>
55
-
61
+ </div>
62
+ </div>
63
+ </Dialog>
56
64
  </template>
@@ -43,6 +43,8 @@ const saveLocale = async (v: string) => {
43
43
  <!-- </div> -->
44
44
 
45
45
  <Dialog
46
+ modal
47
+ dismissableMask
46
48
  appendTo="body"
47
49
  ref="userprofileoverlay"
48
50
  v-model:visible="modelValue"
@@ -65,22 +67,20 @@ const saveLocale = async (v: string) => {
65
67
  </div>
66
68
  <div class="flex flex-col">
67
69
  <h1
68
- class="text-left text-gray-800 dark:text-gray-100 font-lg font-bold tracking-normal leading-tight ml-2"
70
+ class="text-left text-gray-800 dark:text-gray-100 font-lg font-bold tracking-normal leading-tight"
69
71
  >
70
72
  {{ getUserProfile()?.fullName }}
71
73
  </h1>
72
- <p
73
- class="text-gray-400 dark:text-gray-100 font-normal text-base tracking-normal ml-2 mr-4"
74
- >
75
- {{ getUserProfile()?.group }}
76
- </p>
74
+ <NuxtLink :to="getDocumentUrl('pickgroup')" @click="modelValue=false">
75
+ <TextPrimary>{{ getUserProfile()?.currentGroup }} </TextPrimary>
76
+ </NuxtLink>
77
77
  </div>
78
78
  </div>
79
79
  <div class="pt-2 pb-2">
80
80
  <TextTitle>{{ getUserProfile()?.branchName }}</TextTitle>
81
- <TextPrimary @click="goTenantPicker">{{
82
- t("switchDatabase")
83
- }} </TextPrimary>
81
+ <TextPrimary @click="goTenantPicker"
82
+ >{{ t("switchDatabase") }}
83
+ </TextPrimary>
84
84
  </div>
85
85
  <div class="col-span-full">
86
86
  <label
@@ -1,11 +1,15 @@
1
- <template>
2
- <div
3
- class="w-full dark:bg-gray-800 z-20 justify justify-between absolute h h-14 flex flex-row place-items-center opacity-90 dark:text-white"
4
- >
5
- <div class="text-left"><slot name="start"></slot></div>
6
- <div class="flex-1 text-center line-clamp-2"><slot name="center"></slot></div>
7
- <div class=" text-right"><slot name="end"></slot></div>
8
- </div>
1
+ <template>
2
+ <div v-bind="$attrs"
3
+ class="w-full dark:bg-gray-800 z-20 justify justify-between absolute h h-14 flex flex-row place-items-center opacity-90 dark:text-white"
4
+ >
5
+ <div class="text-left"><slot name="start"></slot></div>
6
+ <div class="flex-1 text-center line-clamp-2">
7
+ <slot name="center"></slot>
8
+ </div>
9
+ <div class="text-right"><slot name="end"></slot></div>
10
+ </div>
11
+ <div class="h-14"></div>
12
+
9
13
  </template>
10
14
  <script setup lang="ts">
11
15
  /**
@@ -19,7 +19,7 @@
19
19
  <slot name="headerRight"></slot>
20
20
  </template>
21
21
  </MobileToolbar>
22
- <div class="mt-14">
22
+ <div >
23
23
  <slot name="default"></slot>
24
24
  </div>
25
25
  </div>
@@ -154,10 +154,12 @@ watch(showDialog, () => {
154
154
  watch(
155
155
  () => useRoute().path,
156
156
  async () => {
157
- if (getPathPara("id")) {
158
- showDialog.value = true;
159
- } else {
160
- showDialog.value = false;
157
+ if(!isMobile()){
158
+ if (getPathPara("id")) {
159
+ showDialog.value = true;
160
+ } else {
161
+ showDialog.value = false;
162
+ }
161
163
  }
162
164
  },
163
165
  );
@@ -0,0 +1,13 @@
1
+ <template>
2
+ <span v-if="modelValue">{{ toLocalDateTime(modelValue) }}</span>
3
+ <span v-else>-</span>
4
+ </template>
5
+ <script lang="ts" setup>
6
+ /**
7
+ * This file was automatically generated by simpleapp generator during initialization.
8
+ * DONT CHANGE THIS FILE CAUSE IT OVERRIDE
9
+ * last change 2024-03-10
10
+ * author: Ks Tan
11
+ */
12
+ const modelValue = defineModel<Date | string>();
13
+ </script>
@@ -2,12 +2,11 @@
2
2
  <span
3
3
  v-if="setting?.collection"
4
4
  @click="viewRecord"
5
- class="text-primary-700 hover:text-primary-500 dark:text-primary-400 cursor-pointer"
5
+ class="text-primary-700 hover:text-primary-500 dark:text-primary-400 cursor-pointer"
6
6
  >
7
7
  <slot>
8
8
  {{ displayText }}
9
9
  </slot>
10
-
11
10
  </span>
12
11
  <span v-else>{{ displayText }}</span>
13
12
  </template>
@@ -18,10 +17,11 @@
18
17
  * last change 2024-02-04
19
18
  * author: Ks Tan
20
19
  */
21
- import { ForeignKey } from "~/types";
20
+ import { ForeignKey, FormCrudEvent } from "~/types";
22
21
 
23
22
  type SettingProp = { collection: string; displayField?: string };
24
23
  const modelValue = defineModel<ForeignKey>();
24
+ const emits = defineEmits(['after'])
25
25
  const props = defineProps<{ setting: SettingProp }>();
26
26
  const displayText = computed(() => {
27
27
  const s = props.setting;
@@ -44,6 +44,9 @@ const viewRecord = () => {
44
44
  documentName: props.setting.collection,
45
45
  viewer: viewer.value,
46
46
  readonly: true,
47
+ after: async(actionName:FormCrudEvent,data)=>{
48
+ emits('after',actionName,data)
49
+ }
47
50
  });
48
51
  };
49
52
  </script>
@@ -91,8 +91,7 @@
91
91
  <i class="pi pi-plus"></i>
92
92
  </ButtonText> -->
93
93
  </template>
94
- </mobile-toolbar>
95
- <div class="h-16"></div>
94
+ </mobile-toolbar>
96
95
  <ListView
97
96
  :list="list"
98
97
  :withFilter="true"
@@ -229,7 +228,7 @@ const onBlurAutocomplete = () => {
229
228
  };
230
229
 
231
230
  const showAutocompleteDialog = (isbutton: boolean) => {
232
- mobileListMode.value='list'
231
+ mobileListMode.value = "list";
233
232
  if (modelValue.value && isbutton) {
234
233
  openViewer(false);
235
234
  } else {
@@ -300,7 +299,7 @@ const setFocus = (ev: any) => {
300
299
 
301
300
  //pop up records
302
301
  const openViewer = (readonly: boolean) => {
303
- if (remotedoc) {
302
+ if (remotedoc) {
304
303
  $event("ViewRecord", {
305
304
  _id: modelValue.value?._id as string,
306
305
  eventId: randomUUID(),
@@ -15,16 +15,21 @@
15
15
  <!-- <div :uuid="uuid" >{{ modelValue }}</div> -->
16
16
  <!-- <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> -->
17
17
  <!-- <div v-else-if="readonly==true" :uuid="uuid" class="simpleapp-value-readonly">{{ modelValue }}</div> -->
18
- <!-- <slot v-else name="default" :uuid="uuid" :error="error"></slot> -->
19
- <slot name="default" :uuid="uuid" :error="error"></slot>
20
-
18
+ <!-- <slot v-else name="default" :uuid="uuid" :error="error"></slot> -->
19
+ <slot name="default" :uuid="uuid" :error="error"></slot>
21
20
 
22
- <small v-if="error" class="text-danger-600 dark:text-danger-400">{{ error }}</small>
21
+ <small v-if="error" class="text-danger-600 dark:text-danger-400">{{
22
+ error
23
+ }}</small>
23
24
  <small v-else class="input-desc">{{ fielddesc }}</small>
24
25
  </div>
25
26
  <div v-else :class="defaultcssclass">
26
- <label class="etext-danger-600 dark:text-danger-400">wrong path in getField()</label>
27
- <div class="text-danger-600 dark:text-danger-400">{{ props.setting.path }}</div>
27
+ <label class="etext-danger-600 dark:text-danger-400"
28
+ >wrong path in getField()</label
29
+ >
30
+ <div class="text-danger-600 dark:text-danger-400">
31
+ {{ props.setting.path }}
32
+ </div>
28
33
  </div>
29
34
  </template>
30
35
  <script setup lang="ts">
@@ -55,6 +60,7 @@ const props = defineProps<{
55
60
  readonly?: boolean;
56
61
  // error?:string,
57
62
  setting: any;
63
+ resetcount: number;
58
64
  }>();
59
65
 
60
66
  const readonly = computed(() => {
@@ -85,7 +91,7 @@ const getLabelClass = () => {
85
91
  class1 += "-mb-4 ml-1 z-10 text-xs dark:text-gray-100";
86
92
  else if (modelValue.value !== undefined)
87
93
  class1 += "-mb-4 ml-1 z-10 text-xs dark:text-gray-100";
88
- else class1 += "-mb-4 ml-1 z-10 text-xs dark:text-gray-100 hidden";
94
+ else class1 += "-mb-4 ml-1 z-10 text-xs dark:text-gray-100 ";
89
95
  return class1;
90
96
  };
91
97
 
@@ -137,4 +143,11 @@ watch(props.setting.errors, (newvalue, oldvalue) => {
137
143
  // console.log("validation result",props.setting.instancepath,)
138
144
  // error.value = newvalue[props.setting.instancepath].message
139
145
  });
146
+
147
+ watch(
148
+ () => props.resetcount,
149
+ () => {
150
+ error.value = "";
151
+ },
152
+ );
140
153
  </script>
@@ -32,8 +32,7 @@
32
32
  </slot>
33
33
  <ContextMenu ref="menu" :model="menus as MenuItem[]" />
34
34
  </template>
35
- </MobileToolbar>
36
- <div class="h-14"></div>
35
+ </MobileToolbar>
37
36
  <ConfirmDialog></ConfirmDialog>
38
37
  </div>
39
38
  <div v-else class="simpleapp-tool-bar">
@@ -121,9 +120,7 @@ const title = computed(() =>
121
120
 
122
121
  const menu = ref();
123
122
  const menus = computed(() =>
124
- [...getActions(), ...getDocActions()].filter((item) =>
125
- showMenuButton(item),
126
- ),
123
+ [...getActions(), ...getDocActions()].filter((item) => showMenuButton(item)),
127
124
  );
128
125
 
129
126
  const isShow = computed(