@finema/core 1.4.193 → 1.4.195

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.
Files changed (62) hide show
  1. package/README.md +60 -60
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +1 -1
  4. package/dist/runtime/components/Alert.vue +48 -48
  5. package/dist/runtime/components/Avatar.vue +27 -27
  6. package/dist/runtime/components/Badge.vue +11 -11
  7. package/dist/runtime/components/Breadcrumb.vue +44 -44
  8. package/dist/runtime/components/Button/Group.vue +37 -37
  9. package/dist/runtime/components/Button/index.vue +75 -75
  10. package/dist/runtime/components/Card.vue +38 -38
  11. package/dist/runtime/components/Core.vue +45 -45
  12. package/dist/runtime/components/Dialog/index.vue +108 -108
  13. package/dist/runtime/components/Dropdown/index.vue +70 -70
  14. package/dist/runtime/components/FlexDeck/Base.vue +153 -153
  15. package/dist/runtime/components/FlexDeck/index.vue +68 -68
  16. package/dist/runtime/components/Form/FieldWrapper.vue +23 -23
  17. package/dist/runtime/components/Form/Fields.vue +230 -230
  18. package/dist/runtime/components/Form/InputCheckbox/index.vue +28 -28
  19. package/dist/runtime/components/Form/InputDateTime/index.vue +61 -61
  20. package/dist/runtime/components/Form/InputDateTimeRange/index.vue +83 -83
  21. package/dist/runtime/components/Form/InputNumber/index.vue +27 -27
  22. package/dist/runtime/components/Form/InputRadio/index.vue +27 -27
  23. package/dist/runtime/components/Form/InputSelect/index.vue +45 -45
  24. package/dist/runtime/components/Form/InputSelectMultiple/index.vue +54 -54
  25. package/dist/runtime/components/Form/InputStatic/index.vue +16 -16
  26. package/dist/runtime/components/Form/InputTags/index.vue +141 -141
  27. package/dist/runtime/components/Form/InputText/index.vue +68 -68
  28. package/dist/runtime/components/Form/InputTextarea/index.vue +25 -25
  29. package/dist/runtime/components/Form/InputToggle/index.vue +27 -27
  30. package/dist/runtime/components/Form/InputUploadDropzone/index.vue +206 -206
  31. package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +342 -342
  32. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/ItemUpload.vue +241 -241
  33. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/ItemView.vue +89 -89
  34. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue +170 -170
  35. package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/ItemUpload.vue +161 -161
  36. package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/ItemView.vue +64 -64
  37. package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/index.vue +178 -178
  38. package/dist/runtime/components/Form/InputUploadFileClassic/index.vue +95 -95
  39. package/dist/runtime/components/Form/InputUploadFileClassicAuto/index.vue +151 -151
  40. package/dist/runtime/components/Form/InputUploadImageAuto/index.vue +219 -219
  41. package/dist/runtime/components/Form/InputWYSIWYG/UploadImageForm.vue +55 -55
  42. package/dist/runtime/components/Form/InputWYSIWYG/index.vue +228 -228
  43. package/dist/runtime/components/Form/index.vue +6 -6
  44. package/dist/runtime/components/Icon.vue +23 -23
  45. package/dist/runtime/components/Image.vue +36 -36
  46. package/dist/runtime/components/Loader.vue +27 -27
  47. package/dist/runtime/components/Modal/index.vue +146 -146
  48. package/dist/runtime/components/QRCode.vue +22 -22
  49. package/dist/runtime/components/SimplePagination.vue +96 -96
  50. package/dist/runtime/components/Slideover/index.vue +110 -110
  51. package/dist/runtime/components/Table/Base.vue +154 -160
  52. package/dist/runtime/components/Table/Base.vue~ +159 -0
  53. package/dist/runtime/components/Table/ColumnDate.vue +16 -16
  54. package/dist/runtime/components/Table/ColumnDateTime.vue +18 -18
  55. package/dist/runtime/components/Table/ColumnImage.vue +15 -15
  56. package/dist/runtime/components/Table/ColumnNumber.vue +14 -14
  57. package/dist/runtime/components/Table/ColumnText.vue +29 -29
  58. package/dist/runtime/components/Table/Simple.vue +69 -69
  59. package/dist/runtime/components/Table/index.vue +65 -65
  60. package/dist/runtime/components/Tabs/index.vue +64 -64
  61. package/dist/runtime/components/TeleportSafe.vue +40 -40
  62. package/package.json +101 -101
