@simitgroup/simpleapp-generator 1.2.7 → 1.3.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 (106) hide show
  1. package/dist/buildinschemas/organization.d.ts.map +1 -1
  2. package/dist/buildinschemas/organization.js +3 -1
  3. package/dist/buildinschemas/organization.js.map +1 -1
  4. package/dist/framework.d.ts.map +1 -1
  5. package/dist/framework.js +4 -9
  6. package/dist/framework.js.map +1 -1
  7. package/dist/generate.js +14 -14
  8. package/dist/generate.js.map +1 -1
  9. package/package.json +1 -1
  10. package/src/buildinschemas/organization.ts +3 -1
  11. package/src/framework.ts +5 -9
  12. package/src/generate.ts +17 -16
  13. package/templates/basic/nest/controller.ts.eta +17 -0
  14. package/templates/basic/nest/default.ts.eta +6 -2
  15. package/templates/basic/nuxt/default.ts.eta +10 -6
  16. package/templates/basic/nuxt/pages.[id].vue.eta +9 -7
  17. package/templates/basic/nuxt/pages.form.vue.eta +16 -36
  18. package/templates/basic/nuxt/pages.landing.vue.eta +42 -35
  19. package/templates/basic/nuxt/pages.viewer.vue.eta +4 -6
  20. package/templates/nest/.env._eta +0 -1
  21. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +14 -2
  22. package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +32 -18
  23. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +76 -13
  24. package/templates/nuxt/app.vue.eta +7 -3
  25. package/templates/nuxt/assets/css/calendar.css._eta +21 -8
  26. package/templates/nuxt/assets/css/style.css._eta +17 -10
  27. package/templates/nuxt/assets/primevue/passthrough.ts._eta +44 -22
  28. package/templates/nuxt/components/button/ButtonDefault.vue._eta +1 -2
  29. package/templates/nuxt/components/button/ButtonMultiple.vue._eta +21 -0
  30. package/templates/nuxt/components/calendar/CalendarByResource.vue.eta +29 -8
  31. package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +3 -4
  32. package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +75 -65
  33. package/templates/nuxt/components/event/EventNotification.vue._eta +23 -2
  34. package/templates/nuxt/components/form/FormBranch.vue.eta +83 -0
  35. package/templates/nuxt/components/form/readme.md.eta +1 -0
  36. package/templates/nuxt/components/header/HeaderBar.vue._eta +9 -9
  37. package/templates/nuxt/components/header/HeaderBreadcrumb.vue.eta +2 -2
  38. package/templates/nuxt/components/header/button/HeaderButtonMenuPicker.vue._eta +16 -22
  39. package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +29 -46
  40. package/templates/nuxt/components/list/ListDocument.vue.eta +25 -0
  41. package/templates/nuxt/components/list/ListDocumentTable.vue.eta +77 -0
  42. package/templates/nuxt/components/list/ListView.vue.eta +129 -58
  43. package/templates/nuxt/components/mobile/MobileToolbar.vue.eta +10 -0
  44. package/templates/nuxt/components/overlay/OverlaySideBarCrud.vue.eta +21 -0
  45. package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +20 -0
  46. package/templates/nuxt/components/page/PageDocList.vue.eta +170 -0
  47. package/templates/nuxt/components/renderer/RendererBoolean.vue.eta +8 -4
  48. package/templates/nuxt/components/renderer/RendererDate.vue.eta +4 -4
  49. package/templates/nuxt/components/renderer/RendererLink.vue.eta +12 -20
  50. package/templates/nuxt/components/renderer/RendererMoney.vue.eta +10 -2
  51. package/templates/nuxt/components/renderer/RendererViewer.vue.eta +27 -21
  52. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +202 -150
  53. package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +7 -1
  54. package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +112 -101
  55. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue.eta +183 -91
  56. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +383 -246
  57. package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +4 -3
  58. package/templates/nuxt/components/table/TableDocuments.vue.eta +3 -3
  59. package/templates/nuxt/components/text/TextDanger.vue._eta +5 -0
  60. package/templates/nuxt/components/text/TextSubtitle.vue._eta +5 -0
  61. package/templates/nuxt/components/text/TextTitle.vue._eta +5 -0
  62. package/templates/nuxt/components/user/UserProfileListItem.vue.eta +2 -2
  63. package/templates/nuxt/composables/date.generate.ts.eta +21 -0
  64. package/templates/nuxt/composables/goTo.generate.ts.eta +1 -0
  65. package/templates/nuxt/composables/stringHelper.generate.ts.eta +0 -5
  66. package/templates/nuxt/error.vue._eta +3 -3
  67. package/templates/nuxt/i18n.config.ts.eta +1 -1
  68. package/templates/nuxt/lang/en.ts.eta +16 -0
  69. package/templates/nuxt/layouts/default.vue._eta +34 -34
  70. package/templates/nuxt/layouts/loginlayout.vue._eta +3 -0
  71. package/templates/nuxt/layouts/mobile.vue._eta +52 -0
  72. package/templates/nuxt/nuxt.config.ts._eta +28 -22
  73. package/templates/nuxt/pages/[xorg]/organization/[id].vue.eta +39 -0
  74. package/templates/nuxt/pages/[xorg]/organization/new.vue.eta +30 -143
  75. package/templates/nuxt/pages/[xorg]/organization/viewer.vue.eta +3 -0
  76. package/templates/nuxt/pages/[xorg]/organization.vue.eta +81 -127
  77. package/templates/nuxt/pages/[xorg]/user/[id].vue.eta +40 -0
  78. package/templates/nuxt/pages/[xorg]/user/form.vue.eta +329 -0
  79. package/templates/nuxt/pages/[xorg]/user/index.vue.eta +37 -0
  80. package/templates/nuxt/pages/[xorg]/{organization/[id]/branches/[bid].vue → user/new.vue.eta} +10 -4
  81. package/templates/nuxt/pages/[xorg]/user/viewer.vue.eta +30 -0
  82. package/templates/nuxt/pages/[xorg]/{user.vue._eta → user.vue.eta} +88 -78
  83. package/templates/nuxt/pages/login.vue._eta +34 -0
  84. package/templates/nuxt/pages/profile.vue.eta +12 -3
  85. package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +36 -35
  86. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +6 -0
  87. package/templates/nuxt/server/api/[xorg]/[...].ts.eta +7 -40
  88. package/templates/nuxt/server/api/profile/[...].ts.eta +3 -32
  89. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +42 -3
  90. package/templates/nuxt/types/calendar.ts.eta +8 -1
  91. package/templates/nuxt/types/documentlist.ts.eta +0 -9
  92. package/templates/nuxt/types/events.ts.eta +1 -0
  93. package/templates/nuxt/types/others.ts.eta +4 -1
  94. package/templates/nuxt/types/simpleappinput.ts.eta +12 -2
  95. package/templates/nuxt/types/user.ts.eta +2 -0
  96. package/templates/project/lang/default._json +9 -1
  97. package/tsconfig.tsbuildinfo +1 -1
  98. package/templates/nuxt/components/docPage/DocPageList.vue.eta +0 -125
  99. package/templates/nuxt/lang/en.ts._eta +0 -6
  100. package/templates/nuxt/pages/[xorg]/organization/[bid].vue.eta +0 -14
  101. package/templates/nuxt/pages/[xorg]/organization/[id]/branches/new.vue +0 -149
  102. package/templates/nuxt/pages/[xorg]/organization/[id]/index.vue.eta +0 -1
  103. package/templates/nuxt/pages/[xorg]/user/[id].vue._eta +0 -6
  104. package/templates/nuxt/pages/[xorg]/user/index.vue._eta +0 -302
  105. package/templates/nuxt/pages/login.vue.eta +0 -30
  106. /package/templates/nuxt/lang/{df.ts.eta → df.ts.etaxxxx} +0 -0
