@finema/core 1.4.90 → 1.4.92

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 (60) hide show
  1. package/README.md +63 -63
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +3 -2
  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 +168 -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 +205 -158
  28. package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +349 -243
  29. package/dist/runtime/components/Form/InputUploadDropzoneAuto/types.d.ts +3 -0
  30. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/Item.vue +282 -0
  31. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue +117 -0
  32. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/types.d.ts +22 -0
  33. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/types.mjs +0 -0
  34. package/dist/runtime/components/Form/InputUploadFileClassic/index.vue +101 -101
  35. package/dist/runtime/components/Form/InputUploadFileClassicAuto/index.vue +174 -174
  36. package/dist/runtime/components/Form/index.vue +6 -6
  37. package/dist/runtime/components/Form/types.d.ts +4 -2
  38. package/dist/runtime/components/Form/types.mjs +1 -0
  39. package/dist/runtime/components/Icon.vue +23 -23
  40. package/dist/runtime/components/Image.vue +36 -36
  41. package/dist/runtime/components/Loader.vue +27 -27
  42. package/dist/runtime/components/Modal/index.vue +146 -146
  43. package/dist/runtime/components/SimplePagination.vue +96 -96
  44. package/dist/runtime/components/Slideover/index.vue +110 -110
  45. package/dist/runtime/components/Table/Base.vue +139 -139
  46. package/dist/runtime/components/Table/ColumnDate.vue +16 -16
  47. package/dist/runtime/components/Table/ColumnDateTime.vue +18 -18
  48. package/dist/runtime/components/Table/ColumnImage.vue +15 -15
  49. package/dist/runtime/components/Table/ColumnNumber.vue +14 -14
  50. package/dist/runtime/components/Table/ColumnText.vue +25 -25
  51. package/dist/runtime/components/Table/Simple.vue +69 -69
  52. package/dist/runtime/components/Table/index.vue +65 -65
  53. package/dist/runtime/components/Tabs/index.vue +64 -64
  54. package/dist/runtime/helpers/componentHelper.d.ts +9 -0
  55. package/dist/runtime/helpers/componentHelper.mjs +30 -0
  56. package/dist/runtime/ui.config/uploadFileDropzone.d.ts +36 -13
  57. package/dist/runtime/ui.config/uploadFileDropzone.mjs +42 -19
  58. package/dist/runtime/utils/StringHelper.d.ts +1 -0
  59. package/dist/runtime/utils/StringHelper.mjs +6 -0
  60. package/package.json +88 -88