@@ -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="size-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 { useUI } from '#ui/composables/useUI'
34
- import { slideover } from '#core/ui.config'
35
- import { useUiConfig } from '#core/composables/useConfig'
36
- import type { Strategy } from '#ui/types'
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="size-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 { useUI } from '#ui/composables/useUI'
34
+ import { slideover } from '#core/ui.config'
35
+ import { useUiConfig } from '#core/composables/useConfig'
36
+ import type { Strategy } from '#ui/types'
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,160 +1,154 @@
1
- <template>
2
- <div v-if="!isHideCaption || !isHideBottomPagination" class="mb-4 text-gray-500">
3
- <span class="font-bold">ผลลัพธ์ทั้งหมด:</span>
4
- จำนวน
5
- <span class="font-bold">{{ pageOptions?.totalCount || 0 }}</span>
6
- รายการ
7
- </div>
8
- <UTable
9
- :loading="status.isLoading"
10
- :columns="columns"
11
- :rows="rawData"
12
- :progress="null as unknown as any"
13
- v-bind="$attrs"
14
- >
15
- <template #loading-state>
16
- <div class="flex h-60 items-center justify-center">
17
- <Icon name="i-svg-spinners:180-ring-with-bg" class="text-primary size-8" />
18
- </div>
19
- </template>
20
- <template #empty-state>
21
- <div class="flex flex-col items-center justify-center gap-3 py-6">
22
- <span class="text-sm italic">ไม่พบข้อมูล!</span>
23
- </div>
24
- </template>
25
- <template v-for="column in columns" #[`${column.key}-data`]="{ row }" :key="column.key">
26
- <ColumnNumber
27
- v-if="column.type === COLUMN_TYPES.NUMBER"
28
- :value="transformValue(column, row)"
29
- :column="column"
30
- :class="column.class"
31
- :row="row"
32
- />
33
- <ColumnImage
34
- v-else-if="column.type === COLUMN_TYPES.IMAGE"
35
- :value="transformValue(column, row)"
36
- :column="column"
37
- :class="column.class"
38
- :row="row"
39
- />
40
- <ColumnDateTime
41
- v-else-if="column.type === COLUMN_TYPES.DATE_TIME"
42
- :value="transformValue(column, row)"
43
- :column="column"
44
- :class="column.class"
45
- :row="row"
46
- />
47
- <ColumnDate
48
- v-else-if="column.type === COLUMN_TYPES.DATE"
49
- :value="transformValue(column, row)"
50
- :column="column"
51
- :class="column.class"
52
- :row="row"
53
- />
54
- <component
55
- :is="column.component"
56
- v-else-if="column.type === COLUMN_TYPES.COMPONENT"
57
- :value="transformValue(column, row)"
58
- :column="column"
59
- :class="column.class"
60
- :row="row"
61
- />
62
- <ColumnText v-else :value="transformValue(column, row)" :column="column" :row="row" />
63
- </template>
64
-
65
- <template v-for="(_, slot) of $slots" #[slot]="scope">
66
- <slot :name="slot" v-bind="scope" />
67
- </template>
68
- </UTable>
69
- <div v-if="pageOptions" class="mt-4 flex justify-between px-3">
70
- <p class="text-xs text-gray-500">
71
- ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
72
- </p>
73
- <UPagination
74
- v-if="pageOptions.totalPage > 1 && !isSimplePagination && !isHideBottomPagination"
75
- v-model="page"
76
- :page-count="pageOptions.limit"
77
- :total="pageOptions.totalCount"
78
- />
79
- <SimplePagination
80
- v-if="pageOptions.totalPage > 1 && isSimplePagination"
81
- v-model="page"
82
- :page-count="pageOptions.limit"
83
- :total="pageOptions.totalCount"
84
- />
85
- </div>
86
- </template>
87
-
88
- <script lang="ts" setup>
89
- import { COLUMN_TYPES, type IColumn, type ITableOptions } from '#core/components/Table/types'
90
- import ColumnNumber from '#core/components/Table/ColumnNumber.vue'
91
- import ColumnImage from '#core/components/Table/ColumnImage.vue'
92
- import { computed, type PropType } from 'vue'
93
- import { StringHelper } from '#core/utils/StringHelper'
94
- import { ref, watch } from '#imports'
95
- import ColumnDateTime from '#core/components/Table/ColumnDateTime.vue'
96
- import ColumnDate from '#core/components/Table/ColumnDate.vue'
97
- import ColumnText from '#core/components/Table/ColumnText.vue'
98
-
99
- const emits = defineEmits(['pageChange'])
100
-
101
- const props = defineProps({
102
- status: {
103
- type: Object as PropType<ITableOptions['status']>,
104
- required: true,
105
- },
106
- pageOptions: {
107
- type: Object as PropType<ITableOptions['pageOptions']>,
108
- required: false,
109
- },
110
- columns: {
111
- type: Array as PropType<ITableOptions['columns']>,
112
- required: true,
113
- },
114
- rawData: {
115
- type: Array as PropType<ITableOptions['rawData']>,
116
- required: true,
117
- },
118
- isSimplePagination: {
119
- type: Boolean as PropType<ITableOptions['isSimplePagination']>,
120
- default: false,
121
- },
122
- isHideBottomPagination: {
123
- type: Boolean as PropType<ITableOptions['isHideBottomPagination']>,
124
- default: false,
125
- },
126
- isHideCaption: {
127
- type: Boolean as PropType<ITableOptions['isHideCaption']>,
128
- default: false,
129
- },
130
- })
131
-
132
- const page = ref(props.pageOptions?.currentPage || 1)
133
-
134
- const pageBetween = computed((): string => {
135
- const length = props.rawData?.length
136
-
137
- if (length === 0) {
138
- return '0'
139
- }
140
-
141
- const start = (props.pageOptions!.currentPage - 1) * props.pageOptions!.limit + 1
142
- const end = start + length - 1
143
-
144
- return `${start} - ${end}`
145
- })
146
-
147
- const transformValue = (column: IColumn, row: any) => {
148
- return column.transform ? column.transform(row[column.key], row, column) : row[column.key]
149
- }
150
-
151
- const totalCountWithComma = computed((): string => {
152
- return !props.pageOptions!.totalCount
153
- ? '0'
154
- : StringHelper.withComma(props.pageOptions!.totalCount)
155
- })
156
-
157
- watch(page, () => {
158
- emits('pageChange', page.value)
159
- })
160
- </script>
1
+ <template>
2
+ <div v-if="!isHideCaption || !isHideBottomPagination" class="mb-4 text-gray-500">
3
+ <span class="font-bold">ผลลัพธ์ทั้งหมด:</span>
4
+ จำนวน
5
+ <span class="font-bold">{{ pageOptions?.totalCount || 0 }}</span>
6
+ รายการ
7
+ </div>
8
+ <UTable :loading="status.isLoading" :columns="columns" :rows="rawData" v-bind="$attrs">
9
+ <template #loading-state>
10
+ <div class="flex h-60 items-center justify-center">
11
+ <Icon name="i-svg-spinners:180-ring-with-bg" class="text-primary size-8" />
12
+ </div>
13
+ </template>
14
+ <template #empty-state>
15
+ <div class="flex flex-col items-center justify-center gap-3 py-6">
16
+ <span class="text-sm italic">ไม่พบข้อมูล!</span>
17
+ </div>
18
+ </template>
19
+ <template v-for="column in columns" #[`${column.key}-data`]="{ row }" :key="column.key">
20
+ <ColumnNumber
21
+ v-if="column.type === COLUMN_TYPES.NUMBER"
22
+ :value="transformValue(column, row)"
23
+ :column="column"
24
+ :class="column.class"
25
+ :row="row"
26
+ />
27
+ <ColumnImage
28
+ v-else-if="column.type === COLUMN_TYPES.IMAGE"
29
+ :value="transformValue(column, row)"
30
+ :column="column"
31
+ :class="column.class"
32
+ :row="row"
33
+ />
34
+ <ColumnDateTime
35
+ v-else-if="column.type === COLUMN_TYPES.DATE_TIME"
36
+ :value="transformValue(column, row)"
37
+ :column="column"
38
+ :class="column.class"
39
+ :row="row"
40
+ />
41
+ <ColumnDate
42
+ v-else-if="column.type === COLUMN_TYPES.DATE"
43
+ :value="transformValue(column, row)"
44
+ :column="column"
45
+ :class="column.class"
46
+ :row="row"
47
+ />
48
+ <component
49
+ :is="column.component"
50
+ v-else-if="column.type === COLUMN_TYPES.COMPONENT"
51
+ :value="transformValue(column, row)"
52
+ :column="column"
53
+ :class="column.class"
54
+ :row="row"
55
+ />
56
+ <ColumnText v-else :value="transformValue(column, row)" :column="column" :row="row" />
57
+ </template>
58
+
59
+ <template v-for="(_, slot) of $slots" #[slot]="scope">
60
+ <slot :name="slot" v-bind="scope" />
61
+ </template>
62
+ </UTable>
63
+ <div v-if="pageOptions" class="mt-4 flex justify-between px-3">
64
+ <p class="text-xs text-gray-500">
65
+ ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
66
+ </p>
67
+ <UPagination
68
+ v-if="pageOptions.totalPage > 1 && !isSimplePagination && !isHideBottomPagination"
69
+ v-model="page"
70
+ :page-count="pageOptions.limit"
71
+ :total="pageOptions.totalCount"
72
+ />
73
+ <SimplePagination
74
+ v-if="pageOptions.totalPage > 1 && isSimplePagination"
75
+ v-model="page"
76
+ :page-count="pageOptions.limit"
77
+ :total="pageOptions.totalCount"
78
+ />
79
+ </div>
80
+ </template>
81
+
82
+ <script lang="ts" setup>
83
+ import { COLUMN_TYPES, type IColumn, type ITableOptions } from '#core/components/Table/types'
84
+ import ColumnNumber from '#core/components/Table/ColumnNumber.vue'
85
+ import ColumnImage from '#core/components/Table/ColumnImage.vue'
86
+ import { computed, type PropType } from 'vue'
87
+ import { StringHelper } from '#core/utils/StringHelper'
88
+ import { ref, watch } from '#imports'
89
+ import ColumnDateTime from '#core/components/Table/ColumnDateTime.vue'
90
+ import ColumnDate from '#core/components/Table/ColumnDate.vue'
91
+ import ColumnText from '#core/components/Table/ColumnText.vue'
92
+
93
+ const emits = defineEmits(['pageChange'])
94
+
95
+ const props = defineProps({
96
+ status: {
97
+ type: Object as PropType<ITableOptions['status']>,
98
+ required: true,
99
+ },
100
+ pageOptions: {
101
+ type: Object as PropType<ITableOptions['pageOptions']>,
102
+ required: false,
103
+ },
104
+ columns: {
105
+ type: Array as PropType<ITableOptions['columns']>,
106
+ required: true,
107
+ },
108
+ rawData: {
109
+ type: Array as PropType<ITableOptions['rawData']>,
110
+ required: true,
111
+ },
112
+ isSimplePagination: {
113
+ type: Boolean as PropType<ITableOptions['isSimplePagination']>,
114
+ default: false,
115
+ },
116
+ isHideBottomPagination: {
117
+ type: Boolean as PropType<ITableOptions['isHideBottomPagination']>,
118
+ default: false,
119
+ },
120
+ isHideCaption: {
121
+ type: Boolean as PropType<ITableOptions['isHideCaption']>,
122
+ default: false,
123
+ },
124
+ })
125
+
126
+ const page = ref(props.pageOptions?.currentPage || 1)
127
+
128
+ const pageBetween = computed((): string => {
129
+ const length = props.rawData?.length
130
+
131
+ if (length === 0) {
132
+ return '0'
133
+ }
134
+
135
+ const start = (props.pageOptions!.currentPage - 1) * props.pageOptions!.limit + 1
136
+ const end = start + length - 1
137
+
138
+ return `${start} - ${end}`
139
+ })
140
+
141
+ const transformValue = (column: IColumn, row: any) => {
142
+ return column.transform ? column.transform(row[column.key], row, column) : row[column.key]
143
+ }
144
+
145
+ const totalCountWithComma = computed((): string => {
146
+ return !props.pageOptions!.totalCount
147
+ ? '0'
148
+ : StringHelper.withComma(props.pageOptions!.totalCount)
149
+ })
150
+
151
+ watch(page, () => {
152
+ emits('pageChange', page.value)
153
+ })
154
+ </script>