@simitgroup/simpleapp-generator 1.6.3-alpha → 1.6.4-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 (148) hide show
  1. package/dist/buildinschemas/branch.d.ts.map +1 -1
  2. package/dist/buildinschemas/branch.js +1 -0
  3. package/dist/buildinschemas/branch.js.map +1 -1
  4. package/dist/buildinschemas/changehistories.d.ts +3 -0
  5. package/dist/buildinschemas/changehistories.d.ts.map +1 -0
  6. package/dist/buildinschemas/changehistories.js +36 -0
  7. package/dist/buildinschemas/changehistories.js.map +1 -0
  8. package/dist/buildinschemas/index.d.ts +1 -0
  9. package/dist/buildinschemas/index.d.ts.map +1 -1
  10. package/dist/buildinschemas/index.js +3 -1
  11. package/dist/buildinschemas/index.js.map +1 -1
  12. package/dist/buildinschemas/organization.js +2 -2
  13. package/dist/buildinschemas/organization.js.map +1 -1
  14. package/dist/buildinschemas/user.d.ts.map +1 -1
  15. package/dist/buildinschemas/user.js +5 -1
  16. package/dist/buildinschemas/user.js.map +1 -1
  17. package/dist/buildinschemas/webhook.d.ts +3 -0
  18. package/dist/buildinschemas/webhook.d.ts.map +1 -0
  19. package/dist/buildinschemas/webhook.js +33 -0
  20. package/dist/buildinschemas/webhook.js.map +1 -0
  21. package/dist/framework.d.ts.map +1 -1
  22. package/dist/framework.js +3 -2
  23. package/dist/framework.js.map +1 -1
  24. package/dist/generate.js +30 -11
  25. package/dist/generate.js.map +1 -1
  26. package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
  27. package/dist/processors/jsonschemabuilder.js +10 -2
  28. package/dist/processors/jsonschemabuilder.js.map +1 -1
  29. package/dist/type.d.ts +2 -0
  30. package/dist/type.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/buildinschemas/branch.ts +1 -0
  33. package/src/buildinschemas/changehistories.ts +33 -0
  34. package/src/buildinschemas/index.ts +2 -1
  35. package/src/buildinschemas/organization.ts +2 -2
  36. package/src/buildinschemas/user.ts +5 -1
  37. package/src/buildinschemas/webhook.ts +31 -0
  38. package/src/framework.ts +3 -2
  39. package/src/generate.ts +35 -15
  40. package/src/processors/jsonschemabuilder.ts +10 -2
  41. package/src/type.ts +2 -0
  42. package/templates/basic/nest/controller.ts.eta +23 -2
  43. package/templates/basic/nest/model.ts.eta +9 -1
  44. package/templates/basic/nest/resolver.ts.eta +2 -2
  45. package/templates/basic/nuxt/pages.[id].vue.eta +7 -7
  46. package/templates/basic/nuxt/pages.form.vue.eta +1 -4
  47. package/templates/basic/nuxt/pages.landing.vue.eta +1 -20
  48. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +8 -1
  49. package/templates/nest/src/simpleapp/generate/apischemas/simpleapp.apischema.ts.eta +2 -0
  50. package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +9 -2
  51. package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +5 -10
  52. package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +1 -0
  53. package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +50 -0
  54. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +13 -3
  55. package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +9 -1
  56. package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +12 -6
  57. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +120 -19
  58. package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +3 -1
  59. package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +1 -0
  60. package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +19 -0
  61. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +30 -8
  62. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +2 -1
  63. package/templates/nuxt/assets/css/calendar.css._eta +3 -0
  64. package/templates/nuxt/assets/css/style.css._eta +1 -1
  65. package/templates/nuxt/assets/images/unknown.png.eta +0 -0
  66. package/templates/nuxt/assets/primevue/passthrough.ts._eta +6 -1
  67. package/templates/nuxt/components/button/ButtonAction.vue._eta +40 -39
  68. package/templates/nuxt/components/button/ButtonDanger.vue._eta +11 -3
  69. package/templates/nuxt/components/button/ButtonDefault.vue._eta +11 -3
  70. package/templates/nuxt/components/button/ButtonPrimary.vue._eta +9 -3
  71. package/templates/nuxt/components/button/ButtonSecondary.vue._eta +33 -0
  72. package/templates/nuxt/components/button/ButtonText.vue._eta +9 -5
  73. package/templates/nuxt/components/button/ButtonWarning.vue._eta +11 -3
  74. package/templates/nuxt/components/calendar/CalendarInput.vue.eta +4 -3
  75. package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +33 -16
  76. package/templates/nuxt/components/chart/card.vue._eta +1 -1
  77. package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +36 -26
  78. package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +36 -13
  79. package/templates/nuxt/components/form/FormBranch.vue._eta +52 -5
  80. package/templates/nuxt/components/form/FormDocnoformat.vue.eta +14 -10
  81. package/templates/nuxt/components/form/FormUser.vue._eta +1 -1
  82. package/templates/nuxt/components/form/user/FormUserPermission.vue.eta +77 -59
  83. package/templates/nuxt/components/header/HeaderSelectBranch.vue.eta +42 -35
  84. package/templates/nuxt/components/image/ImageAvatar.vue.eta._vue +30 -0
  85. package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +7 -5
  86. package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +67 -50
  87. package/templates/nuxt/components/list/ListDocumentTable.vue.eta +20 -12
  88. package/templates/nuxt/components/list/ListView.vue.eta +64 -35
  89. package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +5 -4
  90. package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +8 -8
  91. package/templates/nuxt/components/page/PageDocList.vue.eta +36 -13
  92. package/templates/nuxt/components/renderer/RendererDate.vue.eta +8 -2
  93. package/templates/nuxt/components/renderer/RendererDateTime.vue.eta +7 -1
  94. package/templates/nuxt/components/renderer/RendererDocHistories.vue.eta +56 -0
  95. package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +9 -8
  96. package/templates/nuxt/components/renderer/RendererLink.vue.eta +7 -4
  97. package/templates/nuxt/components/renderer/RendererMoney.vue.eta +25 -17
  98. package/templates/nuxt/components/renderer/RendererTime.vue.eta +7 -1
  99. package/templates/nuxt/components/renderer/RendererViewer.vue.eta +19 -9
  100. package/templates/nuxt/components/select/SelectTemplate.vue.eta +47 -21
  101. package/templates/nuxt/components/session/SessionBlock.vue.eta +44 -46
  102. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +24 -15
  103. package/templates/nuxt/components/simpleApp/SimpleAppCalendarInput.vue.eta +64 -0
  104. package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +16 -8
  105. package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +8 -8
  106. package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +1 -1
  107. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +66 -22
  108. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +89 -168
  109. package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +43 -40
  110. package/templates/nuxt/components/simpleApp/SimpleAppUserPicker.vue.eta +387 -0
  111. package/templates/nuxt/components/text/TextDocStatus.vue._eta +22 -0
  112. package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +13 -15
  113. package/templates/nuxt/components/user/UserButtonPermissionInfo.vue.eta +127 -93
  114. package/templates/nuxt/components/user/UserTenantPicker.vue.eta +1 -1
  115. package/templates/nuxt/composables/date.generate.ts.eta +105 -8
  116. package/templates/nuxt/composables/getDocument.generate.ts.eta +8 -6
  117. package/templates/nuxt/composables/getOpenApi.generate.ts.eta +58 -10
  118. package/templates/nuxt/composables/getUserStore.generate.ts.eta +37 -5
  119. package/templates/nuxt/composables/goTo.generate.ts.eta +14 -1
  120. package/templates/nuxt/composables/graphquery.generate.ts.eta +20 -2
  121. package/templates/nuxt/composables/recently.generate.ts.eta +16 -0
  122. package/templates/nuxt/composables/roles.generate.ts.eta +8 -13
  123. package/templates/nuxt/composables/stringHelper.generate.ts.eta +52 -0
  124. package/templates/nuxt/composables/sysmessage.generate.ts.eta +1 -1
  125. package/templates/nuxt/pages/[xorg]/{organization.vue.eta → organization.vue._eta} +38 -9
  126. package/templates/nuxt/pages/[xorg]/user.vue.eta +12 -9
  127. package/templates/nuxt/pages/login.vue._eta +4 -1
  128. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +45 -26
  129. package/templates/nuxt/plugins/70.recently.ts.eta +55 -0
  130. package/templates/nuxt/providers/my-provider.ts.eta +22 -0
  131. package/templates/nuxt/server/api/[xorg]/{[...].ts.eta → [...].ts._eta} +47 -21
  132. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +44 -3
  133. package/templates/nuxt/types/events.ts.eta +3 -2
  134. package/templates/nuxt/types/others.ts.eta +11 -1
  135. package/templates/nuxt/types/schema.ts.eta +3 -1
  136. package/templates/nuxt/types/simpleappinput.ts.eta +1 -1
  137. package/templates/nuxt/types/user.ts.eta +8 -7
  138. package/templates/project/jsonschemas/branch.json._eta +1 -0
  139. package/templates/project/jsonschemas/invoice.json._eta +4 -3
  140. package/templates/project/jsonschemas/organization.json._eta +2 -2
  141. package/templates/project/lang/default._json +3 -2
  142. package/tsconfig.tsbuildinfo +1 -1
  143. package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +0 -38
  144. /package/templates/nuxt/pages/[xorg]/mobile/docnoformat/{index.vue.eta → index.vue.etaxxx} +0 -0
  145. /package/templates/nuxt/pages/[xorg]/mobile/{index.vue._eta → index.vue._etaxxx} +0 -0
  146. /package/templates/nuxt/pages/[xorg]/mobile/organization/{[id].vue._eta → [id].vue._etaxxx} +0 -0
  147. /package/templates/nuxt/pages/[xorg]/mobile/{pickgroup.vue._eta → pickgroup.vue._etaxxx} +0 -0
  148. /package/templates/nuxt/pages/[xorg]/mobile/user/{index.vue.eta → index.vue.etaxxx} +0 -0
