@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.
Files changed (84) hide show
  1. package/dist/buildinschemas/organization.d.ts.map +1 -1
  2. package/dist/buildinschemas/organization.js +3 -1
  3. package/dist/buildinschemas/organization.js.map +1 -1
  4. package/dist/framework.d.ts.map +1 -1
  5. package/dist/framework.js +3 -8
  6. package/dist/framework.js.map +1 -1
  7. package/dist/generate.js +14 -14
  8. package/dist/generate.js.map +1 -1
  9. package/package.json +1 -1
  10. package/src/buildinschemas/organization.ts +3 -1
  11. package/src/framework.ts +4 -8
  12. package/src/generate.ts +17 -16
  13. package/templates/basic/nest/controller.ts.eta +17 -0
  14. package/templates/basic/nest/default.ts.eta +6 -2
  15. package/templates/basic/nuxt/default.ts.eta +10 -6
  16. package/templates/basic/nuxt/pages.[id].vue.eta +9 -7
  17. package/templates/basic/nuxt/pages.form.vue.eta +16 -36
  18. package/templates/basic/nuxt/pages.landing.vue.eta +42 -35
  19. package/templates/basic/nuxt/pages.viewer.vue.eta +4 -6
  20. package/templates/nest/.env._eta +0 -1
  21. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +14 -2
  22. package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +32 -18
  23. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +76 -13
  24. package/templates/nuxt/assets/css/style.css._eta +19 -7
  25. package/templates/nuxt/assets/primevue/passthrough.ts._eta +20 -9
  26. package/templates/nuxt/components/button/ButtonDefault.vue._eta +1 -2
  27. package/templates/nuxt/components/button/ButtonMultiple.vue._eta +21 -0
  28. package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +3 -4
  29. package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +75 -65
  30. package/templates/nuxt/components/form/FormBranch.vue.eta +83 -0
  31. package/templates/nuxt/components/form/readme.md.eta +1 -0
  32. package/templates/nuxt/components/header/button/HeaderButtonMenuPicker.vue._eta +13 -11
  33. package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +11 -17
  34. package/templates/nuxt/components/list/ListDocument.vue.eta +25 -0
  35. package/templates/nuxt/components/list/ListDocumentTable.vue.eta +77 -0
  36. package/templates/nuxt/components/list/ListView.vue.eta +129 -60
  37. package/templates/nuxt/components/mobile/MobileToolbar.vue.eta +10 -0
  38. package/templates/nuxt/components/overlay/OverlaySideBarCrud.vue.eta +21 -0
  39. package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +20 -0
  40. package/templates/nuxt/components/page/PageDocList.vue.eta +170 -0
  41. package/templates/nuxt/components/renderer/RendererBoolean.vue.eta +8 -4
  42. package/templates/nuxt/components/renderer/RendererDate.vue.eta +4 -4
  43. package/templates/nuxt/components/renderer/RendererLink.vue.eta +12 -20
  44. package/templates/nuxt/components/renderer/RendererViewer.vue.eta +27 -21
  45. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +201 -174
  46. package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +115 -111
  47. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue.eta +183 -91
  48. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +383 -263
  49. package/templates/nuxt/components/table/TableDocuments.vue.eta +3 -3
  50. package/templates/nuxt/components/text/TextDanger.vue._eta +5 -0
  51. package/templates/nuxt/components/text/TextSubtitle.vue._eta +5 -0
  52. package/templates/nuxt/components/text/TextTitle.vue._eta +5 -0
  53. package/templates/nuxt/composables/date.generate.ts.eta +14 -9
  54. package/templates/nuxt/i18n.config.ts.eta +1 -1
  55. package/templates/nuxt/lang/en.ts.eta +16 -0
  56. package/templates/nuxt/layouts/default.vue._eta +32 -17
  57. package/templates/nuxt/layouts/mobile.vue._eta +35 -12
  58. package/templates/nuxt/nuxt.config.ts._eta +3 -7
  59. package/templates/nuxt/pages/[xorg]/organization/[id].vue.eta +39 -0
  60. package/templates/nuxt/pages/[xorg]/organization/new.vue.eta +30 -143
  61. package/templates/nuxt/pages/[xorg]/organization/viewer.vue.eta +3 -0
  62. package/templates/nuxt/pages/[xorg]/organization.vue.eta +81 -127
  63. package/templates/nuxt/pages/[xorg]/user/[id].vue.eta +38 -4
  64. package/templates/nuxt/pages/[xorg]/user/form.vue.eta +329 -0
  65. package/templates/nuxt/pages/[xorg]/user/index.vue.eta +29 -292
  66. package/templates/nuxt/pages/[xorg]/{organization/[id]/branches/[bid].vue → user/new.vue.eta} +10 -4
  67. package/templates/nuxt/pages/[xorg]/user/viewer.vue.eta +30 -0
  68. package/templates/nuxt/pages/[xorg]/user.vue.eta +88 -78
  69. package/templates/nuxt/pages/profile.vue.eta +12 -3
  70. package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +2 -3
  71. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +6 -0
  72. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +41 -2
  73. package/templates/nuxt/types/documentlist.ts.eta +0 -9
  74. package/templates/nuxt/types/events.ts.eta +1 -0
  75. package/templates/nuxt/types/simpleappinput.ts.eta +12 -2
  76. package/templates/nuxt/types/user.ts.eta +2 -0
  77. package/templates/project/lang/default._json +5 -0
  78. package/tsconfig.tsbuildinfo +1 -1
  79. package/templates/nuxt/components/docPage/DocPageList.vue.eta +0 -125
  80. package/templates/nuxt/lang/en.ts._eta +0 -6
  81. package/templates/nuxt/pages/[xorg]/organization/[bid].vue.eta +0 -14
  82. package/templates/nuxt/pages/[xorg]/organization/[id]/branches/new.vue +0 -149
  83. package/templates/nuxt/pages/[xorg]/organization/[id]/index.vue.eta +0 -1
  84. /package/templates/nuxt/lang/{df.ts.eta → df.ts.etaxxxx} +0 -0
