@simitgroup/simpleapp-generator 1.2.8 → 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.
- package/dist/buildinschemas/organization.d.ts.map +1 -1
- package/dist/buildinschemas/organization.js +3 -1
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +3 -8
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +14 -14
- package/dist/generate.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/organization.ts +3 -1
- package/src/framework.ts +4 -8
- package/src/generate.ts +17 -16
- package/templates/basic/nest/controller.ts.eta +17 -0
- package/templates/basic/nest/default.ts.eta +6 -2
- package/templates/basic/nuxt/default.ts.eta +10 -6
- package/templates/basic/nuxt/pages.[id].vue.eta +9 -7
- package/templates/basic/nuxt/pages.form.vue.eta +16 -36
- package/templates/basic/nuxt/pages.landing.vue.eta +42 -35
- package/templates/basic/nuxt/pages.viewer.vue.eta +4 -6
- package/templates/nest/.env._eta +0 -1
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +14 -2
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +32 -18
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +76 -13
- package/templates/nuxt/assets/css/style.css._eta +19 -7
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +20 -9
- package/templates/nuxt/components/button/ButtonDefault.vue._eta +1 -2
- package/templates/nuxt/components/button/ButtonMultiple.vue._eta +21 -0
- package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +3 -4
- package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +75 -65
- package/templates/nuxt/components/form/FormBranch.vue.eta +83 -0
- package/templates/nuxt/components/form/readme.md.eta +1 -0
- package/templates/nuxt/components/header/button/HeaderButtonMenuPicker.vue._eta +13 -11
- package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +11 -17
- package/templates/nuxt/components/list/ListDocument.vue.eta +25 -0
- package/templates/nuxt/components/list/ListDocumentTable.vue.eta +77 -0
- package/templates/nuxt/components/list/ListView.vue.eta +129 -60
- package/templates/nuxt/components/mobile/MobileToolbar.vue.eta +10 -0
- package/templates/nuxt/components/overlay/OverlaySideBarCrud.vue.eta +21 -0
- package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +20 -0
- package/templates/nuxt/components/page/PageDocList.vue.eta +170 -0
- package/templates/nuxt/components/renderer/RendererBoolean.vue.eta +8 -4
- package/templates/nuxt/components/renderer/RendererDate.vue.eta +4 -4
- package/templates/nuxt/components/renderer/RendererLink.vue.eta +12 -20
- package/templates/nuxt/components/renderer/RendererViewer.vue.eta +27 -21
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +201 -174
- package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +115 -111
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue.eta +183 -91
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +383 -263
- package/templates/nuxt/components/table/TableDocuments.vue.eta +3 -3
- package/templates/nuxt/components/text/TextDanger.vue._eta +5 -0
- package/templates/nuxt/components/text/TextSubtitle.vue._eta +5 -0
- package/templates/nuxt/components/text/TextTitle.vue._eta +5 -0
- package/templates/nuxt/composables/date.generate.ts.eta +14 -9
- package/templates/nuxt/i18n.config.ts.eta +1 -1
- package/templates/nuxt/lang/en.ts.eta +16 -0
- package/templates/nuxt/layouts/default.vue._eta +32 -17
- package/templates/nuxt/layouts/mobile.vue._eta +35 -12
- package/templates/nuxt/nuxt.config.ts._eta +3 -7
- package/templates/nuxt/pages/[xorg]/organization/[id].vue.eta +39 -0
- package/templates/nuxt/pages/[xorg]/organization/new.vue.eta +30 -143
- package/templates/nuxt/pages/[xorg]/organization/viewer.vue.eta +3 -0
- package/templates/nuxt/pages/[xorg]/organization.vue.eta +81 -127
- package/templates/nuxt/pages/[xorg]/user/[id].vue.eta +38 -4
- package/templates/nuxt/pages/[xorg]/user/form.vue.eta +329 -0
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +29 -292
- package/templates/nuxt/pages/[xorg]/{organization/[id]/branches/[bid].vue → user/new.vue.eta} +10 -4
- package/templates/nuxt/pages/[xorg]/user/viewer.vue.eta +30 -0
- package/templates/nuxt/pages/[xorg]/user.vue.eta +88 -78
- package/templates/nuxt/pages/profile.vue.eta +12 -3
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +2 -3
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +41 -2
- package/templates/nuxt/types/documentlist.ts.eta +0 -9
- package/templates/nuxt/types/events.ts.eta +1 -0
- package/templates/nuxt/types/simpleappinput.ts.eta +12 -2
- package/templates/nuxt/types/user.ts.eta +2 -0
- package/templates/project/lang/default._json +5 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/components/docPage/DocPageList.vue.eta +0 -125
- package/templates/nuxt/lang/en.ts._eta +0 -6
- package/templates/nuxt/pages/[xorg]/organization/[bid].vue.eta +0 -14
- package/templates/nuxt/pages/[xorg]/organization/[id]/branches/new.vue +0 -149
- package/templates/nuxt/pages/[xorg]/organization/[id]/index.vue.eta +0 -1
- /package/templates/nuxt/lang/{df.ts.eta → df.ts.etaxxxx} +0 -0
|
@@ -1,294 +1,414 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
@focus="setFocus"
|
|
97
|
-
:readonly="isReadonly" class="flex flex-col"
|
|
98
|
-
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
99
|
-
:placeholder="placeholder"
|
|
100
|
-
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
|
+
/>
|
|
101
110
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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>
|
|
156
238
|
</template>
|
|
157
239
|
|
|
158
240
|
<script lang="ts" setup>
|
|
159
|
-
import {autocompletetype} from
|
|
160
|
-
import moment from
|
|
161
|
-
import AutoComplete,{ AutoCompleteProps } from
|
|
162
|
-
import Calendar,{ CalendarProps } from
|
|
163
|
-
import Checkbox,{ CheckboxProps } from
|
|
164
|
-
import Chips,{ ChipsProps } from
|
|
165
|
-
import SimpleAppDocumentNo from
|
|
166
|
-
import SimpleAppAutocomplete from
|
|
167
|
-
import Dropdown,{ DropdownProps } from
|
|
168
|
-
import InputNumber, { InputNumberProps } from
|
|
169
|
-
import InputSwitch, { InputSwitchProps } from
|
|
170
|
-
import InputText, { InputTextProps } from
|
|
171
|
-
import Listbox,{ ListboxProps } from
|
|
172
|
-
import MultiSelect,{ MultiSelectProps } from
|
|
173
|
-
import Password,{ PasswordProps } from
|
|
174
|
-
import RadioButton,{ RadioButtonProps } from
|
|
175
|
-
import Rating,{ RatingProps } from
|
|
176
|
-
import Slider,{ SliderProps }
|
|
177
|
-
import Textarea, { TextareaProps } from
|
|
178
|
-
import {SimpleAppInputType} from
|
|
179
|
-
|
|
180
|
-
const modelValue = defineModel({required:true})
|
|
181
|
-
const datevalue = ref('')
|
|
182
|
-
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";
|
|
183
261
|
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
error?:string,
|
|
189
|
-
setting:any,
|
|
190
|
-
type?:string,
|
|
191
|
-
instancepath?:string,
|
|
192
|
-
hidelabel?: boolean
|
|
193
|
-
readonly?: boolean
|
|
194
|
-
autofocus?:boolean
|
|
195
|
-
pt?:any,
|
|
196
|
-
placeholder?:string
|
|
197
|
-
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>();
|
|
198
266
|
|
|
199
|
-
|
|
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
|
+
);
|
|
200
292
|
|
|
293
|
+
const pt =ref(props.pt)
|
|
201
294
|
|
|
202
|
-
if(props.inputType== SimpleAppInputType.date && modelValue.value){
|
|
203
|
-
|
|
204
|
-
}else{
|
|
205
|
-
|
|
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 = "";
|
|
206
299
|
}
|
|
207
300
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
return props.setting.readonly
|
|
213
|
-
}else{
|
|
214
|
-
return false
|
|
215
|
-
}
|
|
216
|
-
})
|
|
217
|
-
const updateTime = () =>{
|
|
218
|
-
modelValue.value = moment(timevalue.value).format("HH:mm:ss")
|
|
219
|
-
}
|
|
220
|
-
const updateDate = (value:any)=>{
|
|
221
|
-
|
|
222
|
-
if(value){
|
|
223
|
-
modelValue.value = moment(value).format('YYYY-MM-DD')
|
|
224
|
-
}else{
|
|
225
|
-
modelValue.value=''
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
}
|
|
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";
|
|
229
305
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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 = {}
|
|
233
319
|
|
|
234
|
-
|
|
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
|
|
325
|
+
|
|
326
|
+
}else{
|
|
327
|
+
pt.value=props.pt
|
|
328
|
+
}
|
|
235
329
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
+
};
|
|
247
351
|
|
|
352
|
+
const setFocus = (ev: any) => {
|
|
353
|
+
if (!isMobile()) ev.target.select();
|
|
354
|
+
};
|
|
248
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
|
+
}
|
|
249
366
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
367
|
+
}
|
|
368
|
+
return options;
|
|
369
|
+
};
|
|
253
370
|
|
|
254
|
-
const emits = defineEmits([
|
|
371
|
+
const emits = defineEmits([
|
|
372
|
+
"change",
|
|
373
|
+
"update:modelValue",
|
|
374
|
+
"update:docNoFormat",
|
|
375
|
+
]);
|
|
255
376
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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 = "";
|
|
266
387
|
}
|
|
388
|
+
}
|
|
267
389
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
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 = "";
|
|
280
403
|
}
|
|
281
|
-
}
|
|
404
|
+
}
|
|
405
|
+
});
|
|
282
406
|
|
|
283
407
|
/************ start autocomplete only ***************/
|
|
284
408
|
|
|
285
409
|
/************ end autocomplete only ***************/
|
|
286
410
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
const triggerDocNoFormatChange=(formatdata:any)=>{
|
|
292
|
-
emits('update:docNoFormat',formatdata)
|
|
293
|
-
}
|
|
294
|
-
</script>
|
|
411
|
+
const triggerDocNoFormatChange = (formatdata: any) => {
|
|
412
|
+
emits("update:docNoFormat", formatdata);
|
|
413
|
+
};
|
|
414
|
+
</script>
|