@@ -1,174 +1,174 @@
1
- <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <div :class="[ui.base]">
4
- <input
5
- ref="fileInput"
6
- type="file"
7
- class="hidden"
8
- :name="name"
9
- :accept="acceptFile"
10
- :disabled="isDisabled"
11
- @change="handleChange"
12
- />
13
- <div :class="[ui.wrapper]">
14
- <div :class="[ui.selectFileBox]">
15
- <Button size="2xs" @click="handleOpenFile">{{ selectFileLabel || 'Choose File' }}</Button>
16
- <p :class="ui.placeholder">
17
- {{ selectedFile?.name ?? placeholder ?? 'No file chosen' }}
18
- </p>
19
- <Badge v-if="selectedFile" size="xs" variant="outline">
20
- {{ isSelectedFileUseMb ? `${selectedFileSizeMb} MB` : `${selectedFileSizeKb} KB` }}
21
- </Badge>
22
- </div>
23
- <div v-if="selectedFile">
24
- <Icon
25
- v-if="upload.status.value.isSuccess"
26
- name="heroicons:check-circle-20-solid"
27
- class="text-success"
28
- />
29
- <Icon
30
- v-if="upload.status.value.isError"
31
- name="heroicons:x-circle-20-solid"
32
- class="text-danger"
33
- />
34
- <Icon
35
- v-if="upload.status.value.isLoading"
36
- name="i-svg-spinners:180-ring-with-bg"
37
- class="text-primary"
38
- />
39
- </div>
40
- </div>
41
- </div>
42
- <img v-if="imagePreviewURL && value" :src="imagePreviewURL" alt="" :class="ui.previewURL" />
43
- </FieldWrapper>
44
- </template>
45
-
46
- <script lang="tsx" setup>
47
- import {
48
- _get,
49
- computed,
50
- ref,
51
- StringHelper,
52
- toRef,
53
- useUI,
54
- useUiConfig,
55
- useWatchTrue,
56
- } from '#imports'
57
- import { type IUploadFileProps } from './types'
58
- import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
59
- import { useFieldHOC } from '#core/composables/useForm'
60
- import { type IUploadRequest, useUploadLoader } from '#core/composables/useUpload'
61
- import { uploadFileInputClassicAuto } from '#core/ui.config'
62
- import i18next from 'i18next'
63
-
64
- const config = useUiConfig<typeof uploadFileInputClassicAuto>(
65
- uploadFileInputClassicAuto,
66
- 'uploadFileInputClassicAuto'
67
- )
68
-
69
- const emits = defineEmits(['success'])
70
- const props = withDefaults(defineProps<IUploadFileProps>(), {})
71
-
72
- const { wrapperProps, setErrors, value } = useFieldHOC<string>(props)
73
-
74
- const request: IUploadRequest = {
75
- pathURL: props.uploadPathURL,
76
- requestOptions: props.requestOptions,
77
- }
78
-
79
- const upload = useUploadLoader(request)
80
-
81
- const fileInput = ref<HTMLInputElement>()
82
- const selectedFile = ref<File | undefined>()
83
- const percent = ref<number>(0)
84
-
85
- const selectedFileSizeKb = computed(() => ((selectedFile.value?.size || 0) / 1000).toFixed(2))
86
- const selectedFileSizeMb = computed(() =>
87
- ((selectedFile.value?.size || 0) / 1000 / 1000).toFixed(2)
88
- )
89
-
90
- const isSelectedFileUseMb = computed(() => (selectedFile.value?.size || 0) / 1000 > 1024)
91
-
92
- const acceptFileSizeKb = computed(() => props.maxSize)
93
- const acceptFileSizeMb = computed(() => ((acceptFileSizeKb.value || 0) / 1024).toFixed(2))
94
- const isAcceptFileUseMb = computed(() => acceptFileSizeKb.value && acceptFileSizeKb.value > 1024)
95
- const acceptFile = computed(() =>
96
- typeof props.accept === 'string' ? props.accept : props.accept?.join(',')
97
- )
98
-
99
- const { ui } = useUI('uploadFileInputClassicAuto', toRef(props, 'ui'), config)
100
-
101
- const handleOpenFile = () => {
102
- fileInput.value?.click()
103
- }
104
-
105
- const handleChange = (e: Event) => {
106
- const file = (e.target as HTMLInputElement).files?.[0]
107
- const result = handleCheckFileCondition(file)
108
-
109
- if (result && file) {
110
- selectedFile.value = file
111
- const formData = new FormData()
112
-
113
- formData.append(props.bodyKey || 'file', file)
114
- upload.run(formData, { data: { onUploadProgress, onDownloadProgress } })
115
- }
116
- }
117
-
118
- const handleCheckFileCondition = (file: File | undefined): boolean => {
119
- if (!file) return false
120
-
121
- const maxSize = checkMaxSize(file)
122
-
123
- if (!maxSize) {
124
- if (isAcceptFileUseMb.value) {
125
- setErrors(i18next.t('custom:invalid_file_size_mb', { size: acceptFileSizeMb.value }))
126
- } else {
127
- setErrors(i18next.t('custom:invalid_file_size_kb', { size: acceptFileSizeKb.value }))
128
- }
129
-
130
- return false
131
- }
132
-
133
- setErrors('')
134
-
135
- return true
136
- }
137
-
138
- const checkMaxSize = (file: File): boolean => {
139
- if (acceptFileSizeKb.value) {
140
- return file.size / 1000 <= acceptFileSizeKb.value
141
- }
142
-
143
- return true
144
- }
145
-
146
- const onUploadProgress = (progressEvent: ProgressEvent) => {
147
- percent.value = (Math.floor((progressEvent.loaded * 100) / progressEvent.total) || 0) * 0.8
148
- }
149
-
150
- const onDownloadProgress = (progressEvent: ProgressEvent) => {
151
- if (progressEvent.total === 0) {
152
- percent.value = 100
153
-
154
- return
155
- }
156
-
157
- percent.value = (Math.floor((progressEvent.loaded * 100) / progressEvent.total) || 0) * 0.2 + 80
158
- }
159
-
160
- useWatchTrue(
161
- () => upload.status.value.isSuccess,
162
- () => {
163
- value.value = _get(upload.data.value, props.responseKey || 'url')
164
- emits('success', upload.data.value)
165
- }
166
- )
167
-
168
- useWatchTrue(
169
- () => upload.status.value.isError,
170
- () => {
171
- setErrors(StringHelper.getError(upload.status.value.errorData))
172
- }
173
- )
174
- </script>
1
+ <template>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <div :class="[ui.base]">
4
+ <input
5
+ ref="fileInput"
6
+ type="file"
7
+ class="hidden"
8
+ :name="name"
9
+ :accept="acceptFile"
10
+ :disabled="isDisabled"
11
+ @change="handleChange"
12
+ />
13
+ <div :class="[ui.wrapper]">
14
+ <div :class="[ui.selectFileBox]">
15
+ <Button size="2xs" @click="handleOpenFile">{{ selectFileLabel || 'Choose File' }}</Button>
16
+ <p :class="ui.placeholder">
17
+ {{ selectedFile?.name ?? placeholder ?? 'No file chosen' }}
18
+ </p>
19
+ <Badge v-if="selectedFile" size="xs" variant="outline">
20
+ {{ isSelectedFileUseMb ? `${selectedFileSizeMb} MB` : `${selectedFileSizeKb} KB` }}
21
+ </Badge>
22
+ </div>
23
+ <div v-if="selectedFile">
24
+ <Icon
25
+ v-if="upload.status.value.isSuccess"
26
+ name="heroicons:check-circle-20-solid"
27
+ class="text-success"
28
+ />
29
+ <Icon
30
+ v-if="upload.status.value.isError"
31
+ name="heroicons:x-circle-20-solid"
32
+ class="text-danger"
33
+ />
34
+ <Icon
35
+ v-if="upload.status.value.isLoading"
36
+ name="i-svg-spinners:180-ring-with-bg"
37
+ class="text-primary"
38
+ />
39
+ </div>
40
+ </div>
41
+ </div>
42
+ <img v-if="imagePreviewURL && value" :src="imagePreviewURL" alt="" :class="ui.previewURL" />
43
+ </FieldWrapper>
44
+ </template>
45
+
46
+ <script lang="tsx" setup>
47
+ import {
48
+ _get,
49
+ computed,
50
+ ref,
51
+ StringHelper,
52
+ toRef,
53
+ useUI,
54
+ useUiConfig,
55
+ useWatchTrue,
56
+ } from '#imports'
57
+ import { type IUploadFileProps } from './types'
58
+ import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
59
+ import { useFieldHOC } from '#core/composables/useForm'
60
+ import { type IUploadRequest, useUploadLoader } from '#core/composables/useUpload'
61
+ import { uploadFileInputClassicAuto } from '#core/ui.config'
62
+ import i18next from 'i18next'
63
+
64
+ const config = useUiConfig<typeof uploadFileInputClassicAuto>(
65
+ uploadFileInputClassicAuto,
66
+ 'uploadFileInputClassicAuto'
67
+ )
68
+
69
+ const emits = defineEmits(['success'])
70
+ const props = withDefaults(defineProps<IUploadFileProps>(), {})
71
+
72
+ const { wrapperProps, setErrors, value } = useFieldHOC<string>(props)
73
+
74
+ const request: IUploadRequest = {
75
+ pathURL: props.uploadPathURL,
76
+ requestOptions: props.requestOptions,
77
+ }
78
+
79
+ const upload = useUploadLoader(request)
80
+
81
+ const fileInput = ref<HTMLInputElement>()
82
+ const selectedFile = ref<File | undefined>()
83
+ const percent = ref<number>(0)
84
+
85
+ const selectedFileSizeKb = computed(() => ((selectedFile.value?.size || 0) / 1000).toFixed(2))
86
+ const selectedFileSizeMb = computed(() =>
87
+ ((selectedFile.value?.size || 0) / 1000 / 1000).toFixed(2)
88
+ )
89
+
90
+ const isSelectedFileUseMb = computed(() => (selectedFile.value?.size || 0) / 1000 > 1024)
91
+
92
+ const acceptFileSizeKb = computed(() => props.maxSize)
93
+ const acceptFileSizeMb = computed(() => ((acceptFileSizeKb.value || 0) / 1024).toFixed(2))
94
+ const isAcceptFileUseMb = computed(() => acceptFileSizeKb.value && acceptFileSizeKb.value > 1024)
95
+ const acceptFile = computed(() =>
96
+ typeof props.accept === 'string' ? props.accept : props.accept?.join(',')
97
+ )
98
+
99
+ const { ui } = useUI('uploadFileInputClassicAuto', toRef(props, 'ui'), config)
100
+
101
+ const handleOpenFile = () => {
102
+ fileInput.value?.click()
103
+ }
104
+
105
+ const handleChange = (e: Event) => {
106
+ const file = (e.target as HTMLInputElement).files?.[0]
107
+ const result = handleCheckFileCondition(file)
108
+
109
+ if (result && file) {
110
+ selectedFile.value = file
111
+ const formData = new FormData()
112
+
113
+ formData.append(props.bodyKey || 'file', file)
114
+ upload.run(formData, { data: { onUploadProgress, onDownloadProgress } })
115
+ }
116
+ }
117
+
118
+ const handleCheckFileCondition = (file: File | undefined): boolean => {
119
+ if (!file) return false
120
+
121
+ const maxSize = checkMaxSize(file)
122
+
123
+ if (!maxSize) {
124
+ if (isAcceptFileUseMb.value) {
125
+ setErrors(i18next.t('custom:invalid_file_size_mb', { size: acceptFileSizeMb.value }))
126
+ } else {
127
+ setErrors(i18next.t('custom:invalid_file_size_kb', { size: acceptFileSizeKb.value }))
128
+ }
129
+
130
+ return false
131
+ }
132
+
133
+ setErrors('')
134
+
135
+ return true
136
+ }
137
+
138
+ const checkMaxSize = (file: File): boolean => {
139
+ if (acceptFileSizeKb.value) {
140
+ return file.size / 1000 <= acceptFileSizeKb.value
141
+ }
142
+
143
+ return true
144
+ }
145
+
146
+ const onUploadProgress = (progressEvent: ProgressEvent) => {
147
+ percent.value = (Math.floor((progressEvent.loaded * 100) / progressEvent.total) || 0) * 0.8
148
+ }
149
+
150
+ const onDownloadProgress = (progressEvent: ProgressEvent) => {
151
+ if (progressEvent.total === 0) {
152
+ percent.value = 100
153
+
154
+ return
155
+ }
156
+
157
+ percent.value = (Math.floor((progressEvent.loaded * 100) / progressEvent.total) || 0) * 0.2 + 80
158
+ }
159
+
160
+ useWatchTrue(
161
+ () => upload.status.value.isSuccess,
162
+ () => {
163
+ value.value = _get(upload.data.value, props.responseKey || 'url')
164
+ emits('success', upload.data.value)
165
+ }
166
+ )
167
+
168
+ useWatchTrue(
169
+ () => upload.status.value.isError,
170
+ () => {
171
+ setErrors(StringHelper.getError(upload.status.value.errorData))
172
+ }
173
+ )
174
+ </script>
@@ -1,6 +1,6 @@
1
- <template>
2
- <form class="form">
3
- <slot />
4
- </form>
5
- </template>
6
- <script lang="ts" setup></script>
1
+ <template>
2
+ <form class="form">
3
+ <slot />
4
+ </form>
5
+ </template>
6
+ <script lang="ts" setup></script>
@@ -13,6 +13,7 @@ import { type IUploadFileField } from '#core/components/Form/InputUploadFileClas
13
13
  import { type IUploadDropzoneField } from '#core/components/Form/InputUploadDropzone/types';