@@ -1,25 +1,36 @@
1
- <template>
2
- <Dialog v-model:visible="visible"
3
- :modal="true"
4
- :close-on-escape="false" >
5
- <template #header>
6
- <div class="flex flex-row gap-4">
7
- <Chip v-for="(v,k) in allview" :label="v.label" @remove="deleteTab" :removable="true"
8
- />
9
- </div>
10
- </template>
11
- <template #default>
12
- <div v-for="(v,k) in allview" v-memo="[k]" class="viewer-item flex flex-col">
13
- <component
14
- :is="defineAsyncComponent(v.viewer)"
15
- :_id="v._id"
16
- :readonly="v.readonly"
17
- :paras="v.paras"
18
- @after="(eventType:string,data:any,result:any)=>after(v,eventType,data,result)"
19
- />
20
- </div>
21
- </template>
22
- </Dialog>
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 '@vueuse/core'
32
- import { useDialog } from 'primevue/usedialog';
33
- import {defineAsyncComponent} from 'vue'
34
- import { ViewRecord } from '~/types';
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 'primevue/chip';
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
- const {$listen,} = useNuxtApp()
40
- const visible = ref(false)
41
- const allview = ref<{[key:string]:ViewRecord}>({})
42
- const after = (v:ViewRecord,eventType:string,data:any,result:any)=>{
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
- $listen('ViewRecord',(setting)=>{
68
- console.log("ViewRecord event received by listener")
69
- visible.value=true
70
- allview.value[setting.eventId]=setting
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
- display: none;
87
+ .viewer-item {
88
+ display: none;
79
89
  }
80
- .viewer-item:last-child{
81
- display: flex;
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 = ref(false)
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
- const treemenu:any[] = []
16
-
15
+ let treemenu:any[] = []
17
16
 
18
17
  getMenustFromPageMeta().reduce((r, item) => {
19
- item.split('/').reduce((o, name) => {
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
- <div v-for="m in treemenu" class="m-4">
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
- </button>
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
- const toggle = (event:any) => {
15
- userprofileoverlay.value.toggle(event);
16
- }
13
+
17
14
  const toProfile = ()=>{
18
- userprofileoverlay.value.toggle();
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
- <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" />
42
- </div>
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
- <OverlayPanel appendTo="body" ref="userprofileoverlay" >
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-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>
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
- </OverlayPanel>
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>