@finema/core 1.4.89 → 1.4.90

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 (47) hide show
  1. package/README.md +63 -63
  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 +53 -53
  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 +76 -76
  10. package/dist/runtime/components/Card.vue +38 -38
  11. package/dist/runtime/components/Core.vue +13 -13
  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 +90 -90
  15. package/dist/runtime/components/FlexDeck/index.vue +66 -66
  16. package/dist/runtime/components/Form/FieldWrapper.vue +23 -23
  17. package/dist/runtime/components/Form/Fields.vue +160 -160
  18. package/dist/runtime/components/Form/InputCheckbox/index.vue +21 -21
  19. package/dist/runtime/components/Form/InputDateTime/index.vue +60 -60
  20. package/dist/runtime/components/Form/InputNumber/index.vue +27 -27
  21. package/dist/runtime/components/Form/InputRadio/index.vue +27 -27
  22. package/dist/runtime/components/Form/InputSelect/index.vue +36 -36
  23. package/dist/runtime/components/Form/InputStatic/index.vue +16 -16
  24. package/dist/runtime/components/Form/InputText/index.vue +67 -67
  25. package/dist/runtime/components/Form/InputTextarea/index.vue +25 -25
  26. package/dist/runtime/components/Form/InputToggle/index.vue +14 -14
  27. package/dist/runtime/components/Form/InputUploadDropzone/index.vue +158 -158
  28. package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +243 -243
  29. package/dist/runtime/components/Form/InputUploadFileClassic/index.vue +101 -101
  30. package/dist/runtime/components/Form/InputUploadFileClassicAuto/index.vue +174 -174
  31. package/dist/runtime/components/Form/index.vue +6 -6
  32. package/dist/runtime/components/Icon.vue +23 -23
  33. package/dist/runtime/components/Image.vue +36 -36
  34. package/dist/runtime/components/Loader.vue +27 -27
  35. package/dist/runtime/components/Modal/index.vue +146 -146
  36. package/dist/runtime/components/SimplePagination.vue +96 -96
  37. package/dist/runtime/components/Slideover/index.vue +110 -110
  38. package/dist/runtime/components/Table/Base.vue +139 -139
  39. package/dist/runtime/components/Table/ColumnDate.vue +16 -16
  40. package/dist/runtime/components/Table/ColumnDateTime.vue +18 -18
  41. package/dist/runtime/components/Table/ColumnImage.vue +15 -15
  42. package/dist/runtime/components/Table/ColumnNumber.vue +14 -14
  43. package/dist/runtime/components/Table/ColumnText.vue +25 -25
  44. package/dist/runtime/components/Table/Simple.vue +69 -69
  45. package/dist/runtime/components/Table/index.vue +65 -65
  46. package/dist/runtime/components/Tabs/index.vue +64 -64
  47. package/package.json +88 -88