@@ -1,277 +1,414 @@
1
1
  <template>
2
- <SimpleAppFieldContainer :hidelabel="hidelabel" v-model="modelValue"
3
- :label="label" :description="description" :pt="pt"
4
- :setting="setting" :instancepath="instancepath" :error="error" #default="slotprops">
5
- <Checkbox v-if="inputType ==SimpleAppInputType.checkbox" :readonly="isReadonly" :pt="pt"
6
- :inputId="slotprops.uuid" :path="setting.instancepath"
7
- v-model="modelValue" :binary="true"
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)"/>
2
+ <SimpleAppFieldContainer
3
+ :hidelabel="hidelabel"
4
+ v-model="modelValue"
5
+ :label="label"
6
+ :description="description"
7
+ :pt="pt"
8
+ :inputType="inputType"
9
+ :setting="setting"
10
+ :instancepath="instancepath"
11
+ :error="error"
12
+ #default="slotprops"
13
+ >
14
+ <Checkbox
15
+ v-if="inputType == SimpleAppInputType.checkbox"
16
+ :readonly="isReadonly"
17
+ :pt="pt"
18
+ :inputId="slotprops.uuid"
19
+ :path="setting.instancepath"
20
+ v-model="modelValue"
21
+ :binary="true"
22
+ v-bind="componentProps as CheckboxProps"
23
+ />
24
+ <InputSwitch
25
+ v-else-if="inputType == SimpleAppInputType.switch"
26
+ :readonly="isReadonly"
27
+ :pt="pt"
28
+ :inputId="slotprops.uuid"
29
+ :path="setting.instancepath"
30
+ v-model="modelValue as boolean"
31
+ :binary="true"
32
+ v-bind="componentProps as InputSwitchProps"
33
+ />
13
34
 
