@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,107 +1,199 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
<div v-if="isMobile()" class="w-full">
|
|
3
|
+
<MobileToolbar>
|
|
4
|
+
<template #start>
|
|
5
|
+
<ButtonText class="text-xl" @click="callClose"
|
|
6
|
+
><i class="pi pi-angle-left"></i
|
|
7
|
+
></ButtonText>
|
|
8
|
+
</template>
|
|
9
|
+
<template #center>
|
|
10
|
+
<TextTitle>{{ title }}</TextTitle>
|
|
11
|
+
</template>
|
|
12
|
+
<template #end>
|
|
13
|
+
<div class="flex flex-row-reverse gap-1 w-full">
|
|
14
|
+
<ButtonText class="text-xl" @click="toggleMenu" v-if="isShow">
|
|
15
|
+
<i class="pi pi-ellipsis-v"></i>
|
|
16
|
+
</ButtonText>
|
|
17
|
+
|
|
18
|
+
<ButtonText
|
|
19
|
+
class="text text-xl"
|
|
20
|
+
@click="
|
|
21
|
+
emitEvent(
|
|
22
|
+
{
|
|
23
|
+
action: doc.isNew() ? 'create' : 'update',
|
|
24
|
+
label: '',
|
|
25
|
+
type: 'crud',
|
|
26
|
+
},
|
|
27
|
+
$event,
|
|
28
|
+
)
|
|
29
|
+
"
|
|
30
|
+
>
|
|
31
|
+
<i class="pi pi-save"></i>
|
|
32
|
+
</ButtonText>
|
|
33
|
+
|
|
34
|
+
<ContextMenu ref="menu" :model="menus as MenuItem[]" />
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
</MobileToolbar>
|
|
38
|
+
<ConfirmDialog></ConfirmDialog>
|
|
39
|
+
</div>
|
|
40
|
+
<div v-else class="simpleapp-tool-bar">
|
|
41
|
+
<Toolbar>
|
|
42
|
+
<template #start>
|
|
43
|
+
<div v-for="(menu, index) in menus" :key="index">
|
|
44
|
+
<div v-if="menu.label && menu.type == 'crud'">
|
|
45
|
+
<ButtonDefault @click="emitEvent(menu, $event)">{{
|
|
46
|
+
menu.label
|
|
47
|
+
}}</ButtonDefault>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
<template #center>
|
|
52
|
+
<div v-for="(menu, index) in menus" :key="index">
|
|
53
|
+
<div v-if="menu.label && menu.type == 'docstatus'">
|
|
54
|
+
<ButtonDefault @click="emitEvent(menu, $event)">{{
|
|
55
|
+
menu.label
|
|
56
|
+
}}</ButtonDefault>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
<template #end> </template>
|
|
61
|
+
</Toolbar>
|
|
62
|
+
|
|
63
|
+
<ConfirmPopup></ConfirmPopup>
|
|
64
|
+
</div>
|
|
18
65
|
</template>
|
|
19
66
|
<script setup lang="ts">
|
|
20
|
-
|
|
21
|
-
import { SimpleAppClient } from '~/simpleapp/generate/clients/SimpleAppClient';
|
|
67
|
+
import { SimpleAppClient } from "~/simpleapp/generate/clients/SimpleAppClient";
|
|
22
68
|
import { useConfirm } from "primevue/useconfirm";
|
|
69
|
+
import { FormActions, FormCrudEvent, FormMenu } from "~/types";
|
|
70
|
+
import { MenuItem } from "primevue/menuitem";
|
|
23
71
|
const confirm = useConfirm();
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const ismodify = ref(false)
|
|
72
|
+
const emits = defineEmits(["on", "close"]);
|
|
27
73
|
const props = defineProps<{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}>()
|
|
74
|
+
document: SimpleAppClient<any, any>;
|
|
75
|
+
disableaction?: string[];
|
|
76
|
+
}>();
|
|
77
|
+
const createData = async () => await doc.create();
|
|
78
|
+
const updateData = async () => await doc.update();
|
|
79
|
+
const deleteData = async () => await doc.delete();
|
|
31
80
|
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
81
|
+
const doc = props.document;
|
|
82
|
+
const data = doc.getReactiveData();
|
|
83
|
+
type Datatype = keyof typeof data.value;
|
|
84
|
+
const config = doc.getSchema()["x-simpleapp-config"];
|
|
85
|
+
const titlefield = (config.documentTitle ?? config.documentTitle) as Datatype;
|
|
86
|
+
const title = ref<string>(
|
|
87
|
+
data.value[titlefield as Datatype]
|
|
88
|
+
? data.value[titlefield as Datatype]
|
|
89
|
+
: t(doc.getDocName()),
|
|
90
|
+
);
|
|
91
|
+
const menu = ref();
|
|
92
|
+
const menus = computed(() =>
|
|
93
|
+
[...getActions(), { separator: true }, ...getDocActions()].filter((item) =>
|
|
94
|
+
showMenuButton(item),
|
|
95
|
+
),
|
|
96
|
+
);
|
|
35
97
|
|
|
36
|
-
const
|
|
98
|
+
const isShow = computed(
|
|
99
|
+
() => menus.value.filter((item) => item.action != undefined).length > 0,
|
|
100
|
+
);
|
|
101
|
+
const toggleMenu = (event: MouseEvent) => {
|
|
102
|
+
menu.value.toggle(event);
|
|
103
|
+
};
|
|
37
104
|
|
|
105
|
+
const callClose = (e:MouseEvent) => {
|
|
106
|
+
useNuxtApp().$event("CloseDialog", doc.getDocName());
|
|
107
|
+
emitEvent({action:'exit',type:'menu',label:''},e)
|
|
108
|
+
// async (menu: FormMenu, clickEvent: MouseEvent)
|
|
109
|
+
};
|
|
110
|
+
const emitMobileEvent = (itemevent: {
|
|
111
|
+
item: any;
|
|
112
|
+
originalEvent: MouseEvent;
|
|
113
|
+
}) => {
|
|
114
|
+
const actionname: string = itemevent.item.action;
|
|
115
|
+
const event = itemevent.originalEvent;
|
|
116
|
+
emitEvent({ action: actionname, type: "crud", label: "" }, event);
|
|
117
|
+
};
|
|
38
118
|
|
|
39
119
|
const getActions = () => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
120
|
+
const actions = doc.getActions();
|
|
121
|
+
const crudmenus: any[] = [];
|
|
122
|
+
// Object.keys(actions).forEach((key)=>{ //crud, api, docstatus
|
|
123
|
+
actions["crud"].forEach((item) => {
|
|
124
|
+
if (props.disableaction && props.disableaction.includes(item)) {
|
|
125
|
+
/*skip this item*/
|
|
126
|
+
} else {
|
|
127
|
+
crudmenus.push({
|
|
128
|
+
action: item,
|
|
129
|
+
label: t(item),
|
|
130
|
+
type: "crud",
|
|
131
|
+
command: emitMobileEvent,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
// })
|
|
136
|
+
return crudmenus;
|
|
137
|
+
};
|
|
56
138
|
|
|
57
|
-
|
|
139
|
+
const emitEvent = async (menu: FormMenu, clickEvent: MouseEvent) => {
|
|
140
|
+
if (menu.action == "delete") {
|
|
141
|
+
confirm.require({
|
|
142
|
+
target: clickEvent.target as HTMLElement,
|
|
143
|
+
header: t("deleteRecord"),
|
|
144
|
+
message: `${t("deleteThisRecord?")}`,
|
|
58
145
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
146
|
+
// icon: "pi pi-exclamation-triangle gap-4",
|
|
147
|
+
acceptClass: "p-button-danger",
|
|
148
|
+
accept: async () => {
|
|
149
|
+
if (await deleteData()) emits("on", FormCrudEvent.delete);
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
} else {
|
|
153
|
+
if (menu.action == "create") {
|
|
154
|
+
if (await createData()) emits("on", FormCrudEvent.create);
|
|
155
|
+
}
|
|
156
|
+
else if (menu.action == "update") {
|
|
157
|
+
if (await updateData()) emits("on", FormCrudEvent.update);
|
|
158
|
+
}
|
|
159
|
+
else if (menu.type == "setDocStatus")
|
|
160
|
+
emits("on", FormCrudEvent.setDocStatus, menu.action);
|
|
161
|
+
else if (menu.action == FormCrudEvent.exit)
|
|
162
|
+
emits("on", FormCrudEvent.exit);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
73
165
|
|
|
166
|
+
const getDocActions = () => {
|
|
167
|
+
const docstatus: string = data.value.documentStatus;
|
|
168
|
+
const allstatus = doc.getSchema()["x-simpleapp-config"].allStatus;
|
|
169
|
+
let docactionmenus: FormMenu[] = [];
|
|
170
|
+
type stringlist = { [key: string]: string };
|
|
171
|
+
const statusNames: stringlist = {};
|
|
172
|
+
allstatus?.forEach((item) => {
|
|
173
|
+
statusNames[item.status] = t(item.statusName);
|
|
174
|
+
});
|
|
175
|
+
if (allstatus) {
|
|
176
|
+
const stateconfig = allstatus.find((item) => item.status === docstatus);
|
|
177
|
+
docactionmenus =
|
|
178
|
+
stateconfig?.actions.map((item) => ({
|
|
179
|
+
action: item,
|
|
180
|
+
label: statusNames[item],
|
|
181
|
+
type: "docstatus",
|
|
182
|
+
})) ?? [];
|
|
183
|
+
}
|
|
184
|
+
return docactionmenus;
|
|
185
|
+
};
|
|
186
|
+
const showMenuButton = (menu: FormMenu) => {
|
|
187
|
+
if (menu.separator) return true;
|
|
188
|
+
if (isMobile() && ["create", "update"].includes(menu.action)) return false;
|
|
189
|
+
if (!canPerform(doc.getDocName(), menu.action)) return false;
|
|
190
|
+
if (doc.isNew() && menu.action == "create") return true;
|
|
191
|
+
if (!doc.isNew() && menu.action == "new") return true;
|
|
192
|
+
if (!doc.isNew() && menu.action == "update") return true;
|
|
193
|
+
if (!doc.isNew() && menu.action == "delete") return true;
|
|
74
194
|
|
|
75
|
-
|
|
76
|
-
const docstatus:string = data.value.documentStatus
|
|
77
|
-
const allstatus = doc.getSchema()['x-simpleapp-config'].allStatus
|
|
78
|
-
let docactionmenus:FormMenu[] = []
|
|
79
|
-
type stringlist = {[key:string]:string}
|
|
80
|
-
const statusNames:stringlist = {}
|
|
81
|
-
allstatus?.forEach(item=>{
|
|
82
|
-
statusNames[item.status]=t(item.statusName)
|
|
83
|
-
})
|
|
84
|
-
if(allstatus){
|
|
85
|
-
const stateconfig = allstatus.find((item)=>item.status===docstatus)
|
|
86
|
-
docactionmenus = stateconfig?.actions.map(item=>({
|
|
87
|
-
action: item,
|
|
88
|
-
label: statusNames[item],
|
|
89
|
-
type: 'docstatus'
|
|
90
|
-
})) ?? []
|
|
91
|
-
}
|
|
92
|
-
return docactionmenus
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
const showMenuButton = (menu:FormMenu)=>{
|
|
96
|
-
|
|
97
|
-
if(!canPerform(doc.getDocName(),menu.action)) return false
|
|
98
|
-
if(doc.isNew() && menu.action == 'create') return true
|
|
99
|
-
if(!doc.isNew() && menu.action == 'new') return true
|
|
100
|
-
if(!doc.isNew() && menu.action == 'update') return true
|
|
101
|
-
if(!doc.isNew() && menu.action == 'delete') return true
|
|
102
|
-
|
|
103
|
-
if(menu.type == 'api' ) return false
|
|
104
|
-
return false
|
|
105
|
-
}
|
|
195
|
+
if (menu.type == "api") return false;
|
|
106
196
|
|
|
107
|
-
|
|
197
|
+
return false;
|
|
198
|
+
};
|
|
199
|
+
</script>
|