@simitgroup/simpleapp-generator 1.2.8 → 1.3.1-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 +6 -8
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +22 -17
- package/dist/generate.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/organization.ts +3 -1
- package/src/framework.ts +9 -9
- package/src/generate.ts +24 -19
- 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 +1 -6
- 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/.env._eta +1 -0
- 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 +5 -8
- 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
|
@@ -16,13 +16,17 @@ const CustomTailwind = usePassThrough(
|
|
|
16
16
|
// buttonContainer:{class:'hidden'},
|
|
17
17
|
},
|
|
18
18
|
card:{
|
|
19
|
-
root:{class:'bg-white dark:bg-gray-
|
|
19
|
+
root:{class:'bg-white dark:bg-gray-800 shadow p-4 rounded-2xl'},
|
|
20
20
|
// title:{class:''},
|
|
21
21
|
// header:{class:''}
|
|
22
22
|
},
|
|
23
23
|
tabpanel:{
|
|
24
24
|
headerTitle:{class:'m-0 p-0'},
|
|
25
25
|
},
|
|
26
|
+
accordiontab:{
|
|
27
|
+
content:{style:'padding: 0.7rem;'}
|
|
28
|
+
|
|
29
|
+
},
|
|
26
30
|
selectbutton:{
|
|
27
31
|
root:{class:'flex flex-row gap-1 '},
|
|
28
32
|
button: ({ context }) => ({
|
|
@@ -41,7 +45,7 @@ const CustomTailwind = usePassThrough(
|
|
|
41
45
|
},
|
|
42
46
|
button:{root:{class: 'focus:outline-none transition duration-150 ease-in-out rounded p-2 m-1 border dark:border-gray-600'}},
|
|
43
47
|
dialog:{
|
|
44
|
-
root:{class:['
|
|
48
|
+
root:{class:[' w-full max-h-full max-w-full md:h-3/4 lg:h-1/2 p-2']},
|
|
45
49
|
header:{class: 'p-dialog-header flex items-center text-2xl justify-between shrink-0 bg-white text-gray-800 border-t-0 rounded-tl-lg rounded-tr-lg p-6 dark:bg-gray-900 dark:text-white/80'},
|
|
46
50
|
content:{class:'p-dialog-content overflow-y-auto bg-white text-gray-700 px-6 pb-8 pt-0 dark:bg-gray-900 dark:text-white/80 rounded-bl-lg rounded-br-lg h-full'}
|
|
47
51
|
},
|
|
@@ -50,14 +54,22 @@ const CustomTailwind = usePassThrough(
|
|
|
50
54
|
input:{class:'w-full p-inputtext p-component font-sans text-base text-gray-600 dark:text-white/80 bg-white dark:bg-gray-900 p-3 border border-gray-300 dark:border-blue-900/40 transition-colors duration-200 appearance-none hover:border-blue-500 rounded-lg'},
|
|
51
55
|
},
|
|
52
56
|
autocomplete:{
|
|
53
|
-
root:{class:'border border-gray-400 dark:!border-blue-900/40 rounded-lg flex flex-row'},
|
|
54
|
-
loadingIcon:{class:'hidden'},
|
|
57
|
+
// root:{class:'border border-gray-400 dark:!border-blue-900/40 rounded-lg flex flex-row'},
|
|
58
|
+
// loadingIcon:{class:'hidden'},
|
|
59
|
+
panel:{
|
|
60
|
+
class:'p-autocomplete-panel p-component p-2 w-full md:max-w-[500px] p-input-filled bg-white text-gray-700 border-0 rounded-md shadow-lg max-h-[200px] overflow-auto dark:bg-gray-900 dark:text-white/80'
|
|
61
|
+
},
|
|
55
62
|
dropdownbutton: {
|
|
56
63
|
root:' btn-primary dark:shadow-primary-800 dark:border-primary-900 text-white rounded-lg flex flex-row p-3 rounded-tl-none rounded-bl-none '
|
|
57
64
|
}
|
|
58
65
|
},
|
|
66
|
+
column:{
|
|
67
|
+
bodycell:{
|
|
68
|
+
style:'padding:5px;'
|
|
69
|
+
},
|
|
70
|
+
},
|
|
59
71
|
sidebar:{
|
|
60
|
-
root:{class:'w-full md:w-
|
|
72
|
+
root:{class:'w-full md:w-2/3 bg-white dark:bg-slate-950 p-0 h-full'},
|
|
61
73
|
header:{class:'dark:text-white text-2xl p-2'},
|
|
62
74
|
content:{class:'p-0 pt-0 h-full w-full grow overflow-y-auto'}
|
|
63
75
|
},
|
|
@@ -70,10 +82,9 @@ const CustomTailwind = usePassThrough(
|
|
|
70
82
|
breadcrumb:{
|
|
71
83
|
root:{class:''}
|
|
72
84
|
},
|
|
73
|
-
inputnumber:{
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
}
|
|
85
|
+
// inputnumber:{
|
|
86
|
+
// input:{class:'text-right text-yellow-700'}
|
|
87
|
+
// }
|
|
77
88
|
},
|
|
78
89
|
);
|
|
79
90
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-for="o in options">
|
|
3
|
+
<ButtonPrimary v-if="value == o.value" @click="switchButton(o.value)">{{
|
|
4
|
+
o.label
|
|
5
|
+
}}</ButtonPrimary>
|
|
6
|
+
<ButtonDefault v-else @click="switchButton(o.value)">{{
|
|
7
|
+
o.label
|
|
8
|
+
}}</ButtonDefault>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
type keyvalue = { label: string; value: string };
|
|
13
|
+
const emits = defineEmits(["switch"]);
|
|
14
|
+
const props = defineProps<{
|
|
15
|
+
options: keyvalue[];
|
|
16
|
+
value: string;
|
|
17
|
+
}>();
|
|
18
|
+
const switchButton = (v: string) => {
|
|
19
|
+
if (v != props.value) emits("switch", v);
|
|
20
|
+
};
|
|
21
|
+
</script>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="p-0
|
|
3
|
-
<
|
|
4
|
-
<i class="pi pi-code"></i>
|
|
5
|
-
{{ label }}</Button>
|
|
2
|
+
<div :class="`p-0 absolute bg-yellow-200 bottom-0 right-0`" v-if="isdebug=='1'">
|
|
3
|
+
<button @click="visible=true" class=" text-white text-xs bg-warning-800 p-0 m-0">
|
|
4
|
+
<i class="pi pi-code"></i>{{ label }}</button>
|
|
6
5
|
<Sidebar v-model:visible="visible" class="text-red-100">
|
|
7
6
|
|
|
8
7
|
<template #header >
|
|
@@ -1,25 +1,36 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<OverlayViewer v-model="visible" :close-event-name="initDocumentName" >
|
|
3
|
+
<!-- <template #header>
|
|
4
|
+
|
|
5
|
+
</template> -->
|
|
6
|
+
<div class="w-full h-full ">
|
|
7
|
+
<div class="flex flex-row gap-4">
|
|
8
|
+
<Chip
|
|
9
|
+
v-for="(v, k) in allview"
|
|
10
|
+
:label="v.label"
|
|
11
|
+
@remove="deleteTab"
|
|
12
|
+
:removable="true"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div
|
|
17
|
+
v-for="(v, k) in allview"
|
|
18
|
+
v-memo="[k]"
|
|
19
|
+
class="viewer-item flex flex-col"
|
|
20
|
+
>
|
|
21
|
+
<component
|
|
22
|
+
:is="defineAsyncComponent(v.viewer)"
|
|
23
|
+
:_id="v._id"
|
|
24
|
+
:readonly="v.readonly"
|
|
25
|
+
:paras="v.paras"
|
|
26
|
+
@after="
|
|
27
|
+
(eventType: FormCrudEvent, data: any, result: any) =>
|
|
28
|
+
after(v, eventType, data, result)
|
|
29
|
+
"
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</OverlayViewer>
|
|
23
34
|
</template>
|
|
24
35
|
<script setup lang="ts">
|
|
25
36
|
/**
|
|
@@ -28,56 +39,55 @@
|
|
|
28
39
|
* last change 2024-01-27
|
|
29
40
|
* author: Ks Tan
|
|
30
41
|
*/
|
|
31
|
-
import { onKeyStroke } from
|
|
32
|
-
import { useDialog } from
|
|
33
|
-
import {defineAsyncComponent} from
|
|
34
|
-
import { ViewRecord } from
|
|
42
|
+
import { onKeyStroke } from "@vueuse/core";
|
|
43
|
+
import { useDialog } from "primevue/usedialog";
|
|
44
|
+
import { defineAsyncComponent } from "vue";
|
|
45
|
+
import { ViewRecord,FormCrudEvent } from "~/types";
|
|
35
46
|
// import TabView from 'primevue/tabview';
|
|
36
|
-
import Chip from
|
|
47
|
+
import Chip from "primevue/chip";
|
|
37
48
|
|
|
49
|
+
const { $listen } = useNuxtApp();
|
|
50
|
+
const initDocumentName = ref('')
|
|
51
|
+
const visible = ref(false);
|
|
52
|
+
const allview = ref<{ [key: string]: ViewRecord }>({});
|
|
53
|
+
const after = (v: ViewRecord, eventType: FormCrudEvent, data: any, result: any) => {
|
|
54
|
+
if (v.after) {
|
|
55
|
+
v.after(eventType, data, result);
|
|
56
|
+
//only after mount consider no remove tab
|
|
57
|
+
if (eventType != "mount") deleteTab();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
38
60
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if(v.after){
|
|
44
|
-
v.after(eventType,data,result)
|
|
45
|
-
//only after mount consider no remove tab
|
|
46
|
-
if(eventType!='mount') deleteTab()
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
onKeyStroke('Escape', (e) => {
|
|
51
|
-
e.preventDefault()
|
|
52
|
-
deleteTab()
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
const deleteTab=()=>{
|
|
56
|
-
|
|
57
|
-
const keys = Object.keys(allview.value)
|
|
58
|
-
const lastkey = keys[keys.length-1]
|
|
59
|
-
delete allview.value[lastkey]
|
|
60
|
-
// updateprops.value++
|
|
61
|
-
if(Object.keys(allview.value).length==0){
|
|
62
|
-
visible.value=false
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
}
|
|
61
|
+
onKeyStroke("Escape", (e) => {
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
deleteTab();
|
|
64
|
+
});
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
const deleteTab = () => {
|
|
67
|
+
const keys = Object.keys(allview.value);
|
|
68
|
+
const lastkey = keys[keys.length - 1];
|
|
69
|
+
delete allview.value[lastkey];
|
|
70
|
+
console.log("DeleteTab",allview.value)
|
|
71
|
+
// updateprops.value++
|
|
72
|
+
if (Object.keys(allview.value).length == 0) {
|
|
73
|
+
visible.value = false;
|
|
74
|
+
useNuxtApp().$event('CloseDialog','viewer')
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
73
78
|
|
|
79
|
+
$listen("ViewRecord", (setting) => {
|
|
80
|
+
if(initDocumentName.value=='') initDocumentName.value= setting.documentName
|
|
81
|
+
visible.value = true;
|
|
82
|
+
allview.value[setting.eventId] = setting;
|
|
83
|
+
});
|
|
74
84
|
</script>
|
|
75
85
|
|
|
76
86
|
<style scoped>
|
|
77
|
-
.viewer-item{
|
|
78
|
-
|
|
87
|
+
.viewer-item {
|
|
88
|
+
display: none;
|
|
79
89
|
}
|
|
80
|
-
.viewer-item:last-child{
|
|
81
|
-
|
|
90
|
+
.viewer-item:last-child {
|
|
91
|
+
display: flex;
|
|
82
92
|
}
|
|
83
|
-
</style>
|
|
93
|
+
</style>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<SimpleAppForm #default="o" :document="doc">
|
|
3
|
+
<client-only>
|
|
4
|
+
<title v-if="id">{{ data.branchName ?? data.branchCode }}</title>
|
|
5
|
+
|
|
6
|
+
<SimpleAppFormToolBar
|
|
7
|
+
:document="doc"
|
|
8
|
+
@on="actionListener"
|
|
9
|
+
></SimpleAppFormToolBar>
|
|
10
|
+
<div
|
|
11
|
+
class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 p-2"
|
|
12
|
+
>
|
|
13
|
+
<SimpleAppInput
|
|
14
|
+
:input-type="SimpleAppInputType.text"
|
|
15
|
+
:setting="o.getField('#/properties/branchName')"
|
|
16
|
+
v-model="data.branchName"
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
<SimpleAppInput
|
|
20
|
+
:input-type="SimpleAppInputType.text"
|
|
21
|
+
:setting="o.getField('#/properties/branchCode')"
|
|
22
|
+
v-model="data.branchCode"
|
|
23
|
+
/>
|
|
24
|
+
|
|
25
|
+
<SimpleAppInput
|
|
26
|
+
:input-type="SimpleAppInputType.checkbox"
|
|
27
|
+
:setting="o.getField('#/properties/active')"
|
|
28
|
+
v-model="data.active"
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
<SimpleAppInput
|
|
32
|
+
:input-type="SimpleAppInputType.textarea"
|
|
33
|
+
:setting="o.getField('#/properties/description')"
|
|
34
|
+
v-model="data.description"
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
</client-only>
|
|
38
|
+
</SimpleAppForm>
|
|
39
|
+
<DebugDocumentData v-model="data" :label="doc.getDocName()" />
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script setup lang="ts">
|
|
43
|
+
/**
|
|
44
|
+
* This file was automatically generated by simpleapp generator.
|
|
45
|
+
* last change 2024-02-16
|
|
46
|
+
* Author: Ks Tan
|
|
47
|
+
*/
|
|
48
|
+
import { SimpleAppInputType, FormCrudEvent } from "~/types";
|
|
49
|
+
import { Branch } from "~/simpleapp/generate/types";
|
|
50
|
+
import { BranchDoc } from "~/simpleapp/docs/BranchDoc";
|
|
51
|
+
|
|
52
|
+
const props = defineProps<{
|
|
53
|
+
_id?: string;
|
|
54
|
+
doc?: BranchDoc;
|
|
55
|
+
paras?: Branch;
|
|
56
|
+
}>();
|
|
57
|
+
const doc = props.doc ?? useNuxtApp().$BranchDoc();
|
|
58
|
+
const data = doc.getReactiveData();
|
|
59
|
+
const emits = defineEmits(["after"]);
|
|
60
|
+
const id = computed(() => props._id ?? "");
|
|
61
|
+
|
|
62
|
+
/************ start default methods ****************/
|
|
63
|
+
|
|
64
|
+
const newData = () => doc.setNew();
|
|
65
|
+
|
|
66
|
+
const getRecord = async () => {
|
|
67
|
+
if (id.value && id.value != "new") {
|
|
68
|
+
await doc.getById(id.value);
|
|
69
|
+
} else {
|
|
70
|
+
newData();
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
getRecord();
|
|
75
|
+
watch(id, async () => await getRecord());
|
|
76
|
+
/************ end default methods ****************/
|
|
77
|
+
|
|
78
|
+
const actionListener = async (actionName: string) => {
|
|
79
|
+
emits("after", actionName, data.value, doc);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
onMounted(async () => await actionListener(FormCrudEvent.mount));
|
|
83
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
all document form auto generate into here
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import Dialog from 'primevue/dialog';
|
|
3
|
-
import {ref} from 'vue'
|
|
3
|
+
// import {ref} from 'vue'
|
|
4
4
|
import {MenuData} from '~/types'
|
|
5
|
-
const visible =
|
|
5
|
+
const visible = defineModel<boolean>({default:true,required:true})
|
|
6
6
|
|
|
7
7
|
// const emit = defineEmits(['select'])
|
|
8
8
|
const selectMenu = (menuname:{name:string,children:any}) =>{
|
|
@@ -12,11 +12,11 @@ const selectMenu = (menuname:{name:string,children:any}) =>{
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
const m = getMenustFromPageMeta()
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
let treemenu:any[] = []
|
|
17
16
|
|
|
18
17
|
getMenustFromPageMeta().reduce((r, item) => {
|
|
19
|
-
item.split('/').
|
|
18
|
+
item.split('/').
|
|
19
|
+
reduce((o, name) => {
|
|
20
20
|
var temp = (o.children = o.children || []).find(q => q.name === name);
|
|
21
21
|
if (!temp) o.children.push(temp = { name });
|
|
22
22
|
return temp;
|
|
@@ -24,17 +24,19 @@ getMenustFromPageMeta().reduce((r, item) => {
|
|
|
24
24
|
return r;
|
|
25
25
|
}, { children: treemenu })
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
treemenu = treemenu.sort((a,b)=>a.name<b.name ?-1:1)
|
|
28
28
|
</script>
|
|
29
29
|
<template>
|
|
30
30
|
|
|
31
|
-
<button class="text-center border-none cursor-pointer pi pi-bars dark:text-white" v-if="getCurrentXorg()" @click="visible=true">
|
|
31
|
+
<!-- <button class="text-center border-none cursor-pointer pi pi-bars dark:text-white" v-if="getCurrentXorg()" @click="visible=true"> -->
|
|
32
32
|
<Dialog v-model:visible="visible" modal :header="t('pickDocument')" :pt="{dialog:{ class:' bg-primary-800 ' }}">
|
|
33
33
|
<div class="">
|
|
34
|
-
|
|
34
|
+
|
|
35
|
+
<div v-for="m in treemenu.sort()" class="m-4">
|
|
36
|
+
|
|
35
37
|
<h3>{{ t(m.name) }}</h3>
|
|
36
|
-
<div class="grid md:grid-cols-2 lg:grid-cols-6 gap-4">
|
|
37
|
-
<ButtonPrimary v-for="submenu in m.children" class="border rounded-lg p-2" @click="selectMenu(submenu)">
|
|
38
|
+
<div class="grid md:grid-cols-2 lg:grid-cols-6 gap-4">
|
|
39
|
+
<ButtonPrimary v-for="submenu in m.children.sort((a:any,b:any)=>a.name<b.name ?-1:1)" class="border rounded-lg p-2" @click="selectMenu(submenu)">
|
|
38
40
|
{{ t(submenu.name) }}
|
|
39
41
|
</ButtonPrimary>
|
|
40
42
|
</div>
|
|
@@ -43,5 +45,5 @@ getMenustFromPageMeta().reduce((r, item) => {
|
|
|
43
45
|
|
|
44
46
|
</div>
|
|
45
47
|
</Dialog>
|
|
46
|
-
|
|
48
|
+
|
|
47
49
|
</template>
|
|
@@ -7,15 +7,12 @@ import {ref} from 'vue'
|
|
|
7
7
|
|
|
8
8
|
const { locale,setLocale,locales } = useI18n()
|
|
9
9
|
const colorMode = useColorMode()
|
|
10
|
-
|
|
10
|
+
const modelValue = defineModel<boolean>()
|
|
11
11
|
const mylocale = ref(locale)
|
|
12
|
-
const userprofileoverlay = ref();
|
|
13
12
|
const colors = [{value:'light', name:t('light')},{value:'dark', name:t('dark')}]
|
|
14
|
-
|
|
15
|
-
userprofileoverlay.value.toggle(event);
|
|
16
|
-
}
|
|
13
|
+
|
|
17
14
|
const toProfile = ()=>{
|
|
18
|
-
|
|
15
|
+
modelValue.value=false
|
|
19
16
|
|
|
20
17
|
if(getCurrentXorg()){
|
|
21
18
|
navigateTo(`/${getCurrentXorg()}/profile`)
|
|
@@ -24,10 +21,6 @@ const toProfile = ()=>{
|
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
}
|
|
27
|
-
const toFrontpage = () =>{
|
|
28
|
-
userprofileoverlay.value.toggle();
|
|
29
|
-
navigateTo('/')
|
|
30
|
-
}
|
|
31
24
|
const saveLocale=async (v:string)=>{
|
|
32
25
|
await setLocale(v)
|
|
33
26
|
}
|
|
@@ -37,14 +30,15 @@ const saveLocale=async (v:string)=>{
|
|
|
37
30
|
</script>
|
|
38
31
|
|
|
39
32
|
<template>
|
|
40
|
-
<div class="bg-cover bg-center rounded-md p-3 cursor-pointer profile-button" @click="toggle">
|
|
41
|
-
<
|
|
42
|
-
|
|
33
|
+
<!-- <div class="bg-cover bg-center rounded-md p-3 cursor-pointer profile-button" @click="toggle">
|
|
34
|
+
<i class="pi pi-user dark:text-white"></i> -->
|
|
35
|
+
<!-- <img :src="getAvatarLink(<string>getProfileEmail(),32)" alt="" class="h-full w-full overflow-hidden object-cover rounded-full border-2 border-white dark:border-gray-700 shadow" /> -->
|
|
36
|
+
<!-- </div> -->
|
|
43
37
|
|
|
44
|
-
<
|
|
38
|
+
<Dialog appendTo="body" ref="userprofileoverlay" v-model:visible="modelValue" close-on-escape :header="t('profile')">
|
|
45
39
|
<!-- <div> -->
|
|
46
40
|
<!-- <div class="py-2 transition duration-150 ease-in-out z-10 absolute top-0 right-0 bottom-0 left-0" id="modal"> -->
|
|
47
|
-
<div class="">
|
|
41
|
+
<div class="p-4">
|
|
48
42
|
<!-- <div class="relative p-4 md:p-8 bg-white dark:bg-gray-800 shadow-md rounded border border-gray-400"> -->
|
|
49
43
|
<div class="w-full flex items-center justify-start text-gray-600 dark:text-gray-400 mb-5" >
|
|
50
44
|
<div class="w-12 h-12 bg-cover bg-center rounded-md">
|
|
@@ -77,13 +71,13 @@ const saveLocale=async (v:string)=>{
|
|
|
77
71
|
|
|
78
72
|
<div class="mt-3 flex items-center justify-start w-full">
|
|
79
73
|
<button class="focus:outline-none transition duration-150 ease-in-out hover:bg-gray-600 bg-gray-700 rounded text-white px-8 py-2 text-sm" @click="toProfile">{{ t('profile') }}</button>
|
|
80
|
-
<button class="focus:outline-none ml-3 bg-warning-100 dark:bg-warning-700 dark:border-warning-700 dark:hover:bg-warning-600 transition duration-150 text-gray-600 dark:text-
|
|
74
|
+
<button class="focus:outline-none ml-3 bg-warning-100 dark:bg-warning-700 dark:border-warning-700 dark:hover:bg-warning-600 transition duration-150 text-gray-600 dark:text-white ease-in-out hover:border-gray-400 hover:bg-gray-300 border rounded px-8 py-2 text-sm" @click="logout()">{{ t('logout') }}</button>
|
|
81
75
|
</div>
|
|
82
76
|
<!-- </div> -->
|
|
83
77
|
</div>
|
|
84
78
|
<!-- </div> -->
|
|
85
79
|
|
|
86
80
|
<!-- </div> -->
|
|
87
|
-
</
|
|
81
|
+
</Dialog>
|
|
88
82
|
|
|
89
83
|
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ListView
|
|
3
|
+
:list="recordlist as T[]"
|
|
4
|
+
with-filter
|
|
5
|
+
:title-field="documentTitle"
|
|
6
|
+
:sub-title-field="uniqueKey"
|
|
7
|
+
#default="{ item, index }"
|
|
8
|
+
>
|
|
9
|
+
<div class="cursor-pointer flex flex-row gap-2" @click="emits('click', item)">
|
|
10
|
+
<slot name="default" :index="index" :item="item">
|
|
11
|
+
<TextTitle class="flex-1">{{ item[(documentTitle as keyof typeof item) ] }}</TextTitle>
|
|
12
|
+
<TextSubtitle >{{ item[uniqueKey as keyof typeof item] }}</TextSubtitle>
|
|
13
|
+
</slot>
|
|
14
|
+
</div>
|
|
15
|
+
</ListView>
|
|
16
|
+
</template>
|
|
17
|
+
<script setup lang="ts" generic="T extends { [key: string]: any }">
|
|
18
|
+
import { SearchBody } from "~/types";
|
|
19
|
+
const emits = defineEmits(["click"]);
|
|
20
|
+
const props = defineProps<{
|
|
21
|
+
recordlist: T[];
|
|
22
|
+
uniqueKey?: string;
|
|
23
|
+
documentTitle?: string;
|
|
24
|
+
}>();
|
|
25
|
+
</script>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DataTable
|
|
3
|
+
v-bind="$attrs"
|
|
4
|
+
stripedRows
|
|
5
|
+
dataKey="_id"
|
|
6
|
+
:showGridlines="true"
|
|
7
|
+
size="small"
|
|
8
|
+
:pt="{
|
|
9
|
+
header: { class: '' },
|
|
10
|
+
headerRow: { class: ' bg-gray-200' },
|
|
11
|
+
}"
|
|
12
|
+
v-on:row-click="clickRow"
|
|
13
|
+
:value="value"
|
|
14
|
+
:filters="filters"
|
|
15
|
+
:paginator="true"
|
|
16
|
+
:rows="20"
|
|
17
|
+
:rowsPerPageOptions="[20, 40, 60, 100]"
|
|
18
|
+
>
|
|
19
|
+
<!-- header -->
|
|
20
|
+
<template #header>
|
|
21
|
+
<div class="flex flex-row w-full text-right justify-content-end">
|
|
22
|
+
<div class="flex-1">
|
|
23
|
+
<slot name="toolbar"></slot>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="flex-1">
|
|
26
|
+
<slot name="title">
|
|
27
|
+
<h1 class="text text-2xl pt-2 text-center dark:text-white">
|
|
28
|
+
{{ t(title) }}
|
|
29
|
+
</h1>
|
|
30
|
+
</slot>
|
|
31
|
+
</div>
|
|
32
|
+
<span class="p-input-icon-left flex-1">
|
|
33
|
+
<i class="pi pi-search mt-4 ml-2 text-gray-400 absolute" />
|
|
34
|
+
<InputText
|
|
35
|
+
type="search"
|
|
36
|
+
v-model="filters['global'].value"
|
|
37
|
+
class="text-right"
|
|
38
|
+
placeholder="Keyword Search"
|
|
39
|
+
/>
|
|
40
|
+
</span>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
<!-- no data found -->
|
|
44
|
+
<template #empty>
|
|
45
|
+
<div class="text-center">
|
|
46
|
+
<div class="text-3xl text-gray-400 pi pi-exclamation-circle"></div>
|
|
47
|
+
<div class="text-3xl text-gray-400">{{ t("noDataFound") }}</div>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
50
|
+
<slot name="default">
|
|
51
|
+
<Column header="undefineColumns"></Column>
|
|
52
|
+
</slot>
|
|
53
|
+
</DataTable>
|
|
54
|
+
</template>
|
|
55
|
+
<script setup lang="ts" generic="T">
|
|
56
|
+
// import { CellSetting } from "~/types";
|
|
57
|
+
import { FilterMatchMode } from "primevue/api";
|
|
58
|
+
import DataTable from "primevue/datatable";
|
|
59
|
+
import Column from "primevue/column";
|
|
60
|
+
import renderComponent from "~/components/renderer";
|
|
61
|
+
import { emit } from "process";
|
|
62
|
+
const props = defineProps<{
|
|
63
|
+
value: T[]
|
|
64
|
+
title: string
|
|
65
|
+
columns: string[]
|
|
66
|
+
uniqueKey: string
|
|
67
|
+
documentTitle: string
|
|
68
|
+
}>();
|
|
69
|
+
const emits = defineEmits(["selectRow"]);
|
|
70
|
+
const clickRow = (eventdata: any) => {
|
|
71
|
+
emits("selectRow", eventdata.data);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const filters = ref({
|
|
75
|
+
global: { value: null, matchMode: FilterMatchMode.CONTAINS },
|
|
76
|
+
});
|
|
77
|
+
</script>
|