14
- <InputText type="date" :pt="pt"
15
- v-else-if="inputType == SimpleAppInputType.date"
16
- :inputId="slotprops.uuid" :path="setting.instancepath"
17
- v-model="datevalue" @update:modelValue="updateDate" :readonly="isReadonly"
18
- :placeholder="placeholder"
19
- v-bind="(componentProps as InputTextProps)"/>
20
- <!-- calendar component -->
21
- <Calendar type="date" :pt="pt" class="flex flex-col"
22
- v-else-if="SimpleAppInputType.calendar==inputType"
23
- :inputId="slotprops.uuid" :path="setting.instancepath"
24
- v-model="datevalue" @update:modelValue="updateDate" :readonly="isReadonly"
25
- :placeholder="placeholder"
26
- v-bind="(componentProps as CalendarProps)"/>
35
+ <InputText
36
+ type="date"
37
+ :pt="pt"
38
+ v-else-if="inputType == SimpleAppInputType.date"
39
+ :inputId="slotprops.uuid"
40
+ :path="setting.instancepath"
41
+ v-model="datevalue"
42
+ @update:modelValue="updateDate"
43
+ :readonly="isReadonly"
44
+ :placeholder="placeholder"
45
+ v-bind="componentProps as InputTextProps"
46
+ />
47
+ <!-- calendar component -->
48
+ <Calendar
49
+ type="date"
50
+ :pt="pt"
51
+ class="flex flex-col"
52
+ v-else-if="SimpleAppInputType.calendar == inputType"
53
+ :inputId="slotprops.uuid"
54
+ :path="setting.instancepath"
55
+ v-model="datevalue"
56
+ @update:modelValue="updateDate"
57
+ :readonly="isReadonly"
58
+ :placeholder="placeholder"
59
+ v-bind="componentProps as CalendarProps"
60
+ />
27
61
 
28
- <!-- time component -->
29
- <Calendar :pt="pt"
30
- v-else-if="inputType == SimpleAppInputType.time" timeOnly showTime
31
- hourFormat="12"
32
- @update:modelValue="updateTime"
33
- :inputId="slotprops.uuid" :path="setting.instancepath"
34
- v-model="(modelValue as string)" :readonly="isReadonly"
35
- :placeholder="placeholder"
36
- v-bind="(componentProps as CalendarProps)"/>
62
+ <!-- time component -->
63
+ <Calendar
64
+ :pt="pt"
65
+ v-else-if="inputType == SimpleAppInputType.time"
66
+ timeOnly
67
+ showTime
68
+ hourFormat="12"
69
+ @update:modelValue="updateTime"
70
+ :inputId="slotprops.uuid"
71
+ :path="setting.instancepath"
72
+ v-model="modelValue as string"
73
+ :readonly="isReadonly"
74
+ :placeholder="placeholder"
75
+ v-bind="componentProps as CalendarProps"
76
+ />
37
77
 
38
- <!-- select/list component -->
39
- <Listbox v-model="modelValue" :pt="pt"
40
- v-else-if="SimpleAppInputType.list==inputType"
41
- :inputId="slotprops.uuid" :path="setting.instancepath"
42
- :readonly="isReadonly"
43
- class="w w-full lg:w-full"
44
- :disabled="isReadonly"
45
- :options="getListOptions()" optionLabel="label" optionValue="value"
46
- :placeholder="placeholder"
47
- v-bind="(componentProps as ListboxProps)"/>
78
+ <!-- select/list component -->
79
+ <Listbox
80
+ v-model="modelValue"
81
+ :pt="pt"
82
+ v-else-if="SimpleAppInputType.list == inputType"
83
+ :inputId="slotprops.uuid"
84
+ :path="setting.instancepath"
85
+ :readonly="isReadonly"
86
+ class="w w-full lg:w-full"
87
+ :disabled="isReadonly"
88
+ :options="getListOptions()"
89
+ optionLabel="label"
90
+ optionValue="value"
91
+ :placeholder="placeholder"
92
+ v-bind="componentProps as ListboxProps"
93
+ />
48
94
 
