@finema/core 1.4.219 → 2.1.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/README.md +58 -39
- package/dist/module.d.mts +4 -24
- package/dist/module.json +4 -3
- package/dist/module.mjs +75 -213
- package/dist/runtime/components/App.vue +27 -0
- package/dist/runtime/components/App.vue.d.ts +12 -0
- package/dist/runtime/components/DevToolsWindow/index.vue +312 -0
- package/dist/runtime/components/DevToolsWindow/index.vue.d.ts +2 -0
- package/dist/runtime/components/Dialog/index.vue +67 -100
- package/dist/runtime/components/Dialog/index.vue.d.ts +10 -0
- package/dist/runtime/components/Empty.vue +29 -14
- package/dist/runtime/components/Empty.vue.d.ts +12 -0
- package/dist/runtime/components/FlexDeck/Base.vue +82 -87
- package/dist/runtime/components/FlexDeck/Base.vue.d.ts +63 -0
- package/dist/runtime/components/FlexDeck/index.vue +38 -39
- package/dist/runtime/components/FlexDeck/index.vue.d.ts +43 -0
- package/dist/runtime/components/Form/FieldWrapper.vue +21 -9
- package/dist/runtime/components/Form/FieldWrapper.vue.d.ts +16 -0
- package/dist/runtime/components/Form/Fields.vue +84 -222
- package/dist/runtime/components/Form/Fields.vue.d.ts +14 -0
- package/dist/runtime/components/Form/InputCheckbox/index.vue +43 -18
- package/dist/runtime/components/Form/InputCheckbox/index.vue.d.ts +3 -0
- package/dist/runtime/components/Form/InputCheckbox/types.d.ts +5 -1
- package/dist/runtime/components/Form/InputDateTime/date_time_field.types.d.ts +1 -1
- package/dist/runtime/components/Form/InputDateTime/index.vue +59 -30
- package/dist/runtime/components/Form/InputDateTime/index.vue.d.ts +4 -0
- package/dist/runtime/components/Form/InputNumber/index.vue +51 -17
- package/dist/runtime/components/Form/InputNumber/index.vue.d.ts +5 -0
- package/dist/runtime/components/Form/InputNumber/types.d.ts +10 -5
- package/dist/runtime/components/Form/InputSelect/index.vue +77 -37
- package/dist/runtime/components/Form/InputSelect/index.vue.d.ts +5 -0
- package/dist/runtime/components/Form/InputSelect/types.d.ts +14 -8
- package/dist/runtime/components/Form/InputSelectMultiple/index.vue +91 -37
- package/dist/runtime/components/Form/InputSelectMultiple/index.vue.d.ts +3 -0
- package/dist/runtime/components/Form/InputSelectMultiple/types.d.ts +9 -8
- package/dist/runtime/components/Form/InputText/index.vue +103 -36
- package/dist/runtime/components/Form/InputText/index.vue.d.ts +5 -0
- package/dist/runtime/components/Form/InputText/types.d.ts +4 -3
- package/dist/runtime/components/Form/InputTextarea/index.vue +43 -11
- package/dist/runtime/components/Form/InputTextarea/index.vue.d.ts +3 -0
- package/dist/runtime/components/Form/InputTextarea/types.d.ts +7 -2
- package/dist/runtime/components/Form/InputToggle/index.vue +41 -17
- package/dist/runtime/components/Form/InputToggle/index.vue.d.ts +3 -0
- package/dist/runtime/components/Form/InputToggle/types.d.ts +5 -1
- package/dist/runtime/components/Form/index.vue +0 -1
- package/dist/runtime/components/Form/index.vue.d.ts +12 -0
- package/dist/runtime/components/Form/types.d.ts +13 -27
- package/dist/runtime/components/Image.vue +47 -32
- package/dist/runtime/components/Image.vue.d.ts +13 -0
- package/dist/runtime/components/Loader.vue +21 -19
- package/dist/runtime/components/Loader.vue.d.ts +22 -0
- package/dist/runtime/components/{LogItem.vue → Log/LogItem.vue} +19 -16
- package/dist/runtime/components/Log/LogItem.vue.d.ts +6 -0
- package/dist/runtime/components/Log/index.vue +28 -0
- package/dist/runtime/components/Log/index.vue.d.ts +7 -0
- package/dist/runtime/components/Table/Base.vue +103 -98
- package/dist/runtime/components/Table/Base.vue.d.ts +47 -0
- package/dist/runtime/components/Table/ColumnDate.vue +10 -12
- package/dist/runtime/components/Table/ColumnDate.vue.d.ts +8 -0
- package/dist/runtime/components/Table/ColumnDateTime.vue +11 -13
- package/dist/runtime/components/Table/ColumnDateTime.vue.d.ts +8 -0
- package/dist/runtime/components/Table/ColumnImage.vue +12 -11
- package/dist/runtime/components/Table/ColumnImage.vue.d.ts +8 -0
- package/dist/runtime/components/Table/ColumnNumber.vue +12 -12
- package/dist/runtime/components/Table/ColumnNumber.vue.d.ts +8 -0
- package/dist/runtime/components/Table/ColumnText.vue +19 -24
- package/dist/runtime/components/Table/ColumnText.vue.d.ts +8 -0
- package/dist/runtime/components/Table/Simple.vue +41 -42
- package/dist/runtime/components/Table/Simple.vue.d.ts +24 -0
- package/dist/runtime/components/Table/index.vue +159 -46
- package/dist/runtime/components/Table/index.vue.d.ts +25 -0
- package/dist/runtime/components/Table/types.d.ts +14 -18
- package/dist/runtime/components/Table/{types.mjs → types.js} +1 -0
- package/dist/runtime/components/TeleportSafe.vue +31 -29
- package/dist/runtime/components/TeleportSafe.vue.d.ts +16 -0
- package/dist/runtime/composables/loaderList.d.ts +2 -2
- package/dist/runtime/composables/loaderList.js +51 -0
- package/dist/runtime/composables/loaderObject.d.ts +1 -1
- package/dist/runtime/composables/loaderObject.js +50 -0
- package/dist/runtime/composables/loaderPage.d.ts +10 -11
- package/dist/runtime/composables/loaderPage.js +243 -0
- package/dist/runtime/composables/useApp.d.ts +4 -9
- package/dist/runtime/composables/{useApp.mjs → useApp.js} +0 -12
- package/dist/runtime/composables/useConfig.d.ts +3 -3
- package/dist/runtime/composables/useConfig.js +12 -0
- package/dist/runtime/composables/useDialog.d.ts +1 -7
- package/dist/runtime/composables/useDialog.js +53 -0
- package/dist/runtime/composables/useFlexDeck.d.ts +1 -1
- package/dist/runtime/composables/{useFlexDeck.mjs → useFlexDeck.js} +5 -5
- package/dist/runtime/composables/useForm.d.ts +5 -2
- package/dist/runtime/composables/useForm.js +37 -0
- package/dist/runtime/composables/useNotification.d.ts +6 -22
- package/dist/runtime/composables/{useNotification.mjs → useNotification.js} +5 -21
- package/dist/runtime/composables/useTable.d.ts +12 -11
- package/dist/runtime/composables/{useTable.mjs → useTable.js} +3 -8
- package/dist/runtime/composables/useUpload.d.ts +2 -2
- package/dist/runtime/composables/{useUpload.mjs → useUpload.js} +1 -1
- package/dist/runtime/helpers/apiBaseHelper.d.ts +29 -0
- package/dist/runtime/helpers/apiBaseHelper.js +63 -0
- package/dist/runtime/helpers/apiListHelper.d.ts +4 -6
- package/dist/runtime/helpers/apiListHelper.js +50 -0
- package/dist/runtime/helpers/apiObjectHelper.d.ts +19 -20
- package/dist/runtime/helpers/apiObjectHelper.js +51 -0
- package/dist/runtime/helpers/apiPageHelper.d.ts +44 -44
- package/dist/runtime/helpers/apiPageHelper.js +287 -0
- package/dist/runtime/helpers/componentHelper.d.ts +11 -12
- package/dist/runtime/helpers/{componentHelper.mjs → componentHelper.js} +2 -7
- package/dist/runtime/i18n/valibot.d.ts +69 -0
- package/dist/runtime/i18n/valibot.js +72 -0
- package/dist/runtime/plugin.d.ts +1 -1
- package/dist/runtime/plugin.js +12 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/theme/button.d.ts +5 -0
- package/dist/runtime/theme/button.js +1 -0
- package/dist/runtime/theme/dialog.d.ts +31 -0
- package/dist/runtime/theme/dialog.js +21 -0
- package/dist/runtime/theme/empty.d.ts +7 -0
- package/dist/runtime/theme/empty.js +7 -0
- package/dist/runtime/theme/form.d.ts +18 -0
- package/dist/runtime/theme/form.js +16 -0
- package/dist/runtime/theme/index.d.ts +10 -0
- package/dist/runtime/theme/index.js +10 -0
- package/dist/runtime/theme/input.d.ts +8 -0
- package/dist/runtime/theme/input.js +4 -0
- package/dist/runtime/theme/inputNumber.d.ts +8 -0
- package/dist/runtime/theme/inputNumber.js +4 -0
- package/dist/runtime/theme/loader.d.ts +28 -0
- package/dist/runtime/theme/loader.js +18 -0
- package/dist/runtime/theme/selectMenu.d.ts +17 -0
- package/dist/runtime/theme/selectMenu.js +18 -0
- package/dist/runtime/theme/table.d.ts +10 -0
- package/dist/runtime/theme/table.js +10 -0
- package/dist/runtime/theme/textarea.d.ts +5 -0
- package/dist/runtime/theme/textarea.js +1 -0
- package/dist/runtime/types/lib.d.ts +1 -1
- package/dist/runtime/utils/ArrayHelper.d.ts +1 -1
- package/dist/runtime/utils/{ArrayHelper.mjs → ArrayHelper.js} +1 -1
- package/dist/runtime/utils/ObjectHelper.d.ts +3 -3
- package/dist/runtime/utils/{ObjectHelper.mjs → ObjectHelper.js} +3 -3
- package/dist/runtime/utils/ParamHelper.d.ts +1 -1
- package/dist/runtime/utils/{ParamHelper.mjs → ParamHelper.js} +1 -1
- package/dist/types.d.mts +2 -15
- package/package.json +54 -63
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -50
- package/dist/runtime/components/Alert.vue +0 -48
- package/dist/runtime/components/Avatar.vue +0 -27
- package/dist/runtime/components/Badge.vue +0 -11
- package/dist/runtime/components/Breadcrumb.vue +0 -44
- package/dist/runtime/components/Button/Group.vue +0 -37
- package/dist/runtime/components/Button/index.vue +0 -75
- package/dist/runtime/components/Card.vue +0 -38
- package/dist/runtime/components/Core.vue +0 -45
- package/dist/runtime/components/Dropdown/index.vue +0 -70
- package/dist/runtime/components/Dropdown/types.d.ts +0 -2
- package/dist/runtime/components/Dropdown/types.mjs +0 -17
- package/dist/runtime/components/Form/InputDateTimeRange/date_range_time_field.types.d.ts +0 -17
- package/dist/runtime/components/Form/InputDateTimeRange/index.vue +0 -91
- package/dist/runtime/components/Form/InputRadio/index.vue +0 -27
- package/dist/runtime/components/Form/InputRadio/types.d.ts +0 -8
- package/dist/runtime/components/Form/InputStatic/index.vue +0 -16
- package/dist/runtime/components/Form/InputStatic/types.d.ts +0 -4
- package/dist/runtime/components/Form/InputTags/index.vue +0 -141
- package/dist/runtime/components/Form/InputTags/types.d.ts +0 -11
- package/dist/runtime/components/Form/InputTextarea/types.mjs +0 -0
- package/dist/runtime/components/Form/InputToggle/types.mjs +0 -0
- package/dist/runtime/components/Form/InputUploadDropzone/index.vue +0 -206
- package/dist/runtime/components/Form/InputUploadDropzone/types.d.ts +0 -11
- package/dist/runtime/components/Form/InputUploadDropzone/types.mjs +0 -0
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +0 -362
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/types.d.ts +0 -23
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/types.mjs +0 -0
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/ItemUpload.vue +0 -241
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/ItemView.vue +0 -110
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue +0 -171
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/types.d.ts +0 -23
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/types.mjs +0 -0
- package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/ItemUpload.vue +0 -161
- package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/ItemView.vue +0 -64
- package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/index.vue +0 -178
- package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/types.d.ts +0 -21
- package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/types.mjs +0 -0
- package/dist/runtime/components/Form/InputUploadFileClassic/index.vue +0 -95
- package/dist/runtime/components/Form/InputUploadFileClassic/types.d.ts +0 -13
- package/dist/runtime/components/Form/InputUploadFileClassic/types.mjs +0 -0
- package/dist/runtime/components/Form/InputUploadFileClassicAuto/index.vue +0 -151
- package/dist/runtime/components/Form/InputUploadFileClassicAuto/types.d.ts +0 -18
- package/dist/runtime/components/Form/InputUploadFileClassicAuto/types.mjs +0 -0
- package/dist/runtime/components/Form/InputUploadImageAuto/index.vue +0 -219
- package/dist/runtime/components/Form/InputUploadImageAuto/types.d.ts +0 -20
- package/dist/runtime/components/Form/InputUploadImageAuto/types.mjs +0 -0
- package/dist/runtime/components/Form/InputWYSIWYG/UploadImageForm.vue +0 -55
- package/dist/runtime/components/Form/InputWYSIWYG/index.vue +0 -230
- package/dist/runtime/components/Form/InputWYSIWYG/types.d.ts +0 -19
- package/dist/runtime/components/Form/InputWYSIWYG/types.mjs +0 -0
- package/dist/runtime/components/Icon.vue +0 -23
- package/dist/runtime/components/Log.vue +0 -22
- package/dist/runtime/components/Modal/index.vue +0 -146
- package/dist/runtime/components/OTPInput.vue +0 -127
- package/dist/runtime/components/QRCode.vue +0 -22
- package/dist/runtime/components/SimplePagination.vue +0 -96
- package/dist/runtime/components/Slideover/index.vue +0 -110
- package/dist/runtime/components/Tabs/index.vue +0 -64
- package/dist/runtime/composables/loaderList.mjs +0 -52
- package/dist/runtime/composables/loaderObject.mjs +0 -52
- package/dist/runtime/composables/loaderPage.mjs +0 -229
- package/dist/runtime/composables/useConfig.mjs +0 -9
- package/dist/runtime/composables/useDialog.mjs +0 -81
- package/dist/runtime/composables/useForm.mjs +0 -18
- package/dist/runtime/core.config.d.ts +0 -14
- package/dist/runtime/core.config.mjs +0 -14
- package/dist/runtime/helpers/apiListHelper.mjs +0 -44
- package/dist/runtime/helpers/apiObjectHelper.mjs +0 -46
- package/dist/runtime/helpers/apiPageHelper.mjs +0 -270
- package/dist/runtime/plugin.mjs +0 -149
- package/dist/runtime/types/common.mjs +0 -0
- package/dist/runtime/types/config.d.ts +0 -1
- package/dist/runtime/types/config.mjs +0 -0
- package/dist/runtime/types/lib.mjs +0 -0
- package/dist/runtime/ui.config/alert.d.ts +0 -3
- package/dist/runtime/ui.config/alert.mjs +0 -6
- package/dist/runtime/ui.config/badge.d.ts +0 -3
- package/dist/runtime/ui.config/badge.mjs +0 -1
- package/dist/runtime/ui.config/breadcrumb.d.ts +0 -1
- package/dist/runtime/ui.config/breadcrumb.mjs +0 -7
- package/dist/runtime/ui.config/button.d.ts +0 -3
- package/dist/runtime/ui.config/button.mjs +0 -8
- package/dist/runtime/ui.config/buttonGroup.d.ts +0 -3
- package/dist/runtime/ui.config/buttonGroup.mjs +0 -1
- package/dist/runtime/ui.config/card.d.ts +0 -1
- package/dist/runtime/ui.config/card.mjs +0 -2
- package/dist/runtime/ui.config/checkbox.d.ts +0 -3
- package/dist/runtime/ui.config/checkbox.mjs +0 -1
- package/dist/runtime/ui.config/formGroup.d.ts +0 -3
- package/dist/runtime/ui.config/formGroup.mjs +0 -5
- package/dist/runtime/ui.config/icon.d.ts +0 -3
- package/dist/runtime/ui.config/icon.mjs +0 -3
- package/dist/runtime/ui.config/index.d.ts +0 -16
- package/dist/runtime/ui.config/index.mjs +0 -16
- package/dist/runtime/ui.config/input.d.ts +0 -3
- package/dist/runtime/ui.config/input.mjs +0 -5
- package/dist/runtime/ui.config/modal.d.ts +0 -1
- package/dist/runtime/ui.config/modal.mjs +0 -34
- package/dist/runtime/ui.config/notification.d.ts +0 -11
- package/dist/runtime/ui.config/notification.mjs +0 -13
- package/dist/runtime/ui.config/notifications.d.ts +0 -3
- package/dist/runtime/ui.config/notifications.mjs +0 -3
- package/dist/runtime/ui.config/pagination.d.ts +0 -3
- package/dist/runtime/ui.config/pagination.mjs +0 -37
- package/dist/runtime/ui.config/select.d.ts +0 -3
- package/dist/runtime/ui.config/select.mjs +0 -5
- package/dist/runtime/ui.config/selectMenu.d.ts +0 -3
- package/dist/runtime/ui.config/selectMenu.mjs +0 -5
- package/dist/runtime/ui.config/slideover.d.ts +0 -1
- package/dist/runtime/ui.config/slideover.mjs +0 -16
- package/dist/runtime/ui.config/table.d.ts +0 -3
- package/dist/runtime/ui.config/table.mjs +0 -47
- package/dist/runtime/ui.config/tabs.d.ts +0 -3
- package/dist/runtime/ui.config/tabs.mjs +0 -4
- package/dist/runtime/ui.config/tags.d.ts +0 -25
- package/dist/runtime/ui.config/tags.mjs +0 -25
- package/dist/runtime/ui.config/textarea.d.ts +0 -3
- package/dist/runtime/ui.config/textarea.mjs +0 -5
- package/dist/runtime/ui.config/toggle.d.ts +0 -3
- package/dist/runtime/ui.config/toggle.mjs +0 -5
- package/dist/runtime/ui.config/uploadDropzoneImage.d.ts +0 -83
- package/dist/runtime/ui.config/uploadDropzoneImage.mjs +0 -26
- package/dist/runtime/ui.config/uploadFileDropzone.d.ts +0 -61
- package/dist/runtime/ui.config/uploadFileDropzone.mjs +0 -61
- package/dist/runtime/ui.config/uploadFileInputClassicAuto.d.ts +0 -8
- package/dist/runtime/ui.config/uploadFileInputClassicAuto.mjs +0 -8
- package/dist/runtime/ui.config/uploadImage.d.ts +0 -34
- package/dist/runtime/ui.config/uploadImage.mjs +0 -36
- package/dist/runtime/ui.css +0 -1
- package/dist/runtime/utils/ArrayHelper.spec.d.ts +0 -1
- package/dist/runtime/utils/ArrayHelper.spec.mjs +0 -112
- package/dist/runtime/utils/FileHelper.spec.d.ts +0 -1
- package/dist/runtime/utils/FileHelper.spec.mjs +0 -14
- package/dist/runtime/utils/ObjectHelper.spec.d.ts +0 -1
- package/dist/runtime/utils/ObjectHelper.spec.mjs +0 -52
- package/dist/runtime/utils/ParamHelper.spec.d.ts +0 -1
- package/dist/runtime/utils/ParamHelper.spec.mjs +0 -78
- package/dist/runtime/utils/StringHelper.spec.d.ts +0 -1
- package/dist/runtime/utils/StringHelper.spec.mjs +0 -76
- package/dist/runtime/utils/TimeHelper.spec.d.ts +0 -1
- package/dist/runtime/utils/TimeHelper.spec.mjs +0 -79
- package/dist/runtime/utils/TimeHelper.thai.spec.d.ts +0 -1
- package/dist/runtime/utils/TimeHelper.thai.spec.mjs +0 -31
- package/dist/types.d.ts +0 -16
- package/dist/runtime/components/FlexDeck/{types.mjs → types.js} +0 -0
- package/dist/runtime/components/Form/InputCheckbox/{types.mjs → types.js} +0 -0
- package/dist/runtime/components/Form/InputDateTime/{date_time_field.types.mjs → date_time_field.types.js} +0 -0
- package/dist/runtime/components/Form/{InputDateTimeRange/date_range_time_field.types.mjs → InputNumber/types.js} +0 -0
- package/dist/runtime/components/Form/{InputNumber/types.mjs → InputSelect/types.js} +0 -0
- package/dist/runtime/components/Form/{InputRadio/types.mjs → InputSelectMultiple/types.js} +0 -0
- package/dist/runtime/components/Form/{InputSelect/types.mjs → InputText/types.js} +0 -0
- package/dist/runtime/components/Form/{InputSelectMultiple/types.mjs → InputTextarea/types.js} +0 -0
- package/dist/runtime/components/Form/{InputStatic/types.mjs → InputToggle/types.js} +0 -0
- package/dist/runtime/components/Form/{types.mjs → types.js} +0 -0
- package/dist/runtime/composables/{useWatch.mjs → useWatch.js} +0 -0
- package/dist/runtime/lib/{Requester.mjs → Requester.js} +0 -0
- package/dist/runtime/{components/Form/InputTags/types.mjs → types/common.js} +0 -0
- package/dist/runtime/{components/Form/InputText/types.mjs → types/lib.js} +0 -0
- package/dist/runtime/utils/{FileHelper.mjs → FileHelper.js} +0 -0
- package/dist/runtime/utils/{StringHelper.mjs → StringHelper.js} +0 -0
- package/dist/runtime/utils/{TimeHelper.mjs → TimeHelper.js} +1 -1
- /package/dist/runtime/utils/{lodash.mjs → lodash.js} +0 -0
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
v-if="!isHideCaption || !isHideBottomPagination"
|
|
4
|
+
class="mb-4 text-gray-500"
|
|
5
|
+
>
|
|
3
6
|
<span class="font-bold">ผลลัพธ์ทั้งหมด:</span>
|
|
4
7
|
จำนวน
|
|
5
8
|
<span class="font-bold">{{ pageOptions?.totalCount || 0 }}</span>
|
|
6
9
|
รายการ
|
|
7
10
|
</div>
|
|
8
|
-
<UTable
|
|
11
|
+
<UTable
|
|
12
|
+
:loading="status.isLoading"
|
|
13
|
+
:columns="uTableCompatibleColumns"
|
|
14
|
+
:rows="rawData"
|
|
15
|
+
v-bind="$attrs"
|
|
16
|
+
>
|
|
9
17
|
<template #loading-state>
|
|
10
18
|
<div class="flex h-60 items-center justify-center">
|
|
11
|
-
<Icon
|
|
19
|
+
<Icon
|
|
20
|
+
name="i-svg-spinners:180-ring-with-bg"
|
|
21
|
+
class="text-primary size-8"
|
|
22
|
+
/>
|
|
12
23
|
</div>
|
|
13
24
|
</template>
|
|
14
25
|
<template #empty-state>
|
|
15
26
|
<Empty />
|
|
16
27
|
</template>
|
|
17
|
-
<template
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
:
|
|
24
|
-
|
|
25
|
-
<ColumnImage
|
|
26
|
-
v-else-if="column.type === COLUMN_TYPES.IMAGE"
|
|
27
|
-
:value="transformValue(column, row)"
|
|
28
|
-
:column="column"
|
|
29
|
-
:class="column.class"
|
|
30
|
-
:row="row"
|
|
31
|
-
/>
|
|
32
|
-
<ColumnDateTime
|
|
33
|
-
v-else-if="column.type === COLUMN_TYPES.DATE_TIME"
|
|
34
|
-
:value="transformValue(column, row)"
|
|
35
|
-
:column="column"
|
|
36
|
-
:class="column.class"
|
|
37
|
-
:row="row"
|
|
38
|
-
/>
|
|
39
|
-
<ColumnDate
|
|
40
|
-
v-else-if="column.type === COLUMN_TYPES.DATE"
|
|
28
|
+
<template
|
|
29
|
+
v-for="column in columns"
|
|
30
|
+
#[`${column.accessorKey}-data`]="{ row }"
|
|
31
|
+
:key="column.accessorKey"
|
|
32
|
+
>
|
|
33
|
+
<component
|
|
34
|
+
:is="column.type === COLUMN_TYPES.COMPONENT ? column.component : column.type ? columnTypeComponents[column.type] : void 0"
|
|
35
|
+
v-if="column.type === COLUMN_TYPES.COMPONENT || column.type && columnTypeComponents[column.type]"
|
|
41
36
|
:value="transformValue(column, row)"
|
|
42
37
|
:column="column"
|
|
43
|
-
:class="column.class"
|
|
44
38
|
:row="row"
|
|
45
39
|
/>
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
v-else-if="column.type === COLUMN_TYPES.COMPONENT"
|
|
40
|
+
<ColumnText
|
|
41
|
+
v-else
|
|
49
42
|
:value="transformValue(column, row)"
|
|
50
43
|
:column="column"
|
|
51
|
-
:class="column.class"
|
|
52
44
|
:row="row"
|
|
53
45
|
/>
|
|
54
|
-
<ColumnText v-else :value="transformValue(column, row)" :column="column" :row="row" />
|
|
55
46
|
</template>
|
|
56
47
|
|
|
57
|
-
<template
|
|
58
|
-
|
|
48
|
+
<template
|
|
49
|
+
v-for="(_, slotName) in $slots"
|
|
50
|
+
#[slotName]="scope"
|
|
51
|
+
>
|
|
52
|
+
<slot
|
|
53
|
+
:name="slotName"
|
|
54
|
+
v-bind="scope"
|
|
55
|
+
/>
|
|
59
56
|
</template>
|
|
60
57
|
</UTable>
|
|
61
|
-
<div
|
|
58
|
+
<div
|
|
59
|
+
v-if="pageOptions"
|
|
60
|
+
class="mt-4 flex justify-between px-3"
|
|
61
|
+
>
|
|
62
62
|
<p class="text-sm text-gray-500">
|
|
63
63
|
ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
|
|
64
64
|
</p>
|
|
65
|
-
<
|
|
65
|
+
<Pagination
|
|
66
66
|
v-if="pageOptions.totalPage > 1 && !isSimplePagination && !isHideBottomPagination"
|
|
67
67
|
v-model="page"
|
|
68
68
|
:page-count="pageOptions.limit"
|
|
@@ -77,85 +77,90 @@
|
|
|
77
77
|
</div>
|
|
78
78
|
</template>
|
|
79
79
|
|
|
80
|
-
<script
|
|
81
|
-
import {
|
|
82
|
-
import
|
|
83
|
-
import
|
|
84
|
-
import
|
|
85
|
-
import { StringHelper } from
|
|
86
|
-
import { ref, watch } from
|
|
87
|
-
import ColumnDateTime from
|
|
88
|
-
import Empty from
|
|
89
|
-
import ColumnDate from
|
|
90
|
-
import ColumnText from
|
|
91
|
-
import { useWatchChange } from
|
|
92
|
-
|
|
93
|
-
const emits = defineEmits([
|
|
94
|
-
|
|
80
|
+
<script setup>
|
|
81
|
+
import { computed } from "vue";
|
|
82
|
+
import { COLUMN_TYPES } from "#core/components/Table/types";
|
|
83
|
+
import ColumnNumber from "#core/components/Table/ColumnNumber.vue";
|
|
84
|
+
import ColumnImage from "#core/components/Table/ColumnImage.vue";
|
|
85
|
+
import { StringHelper } from "#core/utils/StringHelper";
|
|
86
|
+
import { ref, watch } from "#imports";
|
|
87
|
+
import ColumnDateTime from "#core/components/Table/ColumnDateTime.vue";
|
|
88
|
+
import Empty from "#core/components/Empty.vue";
|
|
89
|
+
import ColumnDate from "#core/components/Table/ColumnDate.vue";
|
|
90
|
+
import ColumnText from "#core/components/Table/ColumnText.vue";
|
|
91
|
+
import { useWatchChange } from "#core/composables/useWatch";
|
|
92
|
+
import UTable from "#ui/components/Table";
|
|
93
|
+
const emits = defineEmits(["pageChange"]);
|
|
95
94
|
const props = defineProps({
|
|
96
95
|
status: {
|
|
97
|
-
type: Object
|
|
98
|
-
required: true
|
|
96
|
+
type: Object,
|
|
97
|
+
required: true
|
|
99
98
|
},
|
|
100
99
|
pageOptions: {
|
|
101
|
-
type: Object
|
|
102
|
-
required: false
|
|
100
|
+
type: Object,
|
|
101
|
+
required: false
|
|
103
102
|
},
|
|
104
103
|
columns: {
|
|
105
|
-
type: Array
|
|
106
|
-
|
|
104
|
+
type: Array,
|
|
105
|
+
// This resolves to TableColumn[]
|
|
106
|
+
required: true
|
|
107
107
|
},
|
|
108
108
|
rawData: {
|
|
109
|
-
type: Array
|
|
110
|
-
required: true
|
|
109
|
+
type: Array,
|
|
110
|
+
required: true
|
|
111
111
|
},
|
|
112
112
|
isSimplePagination: {
|
|
113
|
-
type: Boolean
|
|
114
|
-
default: false
|
|
113
|
+
type: Boolean,
|
|
114
|
+
default: false
|
|
115
115
|
},
|
|
116
116
|
isHideBottomPagination: {
|
|
117
|
-
type: Boolean
|
|
118
|
-
default: false
|
|
117
|
+
type: Boolean,
|
|
118
|
+
default: false
|
|
119
119
|
},
|
|
120
120
|
isHideCaption: {
|
|
121
|
-
type: Boolean
|
|
122
|
-
default: false
|
|
123
|
-
}
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: false
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
const page = ref(props.pageOptions?.currentPage || 1);
|
|
126
|
+
const uTableCompatibleColumns = computed(
|
|
127
|
+
() => props.columns.map((col) => ({
|
|
128
|
+
...col,
|
|
129
|
+
key: col.accessorKey
|
|
130
|
+
// Use accessorKey for UTable's key property
|
|
131
|
+
// label: col.label || col.accessorKey // Optional: ensure label if not present, UTable uses key as fallback for header
|
|
132
|
+
}))
|
|
133
|
+
);
|
|
134
|
+
const columnTypeComponents = {
|
|
135
|
+
[COLUMN_TYPES.NUMBER]: ColumnNumber,
|
|
136
|
+
[COLUMN_TYPES.IMAGE]: ColumnImage,
|
|
137
|
+
[COLUMN_TYPES.DATE_TIME]: ColumnDateTime,
|
|
138
|
+
[COLUMN_TYPES.DATE]: ColumnDate,
|
|
139
|
+
[COLUMN_TYPES.TEXT]: ColumnText
|
|
140
|
+
};
|
|
128
141
|
useWatchChange(
|
|
129
142
|
() => props.pageOptions?.currentPage,
|
|
130
|
-
(value
|
|
131
|
-
page.value = value
|
|
143
|
+
(value) => {
|
|
144
|
+
page.value = value;
|
|
132
145
|
}
|
|
133
|
-
)
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
const length = props.rawData?.length
|
|
137
|
-
|
|
146
|
+
);
|
|
147
|
+
const pageBetween = computed(() => {
|
|
148
|
+
const length = props.rawData?.length;
|
|
138
149
|
if (length === 0) {
|
|
139
|
-
return
|
|
150
|
+
return "0";
|
|
140
151
|
}
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const totalCountWithComma = computed((): string => {
|
|
153
|
-
return !props.pageOptions!.totalCount
|
|
154
|
-
? '0'
|
|
155
|
-
: StringHelper.withComma(props.pageOptions!.totalCount)
|
|
156
|
-
})
|
|
157
|
-
|
|
152
|
+
const start = (props.pageOptions.currentPage - 1) * props.pageOptions.limit + 1;
|
|
153
|
+
const end = start + length - 1;
|
|
154
|
+
return `${start} - ${end}`;
|
|
155
|
+
});
|
|
156
|
+
const transformValue = (column, row) => {
|
|
157
|
+
const value = row[column.accessorKey];
|
|
158
|
+
return column.transform ? column.transform(value, row, column) : value;
|
|
159
|
+
};
|
|
160
|
+
const totalCountWithComma = computed(() => {
|
|
161
|
+
return !props.pageOptions?.totalCount ? "0" : StringHelper.withComma(props.pageOptions.totalCount);
|
|
162
|
+
});
|
|
158
163
|
watch(page, () => {
|
|
159
|
-
emits(
|
|
160
|
-
})
|
|
164
|
+
emits("pageChange", page.value);
|
|
165
|
+
});
|
|
161
166
|
</script>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { type ITableOptions } from '#core/components/Table/types';
|
|
3
|
+
declare var __VLS_20: any, __VLS_21: any;
|
|
4
|
+
type __VLS_Slots = {} & {
|
|
5
|
+
[K in NonNullable<typeof __VLS_20>]?: (props: typeof __VLS_21) => any;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
|
+
status: {
|
|
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
|
+
isSimplePagination: {
|
|
25
|
+
type: PropType<ITableOptions["isSimplePagination"]>;
|
|
26
|
+
default: boolean;
|
|
27
|
+
};
|
|
28
|
+
isHideBottomPagination: {
|
|
29
|
+
type: PropType<ITableOptions["isHideBottomPagination"]>;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
isHideCaption: {
|
|
33
|
+
type: PropType<ITableOptions["isHideCaption"]>;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {
|
|
37
|
+
isHideCaption: boolean | undefined;
|
|
38
|
+
isHideBottomPagination: boolean | undefined;
|
|
39
|
+
isSimplePagination: boolean | undefined;
|
|
40
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
41
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
42
|
+
export default _default;
|
|
43
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
44
|
+
new (): {
|
|
45
|
+
$slots: S;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
{{ getValue ||
|
|
2
|
+
{{ getValue || "-" }}
|
|
3
3
|
</template>
|
|
4
|
-
<script lang="ts" setup>
|
|
5
|
-
import { computed } from 'vue'
|
|
6
|
-
import { type IColumn } from '#core/components/Table/types'
|
|
7
|
-
import { TimeHelper } from '#core/utils/TimeHelper'
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
import { TimeHelper } from "#core/utils/TimeHelper";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
value: { type: null, required: true },
|
|
10
|
+
row: { type: null, required: true },
|
|
11
|
+
column: { type: null, required: true }
|
|
12
|
+
});
|
|
13
|
+
const getValue = computed(() => TimeHelper.displayDate(props.value));
|
|
16
14
|
</script>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TableColumn } from '@nuxt/ui';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
value: any;
|
|
4
|
+
row: any;
|
|
5
|
+
column: TableColumn<any>;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: 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>;
|
|
8
|
+
export default _default;
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
{{ getValue ||
|
|
2
|
+
{{ getValue || "-" }}
|
|
3
3
|
</template>
|
|
4
|
-
<script lang="ts" setup>
|
|
5
|
-
import { computed } from 'vue'
|
|
6
|
-
import { type IColumn } from '#core/components/Table/types'
|
|
7
|
-
import { TimeHelper } from '#core/utils/TimeHelper'
|
|
8
|
-
|
|
9
|
-
const props = defineProps<{
|
|
10
|
-
value: any
|
|
11
|
-
row: any
|
|
12
|
-
column: IColumn
|
|
13
|
-
}>()
|
|
14
4
|
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
import { TimeHelper } from "#core/utils/TimeHelper";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
value: { type: null, required: true },
|
|
10
|
+
row: { type: null, required: true },
|
|
11
|
+
column: { type: null, required: true }
|
|
12
|
+
});
|
|
15
13
|
const getValue = computed(() => {
|
|
16
|
-
return TimeHelper.displayDateTime(props.value)
|
|
17
|
-
})
|
|
14
|
+
return TimeHelper.displayDateTime(props.value);
|
|
15
|
+
});
|
|
18
16
|
</script>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TableColumn } from '@nuxt/ui';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
value: any;
|
|
4
|
+
row: any;
|
|
5
|
+
column: TableColumn<any>;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: 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>;
|
|
8
|
+
export default _default;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Image
|
|
2
|
+
<Image
|
|
3
|
+
class="h-12 rounded"
|
|
4
|
+
:src="getValue"
|
|
5
|
+
/>
|
|
3
6
|
</template>
|
|
4
|
-
<script lang="ts" setup>
|
|
5
|
-
import { computed } from 'vue'
|
|
6
|
-
import { type IColumn } from '#core/components/Table/types'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
<script setup>
|
|
9
|
+
import { computed } from "vue";
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
value: { type: null, required: true },
|
|
12
|
+
row: { type: null, required: true },
|
|
13
|
+
column: { type: null, required: true }
|
|
14
|
+
});
|
|
15
|
+
const getValue = computed(() => props.value);
|
|
15
16
|
</script>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TableColumn } from '@nuxt/ui';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
value: any;
|
|
4
|
+
row: any;
|
|
5
|
+
column: TableColumn<any>;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: 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>;
|
|
8
|
+
export default _default;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { computed } from 'vue'
|
|
5
|
-
import { type IColumn } from '#core/components/Table/types'
|
|
1
|
+
<template>
|
|
2
|
+
{{ getValue }}
|
|
3
|
+
</template>
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
import { StringHelper } from "../../utils/StringHelper";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
value: { type: null, required: true },
|
|
10
|
+
row: { type: null, required: true },
|
|
11
|
+
column: { type: null, required: true }
|
|
12
|
+
});
|
|
13
|
+
const getValue = computed(() => StringHelper.withComma(props.value));
|
|
14
14
|
</script>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TableColumn } from '@nuxt/ui';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
value: any;
|
|
4
|
+
row: any;
|
|
5
|
+
column: TableColumn<any>;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: 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>;
|
|
8
|
+
export default _default;
|
|
@@ -1,29 +1,24 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { type IColumn } from '#core/components/Table/types'
|
|
5
|
-
import { StringHelper } from '#imports'
|
|
6
|
-
|
|
7
|
-
const props = defineProps<{
|
|
8
|
-
value: any
|
|
9
|
-
row: any
|
|
10
|
-
column: IColumn<{
|
|
11
|
-
max?: number
|
|
12
|
-
}>
|
|
13
|
-
}>()
|
|
14
|
-
|
|
15
|
-
const getValue = computed<string>(() => {
|
|
16
|
-
const value = props.value
|
|
17
|
-
const max = props.column.props?.max
|
|
1
|
+
<template>
|
|
2
|
+
{{ getValue }}
|
|
3
|
+
</template>
|
|
18
4
|
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
import { StringHelper } from "#imports";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
value: { type: null, required: true },
|
|
10
|
+
row: { type: null, required: true },
|
|
11
|
+
column: { type: null, required: true }
|
|
12
|
+
});
|
|
13
|
+
const getValue = computed(() => {
|
|
14
|
+
const value = props.value;
|
|
15
|
+
const max = props.column?.meta?.max;
|
|
19
16
|
if (max) {
|
|
20
|
-
return StringHelper.truncate(value, max)
|
|
17
|
+
return StringHelper.truncate(value, max);
|
|
21
18
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return value || '-'
|
|
19
|
+
if (typeof value === "string") {
|
|
20
|
+
return value || "-";
|
|
25
21
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
})
|
|
22
|
+
return value ?? "-";
|
|
23
|
+
});
|
|
29
24
|
</script>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TableColumn } from '@nuxt/ui';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
value: any;
|
|
4
|
+
row: any;
|
|
5
|
+
column: TableColumn<any>;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: 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>;
|
|
8
|
+
export default _default;
|
|
@@ -10,61 +10,60 @@
|
|
|
10
10
|
:is-hide-caption="options.isHideCaption"
|
|
11
11
|
@page-change="onPageChange"
|
|
12
12
|
>
|
|
13
|
-
<template
|
|
14
|
-
|
|
13
|
+
<template
|
|
14
|
+
v-for="(_, slot) of $slots"
|
|
15
|
+
#[slot]="slotProps"
|
|
16
|
+
>
|
|
17
|
+
<slot
|
|
18
|
+
:name="slot"
|
|
19
|
+
v-bind="slotProps || {}"
|
|
20
|
+
/>
|
|
15
21
|
</template>
|
|
16
22
|
</Base>
|
|
17
23
|
</template>
|
|
18
|
-
<script lang="ts" setup>
|
|
19
|
-
import { computed, type PropType, ref } from 'vue'
|
|
20
|
-
import { type ISimpleTableOptions } from '#core/components/Table/types'
|
|
21
|
-
import Base from '#core/components/Table/Base.vue'
|
|
22
|
-
import { initPageOptions } from '#core/composables/loaderPage'
|
|
23
|
-
import { useCoreConfig } from '#core/composables/useConfig'
|
|
24
|
-
|
|
25
|
-
defineSlots<{
|
|
26
|
-
'empty-state': () => any
|
|
27
|
-
'loading-state': () => any
|
|
28
|
-
}>()
|
|
29
24
|
|
|
25
|
+
<script setup>
|
|
26
|
+
import { computed, ref } from "vue";
|
|
27
|
+
import Base from "#core/components/Table/Base.vue";
|
|
28
|
+
import { initPageOptions } from "#core/composables/loaderPage";
|
|
29
|
+
import { useCoreConfig } from "#core/composables/useConfig";
|
|
30
|
+
defineSlots();
|
|
30
31
|
const props = defineProps({
|
|
31
|
-
options: {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
options: {
|
|
33
|
+
type: Object,
|
|
34
|
+
required: true
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const currentPage = ref(1);
|
|
38
|
+
const coreConfig = useCoreConfig();
|
|
36
39
|
const isShowSimplePagination = computed(
|
|
37
|
-
()
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
+
() => props.options.isSimplePagination ?? coreConfig.is_simple_pagination ?? false
|
|
41
|
+
);
|
|
40
42
|
const pageOptions = computed(() => {
|
|
41
43
|
if (!props.options?.limit) {
|
|
42
|
-
return
|
|
44
|
+
return void 0;
|
|
43
45
|
}
|
|
44
|
-
|
|
46
|
+
const totalCount = props.options.rawData.length;
|
|
47
|
+
const limit = props.options.limit;
|
|
45
48
|
return {
|
|
46
49
|
...initPageOptions({
|
|
47
|
-
limit
|
|
48
|
-
primary: props.options.primary
|
|
50
|
+
limit,
|
|
51
|
+
primary: props.options.primary
|
|
49
52
|
}),
|
|
50
|
-
totalCount
|
|
51
|
-
totalPage: Math.ceil(
|
|
52
|
-
currentPage: currentPage.value
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
53
|
+
totalCount,
|
|
54
|
+
totalPage: Math.ceil(totalCount / limit),
|
|
55
|
+
currentPage: currentPage.value
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
const onPageChange = (page) => {
|
|
59
|
+
currentPage.value = page;
|
|
60
|
+
};
|
|
60
61
|
const itemsByPage = computed(() => {
|
|
61
62
|
if (!pageOptions.value) {
|
|
62
|
-
return props.options?.rawData
|
|
63
|
+
return props.options?.rawData;
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return props.options?.rawData.slice(start, end)
|
|
69
|
-
})
|
|
65
|
+
const start = (pageOptions.value.currentPage - 1) * pageOptions.value.limit;
|
|
66
|
+
const end = start + pageOptions.value.limit;
|
|
67
|
+
return props.options?.rawData.slice(start, end);
|
|
68
|
+
});
|
|
70
69
|
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import type { ISimpleTableOptions } from '#core/components/Table/types';
|
|
3
|
+
type __VLS_Slots = {
|
|
4
|
+
'empty-state': () => any;
|
|
5
|
+
'loading-state': () => any;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
|
+
options: {
|
|
9
|
+
type: PropType<ISimpleTableOptions>;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
+
options: {
|
|
14
|
+
type: PropType<ISimpleTableOptions>;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
18
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
21
|
+
new (): {
|
|
22
|
+
$slots: S;
|
|
23
|
+
};
|
|
24
|
+
};
|