@finema/core 2.49.1 → 2.51.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 +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Form/FieldWrapper.vue +13 -13
- package/dist/runtime/components/Form/Fields.vue +13 -13
- package/dist/runtime/components/Form/InputCheckbox/index.vue +18 -18
- package/dist/runtime/components/Form/InputComponent/index.vue +1 -1
- package/dist/runtime/components/Form/InputMonth/index.vue +51 -51
- package/dist/runtime/components/Form/InputNumber/index.vue +20 -20
- package/dist/runtime/components/Form/InputSelectMultiple/index.vue +43 -43
- package/dist/runtime/components/Form/InputTags/index.vue +23 -23
- package/dist/runtime/components/Form/InputTextarea/index.vue +18 -18
- package/dist/runtime/components/Form/InputToggle/index.vue +17 -17
- package/dist/runtime/components/Form/InputUploadDropzone/index.vue +30 -30
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +50 -50
- package/dist/runtime/components/Form/fileState/EmptyState.vue +21 -21
- package/dist/runtime/components/Form/fileState/FailedState.vue +33 -33
- package/dist/runtime/components/Form/fileState/LoadingState.vue +24 -24
- package/dist/runtime/components/Form/fileState/PreviewModal.vue +23 -23
- package/dist/runtime/components/Form/index.vue +5 -5
- package/dist/runtime/components/Image.vue +28 -28
- package/dist/runtime/components/Log/index.vue +17 -17
- package/dist/runtime/components/Table/Base.vue +113 -113
- package/dist/runtime/components/Table/Base.vue.d.ts +19 -60
- package/dist/runtime/components/Table/ColumnDate.vue +1 -1
- package/dist/runtime/components/Table/ColumnDateTime.vue +1 -1
- package/dist/runtime/components/Table/ColumnImage.vue +4 -4
- package/dist/runtime/components/Table/ColumnText.vue +1 -1
- package/dist/runtime/components/Table/Pagination.vue +131 -0
- package/dist/runtime/components/Table/Pagination.vue.d.ts +18 -0
- package/dist/runtime/components/Table/Simple.vue +7 -9
- package/dist/runtime/components/Table/Simple.vue.d.ts +10 -15
- package/dist/runtime/components/Table/index.vue +11 -138
- package/dist/runtime/components/Table/types.d.ts +3 -0
- package/dist/runtime/server/tsconfig.json +3 -3
- package/dist/runtime/theme/pagination.d.ts +2 -0
- package/dist/runtime/theme/pagination.js +6 -4
- package/dist/runtime/theme/table.d.ts +4 -0
- package/dist/runtime/theme/table.js +9 -5
- package/package.json +3 -3
|
@@ -1,114 +1,114 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
:class="theme.rootWrapper({
|
|
4
|
+
class: [ui?.rootWrapper]
|
|
5
|
+
})"
|
|
5
6
|
>
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/>
|
|
23
|
-
</div>
|
|
24
|
-
</template>
|
|
25
|
-
<template #empty-state>
|
|
26
|
-
<Empty />
|
|
27
|
-
</template>
|
|
28
|
-
<template
|
|
29
|
-
v-for="column in columns.filter((item) => !!item.type)"
|
|
30
|
-
#[`${column.accessorKey}-cell`]="{ row }"
|
|
31
|
-
:key="column.accessorKey"
|
|
32
|
-
>
|
|
33
|
-
<component
|
|
34
|
-
:is="column.type === COLUMN_TYPES.COMPONENT ? column.component : columnTypeComponents[column.type]"
|
|
35
|
-
v-if="column.type === COLUMN_TYPES.COMPONENT || columnTypeComponents[column.type]"
|
|
36
|
-
:value="transformValue(column, row)"
|
|
37
|
-
:column="column"
|
|
38
|
-
:row="row"
|
|
39
|
-
/>
|
|
40
|
-
</template>
|
|
41
|
-
<template
|
|
42
|
-
v-for="(_, slotName) of $slots"
|
|
43
|
-
#[slotName]="slotProps"
|
|
44
|
-
>
|
|
45
|
-
<slot
|
|
46
|
-
:name="slotName"
|
|
47
|
-
v-bind="slotProps || {}"
|
|
48
|
-
/>
|
|
49
|
-
</template>
|
|
50
|
-
</UTable>
|
|
51
|
-
<div
|
|
52
|
-
v-if="!isHidePagination && pageOptions"
|
|
53
|
-
:class="theme.paginationContainer({})"
|
|
54
|
-
>
|
|
55
|
-
<p
|
|
56
|
-
:class="theme.paginationInfo({})"
|
|
7
|
+
<Pagination
|
|
8
|
+
v-if="!options.isHidePagination && !options.isHidePaginationTop"
|
|
9
|
+
:options="options"
|
|
10
|
+
:ui="ui"
|
|
11
|
+
:page="page"
|
|
12
|
+
:page-limit="pageLimit"
|
|
13
|
+
class="border-b border-[#EAECF0]"
|
|
14
|
+
@pageChange="onPageChange"
|
|
15
|
+
@search="emits('search')"
|
|
16
|
+
@pageLimitChange="changePageLimit"
|
|
17
|
+
/>
|
|
18
|
+
<UTable
|
|
19
|
+
:loading="options.status.isLoading"
|
|
20
|
+
:columns="uTableCompatibleColumns"
|
|
21
|
+
:data="options.rawData"
|
|
22
|
+
v-bind="$attrs"
|
|
57
23
|
>
|
|
58
|
-
|
|
59
|
-
|
|
24
|
+
<template #loading-state>
|
|
25
|
+
<Loader
|
|
26
|
+
:loading="true"
|
|
27
|
+
/>
|
|
28
|
+
</template>
|
|
29
|
+
<template #empty>
|
|
30
|
+
<slot
|
|
31
|
+
v-if="options.status.isLoading"
|
|
32
|
+
name="loading"
|
|
33
|
+
>
|
|
34
|
+
<Loader
|
|
35
|
+
:loading="true"
|
|
36
|
+
/>
|
|
37
|
+
</slot>
|
|
38
|
+
<slot
|
|
39
|
+
v-else-if="options.status.isError"
|
|
40
|
+
name="error"
|
|
41
|
+
>
|
|
42
|
+
<div
|
|
43
|
+
class="
|
|
44
|
+
text-error-400 flex h-[200px] items-center justify-center text-2xl
|
|
45
|
+
"
|
|
46
|
+
>
|
|
47
|
+
{{ StringHelper.getError(options.status.errorData) }}
|
|
48
|
+
</div>
|
|
49
|
+
</slot>
|
|
50
|
+
|
|
51
|
+
<slot
|
|
52
|
+
v-else
|
|
53
|
+
name="error"
|
|
54
|
+
>
|
|
55
|
+
<Empty />
|
|
56
|
+
</slot>
|
|
57
|
+
</template>
|
|
58
|
+
<template
|
|
59
|
+
v-for="column in options.columns.filter((item) => !!item.type)"
|
|
60
|
+
#[`${column.accessorKey}-cell`]="{ row }"
|
|
61
|
+
:key="column.accessorKey"
|
|
62
|
+
>
|
|
63
|
+
<component
|
|
64
|
+
:is="column.type === COLUMN_TYPES.COMPONENT ? column.component : columnTypeComponents[column.type]"
|
|
65
|
+
v-if="column.type === COLUMN_TYPES.COMPONENT || columnTypeComponents[column.type]"
|
|
66
|
+
:value="transformValue(column, row)"
|
|
67
|
+
:column="column"
|
|
68
|
+
:row="row"
|
|
69
|
+
/>
|
|
70
|
+
</template>
|
|
71
|
+
<template
|
|
72
|
+
v-for="(_, slotName) of $slots"
|
|
73
|
+
#[slotName]="slotProps"
|
|
74
|
+
>
|
|
75
|
+
<slot
|
|
76
|
+
:name="slotName"
|
|
77
|
+
v-bind="slotProps || {}"
|
|
78
|
+
/>
|
|
79
|
+
</template>
|
|
80
|
+
</UTable>
|
|
60
81
|
<Pagination
|
|
61
|
-
v-if="
|
|
62
|
-
|
|
63
|
-
:
|
|
64
|
-
:
|
|
65
|
-
:
|
|
66
|
-
|
|
82
|
+
v-if="!options.isHidePagination && !options.isHidePaginationBottom"
|
|
83
|
+
:options="options"
|
|
84
|
+
:ui="ui"
|
|
85
|
+
:page="page"
|
|
86
|
+
:page-limit="pageLimit"
|
|
87
|
+
class="rounded-b-lg border-t border-[#EAECF0]"
|
|
88
|
+
@pageChange="onPageChange"
|
|
89
|
+
@search="emits('search')"
|
|
90
|
+
@pageLimitChange="changePageLimit"
|
|
67
91
|
/>
|
|
68
92
|
</div>
|
|
69
93
|
</template>
|
|
70
94
|
|
|
71
95
|
<script setup>
|
|
72
|
-
import { computed } from "vue";
|
|
96
|
+
import { computed, ref } from "vue";
|
|
73
97
|
import { COLUMN_TYPES } from "#core/components/Table/types";
|
|
74
98
|
import ColumnNumber from "#core/components/Table/ColumnNumber.vue";
|
|
75
99
|
import ColumnImage from "#core/components/Table/ColumnImage.vue";
|
|
76
|
-
import {
|
|
77
|
-
import { ref, useUiConfig, watch } from "#imports";
|
|
100
|
+
import { updateAppConfig, useAppConfig, useUiConfig, useWatchChange } from "#imports";
|
|
78
101
|
import ColumnDateTime from "#core/components/Table/ColumnDateTime.vue";
|
|
79
102
|
import Empty from "#core/components/Empty.vue";
|
|
80
103
|
import ColumnDate from "#core/components/Table/ColumnDate.vue";
|
|
81
104
|
import ColumnText from "#core/components/Table/ColumnText.vue";
|
|
82
|
-
import { useWatchChange } from "#core/composables/useWatch";
|
|
83
105
|
import UTable from "#ui/components/Table";
|
|
106
|
+
import Pagination from "./Pagination.vue";
|
|
84
107
|
import { tableTheme } from "#core/theme/table";
|
|
85
|
-
const emits = defineEmits(["pageChange"]);
|
|
108
|
+
const emits = defineEmits(["pageChange", "search"]);
|
|
86
109
|
const props = defineProps({
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
required: true
|
|
90
|
-
},
|
|
91
|
-
pageOptions: {
|
|
92
|
-
type: Object,
|
|
93
|
-
required: false
|
|
94
|
-
},
|
|
95
|
-
columns: {
|
|
96
|
-
type: Array,
|
|
97
|
-
// This resolves to TableColumn[]
|
|
98
|
-
required: true
|
|
99
|
-
},
|
|
100
|
-
rawData: {
|
|
101
|
-
type: Array,
|
|
102
|
-
required: true
|
|
103
|
-
},
|
|
104
|
-
isHidePagination: {
|
|
105
|
-
type: Boolean,
|
|
106
|
-
default: false
|
|
107
|
-
},
|
|
108
|
-
isHideCaption: {
|
|
109
|
-
type: Boolean,
|
|
110
|
-
default: false
|
|
111
|
-
}
|
|
110
|
+
options: { type: Object, required: true },
|
|
111
|
+
ui: { type: null, required: false }
|
|
112
112
|
});
|
|
113
113
|
const columnTypeComponents = {
|
|
114
114
|
[COLUMN_TYPES.NUMBER]: ColumnNumber,
|
|
@@ -117,39 +117,39 @@ const columnTypeComponents = {
|
|
|
117
117
|
[COLUMN_TYPES.DATE]: ColumnDate,
|
|
118
118
|
[COLUMN_TYPES.TEXT]: ColumnText
|
|
119
119
|
};
|
|
120
|
-
const page = ref(props.pageOptions?.currentPage || 1);
|
|
121
120
|
const theme = computed(() => useUiConfig(tableTheme, "table")());
|
|
121
|
+
const config = useAppConfig();
|
|
122
|
+
const page = ref(props.options.pageOptions?.currentPage || 1);
|
|
123
|
+
const pageLimit = ref(props.options.pageOptions?.limit || config.core.limit_per_page);
|
|
122
124
|
const uTableCompatibleColumns = computed(
|
|
123
|
-
() => props.columns.map((col) => ({
|
|
125
|
+
() => props.options.columns.map((col) => ({
|
|
124
126
|
...col,
|
|
125
127
|
key: col.accessorKey
|
|
126
128
|
// Use accessorKey for UTable's key property
|
|
127
129
|
}))
|
|
128
130
|
);
|
|
131
|
+
const transformValue = (column, row) => {
|
|
132
|
+
return column.cell ? column.cell({
|
|
133
|
+
row
|
|
134
|
+
}) : row.getValue(column.accessorKey);
|
|
135
|
+
};
|
|
129
136
|
useWatchChange(
|
|
130
|
-
() => props.pageOptions?.currentPage,
|
|
137
|
+
() => props.options.pageOptions?.currentPage,
|
|
131
138
|
(value) => {
|
|
132
139
|
page.value = value;
|
|
133
140
|
}
|
|
134
141
|
);
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}) : row.getValue(column.accessorKey);
|
|
142
|
+
const onPageChange = (newPage) => {
|
|
143
|
+
page.value = newPage;
|
|
144
|
+
emits("pageChange", newPage);
|
|
145
|
+
};
|
|
146
|
+
const changePageLimit = (limit) => {
|
|
147
|
+
pageLimit.value = limit;
|
|
148
|
+
updateAppConfig({
|
|
149
|
+
core: {
|
|
150
|
+
limit_per_page: limit
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
emits("search");
|
|
148
154
|
};
|
|
149
|
-
const totalCountWithComma = computed(() => {
|
|
150
|
-
return !props.pageOptions?.totalCount ? "0" : NumberHelper.withComma(props.pageOptions.totalCount);
|
|
151
|
-
});
|
|
152
|
-
watch(page, () => {
|
|
153
|
-
emits("pageChange", page.value);
|
|
154
|
-
});
|
|
155
155
|
</script>
|
|
@@ -1,67 +1,26 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { type ISimpleTableOptions, type ITableOptions } from '#core/components/Table/types';
|
|
2
|
+
import { tableTheme } from '#core/theme/table';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
options: ITableOptions<any> & ISimpleTableOptions<any>;
|
|
5
|
+
ui?: typeof tableTheme['slots'];
|
|
6
|
+
};
|
|
7
|
+
declare var __VLS_22: {}, __VLS_29: {}, __VLS_31: {}, __VLS_45: string | number, __VLS_46: any;
|
|
4
8
|
type __VLS_Slots = {} & {
|
|
5
|
-
[K in NonNullable<typeof
|
|
9
|
+
[K in NonNullable<typeof __VLS_45>]?: (props: typeof __VLS_46) => any;
|
|
10
|
+
} & {
|
|
11
|
+
loading?: (props: typeof __VLS_22) => any;
|
|
12
|
+
} & {
|
|
13
|
+
error?: (props: typeof __VLS_29) => any;
|
|
14
|
+
} & {
|
|
15
|
+
error?: (props: typeof __VLS_31) => any;
|
|
6
16
|
};
|
|
7
|
-
declare const __VLS_component: import("vue").DefineComponent<import("vue").
|
|
8
|
-
|
|
9
|
-
type: PropType<ITableOptions["status"]>;
|
|
10
|
-
required: true;
|
|
11
|
-
};
|
|
12
|
-
pageOptions: {
|
|
13
|
-
type: PropType<ITableOptions["pageOptions"]>;
|
|
14
|
-
required: false;
|
|
15
|
-
};
|
|
16
|
-
columns: {
|
|
17
|
-
type: PropType<ITableOptions["columns"]>;
|
|
18
|
-
required: true;
|
|
19
|
-
};
|
|
20
|
-
rawData: {
|
|
21
|
-
type: PropType<ITableOptions["rawData"]>;
|
|
22
|
-
required: true;
|
|
23
|
-
};
|
|
24
|
-
isHidePagination: {
|
|
25
|
-
type: PropType<ITableOptions["isHidePagination"]>;
|
|
26
|
-
default: boolean;
|
|
27
|
-
};
|
|
28
|
-
isHideCaption: {
|
|
29
|
-
type: PropType<ITableOptions["isHideCaption"]>;
|
|
30
|
-
default: boolean;
|
|
31
|
-
};
|
|
32
|
-
}>, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
+
search: (...args: any[]) => void;
|
|
33
19
|
pageChange: (...args: any[]) => void;
|
|
34
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
35
|
-
|
|
36
|
-
type: PropType<ITableOptions["status"]>;
|
|
37
|
-
required: true;
|
|
38
|
-
};
|
|
39
|
-
pageOptions: {
|
|
40
|
-
type: PropType<ITableOptions["pageOptions"]>;
|
|
41
|
-
required: false;
|
|
42
|
-
};
|
|
43
|
-
columns: {
|
|
44
|
-
type: PropType<ITableOptions["columns"]>;
|
|
45
|
-
required: true;
|
|
46
|
-
};
|
|
47
|
-
rawData: {
|
|
48
|
-
type: PropType<ITableOptions["rawData"]>;
|
|
49
|
-
required: true;
|
|
50
|
-
};
|
|
51
|
-
isHidePagination: {
|
|
52
|
-
type: PropType<ITableOptions["isHidePagination"]>;
|
|
53
|
-
default: boolean;
|
|
54
|
-
};
|
|
55
|
-
isHideCaption: {
|
|
56
|
-
type: PropType<ITableOptions["isHideCaption"]>;
|
|
57
|
-
default: boolean;
|
|
58
|
-
};
|
|
59
|
-
}>> & Readonly<{
|
|
20
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
21
|
+
onSearch?: ((...args: any[]) => any) | undefined;
|
|
60
22
|
onPageChange?: ((...args: any[]) => any) | undefined;
|
|
61
|
-
}>, {
|
|
62
|
-
isHidePagination: boolean | undefined;
|
|
63
|
-
isHideCaption: boolean | undefined;
|
|
64
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
23
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
65
24
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
66
25
|
export default _default;
|
|
67
26
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="theme.paginationContainer({
|
|
4
|
+
class: [ui?.paginationContainer]
|
|
5
|
+
})"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
:class="theme.paginationInfoWrapper({
|
|
9
|
+
class: [ui?.paginationInfoWrapper]
|
|
10
|
+
})"
|
|
11
|
+
>
|
|
12
|
+
<USelect
|
|
13
|
+
v-if="options.pageOptions && !options.isHideLimitSelect"
|
|
14
|
+
size="lg"
|
|
15
|
+
trailing="รายการ"
|
|
16
|
+
:class="theme.paginationLimitSelect({
|
|
17
|
+
class: [ui?.paginationLimitSelect, 'cursor-pointer']
|
|
18
|
+
})"
|
|
19
|
+
:items="pageLimitItems"
|
|
20
|
+
:model-value="pageLimit"
|
|
21
|
+
@update:modelValue="emits('pageLimitChange', $event)"
|
|
22
|
+
>
|
|
23
|
+
<template #default="{ modelValue }">
|
|
24
|
+
<p
|
|
25
|
+
:class="theme.paginationLimitSelectLabel({
|
|
26
|
+
class: [ui?.paginationLimitSelectLabel]
|
|
27
|
+
})"
|
|
28
|
+
>
|
|
29
|
+
{{ modelValue }} รายการ
|
|
30
|
+
</p>
|
|
31
|
+
</template>
|
|
32
|
+
</USelect>
|
|
33
|
+
<p
|
|
34
|
+
:class="theme.paginationInfo({
|
|
35
|
+
class: [ui?.paginationInfo, '']
|
|
36
|
+
})"
|
|
37
|
+
>
|
|
38
|
+
<span v-if="options.pageOptions">{{ pageBetween }} จากทั้งหมด {{ totalCountWithComma }}</span>
|
|
39
|
+
<span v-else>ทั้งหมด {{ options.rawData.length }} รายการ</span>
|
|
40
|
+
</p>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<UPagination
|
|
44
|
+
v-if="options.pageOptions && options.pageOptions.totalPage > 1"
|
|
45
|
+
:page="page"
|
|
46
|
+
:default-page="options.pageOptions?.currentPage || 1"
|
|
47
|
+
:items-per-page="options.pageOptions.limit"
|
|
48
|
+
:total="options.pageOptions.totalCount"
|
|
49
|
+
:to="options.isRouteChange ? to : void 0"
|
|
50
|
+
show-edges
|
|
51
|
+
variant="outline"
|
|
52
|
+
color="neutral"
|
|
53
|
+
active-color="neutral"
|
|
54
|
+
active-variant="subtle"
|
|
55
|
+
@update:page="emits('pageChange', $event)"
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script setup>
|
|
61
|
+
import { computed, NumberHelper, useUiConfig } from "#imports";
|
|
62
|
+
import UPagination from "#ui/components/Pagination";
|
|
63
|
+
import USelect from "#ui/components/Select";
|
|
64
|
+
import { tableTheme } from "../../theme/table";
|
|
65
|
+
const emits = defineEmits(["pageChange", "search", "pageLimitChange"]);
|
|
66
|
+
const props = defineProps({
|
|
67
|
+
page: { type: Number, required: true },
|
|
68
|
+
pageLimit: { type: Number, required: true },
|
|
69
|
+
options: { type: Object, required: true },
|
|
70
|
+
ui: { type: null, required: false }
|
|
71
|
+
});
|
|
72
|
+
const pageLimitItems = [
|
|
73
|
+
{
|
|
74
|
+
label: "10",
|
|
75
|
+
value: 10
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
label: "20",
|
|
79
|
+
value: 20
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
label: "30",
|
|
83
|
+
value: 30
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
label: "50",
|
|
87
|
+
value: 50
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
label: "100",
|
|
91
|
+
value: 100
|
|
92
|
+
}
|
|
93
|
+
];
|
|
94
|
+
const theme = computed(() => useUiConfig(tableTheme, "table")());
|
|
95
|
+
const pageBetween = computed(() => {
|
|
96
|
+
const rawDataLength = props.options.rawData?.length;
|
|
97
|
+
const pageOpts = props.options.pageOptions;
|
|
98
|
+
if (!rawDataLength || !pageOpts) {
|
|
99
|
+
return "0";
|
|
100
|
+
}
|
|
101
|
+
const currentPage = pageOpts.currentPage || 1;
|
|
102
|
+
const limit = pageOpts.limit;
|
|
103
|
+
if (limit <= 0) {
|
|
104
|
+
return "0";
|
|
105
|
+
}
|
|
106
|
+
const start = (currentPage - 1) * limit + 1;
|
|
107
|
+
const end = start + rawDataLength - 1;
|
|
108
|
+
return `${start} - ${end}`;
|
|
109
|
+
});
|
|
110
|
+
const totalCountWithComma = computed(() => {
|
|
111
|
+
const total = props.options.pageOptions?.totalCount;
|
|
112
|
+
if (!total || total <= 0) {
|
|
113
|
+
return "0";
|
|
114
|
+
}
|
|
115
|
+
return NumberHelper.withComma(total);
|
|
116
|
+
});
|
|
117
|
+
const to = (page) => {
|
|
118
|
+
const params = props.options.pageOptions?.request?.params || {};
|
|
119
|
+
const cleanParams = Object.fromEntries(
|
|
120
|
+
Object.entries(params).filter(
|
|
121
|
+
([key, value]) => value !== null && value !== void 0 && value !== ""
|
|
122
|
+
)
|
|
123
|
+
);
|
|
124
|
+
return {
|
|
125
|
+
query: {
|
|
126
|
+
...cleanParams,
|
|
127
|
+
page
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ISimpleTableOptions, type ITableOptions } from '#imports';
|
|
2
|
+
import { tableTheme } from '../../theme/table.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
page: number;
|
|
5
|
+
pageLimit: number;
|
|
6
|
+
options: ITableOptions<any> & ISimpleTableOptions<any>;
|
|
7
|
+
ui?: typeof tableTheme['slots'];
|
|
8
|
+
};
|
|
9
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
10
|
+
search: () => any;
|
|
11
|
+
pageChange: (page: number) => any;
|
|
12
|
+
pageLimitChange: (limit: number) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
14
|
+
onSearch?: (() => any) | undefined;
|
|
15
|
+
onPageChange?: ((page: number) => any) | undefined;
|
|
16
|
+
onPageLimitChange?: ((limit: number) => any) | undefined;
|
|
17
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
export default _default;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Base
|
|
3
3
|
v-bind="$attrs"
|
|
4
|
-
:
|
|
4
|
+
:options="{
|
|
5
|
+
...options,
|
|
6
|
+
pageOptions,
|
|
7
|
+
isHideLimitSelect: true
|
|
8
|
+
}"
|
|
5
9
|
:raw-data="itemsByPage"
|
|
6
|
-
:status="options.status"
|
|
7
|
-
:page-options="pageOptions"
|
|
8
|
-
:is-hide-pagination="options.isHidePagination"
|
|
9
|
-
:is-hide-caption="options.isHideCaption"
|
|
10
10
|
@page-change="onPageChange"
|
|
11
11
|
>
|
|
12
12
|
<template
|
|
@@ -27,10 +27,8 @@ import Base from "#core/components/Table/Base.vue";
|
|
|
27
27
|
import { initPageOptions } from "#core/composables/loaderPage";
|
|
28
28
|
import { useCoreConfig } from "#core/composables/useConfig";
|
|
29
29
|
const props = defineProps({
|
|
30
|
-
options: {
|
|
31
|
-
|
|
32
|
-
required: true
|
|
33
|
-
}
|
|
30
|
+
options: { type: Object, required: true },
|
|
31
|
+
ui: { type: null, required: false }
|
|
34
32
|
});
|
|
35
33
|
defineSlots();
|
|
36
34
|
const currentPage = ref(1);
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import { type PropType } from 'vue';
|
|
2
1
|
import type { ISimpleTableOptions } from '#core/components/Table/types';
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { tableTheme } from '../../theme/table.js';
|
|
3
|
+
import type { TableSlots } from '@nuxt/ui';
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
options: ISimpleTableOptions<any>;
|
|
6
|
+
ui?: typeof tableTheme['slots'];
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}>, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
-
options: {
|
|
14
|
-
type: PropType<ISimpleTableOptions<any>>;
|
|
15
|
-
required: true;
|
|
16
|
-
};
|
|
17
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
|
+
type __VLS_Slots = Slot;
|
|
9
|
+
type Slot = TableSlots<any> & {
|
|
10
|
+
error: (props?: Record<string, any>) => any;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
13
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
19
14
|
export default _default;
|
|
20
15
|
type __VLS_WithSlots<T, S> = T & {
|