49
- <Dropdown v-model="modelValue" :pt="pt"
50
- v-else-if="SimpleAppInputType.select == inputType"
51
- :inputId="slotprops.uuid" :path="setting.instancepath"
52
- :readonly="isReadonly"
53
- class="w w-full lg:w-full"
54
- :disabled="isReadonly"
55
- :options="getListOptions()" optionLabel="label" optionValue="value"
56
- :placeholder="placeholder"
57
- v-bind="componentProps"/>
58
-
59
- <!-- radio component -->
60
- <div v-else-if="inputType == SimpleAppInputType.radio" >
61
- <div v-for="(item,index) in getListOptions()">
62
- <RadioButton :pt="pt" v-model="modelValue"
63
- :inputId="setting.key+'-'+index" name="smaple" :value="item.value"
64
- :readonly="isReadonly"
65
- /> {{ ' ' }}
66
- <label :for="setting.key+'-'+index"> {{ item.label }} </label>
67
- </div>
68
- </div>
69
-
70
- <!-- autocomplete, need do more enterprise grade component-->
71
- <SimpleAppAutocomplete v-else-if="inputType==SimpleAppInputType.autocomplete"
72
- v-model="(modelValue as autocompletetype)"
73
- :pt="pt"
74
- :setting="setting"
75
- :disabled="isReadonly"
76
- :inputId="slotprops.uuid"
77
- :path="setting.instancepath"
78
- :readonly="isReadonly"
79
- :placeholder="placeholder"
80
- />
81
- <!-- v-bind:attributes="componentProps" -->
82
- <!-- document no input-->
83
- <SimpleAppDocumentNo v-else-if="inputType == SimpleAppInputType.documentno"
84
- :setting="setting" v-model="(modelValue as string)" :inputId="slotprops.uuid"
85
- :readonly="isReadonly" @update:docNoFormat="triggerDocNoFormatChange"
86
- :pt="pt"
87
- :path="setting.instancepath"
88
- v-bind="(componentProps as any)"/>
89
- <!-- use componentProps as any at the moment, no ideal yet, and for compatibility -->
90
-
91
-
92
- <!-- password -->
93
- <Password
94
- v-else-if="inputType == SimpleAppInputType.password"
95
- :type="type" v-model="(modelValue as string)" :pt="pt"
96
- :readonly="isReadonly" class="flex flex-col"
97
- :inputId="slotprops.uuid" :path="setting.instancepath"
98
- :placeholder="placeholder"
99
- v-bind="(componentProps as PasswordProps)"/>
95
+ <Dropdown
96
+ v-model="modelValue"
97
+ :pt="pt"
98
+ v-else-if="SimpleAppInputType.select == inputType"
99
+ :inputId="slotprops.uuid"
100
+ :path="setting.instancepath"
101
+ :readonly="isReadonly"
102
+ class="w w-full lg:w-full"
103
+ :disabled="isReadonly"
104
+ :options="getListOptions()"
105
+ optionLabel="label"
106
+ optionValue="value"
107
+ :placeholder="placeholder"
108
+ v-bind="componentProps"
109
+ />
100
110
 
