@finema/core 2.18.2 → 2.18.3
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 +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Table/index.vue +88 -100
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,98 +1,98 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div ref="tableContainer">
|
|
3
|
-
<div
|
|
4
|
-
v-if="options.isEnabledSearch"
|
|
2
|
+
<div ref="tableContainer">
|
|
3
|
+
<div
|
|
4
|
+
v-if="options.isEnabledSearch"
|
|
5
5
|
:class="theme.searchContainer({
|
|
6
6
|
class: [ui?.searchContainer]
|
|
7
|
-
})"
|
|
8
|
-
>
|
|
9
|
-
<Input
|
|
10
|
-
v-model="q"
|
|
11
|
-
icon="i-heroicons-magnifying-glass"
|
|
12
|
-
:placeholder="options.searchPlaceholder || '\u0E04\u0E49\u0E19\u0E2B\u0E32....'"
|
|
13
|
-
/>
|
|
14
|
-
</div>
|
|
15
|
-
<UTable
|
|
16
|
-
v-bind="$attrs"
|
|
17
|
-
:loading="options.status.isLoading"
|
|
18
|
-
:data="options.rawData"
|
|
19
|
-
:columns="options.columns"
|
|
20
|
-
>
|
|
21
|
-
<template #empty>
|
|
22
|
-
<slot
|
|
23
|
-
v-if="options.status.isLoading"
|
|
24
|
-
name="loading"
|
|
25
|
-
>
|
|
26
|
-
<Loader
|
|
27
|
-
:loading="true"
|
|
28
|
-
/>
|
|
29
|
-
</slot>
|
|
30
|
-
<slot
|
|
31
|
-
v-else-if="options.status.isError"
|
|
32
|
-
name="error"
|
|
33
|
-
>
|
|
34
|
-
<div
|
|
35
|
-
class="flex h-[200px] items-center justify-center text-2xl text-error-400"
|
|
36
|
-
>
|
|
37
|
-
{{ StringHelper.getError(options.status.errorData) }}
|
|
38
|
-
</div>
|
|
39
|
-
</slot>
|
|
40
|
-
|
|
41
|
-
<slot
|
|
42
|
-
v-else
|
|
43
|
-
name="error"
|
|
44
|
-
>
|
|
45
|
-
<Empty />
|
|
46
|
-
</slot>
|
|
47
|
-
</template>
|
|
48
|
-
<template
|
|
49
|
-
v-for="column in options.columns.filter((item) => !!item.type)"
|
|
50
|
-
#[`${column.accessorKey}-cell`]="{ row }"
|
|
51
|
-
:key="column.accessorKey"
|
|
52
|
-
>
|
|
53
|
-
<component
|
|
54
|
-
:is="column.type === COLUMN_TYPES.COMPONENT ? column.component : columnTypeComponents[column.type]"
|
|
55
|
-
v-if="column.type === COLUMN_TYPES.COMPONENT || columnTypeComponents[column.type]"
|
|
56
|
-
:value="transformValue(column, row)"
|
|
57
|
-
:column="column"
|
|
58
|
-
:row="row"
|
|
59
|
-
/>
|
|
60
|
-
</template>
|
|
61
|
-
<template
|
|
62
|
-
v-for="(_, slotName) of $slots"
|
|
63
|
-
#[slotName]="slotProps"
|
|
64
|
-
>
|
|
65
|
-
<slot
|
|
66
|
-
:name="slotName"
|
|
67
|
-
v-bind="slotProps || {}"
|
|
68
|
-
/>
|
|
69
|
-
</template>
|
|
70
|
-
</UTable>
|
|
71
|
-
|
|
72
|
-
<div
|
|
73
|
-
v-if="!options.isHidePagination"
|
|
7
|
+
})"
|
|
8
|
+
>
|
|
9
|
+
<Input
|
|
10
|
+
v-model="q"
|
|
11
|
+
icon="i-heroicons-magnifying-glass"
|
|
12
|
+
:placeholder="options.searchPlaceholder || '\u0E04\u0E49\u0E19\u0E2B\u0E32....'"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
<UTable
|
|
16
|
+
v-bind="$attrs"
|
|
17
|
+
:loading="options.status.isLoading"
|
|
18
|
+
:data="options.rawData"
|
|
19
|
+
:columns="options.columns"
|
|
20
|
+
>
|
|
21
|
+
<template #empty>
|
|
22
|
+
<slot
|
|
23
|
+
v-if="options.status.isLoading"
|
|
24
|
+
name="loading"
|
|
25
|
+
>
|
|
26
|
+
<Loader
|
|
27
|
+
:loading="true"
|
|
28
|
+
/>
|
|
29
|
+
</slot>
|
|
30
|
+
<slot
|
|
31
|
+
v-else-if="options.status.isError"
|
|
32
|
+
name="error"
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
class="flex h-[200px] items-center justify-center text-2xl text-error-400"
|
|
36
|
+
>
|
|
37
|
+
{{ StringHelper.getError(options.status.errorData) }}
|
|
38
|
+
</div>
|
|
39
|
+
</slot>
|
|
40
|
+
|
|
41
|
+
<slot
|
|
42
|
+
v-else
|
|
43
|
+
name="error"
|
|
44
|
+
>
|
|
45
|
+
<Empty />
|
|
46
|
+
</slot>
|
|
47
|
+
</template>
|
|
48
|
+
<template
|
|
49
|
+
v-for="column in options.columns.filter((item) => !!item.type)"
|
|
50
|
+
#[`${column.accessorKey}-cell`]="{ row }"
|
|
51
|
+
:key="column.accessorKey"
|
|
52
|
+
>
|
|
53
|
+
<component
|
|
54
|
+
:is="column.type === COLUMN_TYPES.COMPONENT ? column.component : columnTypeComponents[column.type]"
|
|
55
|
+
v-if="column.type === COLUMN_TYPES.COMPONENT || columnTypeComponents[column.type]"
|
|
56
|
+
:value="transformValue(column, row)"
|
|
57
|
+
:column="column"
|
|
58
|
+
:row="row"
|
|
59
|
+
/>
|
|
60
|
+
</template>
|
|
61
|
+
<template
|
|
62
|
+
v-for="(_, slotName) of $slots"
|
|
63
|
+
#[slotName]="slotProps"
|
|
64
|
+
>
|
|
65
|
+
<slot
|
|
66
|
+
:name="slotName"
|
|
67
|
+
v-bind="slotProps || {}"
|
|
68
|
+
/>
|
|
69
|
+
</template>
|
|
70
|
+
</UTable>
|
|
71
|
+
|
|
72
|
+
<div
|
|
73
|
+
v-if="!options.isHidePagination"
|
|
74
74
|
:class="theme.paginationContainer({
|
|
75
75
|
class: [ui?.paginationContainer]
|
|
76
|
-
})"
|
|
77
|
-
>
|
|
78
|
-
<p
|
|
76
|
+
})"
|
|
77
|
+
>
|
|
78
|
+
<p
|
|
79
79
|
:class="theme.paginationInfo({
|
|
80
80
|
class: [ui?.paginationInfo]
|
|
81
|
-
})"
|
|
82
|
-
>
|
|
83
|
-
{{ pageBetween }} รายการ จากทั้งหมด {{ totalCountWithComma }} รายการ
|
|
84
|
-
</p>
|
|
85
|
-
<Pagination
|
|
86
|
-
v-if="options.pageOptions.totalPage > 1"
|
|
87
|
-
v-model:page="page"
|
|
88
|
-
:default-page="options.pageOptions?.currentPage || 1"
|
|
89
|
-
:items-per-page="options.pageOptions.limit"
|
|
90
|
-
:total="options.pageOptions.totalCount"
|
|
91
|
-
:to="options.isPreventRouteChange ? void 0 : to"
|
|
92
|
-
@update:page="onPageChange"
|
|
93
|
-
/>
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
81
|
+
})"
|
|
82
|
+
>
|
|
83
|
+
{{ pageBetween }} รายการ จากทั้งหมด {{ totalCountWithComma }} รายการ
|
|
84
|
+
</p>
|
|
85
|
+
<Pagination
|
|
86
|
+
v-if="options.pageOptions.totalPage > 1"
|
|
87
|
+
v-model:page="page"
|
|
88
|
+
:default-page="options.pageOptions?.currentPage || 1"
|
|
89
|
+
:items-per-page="options.pageOptions.limit"
|
|
90
|
+
:total="options.pageOptions.totalCount"
|
|
91
|
+
:to="options.isPreventRouteChange ? void 0 : to"
|
|
92
|
+
@update:page="onPageChange"
|
|
93
|
+
/>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
96
|
</template>
|
|
97
97
|
|
|
98
98
|
<script setup>
|
|
@@ -148,18 +148,6 @@ watch(
|
|
|
148
148
|
useWatchChange(() => props.options?.pageOptions?.currentPage, (value) => {
|
|
149
149
|
page.value = value;
|
|
150
150
|
});
|
|
151
|
-
useWatchChange(() => props.options?.pageOptions?.request?.params, () => {
|
|
152
|
-
if (props.options?.isPreventRouteChange) return;
|
|
153
|
-
const params = props.options?.pageOptions?.request?.params || {};
|
|
154
|
-
const cleanParams = Object.fromEntries(
|
|
155
|
-
Object.entries(params).filter(
|
|
156
|
-
([key, value]) => value !== null && value !== void 0 && value !== ""
|
|
157
|
-
)
|
|
158
|
-
);
|
|
159
|
-
router.replace({
|
|
160
|
-
query: cleanParams
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
151
|
const pageBetween = computed(() => {
|
|
164
152
|
const rawDataLength = props.options.rawData?.length;
|
|
165
153
|
const pageOpts = props.options.pageOptions;
|