@finema/core 3.16.2 → 3.16.4
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/Base.d.vue.ts +2 -4
- package/dist/runtime/components/Table/Base.vue +11 -8
- package/dist/runtime/components/Table/Base.vue.d.ts +2 -4
- package/dist/runtime/components/Table/Pagination.d.vue.ts +1 -1
- package/dist/runtime/components/Table/Pagination.vue +16 -7
- package/dist/runtime/components/Table/Pagination.vue.d.ts +1 -1
- package/dist/runtime/components/Table/Simple.d.vue.ts +3 -0
- package/dist/runtime/components/Table/Simple.vue +17 -2
- package/dist/runtime/components/Table/Simple.vue.d.ts +3 -0
- package/dist/runtime/composables/useTable.js +27 -9
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { type ISimpleTableOptions, type ITableOptions } from '#core/components/Table/types';
|
|
2
2
|
import { tableTheme } from '#core/theme/table';
|
|
3
3
|
type __VLS_Props = {
|
|
4
|
-
options:
|
|
4
|
+
options: ISimpleTableOptions<any> & Partial<ITableOptions<any>>;
|
|
5
5
|
ui?: (typeof tableTheme)['slots'];
|
|
6
6
|
to?: string | ((row: any) => any);
|
|
7
7
|
target?: string | ((row: any) => string | undefined);
|
|
8
8
|
preserveQuery?: boolean;
|
|
9
9
|
};
|
|
10
|
-
declare var __VLS_25: {}, __VLS_32: {}, __VLS_34: {}, __VLS_47: any, __VLS_48:
|
|
11
|
-
row: any;
|
|
12
|
-
}, __VLS_57: any, __VLS_58: any;
|
|
10
|
+
declare var __VLS_25: {}, __VLS_32: {}, __VLS_34: {}, __VLS_47: any, __VLS_48: any, __VLS_57: any, __VLS_58: any;
|
|
13
11
|
type __VLS_Slots = {} & {
|
|
14
12
|
[K in NonNullable<typeof __VLS_47>]?: (props: typeof __VLS_48) => any;
|
|
15
13
|
} & {
|
|
@@ -55,15 +55,15 @@
|
|
|
55
55
|
</template>
|
|
56
56
|
<template
|
|
57
57
|
v-for="column in options.columns"
|
|
58
|
-
#[`${column.accessorKey}-cell`]="
|
|
58
|
+
#[`${column.accessorKey}-cell`]="slotProps"
|
|
59
59
|
:key="column.accessorKey"
|
|
60
60
|
>
|
|
61
61
|
<NuxtLink
|
|
62
62
|
v-if="to && column.accessorKey !== 'actions'"
|
|
63
|
-
:to="resolveTo(row.original)"
|
|
64
|
-
:target="resolveTarget(row.original)"
|
|
63
|
+
:to="resolveTo(slotProps.row.original)"
|
|
64
|
+
:target="resolveTarget(slotProps.row.original)"
|
|
65
65
|
:rel="
|
|
66
|
-
resolveTarget(row.original) === '_blank' ? 'noopener noreferrer' : void 0
|
|
66
|
+
resolveTarget(slotProps.row.original) === '_blank' ? 'noopener noreferrer' : void 0
|
|
67
67
|
"
|
|
68
68
|
class="absolute inset-0"
|
|
69
69
|
tabindex="-1"
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
>
|
|
77
77
|
<slot
|
|
78
78
|
:name="`${column.accessorKey}-cell`"
|
|
79
|
-
|
|
79
|
+
v-bind="slotProps"
|
|
80
80
|
>
|
|
81
81
|
<component
|
|
82
82
|
:is="
|
|
@@ -85,12 +85,12 @@
|
|
|
85
85
|
v-if="
|
|
86
86
|
column.type === COLUMN_TYPES.COMPONENT || columnTypeComponents[column.type]
|
|
87
87
|
"
|
|
88
|
-
:value="transformValue(column, row)"
|
|
88
|
+
:value="transformValue(column, slotProps.row)"
|
|
89
89
|
:column="column"
|
|
90
|
-
:row="row"
|
|
90
|
+
:row="slotProps.row"
|
|
91
91
|
/>
|
|
92
92
|
<template v-else>
|
|
93
|
-
{{ transformValue(column, row) }}
|
|
93
|
+
{{ transformValue(column, slotProps.row) }}
|
|
94
94
|
</template>
|
|
95
95
|
</slot>
|
|
96
96
|
</div>
|
|
@@ -222,6 +222,9 @@ const onSelect = (rows) => {
|
|
|
222
222
|
};
|
|
223
223
|
const changePageLimit = (limit) => {
|
|
224
224
|
pageLimit.value = limit;
|
|
225
|
+
if (!props.options.repo) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
225
228
|
props.options.repo.fetchPageChange(1, {
|
|
226
229
|
params: {
|
|
227
230
|
...props.options.pageOptions?.request?.params,
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { type ISimpleTableOptions, type ITableOptions } from '#core/components/Table/types';
|
|
2
2
|
import { tableTheme } from '#core/theme/table';
|
|
3
3
|
type __VLS_Props = {
|
|
4
|
-
options:
|
|
4
|
+
options: ISimpleTableOptions<any> & Partial<ITableOptions<any>>;
|
|
5
5
|
ui?: (typeof tableTheme)['slots'];
|
|
6
6
|
to?: string | ((row: any) => any);
|
|
7
7
|
target?: string | ((row: any) => string | undefined);
|
|
8
8
|
preserveQuery?: boolean;
|
|
9
9
|
};
|
|
10
|
-
declare var __VLS_25: {}, __VLS_32: {}, __VLS_34: {}, __VLS_47: any, __VLS_48:
|
|
11
|
-
row: any;
|
|
12
|
-
}, __VLS_57: any, __VLS_58: any;
|
|
10
|
+
declare var __VLS_25: {}, __VLS_32: {}, __VLS_34: {}, __VLS_47: any, __VLS_48: any, __VLS_57: any, __VLS_58: any;
|
|
13
11
|
type __VLS_Slots = {} & {
|
|
14
12
|
[K in NonNullable<typeof __VLS_47>]?: (props: typeof __VLS_48) => any;
|
|
15
13
|
} & {
|
|
@@ -3,7 +3,7 @@ import { tableTheme } from '../../theme/table.js';
|
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
page: number;
|
|
5
5
|
pageLimit: number;
|
|
6
|
-
options:
|
|
6
|
+
options: ISimpleTableOptions<any> & Partial<ITableOptions<any>>;
|
|
7
7
|
ui?: (typeof tableTheme)['slots'];
|
|
8
8
|
};
|
|
9
9
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
})
|
|
35
35
|
"
|
|
36
36
|
>
|
|
37
|
-
{{ modelValue }}
|
|
37
|
+
{{ modelValue }}
|
|
38
|
+
{{ appConfig.core?.locale === "th" ? "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23" : "items" }}
|
|
38
39
|
</p>
|
|
39
40
|
</template>
|
|
40
41
|
</USelect>
|
|
@@ -45,8 +46,12 @@
|
|
|
45
46
|
})
|
|
46
47
|
"
|
|
47
48
|
>
|
|
48
|
-
<span v-if="options.pageOptions">{{ pageBetween }}
|
|
49
|
-
|
|
49
|
+
<span v-if="options.pageOptions">{{ pageBetween }}
|
|
50
|
+
{{ appConfig.core?.locale === "th" ? "\u0E08\u0E32\u0E01\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14" : "of total" }}
|
|
51
|
+
{{ totalCountWithComma }}</span>
|
|
52
|
+
<span v-else>{{ appConfig.core?.locale === "th" ? "\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14" : "Total" }}
|
|
53
|
+
{{ options.rawData.length }}
|
|
54
|
+
{{ appConfig.core?.locale === "th" ? "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23" : "items" }}</span>
|
|
50
55
|
</p>
|
|
51
56
|
</div>
|
|
52
57
|
<UPagination
|
|
@@ -71,9 +76,11 @@
|
|
|
71
76
|
:ui="{ label: themePagination.label }"
|
|
72
77
|
square
|
|
73
78
|
:to="to?.(item.value)"
|
|
74
|
-
:class="
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
:class="
|
|
80
|
+
theme.buttonPagination({
|
|
81
|
+
class: [ui?.buttonPagination]
|
|
82
|
+
})
|
|
83
|
+
"
|
|
77
84
|
/>
|
|
78
85
|
</template>
|
|
79
86
|
</UPagination>
|
|
@@ -98,7 +105,9 @@ const props = defineProps({
|
|
|
98
105
|
options: { type: Object, required: true },
|
|
99
106
|
ui: { type: null, required: false }
|
|
100
107
|
});
|
|
101
|
-
const themePagination = computed(
|
|
108
|
+
const themePagination = computed(
|
|
109
|
+
() => useUiConfig(paginationTheme, "pagination")()
|
|
110
|
+
);
|
|
102
111
|
const appConfig = useAppConfig();
|
|
103
112
|
const pageLimitItems = [
|
|
104
113
|
{
|
|
@@ -3,7 +3,7 @@ import { tableTheme } from '../../theme/table.js';
|
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
page: number;
|
|
5
5
|
pageLimit: number;
|
|
6
|
-
options:
|
|
6
|
+
options: ISimpleTableOptions<any> & Partial<ITableOptions<any>>;
|
|
7
7
|
ui?: (typeof tableTheme)['slots'];
|
|
8
8
|
};
|
|
9
9
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
@@ -7,6 +7,9 @@ type Slot = TableSlots<any> & {
|
|
|
7
7
|
type __VLS_Props = {
|
|
8
8
|
options: ISimpleTableOptions<any>;
|
|
9
9
|
ui?: (typeof tableTheme)['slots'];
|
|
10
|
+
to?: string | ((row: any) => any);
|
|
11
|
+
target?: string | ((row: any) => string | undefined);
|
|
12
|
+
preserveQuery?: boolean;
|
|
10
13
|
};
|
|
11
14
|
type __VLS_Slots = Slot;
|
|
12
15
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
isHideLimitSelect: true,
|
|
8
8
|
rawData: itemsByPage
|
|
9
9
|
}"
|
|
10
|
-
:ui="
|
|
10
|
+
:ui="computedUi"
|
|
11
|
+
:to="to"
|
|
12
|
+
:target="target"
|
|
13
|
+
:preserve-query="preserveQuery"
|
|
11
14
|
@page-change="onPageChange"
|
|
12
15
|
>
|
|
13
16
|
<template
|
|
@@ -29,9 +32,21 @@ import { initPageOptions } from "#core/composables/loaderPage";
|
|
|
29
32
|
import { useCoreConfig } from "#core/composables/useConfig";
|
|
30
33
|
const props = defineProps({
|
|
31
34
|
options: { type: Object, required: true },
|
|
32
|
-
ui: { type: null, required: false }
|
|
35
|
+
ui: { type: null, required: false },
|
|
36
|
+
to: { type: [String, Function], required: false },
|
|
37
|
+
target: { type: [String, Function], required: false },
|
|
38
|
+
preserveQuery: { type: Boolean, required: false }
|
|
33
39
|
});
|
|
34
40
|
defineSlots();
|
|
41
|
+
const computedUi = computed(() => {
|
|
42
|
+
if (!props.to) {
|
|
43
|
+
return props.ui;
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
...props.ui,
|
|
47
|
+
td: [props.ui?.td, "cursor-pointer", "relative"].filter(Boolean).join(" ")
|
|
48
|
+
};
|
|
49
|
+
});
|
|
35
50
|
const currentPage = ref(1);
|
|
36
51
|
const coreConfig = useCoreConfig();
|
|
37
52
|
const pageOptions = computed(() => {
|
|
@@ -7,6 +7,9 @@ type Slot = TableSlots<any> & {
|
|
|
7
7
|
type __VLS_Props = {
|
|
8
8
|
options: ISimpleTableOptions<any>;
|
|
9
9
|
ui?: (typeof tableTheme)['slots'];
|
|
10
|
+
to?: string | ((row: any) => any);
|
|
11
|
+
target?: string | ((row: any) => string | undefined);
|
|
12
|
+
preserveQuery?: boolean;
|
|
10
13
|
};
|
|
11
14
|
type __VLS_Slots = Slot;
|
|
12
15
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
import { get } from "@vueuse/core";
|
|
2
2
|
import { computed, ObjectHelper } from "#imports";
|
|
3
3
|
export const useTable = (options) => computed(() => {
|
|
4
|
+
const {
|
|
5
|
+
repo,
|
|
6
|
+
columns,
|
|
7
|
+
transformItems,
|
|
8
|
+
options: nestedOptions,
|
|
9
|
+
...inlineOptions
|
|
10
|
+
} = options;
|
|
4
11
|
return createTableOptions(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
repo,
|
|
13
|
+
columns(),
|
|
14
|
+
{
|
|
15
|
+
...inlineOptions,
|
|
16
|
+
...typeof nestedOptions === "function" ? nestedOptions() : nestedOptions ?? {}
|
|
17
|
+
},
|
|
18
|
+
transformItems
|
|
9
19
|
);
|
|
10
20
|
});
|
|
11
21
|
export const useTableSimple = (options) => computed(() => {
|
|
22
|
+
const {
|
|
23
|
+
items,
|
|
24
|
+
status,
|
|
25
|
+
columns,
|
|
26
|
+
options: nestedOptions,
|
|
27
|
+
...inlineOptions
|
|
28
|
+
} = options;
|
|
12
29
|
return {
|
|
13
|
-
items:
|
|
14
|
-
columns:
|
|
15
|
-
rawData:
|
|
16
|
-
status:
|
|
17
|
-
...
|
|
30
|
+
items: items(),
|
|
31
|
+
columns: columns(),
|
|
32
|
+
rawData: items(),
|
|
33
|
+
status: status ? status() : ObjectHelper.createStatus(),
|
|
34
|
+
...inlineOptions,
|
|
35
|
+
...typeof nestedOptions === "function" ? nestedOptions() : nestedOptions ?? {}
|
|
18
36
|
};
|
|
19
37
|
});
|
|
20
38
|
export const createTableOptions = (repo, columns, options, transformItems) => {
|