101
- <!-- rating -->
102
- <Rating v-else-if="inputType == SimpleAppInputType.rating"
103
- :type="type" v-model="(modelValue as number)" :pt="pt"
104
- :readonly="isReadonly"
105
- :inputId="slotprops.uuid" :path="setting.instancepath"
106
- v-bind="(componentProps as RatingProps)"/>
107
-
108
- <!-- chip -->
109
- <Chips v-else-if="inputType == SimpleAppInputType.chip"
110
- :type="type" v-model="(modelValue as string[])"
111
- :pt="pt"
112
- :disabled="isReadonly"
113
- :inputId="slotprops.uuid" :path="setting.instancepath"
114
- :placeholder="placeholder"
115
- v-bind="(componentProps as ChipsProps)"
116
- />
117
- <!-- simple component -->
118
- <InputNumber v-else-if="inputType == SimpleAppInputType.number"
119
- :type="type" v-model="(modelValue as number)"
120
- :readonly="isReadonly"
121
- :pt="pt"
122
- :class="!pt ? 'w-full flex flex-col' :''"
123
- :inputId="slotprops.uuid" :path="setting.instancepath"
124
- v-bind="(componentProps as InputNumber)"
125
- :placeholder="placeholder"
126
- />
127
- <Textarea v-else-if="inputType == SimpleAppInputType.textarea"
128
- v-model="(modelValue as string)"
129
- :readonly="isReadonly"
130
- :pt="pt"
131
- :type="type"
132
- class="w-full flex flex-col"
133
- :inputId="slotprops.uuid"
134
- :path="setting.instancepath"
135
- :placeholder="placeholder"
136
- v-bind="(componentProps as TextareaProps)"
137
- />
138
- <InputText v-else
139
- v-model="(modelValue as string)"
140
- :readonly="isReadonly"
141
- :pt="pt"
142
- :type="type"
143
- class="w-full flex flex-col"
144
- :inputId="slotprops.uuid"
145
- :path="setting.instancepath"
146
- :placeholder="placeholder"
147
- v-bind="(componentProps as InputTextProps)"
148
- />
149
- <!-- component require special treatment -->
150
- </SimpleAppFieldContainer>
111
+ <!-- radio component -->
112
+ <div v-else-if="inputType == SimpleAppInputType.radio">
113
+ <div v-for="(item, index) in getListOptions()">
114
+ <RadioButton
115
+ :pt="pt"
116
+ v-model="modelValue"
117
+ :inputId="setting.key + '-' + index"
118
+ name="smaple"
119
+ :value="item.value"
120
+ :readonly="isReadonly"
121
+ />
122
+ {{ " " }}
123
+ <label :for="setting.key + '-' + index"> {{ item.label }} </label>
124
+ </div>
125
+ </div>
126
+
127
+ <!-- autocomplete, need do more enterprise grade component-->
128
+ <SimpleAppAutocomplete
129
+ v-else-if="inputType == SimpleAppInputType.autocomplete"
130
+ v-model="modelValue as autocompletetype"
131
+ :hidelabel="hidelabel"
132
+ :pt="pt"
133
+ :setting="setting"
134
+ :disabled="isReadonly"
135
+ :inputId="slotprops.uuid"
136
+ :path="setting.instancepath"
137
+ :readonly="isReadonly"
138
+ :placeholder="placeholder"
139
+ />
140
+ <!-- v-bind:attributes="componentProps" -->
141
+ <!-- document no input-->
142
+ <SimpleAppDocumentNo
143
+ v-else-if="inputType == SimpleAppInputType.documentno"
144
+ :setting="setting"
145
+ v-model="modelValue as string"
146
+ :inputId="slotprops.uuid"
147
+ :readonly="isReadonly"
148
+ @update:docNoFormat="triggerDocNoFormatChange"
149
+ :pt="pt"
150
+ :path="setting.instancepath"
151
+ v-bind="componentProps as any"
152
+ />
153
+ <!-- use componentProps as any at the moment, no ideal yet, and for compatibility -->
154
+
155
+ <!-- password -->
156
+ <Password
157
+ v-else-if="inputType == SimpleAppInputType.password"
158
+ :type="type"
159
+ v-model="modelValue as string"
160
+ :pt="pt"
161
+ @focus="setFocus"
162
+ :readonly="isReadonly"
163
+ class="flex flex-col"
164
+ :inputId="slotprops.uuid"
165
+ :path="setting.instancepath"
166
+ :placeholder="placeholder"
167
+ v-bind="componentProps as PasswordProps"
168
+ />
169
+
170
+ <!-- rating -->
171
+ <Rating
172
+ v-else-if="inputType == SimpleAppInputType.rating"
173
+ :type="type"
174
+ v-model="modelValue as number"
175
+ :pt="pt"
176
+ :readonly="isReadonly"
177
+ :inputId="slotprops.uuid"
178
+ :path="setting.instancepath"
179
+ v-bind="componentProps as RatingProps"
180
+ />
181
+
182
+ <!-- chip -->
183
+ <Chips
184
+ v-else-if="inputType == SimpleAppInputType.chip"
185
+ :type="type"
186
+ v-model="modelValue as string[]"
187
+ :pt="pt"
188
+ :disabled="isReadonly"
189
+ :inputId="slotprops.uuid"
190
+ :path="setting.instancepath"
191
+ :placeholder="placeholder"
192
+ v-bind="componentProps as ChipsProps"
193
+ />
194
+ <!-- simple component -->
195
+
196
+ <InputNumber
197
+ v-else-if="inputType == SimpleAppInputType.number"
198
+ :type="type"
199
+ v-model="modelValue as number"
200
+ @focus="setFocus"
201
+ :readonly="isReadonly"
202
+ :pt="pt"
203
+ :class="!pt ? 'w-full flex flex-col' : ''"
204
+ :inputId="slotprops.uuid"
205
+ :path="setting.instancepath"
206
+ v-bind="componentProps as InputNumber"
207
+ :placeholder="placeholder"
208
+ />
209
+ <Textarea
210
+ v-else-if="inputType == SimpleAppInputType.textarea"
211
+ v-model="modelValue as string"
212
+ :autofocus="autofocus"
213
+ :readonly="isReadonly"
214
+ :pt="pt"
215
+ :type="type"
216
+ class="w-full flex flex-col"
217
+ :inputId="slotprops.uuid"
218
+ :path="setting.instancepath"
219
+ :placeholder="placeholder"
220
+ v-bind="componentProps as TextareaProps"
221
+ />
222
+ <InputText
223
+ v-else
224
+ v-model="modelValue as string"
225
+ @focus="setFocus"
226
+ :autofocus="autofocus"
227
+ :readonly="isReadonly"
228
+ :pt="pt"
229
+ :type="type"
230
+ class="w-full flex flex-col"
231
+ :inputId="slotprops.uuid"
232
+ :path="setting.instancepath"
233
+ :placeholder="placeholder"
234
+ v-bind="componentProps as InputTextProps"
235
+ />
236
+ <!-- component require special treatment -->
237
+ </SimpleAppFieldContainer>
151
238
  </template>
