@finema/core 1.4.52 → 1.4.53
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 +63 -63
- package/dist/module.d.mts +4 -4
- package/dist/module.d.ts +4 -4
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Alert.vue +49 -49
- package/dist/runtime/components/Avatar.vue +27 -27
- package/dist/runtime/components/Badge.vue +54 -54
- package/dist/runtime/components/Breadcrumb.vue +45 -45
- package/dist/runtime/components/Button/Group.vue +37 -37
- package/dist/runtime/components/Button/index.vue +77 -77
- package/dist/runtime/components/Card.vue +38 -38
- package/dist/runtime/components/Core.vue +13 -13
- package/dist/runtime/components/Dialog/index.vue +108 -108
- package/dist/runtime/components/Dropdown/index.vue +71 -71
- package/dist/runtime/components/Form/FieldWrapper.vue +23 -23
- package/dist/runtime/components/Form/Fields.vue +153 -153
- package/dist/runtime/components/Form/InputCheckbox/index.vue +21 -21
- package/dist/runtime/components/Form/InputDateTime/index.vue +51 -51
- package/dist/runtime/components/Form/InputRadio/index.vue +27 -27
- package/dist/runtime/components/Form/InputSelect/index.vue +36 -36
- package/dist/runtime/components/Form/InputStatic/index.vue +16 -16
- package/dist/runtime/components/Form/InputText/index.vue +54 -54
- package/dist/runtime/components/Form/InputTextarea/index.vue +25 -25
- package/dist/runtime/components/Form/InputToggle/index.vue +14 -14
- package/dist/runtime/components/Form/InputUploadDropzone/index.vue +157 -157
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +241 -241
- package/dist/runtime/components/Form/InputUploadFileClassic/index.vue +36 -36
- package/dist/runtime/components/Form/InputUploadFileClassicAuto/index.vue +165 -165
- package/dist/runtime/components/Form/index.vue +6 -6
- package/dist/runtime/components/Icon.vue +23 -23
- package/dist/runtime/components/Image.vue +36 -36
- package/dist/runtime/components/Loader.vue +14 -14
- package/dist/runtime/components/Modal/index.vue +146 -146
- package/dist/runtime/components/SimplePagination.vue +96 -96
- package/dist/runtime/components/Slideover/index.vue +110 -110
- package/dist/runtime/components/Table/Base.vue +133 -133
- package/dist/runtime/components/Table/ColumnDate.vue +16 -16
- package/dist/runtime/components/Table/ColumnDateTime.vue +18 -18
- package/dist/runtime/components/Table/ColumnImage.vue +13 -13
- package/dist/runtime/components/Table/ColumnNumber.vue +14 -14
- package/dist/runtime/components/Table/Simple.vue +57 -57
- package/dist/runtime/components/Table/index.vue +59 -59
- package/dist/runtime/components/Tabs/index.vue +65 -65
- package/dist/runtime/types/utils.d.ts +29 -29
- package/dist/runtime/ui.css +32 -32
- package/dist/runtime/utils/lodash.d.ts +9 -0
- package/dist/runtime/utils/lodash.mjs +5 -1
- package/package.json +83 -83
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<USlideover
|
|
3
|
-
v-bind="attrs"
|
|
4
|
-
:model-value="modelValue"
|
|
5
|
-
:class="$props.class"
|
|
6
|
-
:prevent-close="preventClose"
|
|
7
|
-
:overlay="overlay"
|
|
8
|
-
:transition="transition"
|
|
9
|
-
:side="side"
|
|
10
|
-
:initial-focus="emptyFocusRef"
|
|
11
|
-
:ui="ui"
|
|
12
|
-
@update:model-value="$emit('update:modelValue', $event)"
|
|
13
|
-
>
|
|
14
|
-
<div v-if="!isHideCloseBtn && preventClose" class="absolute right-0 m-4">
|
|
15
|
-
<Icon
|
|
16
|
-
v-if="!isHideCloseBtn"
|
|
17
|
-
name="i-heroicons-x-mark"
|
|
18
|
-
class="h-6 w-6 cursor-pointer"
|
|
19
|
-
@click="close"
|
|
20
|
-
/>
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
<div :class="['overflow-y-auto', ui.bodyWrapper]">
|
|
24
|
-
<slot />
|
|
25
|
-
</div>
|
|
26
|
-
</USlideover>
|
|
27
|
-
|
|
28
|
-
<div ref="emptyFocusRef" />
|
|
29
|
-
</template>
|
|
30
|
-
|
|
31
|
-
<script lang="ts" setup>
|
|
32
|
-
import { ref, type PropType, toRef, defineShortcuts, watch } from '#imports'
|
|
33
|
-
import type { Strategy } from '#core/types/utils'
|
|
34
|
-
import { useUI } from '#ui/composables/useUI'
|
|
35
|
-
import { slideover } from '#core/ui.config'
|
|
36
|
-
import { useUiConfig } from '#core/composables/useConfig'
|
|
37
|
-
|
|
38
|
-
const config = useUiConfig<typeof slideover>(slideover, 'slideover')
|
|
39
|
-
|
|
40
|
-
const props = defineProps({
|
|
41
|
-
modelValue: {
|
|
42
|
-
type: Boolean as PropType<boolean>,
|
|
43
|
-
default: false,
|
|
44
|
-
},
|
|
45
|
-
side: {
|
|
46
|
-
type: String as PropType<'left' | 'right'>,
|
|
47
|
-
default: 'right',
|
|
48
|
-
validator: (value: string) => ['left', 'right'].includes(value),
|
|
49
|
-
},
|
|
50
|
-
overlay: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: true,
|
|
53
|
-
},
|
|
54
|
-
preventClose: {
|
|
55
|
-
type: Boolean,
|
|
56
|
-
default: false,
|
|
57
|
-
},
|
|
58
|
-
isHideCloseBtn: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: false,
|
|
61
|
-
},
|
|
62
|
-
transition: {
|
|
63
|
-
type: Boolean,
|
|
64
|
-
default: true,
|
|
65
|
-
},
|
|
66
|
-
size: {
|
|
67
|
-
type: String as PropType<keyof typeof slideover.size>,
|
|
68
|
-
default: () => slideover.default.size,
|
|
69
|
-
},
|
|
70
|
-
class: {
|
|
71
|
-
type: [String, Array, Object] as PropType<any>,
|
|
72
|
-
default: undefined,
|
|
73
|
-
},
|
|
74
|
-
ui: {
|
|
75
|
-
type: Object as PropType<Partial<typeof config & { strategy?: Strategy }>>,
|
|
76
|
-
default: undefined,
|
|
77
|
-
},
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
const emits = defineEmits(['update:modelValue'])
|
|
81
|
-
|
|
82
|
-
const emptyFocusRef = ref<HTMLElement | null>(null)
|
|
83
|
-
|
|
84
|
-
defineShortcuts({
|
|
85
|
-
escape: {
|
|
86
|
-
usingInput: true,
|
|
87
|
-
handler: () => {
|
|
88
|
-
if (props.preventClose) return
|
|
89
|
-
emits('update:modelValue', false)
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
const close = () => {
|
|
95
|
-
emits('update:modelValue', false)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const { ui, attrs } = useUI('slideover', toRef(props, 'ui'), config, toRef(props, 'class'))
|
|
99
|
-
|
|
100
|
-
watch(
|
|
101
|
-
() => props.modelValue,
|
|
102
|
-
() => {
|
|
103
|
-
if (props.modelValue) {
|
|
104
|
-
const size = config.size[props.size]
|
|
105
|
-
|
|
106
|
-
ui.value.width = size
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
)
|
|
110
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<USlideover
|
|
3
|
+
v-bind="attrs"
|
|
4
|
+
:model-value="modelValue"
|
|
5
|
+
:class="$props.class"
|
|
6
|
+
:prevent-close="preventClose"
|
|
7
|
+
:overlay="overlay"
|
|
8
|
+
:transition="transition"
|
|
9
|
+
:side="side"
|
|
10
|
+
:initial-focus="emptyFocusRef"
|
|
11
|
+
:ui="ui"
|
|
12
|
+
@update:model-value="$emit('update:modelValue', $event)"
|
|
13
|
+
>
|
|
14
|
+
<div v-if="!isHideCloseBtn && preventClose" class="absolute right-0 m-4">
|
|
15
|
+
<Icon
|
|
16
|
+
v-if="!isHideCloseBtn"
|
|
17
|
+
name="i-heroicons-x-mark"
|
|
18
|
+
class="h-6 w-6 cursor-pointer"
|
|
19
|
+
@click="close"
|
|
20
|
+
/>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div :class="['overflow-y-auto', ui.bodyWrapper]">
|
|
24
|
+
<slot />
|
|
25
|
+
</div>
|
|
26
|
+
</USlideover>
|
|
27
|
+
|
|
28
|
+
<div ref="emptyFocusRef" />
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script lang="ts" setup>
|
|
32
|
+
import { ref, type PropType, toRef, defineShortcuts, watch } from '#imports'
|
|
33
|
+
import type { Strategy } from '#core/types/utils'
|
|
34
|
+
import { useUI } from '#ui/composables/useUI'
|
|
35
|
+
import { slideover } from '#core/ui.config'
|
|
36
|
+
import { useUiConfig } from '#core/composables/useConfig'
|
|
37
|
+
|
|
38
|
+
const config = useUiConfig<typeof slideover>(slideover, 'slideover')
|
|
39
|
+
|
|
40
|
+
const props = defineProps({
|
|
41
|
+
modelValue: {
|
|
42
|
+
type: Boolean as PropType<boolean>,
|
|
43
|
+
default: false,
|
|
44
|
+
},
|
|
45
|
+
side: {
|
|
46
|
+
type: String as PropType<'left' | 'right'>,
|
|
47
|
+
default: 'right',
|
|
48
|
+
validator: (value: string) => ['left', 'right'].includes(value),
|
|
49
|
+
},
|
|
50
|
+
overlay: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: true,
|
|
53
|
+
},
|
|
54
|
+
preventClose: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false,
|
|
57
|
+
},
|
|
58
|
+
isHideCloseBtn: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false,
|
|
61
|
+
},
|
|
62
|
+
transition: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: true,
|
|
65
|
+
},
|
|
66
|
+
size: {
|
|
67
|
+
type: String as PropType<keyof typeof slideover.size>,
|
|
68
|
+
default: () => slideover.default.size,
|
|
69
|
+
},
|
|
70
|
+
class: {
|
|
71
|
+
type: [String, Array, Object] as PropType<any>,
|
|
72
|
+
default: undefined,
|
|
73
|
+
},
|
|
74
|
+
ui: {
|
|
75
|
+
type: Object as PropType<Partial<typeof config & { strategy?: Strategy }>>,
|
|
76
|
+
default: undefined,
|
|
77
|
+
},
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
const emits = defineEmits(['update:modelValue'])
|
|
81
|
+
|
|
82
|
+
const emptyFocusRef = ref<HTMLElement | null>(null)
|
|
83
|
+
|
|
84
|
+
defineShortcuts({
|
|
85
|
+
escape: {
|
|
86
|
+
usingInput: true,
|
|
87
|
+
handler: () => {
|
|
88
|
+
if (props.preventClose) return
|
|
89
|
+
emits('update:modelValue', false)
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
const close = () => {
|
|
95
|
+
emits('update:modelValue', false)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const { ui, attrs } = useUI('slideover', toRef(props, 'ui'), config, toRef(props, 'class'))
|
|
99
|
+
|
|
100
|
+
watch(
|
|
101
|
+
() => props.modelValue,
|
|
102
|
+
() => {
|
|
103
|
+
if (props.modelValue) {
|
|
104
|
+
const size = config.size[props.size]
|
|
105
|
+
|
|
106
|
+
ui.value.width = size
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
</script>
|
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<UTable :loading="status.isLoading" :columns="columns" :rows="rawData" v-bind="$attrs">
|
|
3
|
-
<template #loading-state>
|
|
4
|
-
<div class="flex h-60 items-center justify-center">
|
|
5
|
-
<Icon name="i-svg-spinners:180-ring-with-bg" class="text-primary h-8 w-8" />
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
<template #empty-state>
|
|
9
|
-
<div class="flex flex-col items-center justify-center gap-3 py-6">
|
|
10
|
-
<span class="text-sm italic">ไม่พบข้อมูล!</span>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
<template v-for="column in columns" #[`${column.key}-data`]="{ row }" :key="column.key">
|
|
14
|
-
<ColumnNumber
|
|
15
|
-
v-if="column.type === COLUMN_TYPES.NUMBER"
|
|
16
|
-
:value="row[column.key]"
|
|
17
|
-
:column="column"
|
|
18
|
-
:row="row"
|
|
19
|
-
/>
|
|
20
|
-
<ColumnImage
|
|
21
|
-
v-else-if="column.type === COLUMN_TYPES.IMAGE"
|
|
22
|
-
:value="row[column.key]"
|
|
23
|
-
:column="column"
|
|
24
|
-
:row="row"
|
|
25
|
-
/>
|
|
26
|
-
<ColumnDateTime
|
|
27
|
-
v-else-if="column.type === COLUMN_TYPES.DATE_TIME"
|
|
28
|
-
:value="row[column.key]"
|
|
29
|
-
:column="column"
|
|
30
|
-
:row="row"
|
|
31
|
-
/>
|
|
32
|
-
<ColumnDate
|
|
33
|
-
v-else-if="column.type === COLUMN_TYPES.DATE"
|
|
34
|
-
:value="row[column.key]"
|
|
35
|
-
:column="column"
|
|
36
|
-
:row="row"
|
|
37
|
-
/>
|
|
38
|
-
<component
|
|
39
|
-
:is="column.component"
|
|
40
|
-
v-else-if="column.type === COLUMN_TYPES.COMPONENT"
|
|
41
|
-
:value="row[column.key]"
|
|
42
|
-
:column="column"
|
|
43
|
-
:row="row"
|
|
44
|
-
/>
|
|
45
|
-
|
|
46
|
-
<template v-else>
|
|
47
|
-
<span :title="row[column.key]">{{ row[column.key] ?? '-' }}</span>
|
|
48
|
-
</template>
|
|
49
|
-
</template>
|
|
50
|
-
|
|
51
|
-
<template v-for="(_, slot) of $slots" #[slot]="scope">
|
|
52
|
-
<slot :name="slot" v-bind="scope" />
|
|
53
|
-
</template>
|
|
54
|
-
</UTable>
|
|
55
|
-
<div v-if="pageOptions" class="mt-4 flex justify-between px-3">
|
|
56
|
-
<p class="text-xs text-gray-500">
|
|
57
|
-
ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
|
|
58
|
-
</p>
|
|
59
|
-
<UPagination
|
|
60
|
-
v-if="pageOptions.totalPage > 1 && !isSimplePagination"
|
|
61
|
-
v-model="page"
|
|
62
|
-
:page-count="pageOptions.limit"
|
|
63
|
-
:total="pageOptions.totalCount"
|
|
64
|
-
/>
|
|
65
|
-
<SimplePagination
|
|
66
|
-
v-if="pageOptions.totalPage > 1 && isSimplePagination"
|
|
67
|
-
v-model="page"
|
|
68
|
-
:page-count="pageOptions.limit"
|
|
69
|
-
:total="pageOptions.totalCount"
|
|
70
|
-
/>
|
|
71
|
-
</div>
|
|
72
|
-
</template>
|
|
73
|
-
|
|
74
|
-
<script lang="ts" setup>
|
|
75
|
-
import { COLUMN_TYPES, type ITableOptions } from '#core/components/Table/types'
|
|
76
|
-
import ColumnNumber from '#core/components/Table/ColumnNumber.vue'
|
|
77
|
-
import ColumnImage from '#core/components/Table/ColumnImage.vue'
|
|
78
|
-
import { computed, type PropType } from 'vue'
|
|
79
|
-
import { StringHelper } from '#core/utils/StringHelper'
|
|
80
|
-
import { ref, watch } from '#imports'
|
|
81
|
-
import ColumnDateTime from '#core/components/Table/ColumnDateTime.vue'
|
|
82
|
-
import ColumnDate from '#core/components/Table/ColumnDate.vue'
|
|
83
|
-
|
|
84
|
-
const emits = defineEmits(['pageChange'])
|
|
85
|
-
|
|
86
|
-
const props = defineProps({
|
|
87
|
-
status: {
|
|
88
|
-
type: Object as PropType<ITableOptions['status']>,
|
|
89
|
-
required: true,
|
|
90
|
-
},
|
|
91
|
-
pageOptions: {
|
|
92
|
-
type: Object as PropType<ITableOptions['pageOptions']>,
|
|
93
|
-
required: false,
|
|
94
|
-
},
|
|
95
|
-
columns: {
|
|
96
|
-
type: Array as PropType<ITableOptions['columns']>,
|
|
97
|
-
required: true,
|
|
98
|
-
},
|
|
99
|
-
rawData: {
|
|
100
|
-
type: Array as PropType<ITableOptions['rawData']>,
|
|
101
|
-
required: true,
|
|
102
|
-
},
|
|
103
|
-
isSimplePagination: {
|
|
104
|
-
type: Boolean as PropType<ITableOptions['isSimplePagination']>,
|
|
105
|
-
default: false,
|
|
106
|
-
},
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
const page = ref(props.pageOptions?.currentPage || 1)
|
|
110
|
-
|
|
111
|
-
const pageBetween = computed((): string => {
|
|
112
|
-
const length = props.rawData?.length
|
|
113
|
-
|
|
114
|
-
if (length === 0) {
|
|
115
|
-
return '0'
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const start = (props.pageOptions!.currentPage - 1) * props.pageOptions!.limit + 1
|
|
119
|
-
const end = start + length - 1
|
|
120
|
-
|
|
121
|
-
return `${start} - ${end}`
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
const totalCountWithComma = computed((): string => {
|
|
125
|
-
return !props.pageOptions!.totalCount
|
|
126
|
-
? '0'
|
|
127
|
-
: StringHelper.withComma(props.pageOptions!.totalCount)
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
watch(page, () => {
|
|
131
|
-
emits('pageChange', page.value)
|
|
132
|
-
})
|
|
133
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<UTable :loading="status.isLoading" :columns="columns" :rows="rawData" v-bind="$attrs">
|
|
3
|
+
<template #loading-state>
|
|
4
|
+
<div class="flex h-60 items-center justify-center">
|
|
5
|
+
<Icon name="i-svg-spinners:180-ring-with-bg" class="text-primary h-8 w-8" />
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
<template #empty-state>
|
|
9
|
+
<div class="flex flex-col items-center justify-center gap-3 py-6">
|
|
10
|
+
<span class="text-sm italic">ไม่พบข้อมูล!</span>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
<template v-for="column in columns" #[`${column.key}-data`]="{ row }" :key="column.key">
|
|
14
|
+
<ColumnNumber
|
|
15
|
+
v-if="column.type === COLUMN_TYPES.NUMBER"
|
|
16
|
+
:value="row[column.key]"
|
|
17
|
+
:column="column"
|
|
18
|
+
:row="row"
|
|
19
|
+
/>
|
|
20
|
+
<ColumnImage
|
|
21
|
+
v-else-if="column.type === COLUMN_TYPES.IMAGE"
|
|
22
|
+
:value="row[column.key]"
|
|
23
|
+
:column="column"
|
|
24
|
+
:row="row"
|
|
25
|
+
/>
|
|
26
|
+
<ColumnDateTime
|
|
27
|
+
v-else-if="column.type === COLUMN_TYPES.DATE_TIME"
|
|
28
|
+
:value="row[column.key]"
|
|
29
|
+
:column="column"
|
|
30
|
+
:row="row"
|
|
31
|
+
/>
|
|
32
|
+
<ColumnDate
|
|
33
|
+
v-else-if="column.type === COLUMN_TYPES.DATE"
|
|
34
|
+
:value="row[column.key]"
|
|
35
|
+
:column="column"
|
|
36
|
+
:row="row"
|
|
37
|
+
/>
|
|
38
|
+
<component
|
|
39
|
+
:is="column.component"
|
|
40
|
+
v-else-if="column.type === COLUMN_TYPES.COMPONENT"
|
|
41
|
+
:value="row[column.key]"
|
|
42
|
+
:column="column"
|
|
43
|
+
:row="row"
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<template v-else>
|
|
47
|
+
<span :title="row[column.key]">{{ row[column.key] ?? '-' }}</span>
|
|
48
|
+
</template>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<template v-for="(_, slot) of $slots" #[slot]="scope">
|
|
52
|
+
<slot :name="slot" v-bind="scope" />
|
|
53
|
+
</template>
|
|
54
|
+
</UTable>
|
|
55
|
+
<div v-if="pageOptions" class="mt-4 flex justify-between px-3">
|
|
56
|
+
<p class="text-xs text-gray-500">
|
|
57
|
+
ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
|
|
58
|
+
</p>
|
|
59
|
+
<UPagination
|
|
60
|
+
v-if="pageOptions.totalPage > 1 && !isSimplePagination"
|
|
61
|
+
v-model="page"
|
|
62
|
+
:page-count="pageOptions.limit"
|
|
63
|
+
:total="pageOptions.totalCount"
|
|
64
|
+
/>
|
|
65
|
+
<SimplePagination
|
|
66
|
+
v-if="pageOptions.totalPage > 1 && isSimplePagination"
|
|
67
|
+
v-model="page"
|
|
68
|
+
:page-count="pageOptions.limit"
|
|
69
|
+
:total="pageOptions.totalCount"
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<script lang="ts" setup>
|
|
75
|
+
import { COLUMN_TYPES, type ITableOptions } from '#core/components/Table/types'
|
|
76
|
+
import ColumnNumber from '#core/components/Table/ColumnNumber.vue'
|
|
77
|
+
import ColumnImage from '#core/components/Table/ColumnImage.vue'
|
|
78
|
+
import { computed, type PropType } from 'vue'
|
|
79
|
+
import { StringHelper } from '#core/utils/StringHelper'
|
|
80
|
+
import { ref, watch } from '#imports'
|
|
81
|
+
import ColumnDateTime from '#core/components/Table/ColumnDateTime.vue'
|
|
82
|
+
import ColumnDate from '#core/components/Table/ColumnDate.vue'
|
|
83
|
+
|
|
84
|
+
const emits = defineEmits(['pageChange'])
|
|
85
|
+
|
|
86
|
+
const props = defineProps({
|
|
87
|
+
status: {
|
|
88
|
+
type: Object as PropType<ITableOptions['status']>,
|
|
89
|
+
required: true,
|
|
90
|
+
},
|
|
91
|
+
pageOptions: {
|
|
92
|
+
type: Object as PropType<ITableOptions['pageOptions']>,
|
|
93
|
+
required: false,
|
|
94
|
+
},
|
|
95
|
+
columns: {
|
|
96
|
+
type: Array as PropType<ITableOptions['columns']>,
|
|
97
|
+
required: true,
|
|
98
|
+
},
|
|
99
|
+
rawData: {
|
|
100
|
+
type: Array as PropType<ITableOptions['rawData']>,
|
|
101
|
+
required: true,
|
|
102
|
+
},
|
|
103
|
+
isSimplePagination: {
|
|
104
|
+
type: Boolean as PropType<ITableOptions['isSimplePagination']>,
|
|
105
|
+
default: false,
|
|
106
|
+
},
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
const page = ref(props.pageOptions?.currentPage || 1)
|
|
110
|
+
|
|
111
|
+
const pageBetween = computed((): string => {
|
|
112
|
+
const length = props.rawData?.length
|
|
113
|
+
|
|
114
|
+
if (length === 0) {
|
|
115
|
+
return '0'
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const start = (props.pageOptions!.currentPage - 1) * props.pageOptions!.limit + 1
|
|
119
|
+
const end = start + length - 1
|
|
120
|
+
|
|
121
|
+
return `${start} - ${end}`
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
const totalCountWithComma = computed((): string => {
|
|
125
|
+
return !props.pageOptions!.totalCount
|
|
126
|
+
? '0'
|
|
127
|
+
: StringHelper.withComma(props.pageOptions!.totalCount)
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
watch(page, () => {
|
|
131
|
+
emits('pageChange', page.value)
|
|
132
|
+
})
|
|
133
|
+
</script>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
{{ getValue }}
|
|
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
|
-
|
|
15
|
-
const getValue = computed<string>(() => TimeHelper.displayDate(props.value))
|
|
16
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
{{ getValue }}
|
|
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
|
+
|
|
15
|
+
const getValue = computed<string>(() => TimeHelper.displayDate(props.value))
|
|
16
|
+
</script>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
{{ getValue }}
|
|
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
|
-
|
|
15
|
-
const getValue = computed(() => {
|
|
16
|
-
return TimeHelper.displayDateTime(props.value)
|
|
17
|
-
})
|
|
18
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
{{ getValue }}
|
|
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
|
+
|
|
15
|
+
const getValue = computed(() => {
|
|
16
|
+
return TimeHelper.displayDateTime(props.value)
|
|
17
|
+
})
|
|
18
|
+
</script>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<template><img class="h-12" :src="getValue" /></template>
|
|
2
|
-
<script lang="ts" setup>
|
|
3
|
-
import { computed } from 'vue'
|
|
4
|
-
import { type IColumn } from '#core/components/Table/types'
|
|
5
|
-
|
|
6
|
-
const props = defineProps<{
|
|
7
|
-
value: any
|
|
8
|
-
row: any
|
|
9
|
-
column: IColumn
|
|
10
|
-
}>()
|
|
11
|
-
|
|
12
|
-
const getValue = computed(() => props.value)
|
|
13
|
-
</script>
|
|
1
|
+
<template><img class="h-12" :src="getValue" /></template>
|
|
2
|
+
<script lang="ts" setup>
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import { type IColumn } from '#core/components/Table/types'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
value: any
|
|
8
|
+
row: any
|
|
9
|
+
column: IColumn
|
|
10
|
+
}>()
|
|
11
|
+
|
|
12
|
+
const getValue = computed(() => props.value)
|
|
13
|
+
</script>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<template>{{ getValue }}</template>
|
|
2
|
-
<script lang="ts" setup>
|
|
3
|
-
import { StringHelper } from '../../utils/StringHelper'
|
|
4
|
-
import { computed } from 'vue'
|
|
5
|
-
import { type IColumn } from '#core/components/Table/types'
|
|
6
|
-
|
|
7
|
-
const props = defineProps<{
|
|
8
|
-
value: any
|
|
9
|
-
row: any
|
|
10
|
-
column: IColumn
|
|
11
|
-
}>()
|
|
12
|
-
|
|
13
|
-
const getValue = computed(() => StringHelper.withComma(props.value))
|
|
14
|
-
</script>
|
|
1
|
+
<template>{{ getValue }}</template>
|
|
2
|
+
<script lang="ts" setup>
|
|
3
|
+
import { StringHelper } from '../../utils/StringHelper'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
import { type IColumn } from '#core/components/Table/types'
|
|
6
|
+
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
value: any
|
|
9
|
+
row: any
|
|
10
|
+
column: IColumn
|
|
11
|
+
}>()
|
|
12
|
+
|
|
13
|
+
const getValue = computed(() => StringHelper.withComma(props.value))
|
|
14
|
+
</script>
|