@@ -1,18 +1,19 @@
1
1
  <template>
2
- <div>
2
+ <div class="w-full">
3
3
  <div class="flex flex-row">
4
- <label v-if="!hideLabel" :for="fieldid" class="pt-2">
4
+ <label v-if="!hideLabel" :for="fieldid">
5
5
  {{ t(documentName) }}
6
6
  </label>
7
- <ButtonText
7
+ <div
8
8
  v-if="allowAddNew"
9
9
  @click="addnew"
10
- class="text-xs text-blue-600"
10
+ class="cursor-pointer ml-2 pt-1 text-xs text-blue-600"
11
11
  >
12
12
  <span>{{ t("new") }}</span>
13
- </ButtonText>
13
+ </div>
14
14
  </div>
15
15
  <MultiSelect
16
+ class="w-full md:w-full"
16
17
  :input-id="fieldid"
17
18
  v-if="multiple"
18
19
  display="chip"
@@ -21,18 +22,39 @@
21
22
  :options="options"
22
23
  optionLabel="label"
23
24
  optionValue="value"
25
+ filter
24
26
  :placeholder="placeholder"
25
- />
27
+ >
28
+ <template #value="slotProps">
29
+ <slot name="value" :slotProps="slotProps">
30
+ </slot>
31
+ </template>
32
+ <template #option="slotProps">
33
+ <slot name="default" :option="slotProps.option" :index="slotProps.index">
34
+ </slot>
35
+ </template>
36
+
37
+ </MultiSelect>
26
38
  <Dropdown