152
239
 
153
240
  <script lang="ts" setup>
154
- import {autocompletetype} from '~/types'
155
- import moment from 'moment'
156
- import AutoComplete,{ AutoCompleteProps } from 'primevue/autocomplete';
157
- import Calendar,{ CalendarProps } from 'primevue/calendar';
158
- import Checkbox,{ CheckboxProps } from 'primevue/checkbox';
159
- import Chips,{ ChipsProps } from 'primevue/chips';
160
- import SimpleAppDocumentNo from './SimpleAppDocumentNo.vue';
161
- import SimpleAppAutocomplete from './SimpleAppAutocomplete.vue'
162
- import Dropdown,{ DropdownProps } from 'primevue/dropdown';
163
- import InputNumber, { InputNumberProps } from 'primevue/inputnumber';
164
- import InputSwitch, { InputSwitchProps } from 'primevue/inputswitch';
165
- import InputText, { InputTextProps } from 'primevue/inputtext';
166
- import Listbox,{ ListboxProps } from 'primevue/listbox';
167
- import MultiSelect,{ MultiSelectProps } from 'primevue/multiselect';
168
- import Password,{ PasswordProps } from 'primevue/password';
169
- import RadioButton,{ RadioButtonProps } from 'primevue/radiobutton';
170
- import Rating,{ RatingProps } from 'primevue/rating';
171
- import Slider,{ SliderProps } from 'primevue/slider';
172
- import Textarea, { TextareaProps } from 'primevue/textarea';
173
- import {SimpleAppInputType} from '~/types'
174
-
175
- const modelValue = defineModel({required:true})
176
- const datevalue = ref('')
177
- const timevalue = ref<Date>()
241
+ import { autocompletetype } from "~/types";
242
+ import moment from "moment";
243
+ import AutoComplete, { AutoCompleteProps } from "primevue/autocomplete";
244
+ import Calendar, { CalendarProps } from "primevue/calendar";
245
+ import Checkbox, { CheckboxProps } from "primevue/checkbox";
246
+ import Chips, { ChipsProps } from "primevue/chips";
247
+ import SimpleAppDocumentNo from "./SimpleAppDocumentNo.vue";
248
+ import SimpleAppAutocomplete from "./SimpleAppAutocomplete.vue";
249
+ import Dropdown, { DropdownProps } from "primevue/dropdown";
250
+ import InputNumber, { InputNumberProps } from "primevue/inputnumber";
251
+ import InputSwitch, { InputSwitchProps } from "primevue/inputswitch";
252
+ import InputText, { InputTextProps } from "primevue/inputtext";
253
+ import Listbox, { ListboxProps } from "primevue/listbox";
254
+ import MultiSelect, { MultiSelectProps } from "primevue/multiselect";
255
+ import Password, { PasswordProps } from "primevue/password";
256
+ import RadioButton, { RadioButtonProps } from "primevue/radiobutton";
257
+ import Rating, { RatingProps } from "primevue/rating";
258
+ import Slider, { SliderProps } from "primevue/slider";
259
+ import Textarea, { TextareaProps } from "primevue/textarea";
260
+ import { SimpleAppInputType } from "~/types";
178
261
 
