@finema/core 3.16.3 → 3.16.5
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 +3 -5
- package/dist/runtime/components/Table/Base.vue +37 -14
- package/dist/runtime/components/Table/Base.vue.d.ts +3 -5
- 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/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
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_67: any, __VLS_68: any;
|
|
13
11
|
type __VLS_Slots = {} & {
|
|
14
12
|
[K in NonNullable<typeof __VLS_47>]?: (props: typeof __VLS_48) => any;
|
|
15
13
|
} & {
|
|
16
|
-
[K in NonNullable<typeof
|
|
14
|
+
[K in NonNullable<typeof __VLS_67>]?: (props: typeof __VLS_68) => any;
|
|
17
15
|
} & {
|
|
18
16
|
loading?: (props: typeof __VLS_25) => any;
|
|
19
17
|
} & {
|
|
@@ -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,21 +76,30 @@
|
|
|
76
76
|
>
|
|
77
77
|
<slot
|
|
78
78
|
:name="`${column.accessorKey}-cell`"
|
|
79
|
-
|
|
79
|
+
v-bind="slotProps"
|
|
80
80
|
>
|
|
81
81
|
<component
|
|
82
|
-
:is="
|
|
83
|
-
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
:is="column.component"
|
|
83
|
+
v-if="column.type === COLUMN_TYPES.COMPONENT && column.component"
|
|
84
|
+
:value="transformValue(column, slotProps.row)"
|
|
85
|
+
:column="column"
|
|
86
|
+
:row="slotProps.row"
|
|
87
|
+
/>
|
|
88
|
+
<component
|
|
89
|
+
:is="columnTypeComponents[column.type]"
|
|
90
|
+
v-else-if="
|
|
91
|
+
column.type !== COLUMN_TYPES.COMPONENT && columnTypeComponents[column.type]
|
|
87
92
|
"
|
|
88
|
-
:value="transformValue(column, row)"
|
|
93
|
+
:value="transformValue(column, slotProps.row)"
|
|
89
94
|
:column="column"
|
|
90
|
-
:row="row"
|
|
95
|
+
:row="slotProps.row"
|
|
96
|
+
/>
|
|
97
|
+
<VNodeRenderer
|
|
98
|
+
v-else-if="typeof column.cell === 'function'"
|
|
99
|
+
:vnode="transformValue(column, slotProps.row)"
|
|
91
100
|
/>
|
|
92
101
|
<template v-else>
|
|
93
|
-
{{ transformValue(column, row) }}
|
|
102
|
+
{{ transformValue(column, slotProps.row) }}
|
|
94
103
|
</template>
|
|
95
104
|
</slot>
|
|
96
105
|
</div>
|
|
@@ -121,7 +130,7 @@
|
|
|
121
130
|
</template>
|
|
122
131
|
|
|
123
132
|
<script setup>
|
|
124
|
-
import { computed, ref, useSlots } from "vue";
|
|
133
|
+
import { computed, defineComponent, ref, useSlots } from "vue";
|
|
125
134
|
import {
|
|
126
135
|
COLUMN_TYPES
|
|
127
136
|
} from "#core/components/Table/types";
|
|
@@ -149,6 +158,17 @@ const props = defineProps({
|
|
|
149
158
|
target: { type: [String, Function], required: false },
|
|
150
159
|
preserveQuery: { type: Boolean, required: false }
|
|
151
160
|
});
|
|
161
|
+
const VNodeRenderer = defineComponent({
|
|
162
|
+
props: {
|
|
163
|
+
vnode: {
|
|
164
|
+
type: null,
|
|
165
|
+
required: true
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
setup(props2) {
|
|
169
|
+
return () => props2.vnode;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
152
172
|
const route = useRoute();
|
|
153
173
|
const slots = useSlots();
|
|
154
174
|
const forwardedSlotNames = computed(
|
|
@@ -222,6 +242,9 @@ const onSelect = (rows) => {
|
|
|
222
242
|
};
|
|
223
243
|
const changePageLimit = (limit) => {
|
|
224
244
|
pageLimit.value = limit;
|
|
245
|
+
if (!props.options.repo) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
225
248
|
props.options.repo.fetchPageChange(1, {
|
|
226
249
|
params: {
|
|
227
250
|
...props.options.pageOptions?.request?.params,
|
|
@@ -1,19 +1,17 @@
|
|
|
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_67: any, __VLS_68: any;
|
|
13
11
|
type __VLS_Slots = {} & {
|
|
14
12
|
[K in NonNullable<typeof __VLS_47>]?: (props: typeof __VLS_48) => any;
|
|
15
13
|
} & {
|
|
16
|
-
[K in NonNullable<typeof
|
|
14
|
+
[K in NonNullable<typeof __VLS_67>]?: (props: typeof __VLS_68) => any;
|
|
17
15
|
} & {
|
|
18
16
|
loading?: (props: typeof __VLS_25) => any;
|
|
19
17
|
} & {
|
|
@@ -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>;
|