14
14
  import { type IUploadDropzoneAutoField } from '#core/components/Form/InputUploadDropzoneAuto/types';
15
15
  import type { INumberField } from '#core/components/Form/InputNumber/types';
16
+ import type { IUploadDropzoneAutoMultipleField } from '#core/components/Form/InputUploadDropzoneAutoMultiple/types';
16
17
  export declare const enum INPUT_TYPES {
17
18
  TEXT = "TEXT",
18
19
  NUMBER = "NUMBER",
@@ -29,7 +30,8 @@ export declare const enum INPUT_TYPES {
29
30
  UPLOAD_FILE_CLASSIC = "UPLOAD_FILE_CLASSIC",
30
31
  UPLOAD_FILE_CLASSIC_AUTO = "UPLOAD_FILE_CLASSIC_AUTO",
31
32
  UPLOAD_DROPZONE = "UPLOAD_DROPZONE",
32
- UPLOAD_DROPZONE_AUTO = "UPLOAD_DROPZONE_AUTO"
33
+ UPLOAD_DROPZONE_AUTO = "UPLOAD_DROPZONE_AUTO",
34
+ UPLOAD_DROPZONE_AUTO_MULTIPLE = "UPLOAD_DROPZONE_AUTO_MULTIPLE"
33
35
  }
34
36
  export interface IFieldProps {
35
37
  form?: FormContext;
@@ -58,4 +60,4 @@ export interface IFormFieldBase<I extends INPUT_TYPES, P extends IFieldProps, O>
58
60
  props: P;
59
61
  on?: O;
60
62
  }
61
- export type IFormField = ITextField | INumberField | IStaticField | ICheckboxField | IRadioField | ISelectField | IToggleField | ITextareaField | IDateTimeField | IUploadFileClassicField | IUploadFileField | IUploadDropzoneField | IUploadDropzoneAutoField;
63
+ export type IFormField = ITextField | INumberField | IStaticField | ICheckboxField | IRadioField | ISelectField | IToggleField | ITextareaField | IDateTimeField | IUploadFileClassicField | IUploadFileField | IUploadDropzoneField | IUploadDropzoneAutoField | IUploadDropzoneAutoMultipleField;
@@ -15,5 +15,6 @@ export var INPUT_TYPES = /* @__PURE__ */ ((INPUT_TYPES2) => {
15
15
  INPUT_TYPES2["UPLOAD_FILE_CLASSIC_AUTO"] = "UPLOAD_FILE_CLASSIC_AUTO";
16
16
  INPUT_TYPES2["UPLOAD_DROPZONE"] = "UPLOAD_DROPZONE";
17
17
  INPUT_TYPES2["UPLOAD_DROPZONE_AUTO"] = "UPLOAD_DROPZONE_AUTO";
18
+ INPUT_TYPES2["UPLOAD_DROPZONE_AUTO_MULTIPLE"] = "UPLOAD_DROPZONE_AUTO_MULTIPLE";
18
19
  return INPUT_TYPES2;
19
20
  })(INPUT_TYPES || {});
@@ -1,23 +1,23 @@
1
- <template>
2
- <UIcon :name="name" :dynamic="dynamicValue" />
3
- </template>
4
-
5
- <script lang="ts" setup>
6
- import { computed, useUiConfig } from '#imports'
7
- import { icon } from '#core/ui.config'
8
-
9
- const props = defineProps({
10
- name: {
11
- type: String,
12
- required: true,
13
- },
14
- dynamic: {
15
- type: Boolean,
16
- default: false,
17
- },
18
- })
19
-
20
- const config = useUiConfig<typeof icon>(icon, 'icon')
21
-
22
- const dynamicValue = computed(() => props.dynamic || config.dynamic)
23
- </script>
1
+ <template>
2
+ <UIcon :name="name" :dynamic="dynamicValue" />
3
+ </template>
4
+
5
+ <script lang="ts" setup>
6
+ import { computed, useUiConfig } from '#imports'
7
+ import { icon } from '#core/ui.config'
8
+
9
+ const props = defineProps({
10
+ name: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ dynamic: {
15
+ type: Boolean,
16
+ default: false,
17
+ },
18
+ })
19
+
20
+ const config = useUiConfig<typeof icon>(icon, 'icon')
21
+
22
+ const dynamicValue = computed(() => props.dynamic || config.dynamic)
23
+ </script>
@@ -1,36 +1,36 @@
1
- <template>
2
- <img :src="getSrc" />
3
- </template>
4
- <script lang="ts" setup>
5
- import { useImage } from '@vueuse/core'
6
- import { computed } from 'vue'
7
-
8
- const props = defineProps({
9
- src: {
10
- type: String,
11
- required: true,
12
- },
13
- loadingSrc: {
14
- type: String,
15
- default: '',
16
- },
17
- errorSrc: {
18
- type: String,
19
- default: '',
20
- },
21
- })
22
-
23
- const { isLoading, error } = useImage({ src: props.src })
24
-
25
- const getSrc = computed(() => {
26
- if (isLoading.value) {
27
- return props.loadingSrc
28
- }
29
-
30
- if (error.value) {
31
- return props.errorSrc
32
- }
33
-
34
- return props.src
35
- })
36
- </script>
1
+ <template>
2
+ <img :src="getSrc" />
3
+ </template>
4
+ <script lang="ts" setup>
5
+ import { useImage } from '@vueuse/core'
6
+ import { computed } from 'vue'
7
+
8
+ const props = defineProps({
9
+ src: {
10
+ type: String,
11
+ required: true,
12
+ },
13
+ loadingSrc: {
14
+ type: String,
15
+ default: '',
16
+ },
17
+ errorSrc: {
18
+ type: String,
19
+ default: '',
20
+ },
21
+ })
22
+
23
+ const { isLoading, error } = useImage({ src: props.src })
24
+
25
+ const getSrc = computed(() => {
26
+ if (isLoading.value) {
27
+ return props.loadingSrc
28
+ }
29
+
30
+ if (error.value) {
31
+ return props.errorSrc
32
+ }
33
+
34
+ return props.src
35
+ })
36
+ </script>
@@ -1,27 +1,27 @@
1
- <template>
2
- <div
3
- v-if="isLoading"
4
- :class="[
5
- 'flex items-center justify-center',
6
- $attrs.class,
7
- {
8
- 'min-h-[200px]': !$attrs.class,
9
- },
10
- ]"
11
- >
12
- <UIcon name="i-svg-spinners:180-ring-with-bg" class="text-primary text-4xl" dynamic />
13
- </div>
14
- <slot v-else />
15
- </template>
16
- <script lang="ts" setup>
17
- defineOptions({
18
- inheritAttrs: false,
19
- })
20
-
21
- defineProps({
22
- isLoading: {
23
- type: Boolean,
24
- default: true,
25
- },
26
- })
27
- </script>
1
+ <template>
2
+ <div
3
+ v-if="isLoading"
4
+ :class="[
5
+ 'flex items-center justify-center',
6
+ $attrs.class,
7
+ {
8
+ 'min-h-[200px]': !$attrs.class,
9
+ },
10
+ ]"
11
+ >
12
+ <UIcon name="i-svg-spinners:180-ring-with-bg" class="text-primary text-4xl" dynamic />
13
+ </div>
14
+ <slot v-else />
15
+ </template>
16
+ <script lang="ts" setup>
17
+ defineOptions({
18
+ inheritAttrs: false,
19
+ })
20
+
21
+ defineProps({
22
+ isLoading: {
23
+ type: Boolean,
24
+ default: true,
25
+ },
26
+ })
27
+ </script>