179
- const props = withDefaults( defineProps<{
180
- inputType:SimpleAppInputType,
181
- label?:string,
182
- description?:string,
183
- error?:string,
184
- setting:any,
185
- type?:string,
186
- instancepath?:string,
187
- hidelabel?: boolean
188
- readonly?: boolean
189
- pt?:any,
190
- placeholder?:string
191
- componentProps?: InputNumberProps | InputSwitchProps | InputTextProps | TextareaProps | DropdownProps | CalendarProps | RatingProps
262
+ const instancepath = ref("");
263
+ const modelValue = defineModel({ required: true });
264
+ const datevalue = ref("");
265
+ const timevalue = ref<Date>();
192
266
 
193
- }>(),{type:'text'})
267
+ const props = withDefaults(
268
+ defineProps<{
269
+ inputType: SimpleAppInputType;
270
+ label?: string;
271
+ description?: string;
272
+ error?: string;
273
+ setting: any;
274
+ type?: string;
275
+ instancepath?: string;
276
+ hidelabel?: boolean;
277
+ readonly?: boolean;
278
+ autofocus?: boolean;
279
+ pt?: any;
280
+ placeholder?: string;
281
+ componentProps?:
282
+ | InputNumberProps
283
+ | InputSwitchProps
284
+ | InputTextProps
285
+ | TextareaProps
286
+ | DropdownProps
287
+ | CalendarProps
288
+ | RatingProps;
289
+ }>(),
290
+ { type: "text" },
291
+ );
194
292
 
293
+ const pt =ref(props.pt)
195
294
 
