@finema/core 1.4.195 → 1.4.197

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/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.4.195",
3
+ "version": "1.4.197",
4
4
  "configKey": "core",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.7.4"
package/dist/module.mjs CHANGED
@@ -2,7 +2,7 @@ import { defineNuxtModule, createResolver, installModule, addPlugin, addComponen
2
2
  import { defu } from 'defu';
3
3
 
4
4
  const name = "@finema/core";
5
- const version = "1.4.195";
5
+ const version = "1.4.197";
6
6
 
7
7
  const colorModeOptions = {
8
8
  preference: "light"
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <div class="flex flex-col items-center justify-center py-6 text-gray-400">
3
+ <Icon :name="icon" class="text-[100px]" />
4
+ <p class="mt-4" v-html="message" />
5
+ </div>
6
+ </template>
7
+ <script lang="ts" setup>
8
+ withDefaults(
9
+ defineProps<{
10
+ message: any
11
+ icon: string
12
+ }>(),
13
+ {
14
+ message: 'ไม่พบข้อมูล!',
15
+ icon: 'ph:table-thin',
16
+ }
17
+ )
18
+ </script>
@@ -6,9 +6,7 @@
6
6
  รายการ
7
7
  </div>
8
8
  <slot v-if="!status.isLoading && rawData.length === 0" name="empty-state">
9
- <div class="min-h-60">
10
- <p class="text-center text-sm italic">ไม่พบข้อมูล!</p>
11
- </div>
9
+ <Empty />
12
10
  </slot>
13
11
 
14
12
  <div
@@ -56,6 +54,7 @@ import { useElementVisibility } from '@vueuse/core'
56
54
  import { StringHelper } from '#core/utils/StringHelper'
57
55
  import { ref, useWatchTrue, watch } from '#imports'
58
56
  import type { IFlexDeckOptions } from '#core/components/FlexDeck/types'
57
+ import Empty from '#core/components/Empty.vue'
59
58
 
60
59
  const emits = defineEmits(['pageChange'])
61
60
 
@@ -12,9 +12,7 @@
12
12
  </div>
13
13
  </template>
14
14
  <template #empty-state>
15
- <div class="flex flex-col items-center justify-center gap-3 py-6">
16
- <span class="text-sm italic">ไม่พบข้อมูล!</span>
17
- </div>
15
+ <Empty />
18
16
  </template>
19
17
  <template v-for="column in columns" #[`${column.key}-data`]="{ row }" :key="column.key">
20
18
  <ColumnNumber
@@ -61,7 +59,7 @@
61
59
  </template>
62
60
  </UTable>
63
61
  <div v-if="pageOptions" class="mt-4 flex justify-between px-3">
64
- <p class="text-xs text-gray-500">
62
+ <p class="text-sm text-gray-500">
65
63
  ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
66
64
  </p>
67
65
  <UPagination
@@ -87,6 +85,7 @@ import { computed, type PropType } from 'vue'
87
85
  import { StringHelper } from '#core/utils/StringHelper'
88
86
  import { ref, watch } from '#imports'
89
87
  import ColumnDateTime from '#core/components/Table/ColumnDateTime.vue'
88
+ import Empty from '#core/components/Empty.vue'
90
89
  import ColumnDate from '#core/components/Table/ColumnDate.vue'
91
90
  import ColumnText from '#core/components/Table/ColumnText.vue'
92
91
 
@@ -21,7 +21,10 @@ export const table = {
21
21
  padding: "px-3 py-4",
22
22
  color: "text-gray-500 dark:text-gray-400",
23
23
  font: "",
24
- size: "text-sm"
24
+ size: "text-base"
25
+ },
26
+ progress: {
27
+ wrapper: "absolute inset-x-0 p-0"
25
28
  },
26
29
  default: {
27
30
  sortButton: {
@@ -0,0 +1,48 @@
1
+ import type { DeepPartial } from '#ui/types'
2
+ import type * as config from '#ui/ui.config'
3
+
4
+ export const table: DeepPartial<(typeof config)['table']> = {
5
+ wrapper: 'relative overflow-x-auto bg-white rounded-lg',
6
+ base: 'min-w-full table-fixed',
7
+ divide: 'divide-y divide-y-2 divide-gray-300 dark:divide-gray-700',
8
+ thead: '',
9
+ tbody: 'divide-y divide-gray-200 dark:divide-gray-800',
10
+ tr: {
11
+ base: 'even:bg-gray-50',
12
+ selected: 'bg-gray-50 dark:bg-gray-800/50',
13
+ active: 'hover:bg-gray-50 dark:hover:bg-gray-800/50 cursor-pointer',
14
+ },
15
+ th: {
16
+ base: 'text-left rtl:text-right',
17
+ padding: 'px-3 py-3.5',
18
+ color: 'text-gray-700 dark:text-white',
19
+ font: 'font-normal',
20
+ size: 'text-sm',
21
+ },
22
+ td: {
23
+ base: 'whitespace-nowrap',
24
+ padding: 'px-3 py-4',
25
+ color: 'text-gray-500 dark:text-gray-400',
26
+ font: '',
27
+ size: 'text-sm',
28
+ },
29
+ progress: {
30
+ wrapper: 'absolute inset-x-0 p-0',
31
+ },
32
+ default: {
33
+ sortButton: {
34
+ icon: 'i-heroicons-arrows-up-down-20-solid',
35
+ trailing: true,
36
+ square: true,
37
+ color: 'gray',
38
+ variant: 'ghost',
39
+ class: '-m-1.5 text-gray-700 font-normal',
40
+ },
41
+ loadingState: {
42
+ label: 'กำลังโหลด...',
43
+ },
44
+ emptyState: {
45
+ label: 'ไม่พบข้อมูล',
46
+ },
47
+ },
48
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.4.195",
3
+ "version": "1.4.197",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",
@@ -1,159 +0,0 @@
1
- <template>
2
- <div v-if="!isHideCaption || !isHideBottomPagination" class="mb-4 text-gray-500">
3
- <span class="font-bold">ผลลัพธ์ทั้งหมด:</span>
4
- จำนวน
5
- <span class="font-bold">{{ pageOptions?.totalCount || 0 }}</span>
6
- รายการ
7
- </div>
8
- <UTable
9
- :loading="status.isLoading"
10
- :columns="columns"
11
- :rows="rawData"
12
- v-bind="$attrs"
13
- >
14
- <template #loading-state>
15
- <div class="flex h-60 items-center justify-center">
16
- <Icon name="i-svg-spinners:180-ring-with-bg" class="text-primary size-8" />
17
- </div>
18
- </template>
19
- <template #empty-state>
20
- <div class="flex flex-col items-center justify-center gap-3 py-6">
21
- <span class="text-sm italic">ไม่พบข้อมูล!</span>
22
- </div>
23
- </template>
24
- <template v-for="column in columns" #[`${column.key}-data`]="{ row }" :key="column.key">
25
- <ColumnNumber
26
- v-if="column.type === COLUMN_TYPES.NUMBER"
27
- :value="transformValue(column, row)"
28
- :column="column"
29
- :class="column.class"
30
- :row="row"
31
- />
32
- <ColumnImage
33
- v-else-if="column.type === COLUMN_TYPES.IMAGE"
34
- :value="transformValue(column, row)"
35
- :column="column"
36
- :class="column.class"
37
- :row="row"
38
- />
39
- <ColumnDateTime
40
- v-else-if="column.type === COLUMN_TYPES.DATE_TIME"
41
- :value="transformValue(column, row)"
42
- :column="column"
43
- :class="column.class"
44
- :row="row"
45
- />
46
- <ColumnDate
47
- v-else-if="column.type === COLUMN_TYPES.DATE"
48
- :value="transformValue(column, row)"
49
- :column="column"
50
- :class="column.class"
51
- :row="row"
52
- />
53
- <component
54
- :is="column.component"
55
- v-else-if="column.type === COLUMN_TYPES.COMPONENT"
56
- :value="transformValue(column, row)"
57
- :column="column"
58
- :class="column.class"
59
- :row="row"
60
- />
61
- <ColumnText v-else :value="transformValue(column, row)" :column="column" :row="row" />
62
- </template>
63
-
64
- <template v-for="(_, slot) of $slots" #[slot]="scope">
65
- <slot :name="slot" v-bind="scope" />
66
- </template>
67
- </UTable>
68
- <div v-if="pageOptions" class="mt-4 flex justify-between px-3">
69
- <p class="text-xs text-gray-500">
70
- ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
71
- </p>
72
- <UPagination
73
- v-if="pageOptions.totalPage > 1 && !isSimplePagination && !isHideBottomPagination"
74
- v-model="page"
75
- :page-count="pageOptions.limit"
76
- :total="pageOptions.totalCount"
77
- />
78
- <SimplePagination
79
- v-if="pageOptions.totalPage > 1 && isSimplePagination"
80
- v-model="page"
81
- :page-count="pageOptions.limit"
82
- :total="pageOptions.totalCount"
83
- />
84
- </div>
85
- </template>
86
-
87
- <script lang="ts" setup>
88
- import { COLUMN_TYPES, type IColumn, type ITableOptions } from '#core/components/Table/types'
89
- import ColumnNumber from '#core/components/Table/ColumnNumber.vue'
90
- import ColumnImage from '#core/components/Table/ColumnImage.vue'
91
- import { computed, type PropType } from 'vue'
92
- import { StringHelper } from '#core/utils/StringHelper'
93
- import { ref, watch } from '#imports'
94
- import ColumnDateTime from '#core/components/Table/ColumnDateTime.vue'
95
- import ColumnDate from '#core/components/Table/ColumnDate.vue'
96
- import ColumnText from '#core/components/Table/ColumnText.vue'
97
-
98
- const emits = defineEmits(['pageChange'])
99
-
100
- const props = defineProps({
101
- status: {
102
- type: Object as PropType<ITableOptions['status']>,
103
- required: true,
104
- },
105
- pageOptions: {
106
- type: Object as PropType<ITableOptions['pageOptions']>,
107
- required: false,
108
- },
109
- columns: {
110
- type: Array as PropType<ITableOptions['columns']>,
111
- required: true,
112
- },
113
- rawData: {
114
- type: Array as PropType<ITableOptions['rawData']>,
115
- required: true,
116
- },
117
- isSimplePagination: {
118
- type: Boolean as PropType<ITableOptions['isSimplePagination']>,
119
- default: false,
120
- },
121
- isHideBottomPagination: {
122
- type: Boolean as PropType<ITableOptions['isHideBottomPagination']>,
123
- default: false,
124
- },
125
- isHideCaption: {
126
- type: Boolean as PropType<ITableOptions['isHideCaption']>,
127
- default: false,
128
- },
129
- })
130
-
131
- const page = ref(props.pageOptions?.currentPage || 1)
132
-
133
- const pageBetween = computed((): string => {
134
- const length = props.rawData?.length
135
-
136
- if (length === 0) {
137
- return '0'
138
- }
139
-
140
- const start = (props.pageOptions!.currentPage - 1) * props.pageOptions!.limit + 1
141
- const end = start + length - 1
142
-
143
- return `${start} - ${end}`
144
- })
145
-
146
- const transformValue = (column: IColumn, row: any) => {
147
- return column.transform ? column.transform(row[column.key], row, column) : row[column.key]
148
- }
149
-
150
- const totalCountWithComma = computed((): string => {
151
- return !props.pageOptions!.totalCount
152
- ? '0'
153
- : StringHelper.withComma(props.pageOptions!.totalCount)
154
- })
155
-
156
- watch(page, () => {
157
- emits('pageChange', page.value)
158
- })
159
- </script>