@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.
- package/dist/buildinschemas/branch.d.ts.map +1 -1
- package/dist/buildinschemas/branch.js +1 -0
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/changehistories.d.ts +3 -0
- package/dist/buildinschemas/changehistories.d.ts.map +1 -0
- package/dist/buildinschemas/changehistories.js +36 -0
- package/dist/buildinschemas/changehistories.js.map +1 -0
- package/dist/buildinschemas/index.d.ts +1 -0
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +3 -1
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/organization.js +2 -2
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/buildinschemas/user.d.ts.map +1 -1
- package/dist/buildinschemas/user.js +5 -1
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/buildinschemas/webhook.d.ts +3 -0
- package/dist/buildinschemas/webhook.d.ts.map +1 -0
- package/dist/buildinschemas/webhook.js +33 -0
- package/dist/buildinschemas/webhook.js.map +1 -0
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +3 -2
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +30 -11
- package/dist/generate.js.map +1 -1
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
- package/dist/processors/jsonschemabuilder.js +10 -2
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/type.d.ts +2 -0
- package/dist/type.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/branch.ts +1 -0
- package/src/buildinschemas/changehistories.ts +33 -0
- package/src/buildinschemas/index.ts +2 -1
- package/src/buildinschemas/organization.ts +2 -2
- package/src/buildinschemas/user.ts +5 -1
- package/src/buildinschemas/webhook.ts +31 -0
- package/src/framework.ts +3 -2
- package/src/generate.ts +35 -15
- package/src/processors/jsonschemabuilder.ts +10 -2
- package/src/type.ts +2 -0
- package/templates/basic/nest/controller.ts.eta +23 -2
- package/templates/basic/nest/model.ts.eta +9 -1
- package/templates/basic/nest/resolver.ts.eta +2 -2
- package/templates/basic/nuxt/pages.[id].vue.eta +7 -7
- package/templates/basic/nuxt/pages.form.vue.eta +1 -4
- package/templates/basic/nuxt/pages.landing.vue.eta +1 -20
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +8 -1
- package/templates/nest/src/simpleapp/generate/apischemas/simpleapp.apischema.ts.eta +2 -0
- package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +9 -2
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +5 -10
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +1 -0
- package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +50 -0
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +13 -3
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +9 -1
- package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +12 -6
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +120 -19
- package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +3 -1
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +1 -0
- package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +19 -0
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +30 -8
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +2 -1
- package/templates/nuxt/assets/css/calendar.css._eta +3 -0
- package/templates/nuxt/assets/css/style.css._eta +1 -1
- package/templates/nuxt/assets/images/unknown.png.eta +0 -0
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +6 -1
- package/templates/nuxt/components/button/ButtonAction.vue._eta +40 -39
- package/templates/nuxt/components/button/ButtonDanger.vue._eta +11 -3
- package/templates/nuxt/components/button/ButtonDefault.vue._eta +11 -3
- package/templates/nuxt/components/button/ButtonPrimary.vue._eta +9 -3
- package/templates/nuxt/components/button/ButtonSecondary.vue._eta +33 -0
- package/templates/nuxt/components/button/ButtonText.vue._eta +9 -5
- package/templates/nuxt/components/button/ButtonWarning.vue._eta +11 -3
- package/templates/nuxt/components/calendar/CalendarInput.vue.eta +4 -3
- package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +33 -16
- package/templates/nuxt/components/chart/card.vue._eta +1 -1
- package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +36 -26
- package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +36 -13
- package/templates/nuxt/components/form/FormBranch.vue._eta +52 -5
- package/templates/nuxt/components/form/FormDocnoformat.vue.eta +14 -10
- package/templates/nuxt/components/form/FormUser.vue._eta +1 -1
- package/templates/nuxt/components/form/user/FormUserPermission.vue.eta +77 -59
- package/templates/nuxt/components/header/HeaderSelectBranch.vue.eta +42 -35
- package/templates/nuxt/components/image/ImageAvatar.vue.eta._vue +30 -0
- package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +7 -5
- package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +67 -50
- package/templates/nuxt/components/list/ListDocumentTable.vue.eta +20 -12
- package/templates/nuxt/components/list/ListView.vue.eta +64 -35
- package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +5 -4
- package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +8 -8
- package/templates/nuxt/components/page/PageDocList.vue.eta +36 -13
- package/templates/nuxt/components/renderer/RendererDate.vue.eta +8 -2
- package/templates/nuxt/components/renderer/RendererDateTime.vue.eta +7 -1
- package/templates/nuxt/components/renderer/RendererDocHistories.vue.eta +56 -0
- package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +9 -8
- package/templates/nuxt/components/renderer/RendererLink.vue.eta +7 -4
- package/templates/nuxt/components/renderer/RendererMoney.vue.eta +25 -17
- package/templates/nuxt/components/renderer/RendererTime.vue.eta +7 -1
- package/templates/nuxt/components/renderer/RendererViewer.vue.eta +19 -9
- package/templates/nuxt/components/select/SelectTemplate.vue.eta +47 -21
- package/templates/nuxt/components/session/SessionBlock.vue.eta +44 -46
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +24 -15
- package/templates/nuxt/components/simpleApp/SimpleAppCalendarInput.vue.eta +64 -0
- package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +16 -8
- package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +8 -8
- package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +1 -1
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +66 -22
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +89 -168
- package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +43 -40
- package/templates/nuxt/components/simpleApp/SimpleAppUserPicker.vue.eta +387 -0
- package/templates/nuxt/components/text/TextDocStatus.vue._eta +22 -0
- package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +13 -15
- package/templates/nuxt/components/user/UserButtonPermissionInfo.vue.eta +127 -93
- package/templates/nuxt/components/user/UserTenantPicker.vue.eta +1 -1
- package/templates/nuxt/composables/date.generate.ts.eta +105 -8
- package/templates/nuxt/composables/getDocument.generate.ts.eta +8 -6
- package/templates/nuxt/composables/getOpenApi.generate.ts.eta +58 -10
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +37 -5
- package/templates/nuxt/composables/goTo.generate.ts.eta +14 -1
- package/templates/nuxt/composables/graphquery.generate.ts.eta +20 -2
- package/templates/nuxt/composables/recently.generate.ts.eta +16 -0
- package/templates/nuxt/composables/roles.generate.ts.eta +8 -13
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +52 -0
- package/templates/nuxt/composables/sysmessage.generate.ts.eta +1 -1
- package/templates/nuxt/pages/[xorg]/{organization.vue.eta → organization.vue._eta} +38 -9
- package/templates/nuxt/pages/[xorg]/user.vue.eta +12 -9
- package/templates/nuxt/pages/login.vue._eta +4 -1
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +45 -26
- package/templates/nuxt/plugins/70.recently.ts.eta +55 -0
- package/templates/nuxt/providers/my-provider.ts.eta +22 -0
- package/templates/nuxt/server/api/[xorg]/{[...].ts.eta → [...].ts._eta} +47 -21
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +44 -3
- package/templates/nuxt/types/events.ts.eta +3 -2
- package/templates/nuxt/types/others.ts.eta +11 -1
- package/templates/nuxt/types/schema.ts.eta +3 -1
- package/templates/nuxt/types/simpleappinput.ts.eta +1 -1
- package/templates/nuxt/types/user.ts.eta +8 -7
- package/templates/project/jsonschemas/branch.json._eta +1 -0
- package/templates/project/jsonschemas/invoice.json._eta +4 -3
- package/templates/project/jsonschemas/organization.json._eta +2 -2
- package/templates/project/lang/default._json +3 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +0 -38
- /package/templates/nuxt/pages/[xorg]/mobile/docnoformat/{index.vue.eta → index.vue.etaxxx} +0 -0
- /package/templates/nuxt/pages/[xorg]/mobile/{index.vue._eta → index.vue._etaxxx} +0 -0
- /package/templates/nuxt/pages/[xorg]/mobile/organization/{[id].vue._eta → [id].vue._etaxxx} +0 -0
- /package/templates/nuxt/pages/[xorg]/mobile/{pickgroup.vue._eta → pickgroup.vue._etaxxx} +0 -0
- /package/templates/nuxt/pages/[xorg]/mobile/user/{index.vue.eta → index.vue.etaxxx} +0 -0
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
</MobileToolbar>
|
|
36
36
|
</div>
|
|
37
37
|
<div v-else class="simpleapp-tool-bar">
|
|
38
|
-
|
|
38
|
+
<!-- <div class="flex flex-row justify-end p-2">
|
|
39
39
|
<TextTitle class="dark:text-white line-clamp-2 flex-1">{{
|
|
40
40
|
title
|
|
41
41
|
}}</TextTitle>
|
|
42
42
|
<ButtonText @click="callClose"><i class="pi pi-times" /></ButtonText>
|
|
43
43
|
</div> -->
|
|
44
|
-
<div class="flex flex-row gap-2 p-0 justify-between">
|
|
44
|
+
<div class="flex flex-row gap-2 mb-2 p-0 justify-between">
|
|
45
45
|
<!-- left -->
|
|
46
|
-
<div class="flex flex-row">
|
|
46
|
+
<div class="flex flex-row gap-2">
|
|
47
47
|
<div v-for="(menu, index) in menus" :key="index">
|
|
48
48
|
<div v-if="menu.label && menu.type == 'crud'">
|
|
49
49
|
<ButtonAction
|
|
@@ -56,9 +56,13 @@
|
|
|
56
56
|
</div>
|
|
57
57
|
|
|
58
58
|
<!-- center -->
|
|
59
|
-
<div class="flex flex-row
|
|
59
|
+
<div class="flex flex-row"></div>
|
|
60
60
|
<!-- right -->
|
|
61
|
-
<div class="flex flex-row">
|
|
61
|
+
<div class="flex flex-row gap-2">
|
|
62
|
+
<DebugDocumentData v-model="data" :label="t(doc.getDocName())" />
|
|
63
|
+
<div v-if="data.documentStatus">
|
|
64
|
+
<RendererDocHistories :data="data" />
|
|
65
|
+
</div>
|
|
62
66
|
<div v-for="(menu, index) in menus" :key="index">
|
|
63
67
|
<div v-if="menu.label && menu.type == 'docstatus'">
|
|
64
68
|
<ButtonAction
|
|
@@ -72,7 +76,7 @@
|
|
|
72
76
|
</div>
|
|
73
77
|
<ConfirmPopup></ConfirmPopup>
|
|
74
78
|
</div>
|
|
75
|
-
<Dialog v-model:visible="visiblePrintFormats" :header="t('printFormats')">
|
|
79
|
+
<!-- <Dialog v-model:visible="visiblePrintFormats" :header="t('printFormats')">
|
|
76
80
|
<div>
|
|
77
81
|
<ListView
|
|
78
82
|
:list="printformats"
|
|
@@ -85,7 +89,7 @@
|
|
|
85
89
|
</div>
|
|
86
90
|
</ListView>
|
|
87
91
|
</div>
|
|
88
|
-
</Dialog>
|
|
92
|
+
</Dialog> -->
|
|
89
93
|
<OverlayPanelWithToolBar
|
|
90
94
|
v-if="visiblePrintPreview"
|
|
91
95
|
v-model="visiblePrintPreview"
|
|
@@ -96,11 +100,23 @@
|
|
|
96
100
|
><i class="pi pi-times"
|
|
97
101
|
/></ButtonText>
|
|
98
102
|
</template>
|
|
99
|
-
<template #headerCenter>
|
|
103
|
+
<template #headerCenter>
|
|
104
|
+
<div class="flex flex-row gap-2 justify-center">
|
|
105
|
+
<Dropdown
|
|
106
|
+
:options="printformats"
|
|
107
|
+
option-label="formatName"
|
|
108
|
+
option-value="formatId"
|
|
109
|
+
v-model="currentprintformat"
|
|
110
|
+
@change="printPdf"
|
|
111
|
+
></Dropdown>
|
|
112
|
+
<ButtonPrimary @click="showPrintFormats"
|
|
113
|
+
><i class="pi pi-refresh"
|
|
114
|
+
/></ButtonPrimary>
|
|
115
|
+
</div>
|
|
116
|
+
</template>
|
|
100
117
|
<template #headerRight>
|
|
101
|
-
|
|
102
118
|
<div v-if="isMobile()">
|
|
103
|
-
<ButtonText class="text-xl" @click="sendToPrint"
|
|
119
|
+
<ButtonText class="text-xl" @click="sendToPrint">
|
|
104
120
|
<i class="pi pi-print"></i>
|
|
105
121
|
</ButtonText>
|
|
106
122
|
<ButtonText class="text-xl" v-if="sharable" @click="togglePdfMenu">
|
|
@@ -111,6 +127,14 @@
|
|
|
111
127
|
</template>
|
|
112
128
|
<!-- :header="t('printPreview')"
|
|
113
129
|
position="bottom" -->
|
|
130
|
+
<!-- {{pdfReady}} -->
|
|
131
|
+
|
|
132
|
+
<!-- <div v-if="!pdfReady">
|
|
133
|
+
<div class="flex flex-col justify-center">
|
|
134
|
+
<div class="pi pi-spin pi-spinner" style="font-size: 8rem"></div>
|
|
135
|
+
<div>{{ t("loading") + "..." }}</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div> -->
|
|
114
138
|
<TextDanger v-if="printservererror || !printstr">
|
|
115
139
|
{{ t("printServerError") }}
|
|
116
140
|
</TextDanger>
|
|
@@ -142,9 +166,16 @@ import VuePdfEmbed from "vue-pdf-embed";
|
|
|
142
166
|
|
|
143
167
|
import { SimpleAppClient } from "~/simpleapp/generate/clients/SimpleAppClient";
|
|
144
168
|
import { useConfirm } from "primevue/useconfirm";
|
|
145
|
-
import {
|
|
169
|
+
import {
|
|
170
|
+
FormActions,
|
|
171
|
+
FormCrudEvent,
|
|
172
|
+
FormMenu,
|
|
173
|
+
SchemaPrintFormat,
|
|
174
|
+
} from "~/types";
|
|
175
|
+
import { DropdownChangeEvent } from "primevue/dropdown";
|
|
146
176
|
import { MenuItem } from "primevue/menuitem";
|
|
147
177
|
import { MenuItemCommandEvent } from "primevue/menuitem";
|
|
178
|
+
const currentprintformat = ref();
|
|
148
179
|
const pdfrenderer = ref();
|
|
149
180
|
const confirm = useConfirm();
|
|
150
181
|
const emits = defineEmits(["on", "close"]);
|
|
@@ -152,13 +183,17 @@ const visiblePrintFormats = ref(false);
|
|
|
152
183
|
const visiblePrintPreview = ref(false);
|
|
153
184
|
const printstr = ref();
|
|
154
185
|
const printservererror = ref(false);
|
|
186
|
+
const pdfReady = ref(false);
|
|
155
187
|
const props = defineProps<{
|
|
156
188
|
document: SimpleAppClient<any, any>;
|
|
157
189
|
disableaction?: string[];
|
|
158
190
|
}>();
|
|
191
|
+
const doc = props.document;
|
|
192
|
+
const data = doc.getReactiveData();
|
|
159
193
|
|
|
160
194
|
const createData = async () => {
|
|
161
195
|
try {
|
|
196
|
+
setRecentDocument(data.value._id,{docName:doc.getDocName(),label:title.value})
|
|
162
197
|
return await doc.create();
|
|
163
198
|
} catch (e) {
|
|
164
199
|
console.debug("validation error:", e);
|
|
@@ -166,6 +201,7 @@ const createData = async () => {
|
|
|
166
201
|
};
|
|
167
202
|
const updateData = async () => {
|
|
168
203
|
try {
|
|
204
|
+
setRecentDocument(data.value._id,{docName:doc.getDocName(),label:title.value})
|
|
169
205
|
return await doc.update();
|
|
170
206
|
} catch (e) {
|
|
171
207
|
console.debug("validation error:", e);
|
|
@@ -173,14 +209,13 @@ const updateData = async () => {
|
|
|
173
209
|
};
|
|
174
210
|
const deleteData = async () => {
|
|
175
211
|
try {
|
|
212
|
+
getRecently().delete(data.value._id)
|
|
176
213
|
return await doc.delete();
|
|
177
214
|
} catch (e) {
|
|
178
215
|
console.debug("validation error:", e);
|
|
179
216
|
}
|
|
180
217
|
};
|
|
181
218
|
|
|
182
|
-
const doc = props.document;
|
|
183
|
-
const data = doc.getReactiveData();
|
|
184
219
|
type Datatype = keyof typeof data.value;
|
|
185
220
|
const config = doc.getSchema()["x-simpleapp-config"];
|
|
186
221
|
const titlefield = (config.documentTitle ?? config.uniqueKey) as Datatype;
|
|
@@ -214,26 +249,36 @@ const emitMobileEvent = (itemevent: MenuItemCommandEvent) => {
|
|
|
214
249
|
emitEvent(itemevent.item, event);
|
|
215
250
|
};
|
|
216
251
|
|
|
217
|
-
const printPdf = async (
|
|
218
|
-
|
|
252
|
+
const printPdf = async (dropdown?: DropdownChangeEvent) => {
|
|
253
|
+
let index = 0;
|
|
254
|
+
|
|
255
|
+
if (printformats && printformats.length > 0 && dropdown !== undefined) {
|
|
256
|
+
index = printformats?.findIndex((item) => item.formatId == dropdown.value);
|
|
257
|
+
}
|
|
258
|
+
let format: SchemaPrintFormat = printformats[index];
|
|
219
259
|
printservererror.value = false;
|
|
220
260
|
const formatid: string = format.formatId;
|
|
261
|
+
currentprintformat.value = formatid;
|
|
221
262
|
visiblePrintPreview.value = true;
|
|
222
263
|
// console.log("formatidformatid", format);
|
|
264
|
+
// pdfReady.value=false
|
|
223
265
|
try {
|
|
224
266
|
const tmp: any = await doc
|
|
225
267
|
.getApi()
|
|
226
268
|
.runPrint(data.value._id ?? "", formatid);
|
|
269
|
+
// pdfReady.value=true
|
|
227
270
|
printstr.value = "data:application/pdf;base64," + tmp.data;
|
|
228
271
|
} catch (e) {
|
|
272
|
+
pdfReady.value = true;
|
|
229
273
|
printservererror.value = true;
|
|
230
|
-
printstr.value = "";
|
|
274
|
+
// printstr.value = "";
|
|
231
275
|
console.error("error from print server", e);
|
|
232
276
|
}
|
|
233
277
|
};
|
|
234
278
|
const getActions = () => {
|
|
235
279
|
const actions = doc.getActions();
|
|
236
|
-
const printformats = doc.getSchema()["x-simpleapp-config"]?.printFormats;
|
|
280
|
+
// const printformats = doc.getSchema()["x-simpleapp-config"]?.printFormats;
|
|
281
|
+
|
|
237
282
|
const crudmenus: any[] = [];
|
|
238
283
|
|
|
239
284
|
// Object.keys(actions).forEach((key)=>{ //crud, api, docstatus
|
|
@@ -259,15 +304,14 @@ const getActions = () => {
|
|
|
259
304
|
command: showPrintFormats,
|
|
260
305
|
});
|
|
261
306
|
}
|
|
262
|
-
console.log("crudmenus", crudmenus);
|
|
307
|
+
// console.log("crudmenus", crudmenus);
|
|
263
308
|
|
|
264
309
|
// })
|
|
265
310
|
return crudmenus;
|
|
266
311
|
};
|
|
267
312
|
|
|
268
|
-
const showPrintFormats = () => {
|
|
269
|
-
|
|
270
|
-
// console.log("showPrintFormatContext",itemEvent)
|
|
313
|
+
const showPrintFormats = async () => {
|
|
314
|
+
await printPdf();
|
|
271
315
|
};
|
|
272
316
|
const emitEvent = async (menu: FormMenu, clickEvent: Event | MouseEvent) => {
|
|
273
317
|
if (menu.action == "delete") {
|
|
@@ -321,7 +365,7 @@ const getDocActions = () => {
|
|
|
321
365
|
const showMenuButton = (menu: FormMenu) => {
|
|
322
366
|
if (menu.separator) return true;
|
|
323
367
|
|
|
324
|
-
if (menu.action == "print") return true;
|
|
368
|
+
if (menu.action == "print" && !doc.isNew()) return true;
|
|
325
369
|
//all document status cannot direct apply regardless new or draft
|
|
326
370
|
if (menu.type == "docstatus") return true;
|
|
327
371
|
|
|
@@ -34,71 +34,51 @@
|
|
|
34
34
|
v-bind="componentProps as InputSwitchProps"
|
|
35
35
|
@change="onChange"
|
|
36
36
|
/>
|
|
37
|
-
|
|
38
|
-
<InputText
|
|
39
|
-
type="date"
|
|
40
|
-
:pt="pt"
|
|
41
|
-
v-else-if="inputType == SimpleAppInputType.date"
|
|
42
|
-
:inputId="slotprops.uuid"
|
|
43
|
-
:path="setting.instancepath"
|
|
44
|
-
v-model="datevalue"
|
|
45
|
-
@update:modelValue="updateDate"
|
|
46
|
-
:readonly="isReadonly"
|
|
47
|
-
:placeholder="placeholder"
|
|
48
|
-
v-bind="componentProps as InputTextProps"
|
|
49
|
-
/> -->
|
|
37
|
+
|
|
50
38
|
<!-- calendar component -->
|
|
51
|
-
<
|
|
52
|
-
type="date"
|
|
53
|
-
:pt="pt"
|
|
39
|
+
<SimpleAppCalendarInput
|
|
54
40
|
v-else-if="
|
|
55
41
|
SimpleAppInputType.calendar == inputType ||
|
|
56
42
|
inputType == SimpleAppInputType.date
|
|
57
43
|
"
|
|
58
|
-
:
|
|
59
|
-
|
|
60
|
-
v-model="
|
|
61
|
-
|
|
62
|
-
:touchUI="isMobile()"
|
|
63
|
-
showButtonBar
|
|
64
|
-
:readonly="isReadonly"
|
|
44
|
+
:pt="pt"
|
|
45
|
+
type="date"
|
|
46
|
+
v-model="modelValue"
|
|
47
|
+
:uuid="slotprops.uuid"
|
|
65
48
|
:placeholder="placeholder"
|
|
66
|
-
:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
49
|
+
:setting="setting"
|
|
50
|
+
:readonly="isReadonly"
|
|
51
|
+
:componentProps="componentProps"
|
|
52
|
+
@change="onChange"
|
|
53
|
+
/>
|
|
54
|
+
|
|
70
55
|
<!-- time component -->
|
|
71
|
-
<
|
|
72
|
-
:pt="pt"
|
|
56
|
+
<SimpleAppCalendarInput
|
|
73
57
|
v-else-if="inputType == SimpleAppInputType.time"
|
|
74
|
-
timeOnly
|
|
75
|
-
showTime
|
|
76
|
-
hourFormat="12"
|
|
77
|
-
@update:modelValue="updateTime"
|
|
78
|
-
:inputId="slotprops.uuid"
|
|
79
|
-
:path="setting.instancepath"
|
|
80
|
-
v-model="timevalue"
|
|
81
|
-
:readonly="isReadonly"
|
|
82
|
-
:placeholder="placeholder"
|
|
83
|
-
v-bind="componentProps as CalendarProps"
|
|
84
|
-
/>
|
|
85
|
-
|
|
86
|
-
<Calendar
|
|
87
58
|
:pt="pt"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
:touchUI="isMobile()"
|
|
94
|
-
showButtonBar
|
|
59
|
+
type="time"
|
|
60
|
+
v-model="modelValue"
|
|
61
|
+
:uuid="slotprops.uuid"
|
|
62
|
+
:placeholder="placeholder"
|
|
63
|
+
:setting="setting"
|
|
95
64
|
:readonly="isReadonly"
|
|
65
|
+
:componentProps="componentProps"
|
|
66
|
+
@change="onChange"
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
<SimpleAppCalendarInput
|
|
70
|
+
v-else-if="inputType == SimpleAppInputType.datetime"
|
|
71
|
+
:pt="pt"
|
|
72
|
+
type="datetime"
|
|
73
|
+
v-model="modelValue"
|
|
74
|
+
:uuid="slotprops.uuid"
|
|
96
75
|
:placeholder="placeholder"
|
|
97
|
-
:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
76
|
+
:setting="setting"
|
|
77
|
+
:readonly="isReadonly"
|
|
78
|
+
:componentProps="componentProps"
|
|
79
|
+
@change="onChange"
|
|
80
|
+
/>
|
|
81
|
+
|
|
102
82
|
<!-- select/list component -->
|
|
103
83
|
<Listbox
|
|
104
84
|
v-model="modelValue"
|
|
@@ -134,7 +114,6 @@
|
|
|
134
114
|
@change="onChange"
|
|
135
115
|
/>
|
|
136
116
|
|
|
137
|
-
|
|
138
117
|
<MultiSelect
|
|
139
118
|
v-model="modelValue"
|
|
140
119
|
:pt="pt"
|
|
@@ -168,6 +147,31 @@
|
|
|
168
147
|
</div>
|
|
169
148
|
</div>
|
|
170
149
|
|
|
150
|
+
<SimpleAppUserPicker
|
|
151
|
+
v-else-if="inputType == SimpleAppInputType.user"
|
|
152
|
+
v-model="modelValue as autocompletetype"
|
|
153
|
+
:hidelabel="hidelabel"
|
|
154
|
+
:pt="pt"
|
|
155
|
+
:setting="setting"
|
|
156
|
+
:disabled="isReadonly"
|
|
157
|
+
:inputId="slotprops.uuid"
|
|
158
|
+
:path="setting.instancepath"
|
|
159
|
+
:readonly="isReadonly"
|
|
160
|
+
:placeholder="placeholder"
|
|
161
|
+
:autocompleteFilter="autocompleteFilter"
|
|
162
|
+
@change="onChange"
|
|
163
|
+
>
|
|
164
|
+
<template #header>
|
|
165
|
+
<slot name="header"></slot>
|
|
166
|
+
</template>
|
|
167
|
+
<template #content>
|
|
168
|
+
<slot name="content"></slot>
|
|
169
|
+
</template>
|
|
170
|
+
<template #option="{ index, option }">
|
|
171
|
+
<slot name="option" :index="index" :option="option"></slot>
|
|
172
|
+
</template>
|
|
173
|
+
</SimpleAppUserPicker>
|
|
174
|
+
|
|
171
175
|
<!-- autocomplete, need do more enterprise grade component-->
|
|
172
176
|
<SimpleAppAutocomplete
|
|
173
177
|
v-else-if="inputType == SimpleAppInputType.autocomplete"
|
|
@@ -182,7 +186,17 @@
|
|
|
182
186
|
:placeholder="placeholder"
|
|
183
187
|
:autocompleteFilter="autocompleteFilter"
|
|
184
188
|
@change="onChange"
|
|
185
|
-
|
|
189
|
+
>
|
|
190
|
+
<template #header>
|
|
191
|
+
<slot name="header"></slot>
|
|
192
|
+
</template>
|
|
193
|
+
<template #content>
|
|
194
|
+
<slot name="content"></slot>
|
|
195
|
+
</template>
|
|
196
|
+
<template #option="{ index, option }">
|
|
197
|
+
<slot name="option" :index="index" :option="option"></slot>
|
|
198
|
+
</template>
|
|
199
|
+
</SimpleAppAutocomplete>
|
|
186
200
|
<!-- v-bind:attributes="componentProps" -->
|
|
187
201
|
<!-- document no input-->
|
|
188
202
|
<SimpleAppDocumentNo
|
|
@@ -265,6 +279,8 @@
|
|
|
265
279
|
@focus="setFocus"
|
|
266
280
|
:max-fraction-digits="2"
|
|
267
281
|
:min-fraction-digits="2"
|
|
282
|
+
mode="currency"
|
|
283
|
+
:currency="getCurrency()"
|
|
268
284
|
:readonly="isReadonly"
|
|
269
285
|
:pt="pt"
|
|
270
286
|
:class="!pt ? 'w-full flex flex-col' : ''"
|
|
@@ -340,10 +356,8 @@ const resetcount = ref(0);
|
|
|
340
356
|
const instancepath = ref("");
|
|
341
357
|
const modelValue = defineModel({ required: true });
|
|
342
358
|
|
|
343
|
-
|
|
344
|
-
const
|
|
345
|
-
const timevalue = ref<Date>();
|
|
346
|
-
let watchOnChange = 0;
|
|
359
|
+
|
|
360
|
+
const watchOnChange = ref(false);
|
|
347
361
|
const props = withDefaults(
|
|
348
362
|
defineProps<{
|
|
349
363
|
inputType: SimpleAppInputType;
|
|
@@ -353,6 +367,7 @@ const props = withDefaults(
|
|
|
353
367
|
setting: any;
|
|
354
368
|
type?: string;
|
|
355
369
|
instancepath?: string;
|
|
370
|
+
options?: string[];
|
|
356
371
|
hidelabel?: boolean;
|
|
357
372
|
readonly?: boolean;
|
|
358
373
|
autofocus?: boolean;
|
|
@@ -373,26 +388,6 @@ const props = withDefaults(
|
|
|
373
388
|
|
|
374
389
|
const pt = ref(props.pt);
|
|
375
390
|
|
|
376
|
-
if (props.inputType == SimpleAppInputType.date && modelValue.value) {
|
|
377
|
-
datevalue.value = stringToDate(<string>modelValue.value); //.format("YYYY-MM-DD");
|
|
378
|
-
} else {
|
|
379
|
-
datevalue.value = undefined;
|
|
380
|
-
}
|
|
381
|
-
if (props.inputType == SimpleAppInputType.datetime && modelValue.value) {
|
|
382
|
-
datetimevalue.value = stringToDate(<string>modelValue.value);
|
|
383
|
-
} else {
|
|
384
|
-
datetimevalue.value = undefined;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
if (props.inputType == SimpleAppInputType.time) {
|
|
388
|
-
if (modelValue.value) {
|
|
389
|
-
timevalue.value = stringToDate(
|
|
390
|
-
(today() + "T" + modelValue.value) as string,
|
|
391
|
-
); //.format("YYYY-MM-DD");
|
|
392
|
-
} else {
|
|
393
|
-
timevalue.value = undefined;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
391
|
|
|
397
392
|
if (props?.instancepath) instancepath.value = props.instancepath;
|
|
398
393
|
else if (props.setting?.instancepath)
|
|
@@ -424,6 +419,8 @@ watch(props.setting.errors, (newvalue, oldvalue) => {
|
|
|
424
419
|
} else {
|
|
425
420
|
pt.value = props.pt;
|
|
426
421
|
}
|
|
422
|
+
|
|
423
|
+
watchOnChange.value = true;
|
|
427
424
|
});
|
|
428
425
|
const isReadonly = computed(() => {
|
|
429
426
|
if (props.readonly) {
|
|
@@ -434,39 +431,19 @@ const isReadonly = computed(() => {
|
|
|
434
431
|
return false;
|
|
435
432
|
}
|
|
436
433
|
});
|
|
437
|
-
|
|
438
|
-
value.setSeconds(0);
|
|
439
|
-
modelValue.value = dateToTimeString(value);
|
|
440
|
-
onChange();
|
|
441
|
-
};
|
|
442
|
-
const updateDate = (value: any) => {
|
|
443
|
-
if (value) {
|
|
444
|
-
modelValue.value = dateToString(value);
|
|
445
|
-
} else {
|
|
446
|
-
modelValue.value = "";
|
|
447
|
-
}
|
|
448
|
-
onChange();
|
|
449
|
-
};
|
|
450
|
-
const updateDateTime = (value: any) => {
|
|
451
|
-
if (value) {
|
|
452
|
-
modelValue.value = dateToISOString(value);
|
|
453
|
-
} else {
|
|
454
|
-
modelValue.value = "";
|
|
455
|
-
}
|
|
456
|
-
onChange();
|
|
457
|
-
};
|
|
434
|
+
|
|
458
435
|
|
|
459
436
|
const setFocus = (ev: any) => {
|
|
460
437
|
if (!isMobile()) ev.target.select();
|
|
461
438
|
};
|
|
462
439
|
|
|
463
440
|
const getListOptions = () => {
|
|
464
|
-
const options = [];
|
|
465
|
-
const enumlist =
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
441
|
+
const options = [];
|
|
442
|
+
const enumlist =
|
|
443
|
+
props.options ??
|
|
444
|
+
(props.setting.fieldsetting.type == "array"
|
|
445
|
+
? props.setting.fieldsetting.items.enum
|
|
446
|
+
: props.setting.fieldsetting.enum);
|
|
470
447
|
|
|
471
448
|
if (enumlist) {
|
|
472
449
|
for (let i = 0; i < enumlist.length; i++) {
|
|
@@ -487,69 +464,13 @@ const emits = defineEmits([
|
|
|
487
464
|
"update:docNoFormat",
|
|
488
465
|
]);
|
|
489
466
|
|
|
490
|
-
const getDateFormat = () => {
|
|
491
|
-
return getPrimevueCalendarDateFormat();
|
|
492
|
-
};
|
|
493
|
-
|
|
494
|
-
watch(modelValue, (newvalue: any) => {
|
|
495
|
-
if (
|
|
496
|
-
[SimpleAppInputType.date, SimpleAppInputType.calendar].includes(
|
|
497
|
-
props.inputType,
|
|
498
|
-
)
|
|
499
|
-
) {
|
|
500
|
-
if (modelValue.value) {
|
|
501
|
-
datevalue.value = stringToDate(modelValue.value as string);
|
|
502
|
-
} else {
|
|
503
|
-
timevalue.value = undefined;
|
|
504
|
-
}
|
|
505
|
-
} else if (props.inputType == SimpleAppInputType.datetime) {
|
|
506
|
-
if (modelValue.value) {
|
|
507
|
-
datetimevalue.value = stringToDate(modelValue.value as string);
|
|
508
|
-
} else {
|
|
509
|
-
timevalue.value = undefined;
|
|
510
|
-
}
|
|
511
|
-
} else if (props.inputType == SimpleAppInputType.time) {
|
|
512
|
-
if (modelValue.value) {
|
|
513
|
-
timevalue.value = stringToDate(
|
|
514
|
-
(today() + "T" + modelValue.value) as string,
|
|
515
|
-
);
|
|
516
|
-
} else {
|
|
517
|
-
timevalue.value = undefined;
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
});
|
|
521
|
-
onMounted(() => {
|
|
522
|
-
if (
|
|
523
|
-
[SimpleAppInputType.date, SimpleAppInputType.calendar].includes(
|
|
524
|
-
props.inputType,
|
|
525
|
-
)
|
|
526
|
-
) {
|
|
527
|
-
if (modelValue.value) {
|
|
528
|
-
datevalue.value = stringToDate(modelValue.value as string);
|
|
529
|
-
} else {
|
|
530
|
-
datevalue.value = undefined;
|
|
531
|
-
}
|
|
532
|
-
} else if (props.inputType == SimpleAppInputType.datetime) {
|
|
533
|
-
if (modelValue.value) {
|
|
534
|
-
datetimevalue.value = stringToDate(modelValue.value as string);
|
|
535
|
-
} else {
|
|
536
|
-
datetimevalue.value = undefined;
|
|
537
|
-
}
|
|
538
|
-
} else if (props.inputType == SimpleAppInputType.time) {
|
|
539
|
-
if (modelValue.value) {
|
|
540
|
-
timevalue.value = stringToDate(
|
|
541
|
-
(today() + "T" + modelValue.value) as string,
|
|
542
|
-
);
|
|
543
|
-
} else {
|
|
544
|
-
timevalue.value = undefined;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
});
|
|
548
467
|
|
|
549
468
|
const onChange = () => {
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
469
|
+
if (props.setting.document.isReady()) {
|
|
470
|
+
pt.value = undefined;
|
|
471
|
+
resetcount.value++;
|
|
472
|
+
emits("change", modelValue.value);
|
|
473
|
+
}
|
|
553
474
|
};
|
|
554
475
|
|
|
555
476
|
/************ start autocomplete only ***************/
|
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
<DataTable
|
|
3
|
+
v-bind="$attrs"
|
|
4
|
+
stripedRows
|
|
5
|
+
resizableColumns
|
|
6
|
+
class="simpleapp-datatable p-datatable-sm"
|
|
7
|
+
:value="modelValue"
|
|
8
|
+
>
|
|
9
|
+
<template #empty>
|
|
10
|
+
<div class="text-center">No record found.</div>
|
|
11
|
+
</template>
|
|
12
|
+
<template #header v-if="!setting.readonly && !readonly">
|
|
13
|
+
<div class="flex flex-row gap-2">
|
|
14
|
+
<slot name="header">
|
|
15
|
+
<Button
|
|
16
|
+
icon="pi pi-plus"
|
|
17
|
+
@click="addNew()"
|
|
18
|
+
class="simpleapp-datatable-add btn-primary"
|
|
19
|
+
type="button"
|
|
20
|
+
>{{ t("add") }}</Button
|
|
21
|
+
>
|
|
22
|
+
</slot>
|
|
23
|
+
</div>
|
|
9
24
|
</template>
|
|
10
25
|
<slot>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
</Column>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
<Column class="text-center" header="undefine columns">
|
|
27
|
+
<template #body>
|
|
28
|
+
<div class="text-center">Missing {{ '<Column></Column>' }}</div>
|
|
29
|
+
</template>
|
|
30
|
+
</Column>
|
|
23
31
|
</slot>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</DataTable>
|
|
32
|
+
</DataTable>
|
|
27
33
|
</template>
|
|
28
34
|
<script setup lang="ts">
|
|
29
35
|
/**
|
|
@@ -32,31 +38,28 @@
|
|
|
32
38
|
* last change 2023-10-28
|
|
33
39
|
* Author: Ks Tan
|
|
34
40
|
*/
|
|
35
|
-
import {ref} from
|
|
36
|
-
import DataTable from
|
|
37
|
-
import Column from
|
|
41
|
+
import { ref } from "vue";
|
|
42
|
+
import DataTable from "primevue/datatable";
|
|
43
|
+
import Column from "primevue/column";
|
|
38
44
|
|
|
39
45
|
const props = defineProps<{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}>()
|
|
45
|
-
|
|
46
|
+
// columns:InputTableColumn[],
|
|
47
|
+
setting: any;
|
|
48
|
+
getField: Function;
|
|
49
|
+
readonly?: boolean;
|
|
50
|
+
}>();
|
|
46
51
|
|
|
47
52
|
//{path: '#/properties/details', instancepath: '/details', fieldsetting: {…}, modelObject: Proxy(Object), apiObj: INVApi, …}
|
|
48
|
-
const modelValue = defineModel<any[]>()
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
const modelValue = defineModel<any[]>();
|
|
54
|
+
|
|
51
55
|
const addNew = () => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
+
const field = props.setting.path.split("/").at(-1);
|
|
57
|
+
props.setting.document[`add${field}`]();
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
56
60
|
* 1. support array with field to label
|
|
57
61
|
* 2. auto add edit button
|
|
58
62
|
* 3. option readonly or not readonly
|
|
59
|
-
* 4.
|
|
63
|
+
* 4.
|
|
60
64
|
*/
|
|
61
|
-
|
|
62
65
|
</script>
|