39
+ class="w-full md:w-full"
27
40
  :input-id="fieldid"
28
41
  v-else
29
42
  @update:modelValue="change"
43
+ filter
30
44
  v-model="modelValue"
31
45
  :options="options"
32
46
  optionLabel="label"
33
47
  optionValue="value"
34
48
  :placeholder="placeholder"
35
- />
49
+ >
50
+ <template #value="slotProps">
51
+ <slot name="value" :item="getItem(modelValue)"></slot>
52
+ </template>
53
+ <template #option="slotProps" >
54
+ <slot name="default" :option="slotProps.option" :index="slotProps.index"></slot>
55
+ </template>
56
+
57
+ </Dropdown>
36
58
  </div>
37
59
  </template>
38
60
  <script setup lang="ts">
@@ -44,11 +66,11 @@
44
66
  */
45
67
  import Dropdown from "primevue/dropdown";
46
68
 
47
- import { ForeignKey,SimpleAppDocuments, FormCrudEvent } from "~/types";
69
+ import { ForeignKey, SimpleAppDocuments, FormCrudEvent } from "~/types";
48
70
  const emits = defineEmits(["change"]);
49
71
 
50
72
  const props = defineProps<{
51
- documentName: SimpleAppDocuments;
73
+ documentName: keyof SimpleAppDocuments;
52
74
  placeholder?: string;
53
75
  showNull?: boolean;
54
76
  allowAddNew?: boolean;
@@ -66,6 +88,7 @@ const options = ref<
66
88
  {
67
89
  value: string;
68
90
  label: string;
91
+ more:any;
69
92
  }[]
70
93
  >([]);
71
94
  const getListOptions = async () => {
@@ -79,38 +102,41 @@ const getListOptions = async () => {
79
102
  options.value = list.value.map((item) => ({
80
103
  value: item._id,
81
104
  label: item.label,
105
+ more: item
82
106
  }));
83
107
  };
84
108
  onMounted(async () => {
109
+
85
110
  await getListOptions();
86
111
  if (modelValue.value) change(modelValue.value);
87
112
  });
88
- const getItem = (id: string) => list.value?.find((item) => item._id == id);
113
+ const getItem = (id: string) => list.value?.find((item) => {
114
+ return item._id == id
115
+ });
89
116
 
90
- const change = (id: string|string[]) => {
117
+ const change = (id: string | string[]) => {
91
118
  const selectedItem = getItem(id);
92
119
  emits("change", id, selectedItem);
120
+ // console.log("changed",selectedItem)
93
121
  };
94
122
 
95
123
  const addnew = () => {
96
- const doc = getDocument(props.documentName )?.docClass;
124
+ const doc = getDocument(props.documentName)?.docClass;
97
125
  if (doc) {
98
126
  const tmpdata = doc?.getReactiveData();
99
127
  type DataType = typeof tmpdata.value;
100
128
  onScreenAddDocument<DataType>(
101
- props.documentName ,
129
+ props.documentName,
102
130
  undefined,
103
131
  async (eventType: FormCrudEvent, data: DataType) => {
104
132
  if (eventType == FormCrudEvent.create) {
105
133
  await getListOptions();
106
- if(props.multiple) {
107
- if(modelValue.value===undefined) modelValue.value=[data._id]
108
- else if(Array.isArray(modelValue.value))
109
- modelValue.value.push(data._id);
110
-
111
-
112
- }
113
- else modelValue.value = data._id;
134
+ if (props.multiple) {
135
+ if (modelValue.value === undefined) modelValue.value = [data._id];
136
+ else if (Array.isArray(modelValue.value))
137
+ modelValue.value.push(data._id);
138
+ } else modelValue.value = data._id;
139
+ refreshDocumentList(props.documentName);
114
140
  emits("change", data._id, getItem(data._id));
115
141
  }
116
142
  },
@@ -1,55 +1,53 @@
1
1
  <template>
2
-
3
- <Dialog v-model:visible="showDialog" modal :pt="{root:{class:'w-1/3'}}"
4
- :header="t('sessionExpire')">
5
- <div>
6
- {{ t('reloginMessage') }}
7
- </div>
8
- <div class="text-right">
9
- <Button @click="relogin" class="btn-primary">
10
- {{ t('login') }}
11
- </Button>
12
- </div>
13
-
14
-
15
- </Dialog>
16
-
17
-
18
-
19
-
20
- </template>
21
- <script lang="ts" setup>
22
- /**
2
+ <Dialog
3
+ v-model:visible="showDialog"
4
+ modal
5
+ :pt="{ root: { class: 'w-1/3' } }"
6
+ :header="t('sessionExpire')"
7
+ >
8
+ <div>
9
+ {{ t("reloginMessage") }}
10
+ </div>
11
+ <div class="text-right">
12
+ <Button @click="relogin" class="btn-primary">
13
+ {{ t("login") }}
14
+ </Button>
15
+ </div>
16
+ </Dialog>
17
+ </template>
18
+ <script lang="ts" setup>
19
+ /**
23
20
  * This file was automatically generated by simpleapp generator. Every
24
21
  * MODIFICATION OVERRIDE BY GENERATEOR
25
22
  * last change 2023-10-28
26
23
  * Author: Ks Tan
27
24
  */
28
- import {PROFILEApi} from '~/simpleapp/generate/openapi'
29
- const showDialog = ref(false)
30
- const tabvisible = ref('')
31
-
32
-
33
- addEventListener("visibilitychange", async (event) => {
34
- tabvisible.value = document.visibilityState
35
-
36
- if(document.visibilityState ==='visible'){
37
- //focus tab, try session still active?
38
- const result = await getApiSession()
39
- if(result){
40
- showDialog.value=false
41
- }else{
42
- showDialog.value=true
25
+ import { PROFILEApi } from "~/simpleapp/generate/openapi";
26
+ const showDialog = ref(false);
27
+ const tabvisible = ref("");
28
+
29
+ addEventListener("visibilitychange", async (event) => {
30
+ tabvisible.value = document.visibilityState;
31
+
32
+ if (document.visibilityState === "visible") {
33
+ //focus tab, try session still active?
34
+ try{
35
+ const result = await getApiSession();
36
+ console.log("get sessionresult ",result)
37
+ if (result) {
38
+
39
+ showDialog.value = false;
40
+ } else {
41
+ showDialog.value = true;
43
42
  }
43
+ }catch(e){
44
+ showDialog.value = true;
44
45
  }
45
- });
46
-
47
-
48
- const relogin= ()=>{
49
- window.open(useRuntimeConfig().public.APP_URL+'/relogin')
46
+
50
47
  }
51
-
52
-
53
-
54
-
55
- </script>
48
+ });
49
+
50
+ const relogin = () => {
51
+ window.open(useRuntimeConfig().public.APP_URL + "/relogin");
52
+ };
53
+ </script>
@@ -1,35 +1,37 @@
1
1
  <template>
2
2
  <div
3
3
  v-if="readonly"
4
- class="p-3 border rounded-lg border-gray-300 dark:border-blue-900/40"
4
+ class="p-2 border rounded-lg border-gray-300 dark:border-blue-900/40"
5
5
  >
6
6
  <button
7
7
  :readonly="readonly"
8
8
  class="cursor-pointer text-primary-600 dark:text-primary-400"
9
9
  tabindex="0"
10
10
  @click="openViewer(true)"
11
- >{{ modelValue && modelValue.label ? modelValue.label : "-" }}</button
12
11
  >
12
+ {{ modelValue && modelValue.label ? modelValue.label : "-" }}
13
+ </button>
13
14
  </div>
14
15
  <div
15
16
  v-else-if="modelValue !== undefined"
16
- class="p-3 border rounded-lg border-gray-300 dark:border-blue-900/40 relative"
17
+ class="p-2 border rounded-lg border-gray-300 dark:border-blue-900/40 relative"
17
18
  >
18
19
  <button
19
20
  ref="autocompleteinput"
20
21
  readonly
21
22
  class="cursor-pointer text-primary-600 dark:text-primary-400"
22
-
23
23
  @click="openViewer(true)"
24
- >{{ modelValue && modelValue.label ? modelValue.label : "-" }}</button>
24
+ >
25
+ {{ modelValue && modelValue.label ? modelValue.label : "-" }}
26
+ </button>
25
27
 
26
28
  <div
27
29
  class="absolute h-full top-0 right-0 text-right text-white z-10 align-middle p-3"
28
30
  >
29
31
  <button
30
32
  class="pi pi-times rounded-full bg-slate-500 p-1 cursor-pointer text-xs"
31
- @click="clear" tabindex="0"
32
-
33
+ @click="clear"
34
+ tabindex="0"
33
35
  ></button>
34
36
  </div>
35
37
  </div>
@@ -47,7 +49,7 @@
47
49
  <AutoComplete
48
50
  v-if="!isMobile()"
49
51
  class="w-full"
50
- v-model="modelValue"
52
+ v-model="autocompleteitem"
51
53
  ref="autocompleteinput"
52
54
  forceSelection
53
55
  optionLabel="label"
@@ -70,9 +72,15 @@
70
72
  >
71
73
  <template #header>
72
74
  <slot name="header">
73
- <div class="flex flex-row font font-bold dark:text-white">
74
- <div class="w w-1/3">{{ t(codefield) ?? t("code") }}</div>
75
- <div class="w w-2/3">{{ t(labelfield) ?? t("label") }}</div>
75
+ <div
76
+ class="flex flex-row font font-semibold text-sm dark:text-white gap-2 p-2"
77
+ >
78
+ <div class="w w-1/3 line-clamp-1">
79
+ {{ t(codefield) ?? t("code") }}
80
+ </div>
81
+ <div class="w w-2/3 line-clamp-1">
82
+ {{ t(labelfield) ?? t("label") }}
83
+ </div>
76
84
  </div>
77
85
  </slot>
78
86
  </template>
@@ -81,9 +89,9 @@
81
89
  </template>
82
90
  <template #option="{ index, option }">
83
91
  <slot name="option" :index="index" :option="option">
84
- <div class="flex flex-row dark:text-white">
85
- <div class="w w-1/3">{{ option.code }}</div>
86
- <div class="w w-2/3">{{ option.label }}</div>
92
+ <div class="flex flex-row dark:text-white text-sm gap-2">
93
+ <div class="w w-1/3 line-clamp-1">{{ option.code }}</div>
94
+ <div class="w w-2/3 line-clamp-1">{{ option.label }}</div>
87
95
  </div>
88
96
  </slot>
89
97
  </template>
@@ -202,6 +210,7 @@ const props = withDefaults(
202
210
  showNull: true,
203
211
  },
204
212
  );
213
+
205
214
  const mobileListMode = ref("list");
206
215
  const defaultFilterValue = ref("");
207
216
  const path = "$" + props.setting.instancepath;
@@ -324,7 +333,7 @@ const setFocus = (ev: any) => {
324
333
  const openViewer = (readonly: boolean) => {
325
334
  if (remotedoc) {
326
335
  $event("ViewRecord", {
327
- _id: modelValue.value?._id as string,
336
+ _id: (modelValue.value?._id ?? '' )as string,
328
337
  eventId: randomUUID(),
329
338
  label: (readonly
330
339
  ? modelValue.value?.label
@@ -0,0 +1,64 @@
1
+ <template>
2
+ <Calendar
3
+ :pt="pt"
4
+ :inputId="uuid"
5
+ :path="setting.instancepath"
6
+ v-model="datetimevalue"
7
+ @update:modelValue="updateDateTime"
8
+ showButtonBar
9
+ :readonly="readonly"
10
+ :placeholder="placeholder"
11
+ :showTime="showtime"
12
+ :timeOnly="timeOnly"
13
+ hourFormat="12"
14
+ v-bind="componentProps as CalendarProps"
15
+ />
16
+ </template>
17
+ <script setup lang="ts">
18
+ // :date-format="getDateFormat()"
19
+ import { CalendarProps } from 'primevue/calendar';
20
+ const props =defineProps<{
21
+ pt:any
22
+ uuid:string
23
+ placeholder?:string
24
+ setting: any;
25
+ readonly?: boolean;
26
+ componentProps?:CalendarProps
27
+ type: "date"|"time"|"datetime"
28
+ }>()
29
+
30
+
31
+ const emits = defineEmits(['change'])
32
+ const showtime = props.type == 'date'? false : true
33
+ const timeOnly = props.type=='time'?true:false
34
+ const modelValue = defineModel<string>({ required: true });
35
+ const datetimevalue = ref<Date>();
36
+
37
+
38
+ const refreshFromParent = ()=>{
39
+ if(modelValue.value === undefined || modelValue.value=='')
40
+ datetimevalue.value = undefined
41
+ else if(props.type=='time')
42
+ datetimevalue.value = stringToDate(('2000-01-01 '+modelValue.value??'00:00:00'))
43
+ else if(props.type=='date')
44
+ datetimevalue.value = stringToDate((modelValue.value)+'T00:00:00')
45
+ else
46
+ datetimevalue.value = stringToDate(modelValue.value)
47
+ }
48
+
49
+ watch(modelValue, () => refreshFromParent())
50
+
51
+ const updateDateTime = (value: any) => {
52
+ if (!value) modelValue.value = "";
53
+ else if(props.type=='datetime')modelValue.value = dateToISOString(value)
54
+ else if(props.type=='date')modelValue.value = dateToString(value)
55
+ else if(props.type=='time') modelValue.value = dateToTimeString(value)
56
+
57
+
58
+
59
+ emits('change');
60
+ };
61
+
62
+
63
+ refreshFromParent()
64
+ </script>
@@ -22,14 +22,15 @@
22
22
  </slot>
23
23
  </ListView>
24
24
 
25
- <Dialog v-model:visible="showDialog" modal :header="t('editDetails')">
25
+ <Dialog v-model:visible="showDialog"
26
+ modal :header="t('editDetails')" :pt="{root:{class:'w-1/2'}}">
26
27
  <div class="flex flex-col p-2 gap-4">
27
28
  <slot name="popupbody" :index="rowIndex" :item="list[rowIndex]">
28
29
  row {{ rowIndex }} define SimpleAppInputs here
29
30
  </slot>
30
31
  </div>
31
32
  <template #footer>
32
- <div v-if="!readOnly" class="flex flex-row gap-2 w-full">
33
+ <div v-if="!readonly" class="flex flex-row gap-2 w-full">
33
34
  <ButtonDanger @click="deleteItem">{{ t("delete") }}</ButtonDanger>
34
35
  <ButtonPrimary @click="updateItem">{{ t("ok") }}</ButtonPrimary>
35
36
  </div>
@@ -38,6 +39,7 @@
38
39
  </div>
39
40
  </template>
40
41
  <script setup lang="ts" generic="T extends { [key: string]: any }">
42
+ import { SimpleAppClient } from "~/simpleapp/generate/clients/SimpleAppClient";
41
43
  /**
42
44
  * This file was automatically generated by simpleapp generator. Every
43
45
  * MODIFICATION OVERRIDE BY GENERATEOR
@@ -46,13 +48,20 @@
46
48
  */
47
49
  const showDialog = ref(false);
48
50
  const rowIndex = ref(0);
51
+
49
52
  const emits = defineEmits(["addrow", "deleteitem", "itemupdated"]);
50
- const props = defineProps<{
51
- list: T[];
52
- title?: string;
53
- addNew?: boolean
53
+ const props = defineProps<{
54
+ list: T[];
55
+ title?: string;
56
+ addNew?: boolean;
57
+ readonly?: boolean;
58
+ doc: SimpleAppClient<any, any>;
54
59
  }>();
55
-
60
+ const readonly = computed(() => {
61
+ if (props.readonly) return true;
62
+ else if (props.doc.isReadOnly()) return true;
63
+ else return false;
64
+ });
56
65
  const showRow = (index: number, item: T) => {
57
66
  showDialog.value = true;
58
67
  rowIndex.value = index;
@@ -70,6 +79,5 @@ const addRow = (event: MouseEvent) => {
70
79
  emits("addrow", MouseEvent);
71
80
  const lineno = props.list.length - 1;
72
81
  showRow(lineno, props.list[lineno]);
73
-
74
82
  };
75
83
  </script>
@@ -9,28 +9,28 @@
9
9
  :class="
10
10
  !pt
11
11
  ? 'flex-1 w-full rounded-lg ' +
12
- (props.readonly ? '' : 'rounded-tr-none rounded-br-none')
12
+ (props.readonly || !props.setting.document.isNew() ? '' : 'rounded-tr-none rounded-br-none')
13
13
  : ''
14
14
  "
15
15
  />
16
- <span class="" v-if="!readonly">
17
- <button v-ripple
16
+ <span class="" v-if="!readonly && props.setting.document.isNew()">
17
+ <button
18
+ v-ripple
18
19
  type="button"
19
20
  @click="toggle"
20
21
  tabindex="-1"
21
- class="'btn btn-primary p-3 dark:border-blue-900/40 rounded-lg rounded-tl-none rounded-bl-none"
22
+ class="'btn bg-primary-500 dark:text-black text-white p-3 dark:border-blue-900/40 rounded-lg rounded-tl-none rounded-bl-none"
22
23
  >
23
24
  <i class="pi pi-angle-down"></i>
24
25
  </button>
25
- <OverlayPanel ref="op" class="p-4">
26
+ <OverlayPanel ref="op">
26
27
  <div class="m-4">
27
28
  <ul>
28
29
  <li v-for="docno in docFormatlist" class="hover-list-primary p-2">
29
- <a class="" @click="chooseFormat(docno)">
30
- <span class="pi pi-hashtag mr-2"></span>
30
+ <div class="flex flex-row gap-2 cursor-pointer" @click="chooseFormat(docno)">
31
31
  <span class="">{{ docno.docNoFormatName }}</span>
32
32
  <span class="text text-green-600">{{ docno.sample }}</span>
33
- </a>
33
+ </div>
34
34
  </li>
35
35
  </ul>
36
36
  </div>
@@ -75,7 +75,7 @@ let schema: any;
75
75
  const getLayoutClass = () =>
76
76
  `simpleapp-input-container flex ${
77
77
  props.inputType == "checkbox"
78
- ? " flex-row gap-4 mt-1 ml-1 "
78
+ ? " flex flex-col "
79
79
  : "flex flex-col "
80
80
  }`;
81
81