@finema/core 2.10.0 → 2.11.0
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
package/dist/module.mjs
CHANGED
|
@@ -1,116 +1,116 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
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
|
-
<div
|
|
16
|
-
v-if="!options.isHideCaption || !options.isHideBottomPagination"
|
|
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
|
+
<div
|
|
16
|
+
v-if="!options.isHideCaption || !options.isHideBottomPagination"
|
|
17
17
|
:class="theme.captionContainer({
|
|
18
18
|
class: [ui?.captionContainer]
|
|
19
|
-
})"
|
|
20
|
-
>
|
|
21
|
-
<span
|
|
19
|
+
})"
|
|
20
|
+
>
|
|
21
|
+
<span
|
|
22
22
|
:class="theme.captionBoldText({
|
|
23
23
|
class: [ui?.captionBoldText]
|
|
24
|
-
})"
|
|
25
|
-
>
|
|
26
|
-
ผลลัพธ์ทั้งหมด:</span>
|
|
27
|
-
จำนวน
|
|
28
|
-
<span
|
|
24
|
+
})"
|
|
25
|
+
>
|
|
26
|
+
ผลลัพธ์ทั้งหมด:</span>
|
|
27
|
+
จำนวน
|
|
28
|
+
<span
|
|
29
29
|
:class="theme.captionBoldText({
|
|
30
30
|
class: [ui?.captionBoldText]
|
|
31
|
-
})"
|
|
32
|
-
>{{ options.pageOptions?.totalCount || 0 }}</span>
|
|
33
|
-
รายการ
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<UTable
|
|
37
|
-
v-bind="$attrs"
|
|
38
|
-
:loading="options.status.isLoading"
|
|
39
|
-
:data="options.rawData"
|
|
40
|
-
:columns="options.columns"
|
|
41
|
-
>
|
|
42
|
-
<template #empty>
|
|
43
|
-
<slot
|
|
44
|
-
v-if="options.status.isLoading"
|
|
45
|
-
name="loading"
|
|
46
|
-
>
|
|
47
|
-
<Loader
|
|
48
|
-
:loading="true"
|
|
49
|
-
/>
|
|
50
|
-
</slot>
|
|
51
|
-
<slot
|
|
52
|
-
v-else-if="options.status.isError"
|
|
53
|
-
name="error"
|
|
54
|
-
>
|
|
55
|
-
<div
|
|
56
|
-
class="flex h-[200px] items-center justify-center text-2xl text-error-400"
|
|
57
|
-
>
|
|
58
|
-
{{ StringHelper.getError(options.status.errorData) }}
|
|
59
|
-
</div>
|
|
60
|
-
</slot>
|
|
61
|
-
|
|
62
|
-
<slot
|
|
63
|
-
v-else
|
|
64
|
-
name="error"
|
|
65
|
-
>
|
|
66
|
-
<Empty />
|
|
67
|
-
</slot>
|
|
68
|
-
</template>
|
|
69
|
-
<template
|
|
70
|
-
v-for="column in options.columns.filter((item) => !!item.type)"
|
|
71
|
-
#[`${column.accessorKey}-cell`]="{ row }"
|
|
72
|
-
:key="column.accessorKey"
|
|
73
|
-
>
|
|
74
|
-
<component
|
|
75
|
-
:is="column.type === COLUMN_TYPES.COMPONENT ? column.component : columnTypeComponents[column.type]"
|
|
76
|
-
v-if="column.type === COLUMN_TYPES.COMPONENT || columnTypeComponents[column.type]"
|
|
77
|
-
:value="transformValue(column, row)"
|
|
78
|
-
:column="column"
|
|
79
|
-
:row="row"
|
|
80
|
-
/>
|
|
81
|
-
</template>
|
|
82
|
-
<template
|
|
83
|
-
v-for="(_, slotName) of $slots"
|
|
84
|
-
#[slotName]="slotProps"
|
|
85
|
-
>
|
|
86
|
-
<slot
|
|
87
|
-
:name="slotName"
|
|
88
|
-
v-bind="slotProps || {}"
|
|
89
|
-
/>
|
|
90
|
-
</template>
|
|
91
|
-
</UTable>
|
|
92
|
-
|
|
93
|
-
<div
|
|
31
|
+
})"
|
|
32
|
+
>{{ options.pageOptions?.totalCount || 0 }}</span>
|
|
33
|
+
รายการ
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<UTable
|
|
37
|
+
v-bind="$attrs"
|
|
38
|
+
:loading="options.status.isLoading"
|
|
39
|
+
:data="options.rawData"
|
|
40
|
+
:columns="options.columns"
|
|
41
|
+
>
|
|
42
|
+
<template #empty>
|
|
43
|
+
<slot
|
|
44
|
+
v-if="options.status.isLoading"
|
|
45
|
+
name="loading"
|
|
46
|
+
>
|
|
47
|
+
<Loader
|
|
48
|
+
:loading="true"
|
|
49
|
+
/>
|
|
50
|
+
</slot>
|
|
51
|
+
<slot
|
|
52
|
+
v-else-if="options.status.isError"
|
|
53
|
+
name="error"
|
|
54
|
+
>
|
|
55
|
+
<div
|
|
56
|
+
class="flex h-[200px] items-center justify-center text-2xl text-error-400"
|
|
57
|
+
>
|
|
58
|
+
{{ StringHelper.getError(options.status.errorData) }}
|
|
59
|
+
</div>
|
|
60
|
+
</slot>
|
|
61
|
+
|
|
62
|
+
<slot
|
|
63
|
+
v-else
|
|
64
|
+
name="error"
|
|
65
|
+
>
|
|
66
|
+
<Empty />
|
|
67
|
+
</slot>
|
|
68
|
+
</template>
|
|
69
|
+
<template
|
|
70
|
+
v-for="column in options.columns.filter((item) => !!item.type)"
|
|
71
|
+
#[`${column.accessorKey}-cell`]="{ row }"
|
|
72
|
+
:key="column.accessorKey"
|
|
73
|
+
>
|
|
74
|
+
<component
|
|
75
|
+
:is="column.type === COLUMN_TYPES.COMPONENT ? column.component : columnTypeComponents[column.type]"
|
|
76
|
+
v-if="column.type === COLUMN_TYPES.COMPONENT || columnTypeComponents[column.type]"
|
|
77
|
+
:value="transformValue(column, row)"
|
|
78
|
+
:column="column"
|
|
79
|
+
:row="row"
|
|
80
|
+
/>
|
|
81
|
+
</template>
|
|
82
|
+
<template
|
|
83
|
+
v-for="(_, slotName) of $slots"
|
|
84
|
+
#[slotName]="slotProps"
|
|
85
|
+
>
|
|
86
|
+
<slot
|
|
87
|
+
:name="slotName"
|
|
88
|
+
v-bind="slotProps || {}"
|
|
89
|
+
/>
|
|
90
|
+
</template>
|
|
91
|
+
</UTable>
|
|
92
|
+
|
|
93
|
+
<div
|
|
94
94
|
:class="theme.paginationContainer({
|
|
95
95
|
class: [ui?.paginationContainer]
|
|
96
|
-
})"
|
|
97
|
-
>
|
|
98
|
-
<p
|
|
96
|
+
})"
|
|
97
|
+
>
|
|
98
|
+
<p
|
|
99
99
|
:class="theme.paginationInfo({
|
|
100
100
|
class: [ui?.paginationInfo]
|
|
101
|
-
})"
|
|
102
|
-
>
|
|
103
|
-
ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
|
|
104
|
-
</p>
|
|
105
|
-
<Pagination
|
|
106
|
-
v-model:page="page"
|
|
107
|
-
:default-page="options.pageOptions?.currentPage || 1"
|
|
108
|
-
:items-per-page="options.pageOptions.limit"
|
|
109
|
-
:total="options.pageOptions.totalCount"
|
|
110
|
-
@update:page="
|
|
111
|
-
/>
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
101
|
+
})"
|
|
102
|
+
>
|
|
103
|
+
ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
|
|
104
|
+
</p>
|
|
105
|
+
<Pagination
|
|
106
|
+
v-model:page="page"
|
|
107
|
+
:default-page="options.pageOptions?.currentPage || 1"
|
|
108
|
+
:items-per-page="options.pageOptions.limit"
|
|
109
|
+
:total="options.pageOptions.totalCount"
|
|
110
|
+
@update:page="onPageChange"
|
|
111
|
+
/>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
114
|
</template>
|
|
115
115
|
|
|
116
116
|
<script setup>
|
|
@@ -139,6 +139,7 @@ const props = defineProps({
|
|
|
139
139
|
ui: { type: null, required: false }
|
|
140
140
|
});
|
|
141
141
|
const page = ref(props.options?.pageOptions?.currentPage || 1);
|
|
142
|
+
const tableContainer = ref();
|
|
142
143
|
const theme = computed(() => useUiConfig(tableTheme, "table")());
|
|
143
144
|
const q = ref(props.options?.pageOptions.search ?? "");
|
|
144
145
|
watch(
|
|
@@ -177,4 +178,13 @@ const transformValue = (column, row) => {
|
|
|
177
178
|
row
|
|
178
179
|
}) : row.getValue(column.accessorKey);
|
|
179
180
|
};
|
|
181
|
+
const onPageChange = (newPage) => {
|
|
182
|
+
if (tableContainer.value) {
|
|
183
|
+
tableContainer.value.scrollIntoView({
|
|
184
|
+
behavior: "smooth",
|
|
185
|
+
block: "start"
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
emits("pageChange", newPage);
|
|
189
|
+
};
|
|
180
190
|
</script>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { computed, reactive } from "vue";
|
|
2
2
|
import { ObjectHelper } from "../utils/ObjectHelper.js";
|
|
3
3
|
import {
|
|
4
4
|
apiObjectHelper
|
|
@@ -43,9 +43,9 @@ export const useObjectLoader = (loaderOptions) => {
|
|
|
43
43
|
state.data = _data;
|
|
44
44
|
};
|
|
45
45
|
return {
|
|
46
|
-
data:
|
|
47
|
-
status:
|
|
48
|
-
options:
|
|
46
|
+
data: computed(() => state.data),
|
|
47
|
+
status: computed(() => state.status),
|
|
48
|
+
options: computed(() => state.options),
|
|
49
49
|
run,
|
|
50
50
|
clear,
|
|
51
51
|
setLoading,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AxiosRequestConfig, Method } from 'axios';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComputedRef } from 'vue';
|
|
3
3
|
import type { IAPIObjectState, IAPIOptions, IStatus } from '../types/lib.js';
|
|
4
4
|
import { type IBaseLoaderOptions } from './apiBaseHelper.js';
|
|
5
5
|
import type { IListRunLoaderOptions } from './apiListHelper.js';
|
|
@@ -17,9 +17,9 @@ export interface IObjectLoaderOptions<T = any, B = any, _O = any> {
|
|
|
17
17
|
getRequestOptions?: (data: B | undefined, opts: IObjectRunLoaderOptions<T, B>) => AxiosRequestConfig;
|
|
18
18
|
}
|
|
19
19
|
export interface IUseObjectLoader<T, B, _O> {
|
|
20
|
-
status:
|
|
21
|
-
data:
|
|
22
|
-
options:
|
|
20
|
+
status: ComputedRef<IStatus>;
|
|
21
|
+
data: ComputedRef<T | null>;
|
|
22
|
+
options: ComputedRef<IAPIOptions>;
|
|
23
23
|
run: (payload?: IObjectRunLoaderOptions<T, B>) => Promise<void>;
|
|
24
24
|
clear: () => void;
|
|
25
25
|
setLoading: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@import "tailwindcss";@import "@nuxt/ui";@theme static{--font-sans:"Noto Sans Thai","Noto Sans Thai Looped","Public Sans",sans-serif;--color-main:#232c5a;--color-main-50:#f4f4f7;--color-main-100:#e9eaef;--color-main-200:#c8cad6;--color-main-300:#a7abbd;--color-main-400:#656b8c;--color-main-500:#232c5a;--color-main-600:#202851;--color-main-700:#151a36;--color-main-800:#101429;--color-main-900:#0b0d1b;--color-main-950:#0b0d1b;--color-secondary:#ee8b36;--color-secondary-50:#fdf1e7;--color-secondary-100:#f9d6b8;--color-secondary-200:#f5bb89;--color-secondary-300:#f1a05a;--color-secondary-400:#ed852b;--color-secondary-500:#d46b12;--color-secondary-600:#a5540e;--color-secondary-700:#763c0a;--color-secondary-800:#472406;--color-secondary-900:#180c02;--color-info:#0d8cee;--color-info-50:#f3f9fe;--color-info-100:#e7f4fd;--color-info-200:#ebf6ff;--color-info-300:#9ed1f8;--color-info-400:#56aff3;--color-info-500:#0d8cee;--color-info-600:#0c7ed6;--color-info-700:#08548f;--color-info-800:#063f6b;--color-info-900:#042a47;--color-error:#f25555;--color-error-50:#fef7f7;--color-error-100:#feeeee;--color-error-200:#ffdfdf;--color-error-300:#fabbbb;--color-error-400:#f68888;--color-error-500:#f25555;--color-error-600:#da4d4d;--color-error-700:#913333;--color-error-800:#6d2626;--color-error-900:#491a1a;--color-success:#3fb061;--color-success-50:#f5fbf7;--color-success-100:#ecf7ef;--color-success-200:#daeee0;--color-success-300:#b2dfc0;--color-success-400:#79c890;--color-success-500:#3fb061;--color-success-600:#399e57;--color-success-700:#266a3a;--color-success-800:#1c4f2c;--color-success-900:#13351d;--color-warning:#ff9a35;--color-warning-50:#fffaf5;--color-warning-100:#fff5eb;--color-warning-200:#fef1cc;--color-warning-300:#ffd7ae;--color-warning-400:#ffb872;--color-warning-500:#ff9a35;--color-warning-600:#e68b30;--color-warning-700:#995c20;--color-warning-800:#734518;--color-warning-900:#4d2e10}::-webkit-scrollbar{-webkit-appearance:none;height:10px;width:10px}::-webkit-scrollbar-thumb{background-color:rgba(0,0,0,.3);border-radius:4px;box-shadow:0 0 1px hsla(0,0%,100%,.5)}:root{--dp-font-family:inherit!important}.dp__theme_light{--dp-primary-color:
|
|
1
|
+
@import "tailwindcss";@import "@nuxt/ui";@theme static{--font-sans:"Noto Sans Thai","Noto Sans Thai Looped","Public Sans",sans-serif;--color-main:#232c5a;--color-main-50:#f4f4f7;--color-main-100:#e9eaef;--color-main-200:#c8cad6;--color-main-300:#a7abbd;--color-main-400:#656b8c;--color-main-500:#232c5a;--color-main-600:#202851;--color-main-700:#151a36;--color-main-800:#101429;--color-main-900:#0b0d1b;--color-main-950:#0b0d1b;--color-secondary:#ee8b36;--color-secondary-50:#fdf1e7;--color-secondary-100:#f9d6b8;--color-secondary-200:#f5bb89;--color-secondary-300:#f1a05a;--color-secondary-400:#ed852b;--color-secondary-500:#d46b12;--color-secondary-600:#a5540e;--color-secondary-700:#763c0a;--color-secondary-800:#472406;--color-secondary-900:#180c02;--color-info:#0d8cee;--color-info-50:#f3f9fe;--color-info-100:#e7f4fd;--color-info-200:#ebf6ff;--color-info-300:#9ed1f8;--color-info-400:#56aff3;--color-info-500:#0d8cee;--color-info-600:#0c7ed6;--color-info-700:#08548f;--color-info-800:#063f6b;--color-info-900:#042a47;--color-error:#f25555;--color-error-50:#fef7f7;--color-error-100:#feeeee;--color-error-200:#ffdfdf;--color-error-300:#fabbbb;--color-error-400:#f68888;--color-error-500:#f25555;--color-error-600:#da4d4d;--color-error-700:#913333;--color-error-800:#6d2626;--color-error-900:#491a1a;--color-success:#3fb061;--color-success-50:#f5fbf7;--color-success-100:#ecf7ef;--color-success-200:#daeee0;--color-success-300:#b2dfc0;--color-success-400:#79c890;--color-success-500:#3fb061;--color-success-600:#399e57;--color-success-700:#266a3a;--color-success-800:#1c4f2c;--color-success-900:#13351d;--color-warning:#ff9a35;--color-warning-50:#fffaf5;--color-warning-100:#fff5eb;--color-warning-200:#fef1cc;--color-warning-300:#ffd7ae;--color-warning-400:#ffb872;--color-warning-500:#ff9a35;--color-warning-600:#e68b30;--color-warning-700:#995c20;--color-warning-800:#734518;--color-warning-900:#4d2e10}::-webkit-scrollbar{-webkit-appearance:none;height:10px;width:10px}::-webkit-scrollbar-thumb{background-color:rgba(0,0,0,.3);border-radius:4px;box-shadow:0 0 1px hsla(0,0%,100%,.5)}:root{--dp-font-family:inherit!important}.dp__theme_light{--dp-primary-color:var(--color-main)!important;--dp-primary-disabled-color:var(--color-main-200)!important}#__nuxt,body,html{@apply w-full h-full}
|