@@ -1,90 +1,90 @@
1
- <template>
2
- <slot v-if="status.isLoading" name="loading-state">
3
- <div class="flex h-60 items-center justify-center">
4
- <Icon name="i-svg-spinners:180-ring-with-bg" class="text-primary size-8" />
5
- </div>
6
- </slot>
7
- <slot v-if="!status.isLoading && rawData.length === 0" name="empty-state">
8
- <div class="min-h-60">
9
- <p class="text-center text-sm italic">ไม่พบข้อมูล!</p>
10
- </div>
11
- </slot>
12
- <div v-if="status.isSuccess" :class="containerClass">
13
- <slot v-for="(row, index) in rawData" :key="index" :row="row" />
14
- </div>
15
- <div v-if="pageOptions" class="mt-4 flex justify-between px-3">
16
- <p class="text-xs text-gray-500">
17
- ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
18
- </p>
19
- <UPagination
20
- v-if="pageOptions.totalPage > 1 && !isSimplePagination && !isHideBottomPagination"
21
- v-model="page"
22
- :page-count="pageOptions.limit"
23
- :total="pageOptions.totalCount"
24
- />
25
- <SimplePagination
26
- v-if="pageOptions.totalPage > 1 && isSimplePagination"
27
- v-model="page"
28
- :page-count="pageOptions.limit"
29
- :total="pageOptions.totalCount"
30
- />
31
- </div>
32
- </template>
33
-
34
- <script lang="ts" setup>
35
- import { computed, type PropType } from 'vue'
36
- import { StringHelper } from '#core/utils/StringHelper'
37
- import { ref, watch } from '#imports'
38
- import type { IFlexDeckOptions } from '#core/components/FlexDeck/types'
39
-
40
- const emits = defineEmits(['pageChange'])
41
-
42
- const props = defineProps({
43
- status: {
44
- type: Object as PropType<IFlexDeckOptions['status']>,
45
- required: true,
46
- },
47
- pageOptions: {
48
- type: Object as PropType<IFlexDeckOptions['pageOptions']>,
49
- required: false,
50
- },
51
- rawData: {
52
- type: Array as PropType<IFlexDeckOptions['rawData']>,
53
- required: true,
54
- },
55
- isSimplePagination: {
56
- type: Boolean as PropType<IFlexDeckOptions['isSimplePagination']>,
57
- default: false,
58
- },
59
- isHideBottomPagination: {
60
- type: Boolean as PropType<IFlexDeckOptions['isHideBottomPagination']>,
61
- default: false,
62
- },
63
- containerClass: { type: [String, Array, Object] },
64
- })
65
-
66
- const page = ref(props.pageOptions?.currentPage || 1)
67
-
68
- const pageBetween = computed((): string => {
69
- const length = props.rawData?.length
70
-
71
- if (length === 0) {
72
- return '0'
73
- }
74
-
75
- const start = (props.pageOptions!.currentPage - 1) * props.pageOptions!.limit + 1
76
- const end = start + length - 1
77
-
78
- return `${start} - ${end}`
79
- })
80
-
81
- const totalCountWithComma = computed((): string => {
82
- return !props.pageOptions!.totalCount
83
- ? '0'
84
- : StringHelper.withComma(props.pageOptions!.totalCount)
85
- })
86
-
87
- watch(page, () => {
88
- emits('pageChange', page.value)
89
- })
90
- </script>
1
+ <template>
2
+ <slot v-if="status.isLoading" name="loading-state">
3
+ <div class="flex h-60 items-center justify-center">
4
+ <Icon name="i-svg-spinners:180-ring-with-bg" class="text-primary size-8" />
5
+ </div>
6
+ </slot>
7
+ <slot v-if="!status.isLoading && rawData.length === 0" name="empty-state">
8
+ <div class="min-h-60">
9
+ <p class="text-center text-sm italic">ไม่พบข้อมูล!</p>
10
+ </div>
11
+ </slot>
12
+ <div v-if="status.isSuccess" :class="containerClass">
13
+ <slot v-for="(row, index) in rawData" :key="index" :row="row" />
14
+ </div>
15
+ <div v-if="pageOptions" class="mt-4 flex justify-between px-3">
16
+ <p class="text-xs text-gray-500">
17
+ ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
18
+ </p>
19
+ <UPagination
20
+ v-if="pageOptions.totalPage > 1 && !isSimplePagination && !isHideBottomPagination"
21
+ v-model="page"
22
+ :page-count="pageOptions.limit"
23
+ :total="pageOptions.totalCount"
24
+ />
25
+ <SimplePagination
26
+ v-if="pageOptions.totalPage > 1 && isSimplePagination"
27
+ v-model="page"
28
+ :page-count="pageOptions.limit"
29
+ :total="pageOptions.totalCount"
30
+ />
31
+ </div>
32
+ </template>
33
+
34
+ <script lang="ts" setup>
35
+ import { computed, type PropType } from 'vue'
36
+ import { StringHelper } from '#core/utils/StringHelper'
37
+ import { ref, watch } from '#imports'
38
+ import type { IFlexDeckOptions } from '#core/components/FlexDeck/types'
39
+
40
+ const emits = defineEmits(['pageChange'])
41
+
42
+ const props = defineProps({
43
+ status: {
44
+ type: Object as PropType<IFlexDeckOptions['status']>,
45
+ required: true,
46
+ },
47
+ pageOptions: {
48
+ type: Object as PropType<IFlexDeckOptions['pageOptions']>,
49
+ required: false,
50
+ },
51
+ rawData: {
52
+ type: Array as PropType<IFlexDeckOptions['rawData']>,
53
+ required: true,
54
+ },
55
+ isSimplePagination: {
56
+ type: Boolean as PropType<IFlexDeckOptions['isSimplePagination']>,
57
+ default: false,
58
+ },
59
+ isHideBottomPagination: {
60
+ type: Boolean as PropType<IFlexDeckOptions['isHideBottomPagination']>,
61
+ default: false,
62
+ },
63
+ containerClass: { type: [String, Array, Object] },
64
+ })
65
+
66
+ const page = ref(props.pageOptions?.currentPage || 1)
67
+
68
+ const pageBetween = computed((): string => {
69
+ const length = props.rawData?.length
70
+
71
+ if (length === 0) {
72
+ return '0'
73
+ }
74
+
75
+ const start = (props.pageOptions!.currentPage - 1) * props.pageOptions!.limit + 1
76
+ const end = start + length - 1
77
+
78
+ return `${start} - ${end}`
79
+ })
80
+
81
+ const totalCountWithComma = computed((): string => {
82
+ return !props.pageOptions!.totalCount
83
+ ? '0'
84
+ : StringHelper.withComma(props.pageOptions!.totalCount)
85
+ })
86
+
87
+ watch(page, () => {
88
+ emits('pageChange', page.value)
89
+ })
90
+ </script>
@@ -1,66 +1,66 @@
1
- <template>
2
- <div>
3
- <div v-if="options.isEnabledSearch" class="mb-4 flex justify-end">
4
- <UInput
5
- v-model="q"
6
- icon="i-heroicons-magnifying-glass"
7
- :placeholder="options.searchPlaceholder || 'ค้นหา...'"
8
- />
9
- </div>
10
- <Base
11
- :raw-data="options.rawData"
12
- :status="options.status"
13
- :page-options="options.pageOptions"
14
- :is-simple-pagination="isShowSimplePagination"
15
- :is-hide-bottom-pagination="options.isHideBottomPagination"
16
- :container-class="containerClass"
17
- @page-change="onPageChange"
18
- >
19
- <template v-for="(_, slot) of $slots" #[slot]="slotProps">
20
- <slot :name="slot" v-bind="slotProps || {}" />
21
- </template>
22
- </Base>
23
- </div>
24
- </template>
25
- <script lang="ts" setup>
26
- import { type PropType } from 'vue'
27
- import { _debounce, computed, ref, watch } from '#imports'
28
- import { useCoreConfig } from '#core/composables/useConfig'
29
- import Base from '#core/components/FlexDeck/Base.vue'
30
- import type { IFlexDeckOptions } from '#core/components/FlexDeck/types'
31
-
32
- defineSlots<{
33
- default: (props: { row: any }) => any
34
- 'empty-state': () => any
35
- 'loading-state': () => any
36
- }>()
37
-
38
- const emits = defineEmits<{
39
- (event: 'pageChange', page: number): void
40
- (event: 'search', q: string): void
41
- }>()
42
-
43
- const props = defineProps({
44
- options: { type: Object as PropType<IFlexDeckOptions>, required: true },
45
- containerClass: { type: [String, Array, Object], default: '' },
46
- })
47
-
48
- const coreConfig = useCoreConfig()
49
-
50
- const q = ref(props.options?.pageOptions.search ?? '')
51
-
52
- const isShowSimplePagination = computed(
53
- (): boolean => props.options.isSimplePagination ?? coreConfig.is_simple_pagination
54
- )
55
-
56
- watch(
57
- q,
58
- _debounce((value) => {
59
- emits('search', value)
60
- }, 500)
61
- )
62
-
63
- const onPageChange = (page: number) => {
64
- emits('pageChange', page)
65
- }
66
- </script>
1
+ <template>
2
+ <div>
3
+ <div v-if="options.isEnabledSearch" class="mb-4 flex justify-end">
4
+ <UInput
5
+ v-model="q"
6
+ icon="i-heroicons-magnifying-glass"
7
+ :placeholder="options.searchPlaceholder || 'ค้นหา...'"
8
+ />
9
+ </div>
10
+ <Base
11
+ :raw-data="options.rawData"
12
+ :status="options.status"
13
+ :page-options="options.pageOptions"
14
+ :is-simple-pagination="isShowSimplePagination"
15
+ :is-hide-bottom-pagination="options.isHideBottomPagination"
16
+ :container-class="containerClass"
17
+ @page-change="onPageChange"
18
+ >
19
+ <template v-for="(_, slot) of $slots" #[slot]="slotProps">
20
+ <slot :name="slot" v-bind="slotProps || {}" />
21
+ </template>
22
+ </Base>
23
+ </div>
24
+ </template>
25
+ <script lang="ts" setup>
26
+ import { type PropType } from 'vue'
27
+ import { _debounce, computed, ref, watch } from '#imports'
28
+ import { useCoreConfig } from '#core/composables/useConfig'
29
+ import Base from '#core/components/FlexDeck/Base.vue'
30
+ import type { IFlexDeckOptions } from '#core/components/FlexDeck/types'
31
+
32
+ defineSlots<{
33
+ default: (props: { row: any }) => any
34
+ 'empty-state': () => any
35
+ 'loading-state': () => any
36
+ }>()
37
+
38
+ const emits = defineEmits<{
39
+ (event: 'pageChange', page: number): void
40
+ (event: 'search', q: string): void
41
+ }>()
42
+
43
+ const props = defineProps({
44
+ options: { type: Object as PropType<IFlexDeckOptions>, required: true },
45
+ containerClass: { type: [String, Array, Object], default: '' },
46
+ })
47
+
48
+ const coreConfig = useCoreConfig()
49
+
50
+ const q = ref(props.options?.pageOptions.search ?? '')
51
+
52
+ const isShowSimplePagination = computed(
53
+ (): boolean => props.options.isSimplePagination ?? coreConfig.is_simple_pagination
54
+ )
55
+
56
+ watch(
57
+ q,
58
+ _debounce((value) => {
59
+ emits('search', value)
60
+ }, 500)
61
+ )
62
+
63
+ const onPageChange = (page: number) => {
64
+ emits('pageChange', page)
65
+ }
66
+ </script>
@@ -1,23 +1,23 @@
1
- <template>
2
- <UFormGroup
3
- :label="label"
4
- :name="name"
5
- :description="description"
6
- :hint="hint"
7
- :size="size as FormGroupSize"
8
- :data-testid="name"
9
- :help="help"
10
- :error="errorMessage"
11
- :required="!!isRequired"
12
- :ui="containerUi"
13
- >
14
- <slot />
15
- </UFormGroup>
16
- </template>
17
-
18
- <script lang="ts" setup>
19
- import { type IFieldProps } from '#core/components/Form/types'
20
- import type { FormGroupSize } from '#ui/types'
21
-
22
- defineProps<IFieldProps>()
23
- </script>
1
+ <template>
2
+ <UFormGroup
3
+ :label="label"
4
+ :name="name"
5
+ :description="description"
6
+ :hint="hint"
7
+ :size="size as FormGroupSize"
8
+ :data-testid="name"
9
+ :help="help"
10
+ :error="errorMessage"
11
+ :required="!!isRequired"
12
+ :ui="containerUi"
13
+ >
14
+ <slot />
15
+ </UFormGroup>
16
+ </template>
17
+
18
+ <script lang="ts" setup>
19
+ import { type IFieldProps } from '#core/components/Form/types'
20
+ import type { FormGroupSize } from '#ui/types'
21
+
22
+ defineProps<IFieldProps>()
23
+ </script>