@simitgroup/simpleapp-generator 1.1.0 → 1.1.2
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/framework.js +2 -2
- package/dist/framework.js.map +1 -1
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +15 -44
- package/dist/generate.js.map +1 -1
- package/dist/processors/jsonschemabuilder.js +9 -0
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/storage.d.ts +1 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +2 -1
- package/dist/storage.js.map +1 -1
- package/package.json +1 -1
- package/src/framework.ts +2 -2
- package/src/generate.ts +22 -49
- package/src/processors/jsonschemabuilder.ts +12 -2
- package/src/storage.ts +2 -1
- package/templates/basic/nuxt/pages.landing.vue.eta +20 -27
- package/templates/basic/nuxt/pages.new.vue.eta +8 -7
- package/templates/basic/nuxt/pages.viewer.vue.eta +13 -0
- package/templates/nest/src/simpleapp/services/docno.service.ts.eta +1 -1
- package/templates/nuxt/app.vue.eta +5 -1
- package/templates/nuxt/assets/css/style.css._eta +33 -15
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +14 -7
- package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +23 -22
- package/templates/nuxt/components/docPage/DocPageList.vue.eta +112 -0
- package/templates/nuxt/components/event/EventDocumentViewer.vue.eta +69 -0
- package/templates/nuxt/components/header/HeaderBar.vue.eta +12 -10
- package/templates/nuxt/components/header/HeaderBreadcrumb.vue.eta +76 -0
- package/templates/nuxt/components/header/button/HeaderButtonMenuPicker.vue.eta +5 -7
- package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +39 -8
- package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +22 -3
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +82 -0
- package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +8 -8
- package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +21 -7
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +24 -63
- package/templates/nuxt/components/table/TableDocuments.vue.eta +12 -6
- package/templates/nuxt/components/user/UserButtonCreateTenant.vue.eta +25 -3
- package/templates/nuxt/components/user/UserProfileListItem.vue.eta +41 -41
- package/templates/nuxt/components/user/UserTenantPicker.vue.eta +26 -14
- package/templates/nuxt/composables/getDocument.generate.ts.eta +1 -1
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +4 -1
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +5 -1
- package/templates/nuxt/composables/themes.generate.ts.eta +1 -0
- package/templates/nuxt/i18n.config.ts.eta +5 -0
- package/templates/nuxt/lang/cn.ts._eta +9 -0
- package/templates/nuxt/lang/df.ts.eta +18 -0
- package/templates/nuxt/lang/en.ts._eta +6 -0
- package/templates/nuxt/layouts/{documentlist.vue.eta → documentlist.vue.eta.disabled} +1 -1
- package/templates/nuxt/nuxt.config.ts.eta +49 -16
- package/templates/nuxt/pages/[xorg]/docnoformat.vue.eta +11 -81
- package/templates/nuxt/pages/[xorg]/organization/[id]/branches/new.vue +1 -1
- package/templates/nuxt/pages/[xorg]/organization.vue.eta +10 -0
- package/templates/nuxt/pages/[xorg]/profile.vue.eta +3 -0
- package/templates/nuxt/pages/[xorg]/user.vue.eta +5 -0
- package/templates/nuxt/pages/index.vue._eta +19 -56
- package/templates/nuxt/pages/profile.vue.eta +12 -12
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +7 -0
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +1 -1
- package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +4 -1
- package/templates/nuxt/tailwind.config.ts._eta +18 -17
- package/templates/nuxt/types/events.ts.eta +11 -0
- package/templates/nuxt/types/others.ts.eta +4 -1
- package/templates/project/jsonschemas/category.json._eta +3 -3
- package/templates/project/jsonschemas/customer.json._eta +15 -2
- package/templates/project/jsonschemas/invoice.json._eta +5 -4
- package/templates/project/jsonschemas/product.json._eta +3 -3
- package/templates/project/sharelibs/money.ts.eta +2 -3
- package/tsconfig.tsbuildinfo +1 -1
- /package/templates/nuxt/layouts/{sidelist.vue.eta → sidelist.vue.eta.disabled} +0 -0
- /package/templates/nuxt/layouts/{sidelistcrud.vue.eta → sidelistcrud.vue.eta.disabled} +0 -0
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import Avatar from 'primevue/avatar';
|
|
3
|
+
import Dropdown from 'primevue/dropdown';
|
|
3
4
|
import OverlayPanel from 'primevue/overlaypanel';
|
|
4
5
|
import {ref} from 'vue'
|
|
5
6
|
|
|
7
|
+
|
|
8
|
+
const { locale,setLocale,locales } = useI18n()
|
|
9
|
+
const mylocale = ref(locale)
|
|
6
10
|
const userprofileoverlay = ref();
|
|
11
|
+
const colors = [{value:'light', name:'Light'},{value:'dark', name:'Dark'}]
|
|
7
12
|
const toggle = (event:any) => {
|
|
8
13
|
userprofileoverlay.value.toggle(event);
|
|
9
14
|
}
|
|
@@ -21,6 +26,11 @@ const toFrontpage = () =>{
|
|
|
21
26
|
userprofileoverlay.value.toggle();
|
|
22
27
|
navigateTo('/')
|
|
23
28
|
}
|
|
29
|
+
const saveLocale=async (v:string)=>{
|
|
30
|
+
await setLocale(v)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
24
34
|
|
|
25
35
|
</script>
|
|
26
36
|
|
|
@@ -29,10 +39,10 @@ const toFrontpage = () =>{
|
|
|
29
39
|
<div class=" w-[120px] truncate ...">
|
|
30
40
|
|
|
31
41
|
<div class="flex flex-row-reverse cursor-pointer border-none w-full" @click="toggle">
|
|
32
|
-
<p>{{
|
|
42
|
+
<p>{{ getProfileFullName() }}</p>
|
|
33
43
|
<!-- <Avatar :image="getUserStore().getAvatarLink(32)" class="" size="normal" shape="circle" /> -->
|
|
34
44
|
<div class="w-8 h-8 bg-cover bg-center rounded-md">
|
|
35
|
-
<img :src="getAvatarLink(
|
|
45
|
+
<img :src="getAvatarLink(getProfileEmail(),32)" alt="" class="h-full w-full overflow-hidden object-cover rounded-full border-2 border-white dark:border-gray-700 shadow" />
|
|
36
46
|
</div>
|
|
37
47
|
</div>
|
|
38
48
|
|
|
@@ -42,21 +52,42 @@ const toFrontpage = () =>{
|
|
|
42
52
|
<div class="py-2 transition duration-150 ease-in-out z-10 absolute top-0 right-0 bottom-0 left-0" id="modal">
|
|
43
53
|
<div role="alert" class="container mx-auto w-full md:w-full max-w-lg">
|
|
44
54
|
<div class="relative p-4 md:p-8 bg-white dark:bg-gray-800 shadow-md rounded border border-gray-400">
|
|
45
|
-
<div class="w-full flex items-center justify-start text-gray-600 dark:text-gray-400 mb-5
|
|
55
|
+
<div class="w-full flex items-center justify-start text-gray-600 dark:text-gray-400 mb-5" >
|
|
46
56
|
<div class="w-12 h-12 bg-cover bg-center rounded-md">
|
|
47
|
-
<img :src="getAvatarLink(
|
|
57
|
+
<img :src="getAvatarLink(getProfileEmail(),32)" alt="" class="h-full w-full overflow-hidden object-cover rounded-full border-2 border-white dark:border-gray-700 shadow" />
|
|
48
58
|
</div>
|
|
49
|
-
<div class="flex flex-col
|
|
59
|
+
<div class="flex flex-col" >
|
|
50
60
|
<h1 class="text-left text-gray-800 dark:text-gray-100 font-lg font-bold tracking-normal leading-tight ml-2">{{ getUserProfile().fullName }}</h1>
|
|
51
61
|
<p class="text-gray-400 dark:text-gray-100 font-normal text-base tracking-normal ml-2 mr-4">{{getUserProfile().group }}</p>
|
|
52
62
|
</div>
|
|
53
63
|
|
|
54
64
|
</div>
|
|
65
|
+
<!-- language -->
|
|
66
|
+
<div class="col-span-full">
|
|
67
|
+
<label for="pick-lang" class="block text-sm font-medium leading-6 text-gray-900 dark:text-gray-300">{{ t('language') }}</label>
|
|
68
|
+
<div class="mt-2">
|
|
69
|
+
<Dropdown inputId="pick-lang" @update:model-value="saveLocale" v-model="mylocale" option-value="code" option-label="name" :options="locales" >
|
|
70
|
+
</Dropdown>
|
|
71
|
+
<!-- <select v-model="$colorMode.preference" id="picklang">
|
|
72
|
+
<option value="light">Light</option>
|
|
73
|
+
<option value="dark">Dark</option>
|
|
74
|
+
</select> -->
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="mt-3 col-span-full">
|
|
78
|
+
<label for="pick-theme" class="block text-sm font-medium leading-6 text-gray-900 dark:text-gray-300">{{ t('theme') }}</label>
|
|
79
|
+
<div class="mt-2">
|
|
80
|
+
<Dropdown inputId="pick-theme" v-model="$colorMode.preference" option-value="value" option-label="name" :options="colors" >
|
|
81
|
+
</Dropdown>
|
|
82
|
+
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
55
86
|
|
|
56
|
-
<div class="flex items-center justify-start w-full">
|
|
57
|
-
<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="
|
|
87
|
+
<div class="mt-3 flex items-center justify-start w-full">
|
|
88
|
+
<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>
|
|
58
89
|
<!-- <button class="focus:outline-none transition duration-150 ease-in-out bg-gray-600 rounded text-white px-8 py-2 text-sm" @click="toFrontpage">Pick Tenant</button> -->
|
|
59
|
-
<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-gray-400 ease-in-out hover:border-gray-400 hover:bg-gray-300 border rounded px-8 py-2 text-sm" @click="logout()">
|
|
90
|
+
<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-gray-400 ease-in-out hover:border-gray-400 hover:bg-gray-300 border rounded px-8 py-2 text-sm" @click="logout()">{{ t('logout') }}</button>
|
|
60
91
|
</div>
|
|
61
92
|
</div>
|
|
62
93
|
</div>
|
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<span v-if="setting?.collection" @click="viewRecord" class="text-primary-700 hover:text-primary-500 cursor-pointer">
|
|
3
3
|
{{modelValue?.label}}
|
|
4
|
-
</
|
|
4
|
+
</span>
|
|
5
5
|
<span v-else>{{modelValue?.label || modelValue}}</span>
|
|
6
6
|
</template>
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
const modelValue = defineModel()
|
|
9
8
|
|
|
9
|
+
|
|
10
|
+
const modelValue = defineModel<{label:string,_id:string}>()
|
|
10
11
|
const props = defineProps<{setting:any}>()
|
|
12
|
+
const {$event} = useNuxtApp()
|
|
13
|
+
const viewer=ref()
|
|
14
|
+
const viewRecord = () => {
|
|
15
|
+
viewer.value = getDocument(props.setting.collection)?.viewer
|
|
16
|
+
|
|
17
|
+
// getDocumentUrl(setting.collection,modelValue ? modelValue['_id']:'')
|
|
18
|
+
//getDocumentUrl(setting.collection,modelValue ? modelValue['_id']:'')
|
|
19
|
+
$event('ViewRecord',{
|
|
20
|
+
_id: modelValue.value?._id as string,
|
|
21
|
+
label: modelValue.value?.label as string,
|
|
22
|
+
eventId: crypto.randomUUID(),
|
|
23
|
+
documentName: props.setting.collection,
|
|
24
|
+
viewer: viewer.value,
|
|
25
|
+
readonly:true
|
|
26
|
+
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
}
|
|
11
30
|
</script>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<AutoComplete v-model="modelValue" v-if="!readonly"
|
|
3
|
+
forceSelection optionLabel="label" :dropdown="true"
|
|
4
|
+
@item-select="pickAutoComplete"
|
|
5
|
+
@complete="getListFromAutocompleteApi"
|
|
6
|
+
:pt="pt"
|
|
7
|
+
:disabled="readonly"
|
|
8
|
+
:suggestions="list"
|
|
9
|
+
@blur="onBlurAutocomplete"
|
|
10
|
+
:inputId="inputId" :path="setting.instancepath"
|
|
11
|
+
:readonly="readonly"
|
|
12
|
+
/>
|
|
13
|
+
<div v-else class="p-3 border rounded-lg border-gray-300 dark:border-blue-900/40 ">
|
|
14
|
+
<A :readonly="readonly" class="cursor-pointer text-primary-600 dark:text-primary-400 "
|
|
15
|
+
tabindex="0" @click="openViewer">{{modelValue?.label}}</A>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
import { isNull, pick } from 'lodash';
|
|
20
|
+
import {autocompletetype} from '~/types'
|
|
21
|
+
import {ForeignKey} from '~/types'
|
|
22
|
+
const {$event} = useNuxtApp()
|
|
23
|
+
const list = ref([])
|
|
24
|
+
const emptyautocomplete =():autocompletetype=> ({_id:'',label:''})
|
|
25
|
+
const autocompleteitem = ref<autocompletetype>(emptyautocomplete())
|
|
26
|
+
const props = defineProps<{
|
|
27
|
+
setting:any
|
|
28
|
+
readonly?:boolean
|
|
29
|
+
inputId:string
|
|
30
|
+
pt?:any
|
|
31
|
+
}>()
|
|
32
|
+
const modelValue = defineModel<{_id:string,label:string}>()
|
|
33
|
+
const onBlurAutocomplete = ()=>{
|
|
34
|
+
|
|
35
|
+
if( autocompleteitem.value === null){
|
|
36
|
+
autocompleteitem.value = emptyautocomplete()
|
|
37
|
+
}
|
|
38
|
+
if(isNull(modelValue.value )){
|
|
39
|
+
modelValue.value = autocompleteitem.value
|
|
40
|
+
}
|
|
41
|
+
else if(typeof modelValue.value =='object'){
|
|
42
|
+
|
|
43
|
+
}else{
|
|
44
|
+
modelValue.value = autocompleteitem.value
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
const getListFromAutocompleteApi = (event:any)=>{
|
|
49
|
+
const keyword = event.query??''
|
|
50
|
+
//props.setting.document.getDocType()
|
|
51
|
+
const targetDocument = props.setting.fieldsetting['x-foreignkey']
|
|
52
|
+
getDocumentApi(targetDocument).autoComplete(keyword).then((res:any)=>{
|
|
53
|
+
list.value = res.data
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
const pickAutoComplete = (event:any)=>{
|
|
57
|
+
if(typeof event.value.query == 'undefined'){
|
|
58
|
+
modelValue.value=event.value
|
|
59
|
+
autocompleteitem.value = event.value
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const emits = defineEmits(['change','update:modelValue','update:docNoFormat'])
|
|
64
|
+
watch(modelValue ,(newvalue:any)=>{
|
|
65
|
+
modelValue.value=autocompleteitem.value
|
|
66
|
+
|
|
67
|
+
emits('change',modelValue.value)
|
|
68
|
+
emits('update:modelValue',modelValue.value)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
const openViewer = () =>{
|
|
72
|
+
$event('ViewRecord',{
|
|
73
|
+
_id: modelValue.value?._id as string,
|
|
74
|
+
eventId: crypto.randomUUID(),
|
|
75
|
+
label: modelValue.value?.label as string,
|
|
76
|
+
readonly:true,
|
|
77
|
+
viewer : getDocument(props.setting.fieldsetting['x-foreignkey'])?.viewer,
|
|
78
|
+
documentName: props.setting.fieldsetting['x-foreignkey'],
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
</script>
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
|
|
2
2
|
<template>
|
|
3
3
|
|
|
4
|
-
<div class="
|
|
5
|
-
<InputText
|
|
4
|
+
<div class="flex flex-row w-full">
|
|
5
|
+
<InputText
|
|
6
6
|
:readonly="readonly"
|
|
7
7
|
v-model="modelValue"
|
|
8
8
|
:placeholder="placeholder"
|
|
9
|
+
:class="'flex-1 w-full rounded-lg '+ ( props.readonly?'':'dark:!bg-gray-700 rounded-tr-none rounded-br-none')"
|
|
9
10
|
/>
|
|
10
|
-
<span class="
|
|
11
|
-
<button type="button" @click="toggle"
|
|
12
|
-
|
|
13
|
-
class="border rounded-tl-none rounded-bl-none btn btn-primary -ml-1 h-full p-3 rounded-r-md">
|
|
11
|
+
<span class="" v-if="!readonly">
|
|
12
|
+
<button type="button" @click="toggle" tabindex="-1"
|
|
13
|
+
class="'btn btn-primary p-3 dark:border-blue-900/40 rounded-lg rounded-tl-none rounded-bl-none">
|
|
14
14
|
<i class="pi pi-angle-down"></i>
|
|
15
15
|
</button>
|
|
16
16
|
<OverlayPanel ref="op" class="p-4">
|
|
17
17
|
<div class="m-4">
|
|
18
18
|
<ul>
|
|
19
19
|
<li v-for="docno in docFormatlist" class="hover-list-primary p-2" >
|
|
20
|
-
<a class="
|
|
20
|
+
<a class="" @click="chooseFormat(docno)">
|
|
21
21
|
<span class="pi pi-hashtag mr-2"></span>
|
|
22
22
|
<span class="">{{docno.docNoFormatName}}</span>
|
|
23
|
-
<span class="
|
|
23
|
+
<span class=" text text-green-600">{{docno.sample}}</span>
|
|
24
24
|
</a>
|
|
25
25
|
</li>
|
|
26
26
|
</ul>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div v-if="schema"
|
|
2
|
+
<div v-if="schema" class="flex flex-col">
|
|
3
3
|
<div v-if="hidelabel"></div>
|
|
4
|
-
<label v-else-if="error" class="text-danger-600" :for="uuid">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="text-danger-600">*</span></label>
|
|
5
|
-
<label v-else :for="uuid">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="text-danger-600">*</span></label>
|
|
4
|
+
<label v-else-if="error" class="text-danger-600 overflow-hidden" :for="uuid">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="text-danger-600">*</span></label>
|
|
5
|
+
<label v-else :for="uuid" class="whitespace-nowrap text-gray-500 truncate">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="text-danger-600">*</span></label>
|
|
6
6
|
|
|
7
7
|
<!-- <div :uuid="uuid" >{{ modelValue }}</div> -->
|
|
8
8
|
<!-- <div v-if="typeof modelValue =='object' && typeof modelValue['_id']!='undefined' && typeof modelValue['label']!='undefined' && readonly ==true " :uuid="uuid" class="simpleapp-value-readonly">{{ modelValue['label'] }}</div> -->
|
|
@@ -24,8 +24,10 @@ import SimpleAppValue from './SimpleAppValue.vue'
|
|
|
24
24
|
// import {computed,setBlockTracking,watch} from 'vue'
|
|
25
25
|
|
|
26
26
|
import {ref} from 'vue'
|
|
27
|
+
|
|
28
|
+
|
|
27
29
|
const uuid = crypto.randomUUID();
|
|
28
|
-
const fieldlabel = ref('')
|
|
30
|
+
// const fieldlabel = ref('')
|
|
29
31
|
// const fielddesc = ref('')
|
|
30
32
|
const defaultcssclass='simpleapp-input-container'
|
|
31
33
|
const fieldcontainerclass = ref(defaultcssclass)
|
|
@@ -57,6 +59,7 @@ let schema:any
|
|
|
57
59
|
const fielddesc = computed(()=>{
|
|
58
60
|
return props.description ?? schema.description ?? ''
|
|
59
61
|
})
|
|
62
|
+
|
|
60
63
|
if(props.setting.fieldsetting && props.setting.fieldsetting.type){
|
|
61
64
|
|
|
62
65
|
schema = props.setting.fieldsetting
|
|
@@ -68,9 +71,8 @@ if(props.setting.fieldsetting && props.setting.fieldsetting.type){
|
|
|
68
71
|
const fieldnamearr = instancepath.value.split('/')
|
|
69
72
|
const fieldname = camelCaseToWords(fieldnamearr[fieldnamearr.length-1])
|
|
70
73
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
else fieldlabel.value=fieldname
|
|
74
|
+
|
|
75
|
+
|
|
74
76
|
|
|
75
77
|
// if(props.description)fielddesc.value = props.description
|
|
76
78
|
// else if (schema?.description != 'undefined') fielddesc.value=schema.description
|
|
@@ -79,6 +81,18 @@ if(props.setting.fieldsetting && props.setting.fieldsetting.type){
|
|
|
79
81
|
|
|
80
82
|
|
|
81
83
|
}
|
|
84
|
+
const fieldlabel = computed(()=>{
|
|
85
|
+
|
|
86
|
+
if(props.label){
|
|
87
|
+
return t(props.label)
|
|
88
|
+
}
|
|
89
|
+
else if (schema.title ) {
|
|
90
|
+
return t(schema.title)
|
|
91
|
+
}
|
|
92
|
+
else{
|
|
93
|
+
return t(props.setting.key)
|
|
94
|
+
}
|
|
95
|
+
})
|
|
82
96
|
const errormsg = computed(()=>{
|
|
83
97
|
|
|
84
98
|
props.setting.errors[instancepath.value]
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- date component -->
|
|
12
12
|
<component :is="inputComponent" type="date" :pt="pt"
|
|
13
|
-
v-else-if="inputType == SimpleAppInputType.date"
|
|
13
|
+
v-else-if="inputType == SimpleAppInputType.date"
|
|
14
14
|
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
15
15
|
v-model="datevalue" @update:modelValue="updateDate" :readonly="isReadonly"/>
|
|
16
16
|
<!-- calendar component -->
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
v-else-if="[SimpleAppInputType.select,SimpleAppInputType.list].includes(inputType)"
|
|
25
25
|
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
26
26
|
:readonly="isReadonly"
|
|
27
|
-
|
|
27
|
+
:disabled="isReadonly"
|
|
28
|
+
:options="getListOptions()" optionLabel="label" optionValue="value"/>
|
|
28
29
|
|
|
29
30
|
<!-- radio component -->
|
|
30
31
|
<div v-else-if="inputType == SimpleAppInputType.radio" >
|
|
@@ -37,32 +38,22 @@
|
|
|
37
38
|
</div>
|
|
38
39
|
</div>
|
|
39
40
|
|
|
40
|
-
<!-- autocomplete -->
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
:
|
|
48
|
-
root:{class:'rounded-lg flex flex-row'},
|
|
49
|
-
input:{class:'w-full font-sans text-gray-600 dark:text-white/80 bg-white dark:bg-gray-900 border border-gray-300 dark:border-blue-900/40 rounded-lg rounded-tr-none rounded-br-none transition-colors duration-200 appearance-none hover:border-blue-500 focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)] text-base'},
|
|
50
|
-
loadingIcon:{class:'hidden'},
|
|
51
|
-
dropdownbutton: {
|
|
52
|
-
root:' bg-primary-600 hover:bg-primary-400 text-white rounded flex flex-row p-3 rounded-tl-none rounded-bl-none '
|
|
53
|
-
}
|
|
54
|
-
}"
|
|
55
|
-
:disabled="isReadonly"
|
|
56
|
-
:suggestions="list"
|
|
57
|
-
@blur="onBlurAutocomplete"
|
|
58
|
-
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
41
|
+
<!-- autocomplete, need do more enterprise grade component-->
|
|
42
|
+
<SimpleAppAutocomplete v-else-if="inputType==SimpleAppInputType.autocomplete"
|
|
43
|
+
v-model="modelValue"
|
|
44
|
+
:pt="pt"
|
|
45
|
+
:setting="setting"
|
|
46
|
+
:disabled="isReadonly"
|
|
47
|
+
:inputId="slotprops.uuid"
|
|
48
|
+
:path="setting.instancepath"
|
|
59
49
|
:readonly="isReadonly"
|
|
60
50
|
/>
|
|
61
51
|
|
|
62
52
|
<!-- document no input-->
|
|
63
53
|
<SimpleAppDocumentNo v-else-if="inputType == SimpleAppInputType.documentno"
|
|
64
54
|
:setting="setting" v-model="modelValue" :inputId="slotprops.uuid"
|
|
65
|
-
:readonly="isReadonly" @update:docNoFormat="triggerDocNoFormatChange"
|
|
55
|
+
:readonly="isReadonly" @update:docNoFormat="triggerDocNoFormatChange"
|
|
56
|
+
:pt="pt"
|
|
66
57
|
:path="setting.instancepath"/>
|
|
67
58
|
|
|
68
59
|
|
|
@@ -83,13 +74,11 @@
|
|
|
83
74
|
<component v-else-if="inputType == SimpleAppInputType.chip"
|
|
84
75
|
:is="inputComponent" :type="type" v-model="modelValue"
|
|
85
76
|
:pt="pt"
|
|
86
|
-
:disabled="isReadonly"
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
:disabled="isReadonly"
|
|
89
78
|
:inputId="slotprops.uuid" :path="setting.instancepath"/>
|
|
90
79
|
<!-- simple component -->
|
|
91
|
-
<component v-else :is="inputComponent" :type="type" v-model="modelValue"
|
|
92
|
-
:readonly="isReadonly"
|
|
80
|
+
<component v-else :is="inputComponent" :type="type" v-model="modelValue"
|
|
81
|
+
:readonly="isReadonly"
|
|
93
82
|
class="w-full flex flex-col"
|
|
94
83
|
:inputId="slotprops.uuid" :path="setting.instancepath"/>
|
|
95
84
|
|
|
@@ -100,14 +89,13 @@
|
|
|
100
89
|
</template>
|
|
101
90
|
|
|
102
91
|
<script lang="ts" setup>
|
|
103
|
-
import { isNull, pick } from 'lodash';
|
|
104
|
-
import {autocompletetype} from '~/types'
|
|
105
92
|
import moment from 'moment'
|
|
106
93
|
import AutoComplete from 'primevue/autocomplete';
|
|
107
94
|
import Calendar from 'primevue/calendar';
|
|
108
95
|
import Checkbox from 'primevue/checkbox';
|
|
109
96
|
import Chips from 'primevue/chips';
|
|
110
97
|
import SimpleAppDocumentNo from './SimpleAppDocumentNo.vue';
|
|
98
|
+
import SimpleAppAutocomplete from './SimpleAppAutocomplete.vue'
|
|
111
99
|
import Dropdown from 'primevue/dropdown';
|
|
112
100
|
import InputNumber from 'primevue/inputnumber';
|
|
113
101
|
import InputSwitch from 'primevue/inputswitch';
|
|
@@ -121,12 +109,12 @@ import Slider from 'primevue/slider';
|
|
|
121
109
|
import Textarea from 'primevue/textarea';
|
|
122
110
|
import {SimpleAppInputType} from '~/types'
|
|
123
111
|
|
|
112
|
+
|
|
124
113
|
let inputComponent :Component
|
|
125
|
-
|
|
126
|
-
|
|
114
|
+
|
|
115
|
+
|
|
127
116
|
const datevalue = ref('')
|
|
128
117
|
const modelValue = defineModel()
|
|
129
|
-
const list = ref([])
|
|
130
118
|
const props = withDefaults( defineProps<{
|
|
131
119
|
inputType:SimpleAppInputType,
|
|
132
120
|
label?:string,
|
|
@@ -210,7 +198,7 @@ const isReadonly = computed(()=>{
|
|
|
210
198
|
})
|
|
211
199
|
|
|
212
200
|
const updateDate = (value:any)=>{
|
|
213
|
-
modelValue.value = moment(value).
|
|
201
|
+
modelValue.value = moment(value).format('YYYY-MM-DD')
|
|
214
202
|
}
|
|
215
203
|
|
|
216
204
|
|
|
@@ -235,9 +223,10 @@ watch(modelValue ,(newvalue:any)=>{
|
|
|
235
223
|
|
|
236
224
|
if([SimpleAppInputType.date,SimpleAppInputType.calendar].includes(props.inputType)){
|
|
237
225
|
datevalue.value = moment(modelValue.value as string ).format('YYYY-MM-DD')
|
|
238
|
-
}else if(props.inputType==SimpleAppInputType.autocomplete){
|
|
239
|
-
modelValue.value=autocompleteitem.value
|
|
240
226
|
}
|
|
227
|
+
// else if(props.inputType==SimpleAppInputType.autocomplete){
|
|
228
|
+
// modelValue.value=autocompleteitem.value
|
|
229
|
+
// }
|
|
241
230
|
|
|
242
231
|
emits('change',modelValue.value)
|
|
243
232
|
emits('update:modelValue',modelValue.value)
|
|
@@ -245,35 +234,7 @@ watch(modelValue ,(newvalue:any)=>{
|
|
|
245
234
|
|
|
246
235
|
|
|
247
236
|
/************ start autocomplete only ***************/
|
|
248
|
-
const onBlurAutocomplete = ()=>{
|
|
249
|
-
|
|
250
|
-
if( autocompleteitem.value === null){
|
|
251
|
-
autocompleteitem.value = emptyautocomplete()
|
|
252
|
-
}
|
|
253
|
-
if(isNull(modelValue.value )){
|
|
254
|
-
modelValue.value = autocompleteitem.value
|
|
255
|
-
}
|
|
256
|
-
else if(typeof modelValue.value =='object'){
|
|
257
|
-
|
|
258
|
-
}else{
|
|
259
|
-
modelValue.value = autocompleteitem.value
|
|
260
|
-
}
|
|
261
237
|
|
|
262
|
-
}
|
|
263
|
-
const getListFromAutocompleteApi = (event:any)=>{
|
|
264
|
-
const keyword = event.query??''
|
|
265
|
-
//props.setting.document.getDocType()
|
|
266
|
-
const targetDocument = props.setting.fieldsetting['x-foreignkey']
|
|
267
|
-
getDocumentApi(targetDocument).autoComplete(keyword).then((res:any)=>{
|
|
268
|
-
list.value = res.data
|
|
269
|
-
})
|
|
270
|
-
}
|
|
271
|
-
const pickAutoComplete = (event:any)=>{
|
|
272
|
-
if(typeof event.value.query == 'undefined'){
|
|
273
|
-
modelValue.value=event.value
|
|
274
|
-
autocompleteitem.value = event.value
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
238
|
/************ end autocomplete only ***************/
|
|
278
239
|
|
|
279
240
|
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
:showGridlines="true"
|
|
6
6
|
size="small"
|
|
7
7
|
:pt="{
|
|
8
|
-
|
|
9
|
-
headerRow:{ class:'
|
|
8
|
+
header:{ class:''},
|
|
9
|
+
headerRow:{ class:' bg-gray-200'},
|
|
10
10
|
}"
|
|
11
|
+
v-on:row-click="clickRow"
|
|
11
12
|
:value="value"
|
|
12
13
|
:filters="filters"
|
|
13
14
|
:paginator="true" :rows="20"
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
>
|
|
16
17
|
<!-- header -->
|
|
17
18
|
<template #header>
|
|
18
|
-
<div class=" flex flex-row w-full text-right justify-content-end">
|
|
19
|
+
<div class=" flex flex-row w-full text-right justify-content-end" >
|
|
19
20
|
<div class="flex-1">
|
|
20
21
|
<slot name="toolbar"></slot>
|
|
21
22
|
</div>
|
|
@@ -100,13 +101,18 @@ import { FilterMatchMode } from 'primevue/api';
|
|
|
100
101
|
import DataTable from 'primevue/datatable';
|
|
101
102
|
import Column from 'primevue/column';
|
|
102
103
|
import renderComponent from '~/components/renderer'
|
|
104
|
+
import { emit } from 'process';
|
|
103
105
|
const props = defineProps<{
|
|
104
106
|
value:any[]
|
|
105
|
-
columns: CellSetting[]
|
|
106
|
-
title:string
|
|
107
|
-
|
|
107
|
+
columns: CellSetting[]
|
|
108
|
+
title:string
|
|
108
109
|
|
|
109
110
|
}>()
|
|
111
|
+
const emits = defineEmits(['selectRow'])
|
|
112
|
+
|
|
113
|
+
const clickRow = (eventdata:any) =>{
|
|
114
|
+
emits('selectRow',eventdata.data)
|
|
115
|
+
}
|
|
110
116
|
|
|
111
117
|
const filters = ref({
|
|
112
118
|
'global': {value: null, matchMode: FilterMatchMode.CONTAINS},
|
|
@@ -8,7 +8,29 @@
|
|
|
8
8
|
/> -->
|
|
9
9
|
|
|
10
10
|
<!-- <button class="">Create</button> -->
|
|
11
|
-
<form @submit.prevent="true" class="
|
|
11
|
+
<form @submit.prevent="true" class="w-full">
|
|
12
|
+
<div class="p-inputgroup flex flex-row">
|
|
13
|
+
<InputText
|
|
14
|
+
class="flex-1"
|
|
15
|
+
type="email"
|
|
16
|
+
placeholder="your company name"
|
|
17
|
+
v-model:model-value="data.tenantName"
|
|
18
|
+
/>
|
|
19
|
+
<div class="p-inputgroup-addon p p-0">
|
|
20
|
+
<button
|
|
21
|
+
:label="t('create')"
|
|
22
|
+
class="border rounded-tl-none rounded-bl-none btn btn-primary -ml-1 h-full p-3 rounded-r-md"
|
|
23
|
+
@click="createTenant" :loading="onhold"
|
|
24
|
+
>
|
|
25
|
+
{{t('create')}}
|
|
26
|
+
</button>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</form>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<!-- <form @submit.prevent="true" class="flex flex-row text-center">
|
|
33
|
+
|
|
12
34
|
<div class="flex flex-col">
|
|
13
35
|
<InputText
|
|
14
36
|
type="text"
|
|
@@ -18,10 +40,10 @@
|
|
|
18
40
|
/>
|
|
19
41
|
<div v-if="errCreateTenant" class="text-error">{{ errCreateTenant }}</div>
|
|
20
42
|
</div>
|
|
21
|
-
<Button class="w-full md:w-auto
|
|
43
|
+
<Button class="w-full md:w-auto dark:border-transparent px-8 py-4 border rounded-md btn btn-primary grid place-items-center font-semibold mt-4 md:mt-0 focus:outline-none focus:ring-2 focus:ring-primary-700 focus:ring-primary-50" type="submit" @click="createTenant" :loading="onhold">
|
|
22
44
|
Create
|
|
23
45
|
</Button>
|
|
24
|
-
</form>
|
|
46
|
+
</form> -->
|
|
25
47
|
</div>
|
|
26
48
|
|
|
27
49
|
|