196
- if(props.inputType== SimpleAppInputType.date && modelValue.value){
197
- datevalue.value = moment(modelValue.value as string ).format('YYYY-MM-DD')
198
- }else{
199
- datevalue.value = ''
295
+ if (props.inputType == SimpleAppInputType.date && modelValue.value) {
296
+ datevalue.value = moment(modelValue.value as string).format("YYYY-MM-DD");
297
+ } else {
298
+ datevalue.value = "";
200
299
  }
201
300
 
202
- const isReadonly = computed(()=>{
203
- if(props.readonly){
204
- return props.readonly
205
- }else if(props.setting.readonly){
206
- return props.setting.readonly
207
- }else{
208
- return false
209
- }
210
- })
211
- const updateTime = () =>{
212
- modelValue.value = moment(timevalue.value).format("HH:mm:ss")
213
- }
214
- const updateDate = (value:any)=>{
215
-
216
- if(value){
217
- modelValue.value = moment(value).format('YYYY-MM-DD')
218
- }else{
219
- modelValue.value=''
220
- }
221
-
222
- }
301
+ if (props?.instancepath) instancepath.value = props.instancepath;
302
+ else if (props.setting?.instancepath)
303
+ instancepath.value = props.setting.instancepath;
304
+ else instancepath.value = "/unknown";
305
+
306
+ watch(props.setting.errors, (newvalue, oldvalue) => {
307
+ let errmsg = ''
308
+ if (newvalue[instancepath.value]) {
309
+ const errlist: any[] = newvalue[instancepath.value];
310
+ for (let i = 0; i < errlist.length; i++) {
311
+ errmsg += errlist[i].message + ",";
312
+ }
313
+ } else {
314
+ errmsg = "";
315
+ }
316
+ if(errmsg!=''){
317
+ const errorstyle = { style:'border-color: lightcoral; color:white '}
318
+ if(!pt.value)pt.value = {}
223
319
 
320
+ if(props.inputType == SimpleAppInputType.text) pt.value={ root: errorstyle}
321
+ else if(props.inputType == SimpleAppInputType.autocomplete) pt.value={ input:errorstyle}
322
+ else if(props.inputType == SimpleAppInputType.number) pt.value={ input: {root:errorstyle} }
323
+ else pt.value = {root: errorstyle, input:{root:errorstyle}}
324
+ //some component still not working
224
325
 
225
- const getListOptions = () =>{
326
+ }else{
327
+ pt.value=props.pt
328
+ }
226
329
 
227
- const options = []
228
- if(props.setting.fieldsetting.enum){
229
- for(let i=0;i<props.setting.fieldsetting.enum.length;i++){
230
- const v = props.setting.fieldsetting.enum[i]
231
- if(typeof v == 'string'){
232
- options.push({value:v, label: t(v)})
233
- }else{
234
- options.push({value:v.value, label: t(v.label)})
235
- }
236
-
237
- }
330
+
331
+ })
332
+ const isReadonly = computed(() => {
333
+ if (props.readonly) {
334
+ return props.readonly;
335
+ } else if (props.setting.readonly) {
336
+ return props.setting.readonly;
337
+ } else {
338
+ return false;
339
+ }
340
+ });
341
+ const updateTime = () => {
342
+ modelValue.value = moment(timevalue.value).format("HH:mm:ss");
343
+ };
344
+ const updateDate = (value: any) => {
345
+ if (value) {
346
+ modelValue.value = moment(value).format("YYYY-MM-DD");
347
+ } else {
348
+ modelValue.value = "";
349
+ }
350
+ };
238
351
 
352
+ const setFocus = (ev: any) => {
353
+ if (!isMobile()) ev.target.select();
354
+ };
239
355
 
356
+ const getListOptions = () => {
357
+ const options = [];
358
+ if (props.setting.fieldsetting.enum) {
359
+ for (let i = 0; i < props.setting.fieldsetting.enum.length; i++) {
360
+ const v = props.setting.fieldsetting.enum[i];
361
+ if (typeof v == "string") {
362
+ options.push({ value: v, label: t(v) });
363
+ } else {
364
+ options.push({ value: v.value, label: t(v.label) });
365
+ }
240
366
  }
241
- return options
242
- }
367
+ }
368
+ return options;
369
+ };
243
370
 
371
+ const emits = defineEmits([
372
+ "change",
373
+ "update:modelValue",
374
+ "update:docNoFormat",
375
+ ]);
244
376
 
245
- const emits = defineEmits(['change','update:modelValue','update:docNoFormat'])
246
-
247
- watch(modelValue ,(newvalue:any)=>{
248
-
249
- if([SimpleAppInputType.date,SimpleAppInputType.calendar].includes(props.inputType)){
250
- if(modelValue.value){
251
- datevalue.value = moment(modelValue.value as string ).format('YYYY-MM-DD')
252
- }else{
253
- datevalue.value = ''
254
- }
255
-
377
+ watch(modelValue, (newvalue: any) => {
378
+ if (
379
+ [SimpleAppInputType.date, SimpleAppInputType.calendar].includes(
380
+ props.inputType,
381
+ )
382
+ ) {
383
+ if (modelValue.value) {
384
+ datevalue.value = moment(modelValue.value as string).format("YYYY-MM-DD");
385
+ } else {
386
+ datevalue.value = "";
256
387
  }
388
+ }
257
389
 
258
-
259
- emits('change',modelValue.value)
260
- emits('update:modelValue',modelValue.value)
261
- })
262
-
390
+ emits("change", modelValue.value);
391
+ emits("update:modelValue", modelValue.value);
392
+ });
393
+ onMounted(() => {
394
+ if (
395
+ [SimpleAppInputType.date, SimpleAppInputType.calendar].includes(
396
+ props.inputType,
397
+ )
398
+ ) {
399
+ if (modelValue.value) {
400
+ datevalue.value = moment(modelValue.value as string).format("YYYY-MM-DD");
401
+ } else {
402
+ datevalue.value = "";
403
+ }
404
+ }
405
+ });
263
406
 
264
407
  /************ start autocomplete only ***************/
265
408
 
266
409
  /************ end autocomplete only ***************/
267
410
 
268
-
269
-
270
-
271
-
272
- const triggerDocNoFormatChange=(formatdata:any)=>{
273
- emits('update:docNoFormat',formatdata)
274
- }
411
+ const triggerDocNoFormatChange = (formatdata: any) => {
412
+ emits("update:docNoFormat", formatdata);
413
+ };
275
414
  </script>
276
- <style scoped>
277
- </style>