@finema/core 1.4.71 → 1.4.72

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 (46) 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/Form/FieldWrapper.vue +23 -23
  15. package/dist/runtime/components/Form/Fields.vue +153 -153
  16. package/dist/runtime/components/Form/InputCheckbox/index.vue +21 -21
  17. package/dist/runtime/components/Form/InputDateTime/index.vue +60 -60
  18. package/dist/runtime/components/Form/InputRadio/index.vue +27 -27
  19. package/dist/runtime/components/Form/InputSelect/index.vue +36 -36
  20. package/dist/runtime/components/Form/InputStatic/index.vue +16 -16
  21. package/dist/runtime/components/Form/InputText/index.vue +54 -54
  22. package/dist/runtime/components/Form/InputTextarea/index.vue +25 -25
  23. package/dist/runtime/components/Form/InputToggle/index.vue +14 -14
  24. package/dist/runtime/components/Form/InputUploadDropzone/index.vue +158 -158
  25. package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +242 -242
  26. package/dist/runtime/components/Form/InputUploadFileClassic/index.vue +102 -102
  27. package/dist/runtime/components/Form/InputUploadFileClassicAuto/index.vue +166 -166
  28. package/dist/runtime/components/Form/index.vue +6 -6
  29. package/dist/runtime/components/Icon.vue +23 -23
  30. package/dist/runtime/components/Image.vue +36 -36
  31. package/dist/runtime/components/Loader.vue +14 -14
  32. package/dist/runtime/components/Modal/index.vue +146 -146
  33. package/dist/runtime/components/SimplePagination.vue +96 -96
  34. package/dist/runtime/components/Slideover/index.vue +110 -110
  35. package/dist/runtime/components/Table/Base.vue +139 -139
  36. package/dist/runtime/components/Table/ColumnDate.vue +16 -16
  37. package/dist/runtime/components/Table/ColumnDateTime.vue +18 -18
  38. package/dist/runtime/components/Table/ColumnImage.vue +15 -15
  39. package/dist/runtime/components/Table/ColumnNumber.vue +14 -14
  40. package/dist/runtime/components/Table/ColumnText.vue +25 -25
  41. package/dist/runtime/components/Table/Simple.vue +64 -64
  42. package/dist/runtime/components/Table/index.vue +60 -60
  43. package/dist/runtime/components/Tabs/index.vue +64 -64
  44. package/dist/runtime/composables/useForm.d.ts +2 -2
  45. package/dist/runtime/ui.css +32 -32
  46. package/package.json +88 -88
@@ -1,102 +1,102 @@
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
- :required="isRequired"
11
- :disabled="isDisabled"
12
- @change="handleChange"
13
- />
14
- <div :class="[ui.wrapper]">
15
- <div :class="[ui.selectFileBox]">
16
- <Button size="2xs" @click="handleOpenFile">{{ selectFileLabel || 'Choose File' }}</Button>
17
- <p :class="ui.placeholder">
18
- {{ value?.name ?? placeholder ?? 'No file chosen' }}
19
- </p>
20
- <Badge v-if="value" size="xs" variant="outline">
21
- {{ isSelectedFileUseMb ? `${selectedFileSizeMb} MB` : `${selectedFileSizeKb} KB` }}
22
- </Badge>
23
- </div>
24
- </div>
25
- </div>
26
- </FieldWrapper>
27
- </template>
28
- <script lang="ts" setup>
29
- import { useFieldHOC } from '#core/composables/useForm'
30
- import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
31
- import { type IUploadFileClassicFieldProps } from '#core/components/Form/InputUploadFileClassic/types'
32
- import { useUiConfig } from '#core/composables/useConfig'
33
- import { uploadFileInputClassicAuto } from '#core/ui.config'
34
- import { computed, ref, toRef, useUI } from '#imports'
35
- import i18next from 'i18next'
36
-
37
- const config = useUiConfig<typeof uploadFileInputClassicAuto>(
38
- uploadFileInputClassicAuto,
39
- 'uploadFileInputClassicAuto'
40
- )
41
-
42
- const emits = defineEmits(['change'])
43
- const props = withDefaults(defineProps<IUploadFileClassicFieldProps>(), {})
44
-
45
- const { value, wrapperProps, setErrors } = useFieldHOC<File | undefined>(props)
46
- const selectedFileSizeKb = computed(() => ((value.value?.size || 0) / 1000).toFixed(2))
47
- const selectedFileSizeMb = computed(() => ((value.value?.size || 0) / 1000 / 1000).toFixed(2))
48
-
49
- const isSelectedFileUseMb = computed(() => (value.value?.size || 0) / 1000 > 1024)
50
- const isAcceptFileUseMb = computed(() => acceptFileSizeKb.value && acceptFileSizeKb.value > 1024)
51
- const acceptFileSizeMb = computed(() => ((acceptFileSizeKb.value || 0) / 1024).toFixed(2))
52
- const acceptFileSizeKb = computed(() => props.maxSize)
53
- const acceptFile = computed(() =>
54
- typeof props.accept === 'string' ? props.accept : props.accept?.join(',')
55
- )
56
-
57
- const fileInput = ref<HTMLInputElement>()
58
-
59
- const handleOpenFile = () => {
60
- fileInput.value?.click()
61
- }
62
-
63
- const { ui } = useUI('uploadFileInputClassicAuto', toRef(props, 'ui'), config)
64
-
65
- const checkMaxSize = (file: File): boolean => {
66
- if (acceptFileSizeKb.value) {
67
- return file.size / 1000 <= acceptFileSizeKb.value
68
- }
69
-
70
- return true
71
- }
72
-
73
- const handleCheckFileCondition = (file: File | undefined): boolean => {
74
- if (!file) return false
75
-
76
- const maxSize = checkMaxSize(file)
77
-
78
- if (!maxSize) {
79
- if (isAcceptFileUseMb.value) {
80
- setErrors(i18next.t('custom:invalid_file_size_mb', { size: acceptFileSizeMb.value }))
81
- } else {
82
- setErrors(i18next.t('custom:invalid_file_size_kb', { size: acceptFileSizeKb.value }))
83
- }
84
-
85
- return false
86
- }
87
-
88
- setErrors('')
89
-
90
- return true
91
- }
92
-
93
- const handleChange = (e: Event) => {
94
- const file = (e.target as HTMLInputElement).files?.[0]
95
- const result = handleCheckFileCondition(file)
96
-
97
- if (result && file) {
98
- value.value = file
99
- emits('change', file)
100
- }
101
- }
102
- </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
+ :required="isRequired"
11
+ :disabled="isDisabled"
12
+ @change="handleChange"
13
+ />
14
+ <div :class="[ui.wrapper]">
15
+ <div :class="[ui.selectFileBox]">
16
+ <Button size="2xs" @click="handleOpenFile">{{ selectFileLabel || 'Choose File' }}</Button>
17
+ <p :class="ui.placeholder">
18
+ {{ value?.name ?? placeholder ?? 'No file chosen' }}
19
+ </p>
20
+ <Badge v-if="value" size="xs" variant="outline">
21
+ {{ isSelectedFileUseMb ? `${selectedFileSizeMb} MB` : `${selectedFileSizeKb} KB` }}
22
+ </Badge>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </FieldWrapper>
27
+ </template>
28
+ <script lang="ts" setup>
29
+ import { useFieldHOC } from '#core/composables/useForm'
30
+ import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
31
+ import { type IUploadFileClassicFieldProps } from '#core/components/Form/InputUploadFileClassic/types'
32
+ import { useUiConfig } from '#core/composables/useConfig'
33
+ import { uploadFileInputClassicAuto } from '#core/ui.config'
34
+ import { computed, ref, toRef, useUI } from '#imports'
35
+ import i18next from 'i18next'
36
+
37
+ const config = useUiConfig<typeof uploadFileInputClassicAuto>(
38
+ uploadFileInputClassicAuto,
39
+ 'uploadFileInputClassicAuto'
40
+ )
41
+
42
+ const emits = defineEmits(['change'])
43
+ const props = withDefaults(defineProps<IUploadFileClassicFieldProps>(), {})
44
+
45
+ const { value, wrapperProps, setErrors } = useFieldHOC<File | undefined>(props)
46
+ const selectedFileSizeKb = computed(() => ((value.value?.size || 0) / 1000).toFixed(2))
47
+ const selectedFileSizeMb = computed(() => ((value.value?.size || 0) / 1000 / 1000).toFixed(2))
48
+
49
+ const isSelectedFileUseMb = computed(() => (value.value?.size || 0) / 1000 > 1024)
50
+ const isAcceptFileUseMb = computed(() => acceptFileSizeKb.value && acceptFileSizeKb.value > 1024)
51
+ const acceptFileSizeMb = computed(() => ((acceptFileSizeKb.value || 0) / 1024).toFixed(2))
52
+ const acceptFileSizeKb = computed(() => props.maxSize)
53
+ const acceptFile = computed(() =>
54
+ typeof props.accept === 'string' ? props.accept : props.accept?.join(',')
55
+ )
56
+
57
+ const fileInput = ref<HTMLInputElement>()
58
+
59
+ const handleOpenFile = () => {
60
+ fileInput.value?.click()
61
+ }
62
+
63
+ const { ui } = useUI('uploadFileInputClassicAuto', toRef(props, 'ui'), config)
64
+
65
+ const checkMaxSize = (file: File): boolean => {
66
+ if (acceptFileSizeKb.value) {
67
+ return file.size / 1000 <= acceptFileSizeKb.value
68
+ }
69
+
70
+ return true
71
+ }
72
+
73
+ const handleCheckFileCondition = (file: File | undefined): boolean => {
74
+ if (!file) return false
75
+
76
+ const maxSize = checkMaxSize(file)
77
+
78
+ if (!maxSize) {
79
+ if (isAcceptFileUseMb.value) {
80
+ setErrors(i18next.t('custom:invalid_file_size_mb', { size: acceptFileSizeMb.value }))
81
+ } else {
82
+ setErrors(i18next.t('custom:invalid_file_size_kb', { size: acceptFileSizeKb.value }))
83
+ }
84
+
85
+ return false
86
+ }
87
+
88
+ setErrors('')
89
+
90
+ return true
91
+ }
92
+
93
+ const handleChange = (e: Event) => {
94
+ const file = (e.target as HTMLInputElement).files?.[0]
95
+ const result = handleCheckFileCondition(file)
96
+
97
+ if (result && file) {
98
+ value.value = file
99
+ emits('change', file)
100
+ }
101
+ }
102
+ </script>
@@ -1,166 +1,166 @@
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
- :required="isRequired"
11
- :disabled="isDisabled"
12
- @change="handleChange"
13
- />
14
- <div :class="[ui.wrapper]">
15
- <div :class="[ui.selectFileBox]">
16
- <Button size="2xs" @click="handleOpenFile">{{ selectFileLabel || 'Choose File' }}</Button>
17
- <p :class="ui.placeholder">
18
- {{ selectedFile?.name ?? placeholder ?? 'No file chosen' }}
19
- </p>
20
- <Badge v-if="selectedFile" size="xs" variant="outline">
21
- {{ isSelectedFileUseMb ? `${selectedFileSizeMb} MB` : `${selectedFileSizeKb} KB` }}
22
- </Badge>
23
- </div>
24
- <div v-if="selectedFile">
25
- <Icon
26
- v-if="upload.status.value.isSuccess"
27
- name="heroicons:check-circle-20-solid"
28
- class="text-success"
29
- />
30
- <Icon
31
- v-if="upload.status.value.isError"
32
- name="heroicons:x-circle-20-solid"
33
- class="text-danger"
34
- />
35
- <Icon
36
- v-if="upload.status.value.isLoading"
37
- name="i-svg-spinners:180-ring-with-bg"
38
- class="text-primary"
39
- />
40
- </div>
41
- </div>
42
- </div>
43
- <img v-if="imagePreviewURL && value" :src="imagePreviewURL" alt="" :class="ui.previewURL" />
44
- </FieldWrapper>
45
- </template>
46
-
47
- <script lang="tsx" setup>
48
- import { computed, ref, StringHelper, toRef, useUI, useUiConfig, useWatchTrue } from '#imports'
49
- import { type IUploadFileProps } from './types'
50
- import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
51
- import { useFieldHOC } from '#core/composables/useForm'
52
- import { type IUploadRequest, useUploadLoader } from '#core/composables/useUpload'
53
- import { uploadFileInputClassicAuto } from '#core/ui.config'
54
- import i18next from 'i18next'
55
-
56
- const config = useUiConfig<typeof uploadFileInputClassicAuto>(
57
- uploadFileInputClassicAuto,
58
- 'uploadFileInputClassicAuto'
59
- )
60
-
61
- const emits = defineEmits(['success'])
62
- const props = withDefaults(defineProps<IUploadFileProps>(), {})
63
-
64
- const { wrapperProps, setErrors, value } = useFieldHOC<string>(props)
65
-
66
- const request: IUploadRequest = {
67
- pathURL: props.uploadPathURL,
68
- requestOptions: props.requestOptions,
69
- }
70
-
71
- const upload = useUploadLoader(request)
72
-
73
- const fileInput = ref<HTMLInputElement>()
74
- const selectedFile = ref<File | undefined>()
75
- const percent = ref<number>(0)
76
-
77
- const selectedFileSizeKb = computed(() => ((selectedFile.value?.size || 0) / 1000).toFixed(2))
78
- const selectedFileSizeMb = computed(() =>
79
- ((selectedFile.value?.size || 0) / 1000 / 1000).toFixed(2)
80
- )
81
-
82
- const isSelectedFileUseMb = computed(() => (selectedFile.value?.size || 0) / 1000 > 1024)
83
-
84
- const acceptFileSizeKb = computed(() => props.maxSize)
85
- const acceptFileSizeMb = computed(() => ((acceptFileSizeKb.value || 0) / 1024).toFixed(2))
86
- const isAcceptFileUseMb = computed(() => acceptFileSizeKb.value && acceptFileSizeKb.value > 1024)
87
- const acceptFile = computed(() =>
88
- typeof props.accept === 'string' ? props.accept : props.accept?.join(',')
89
- )
90
-
91
- const { ui } = useUI('uploadFileInputClassicAuto', toRef(props, 'ui'), config)
92
-
93
- const handleOpenFile = () => {
94
- fileInput.value?.click()
95
- }
96
-
97
- const handleChange = (e: Event) => {
98
- const file = (e.target as HTMLInputElement).files?.[0]
99
- const result = handleCheckFileCondition(file)
100
-
101
- if (result && file) {
102
- selectedFile.value = file
103
- const formData = new FormData()
104
-
105
- formData.append(props.bodyKey || 'file', file)
106
- upload.run(formData, { data: { onUploadProgress, onDownloadProgress } })
107
- }
108
- }
109
-
110
- const handleCheckFileCondition = (file: File | undefined): boolean => {
111
- if (!file) return false
112
-
113
- const maxSize = checkMaxSize(file)
114
-
115
- if (!maxSize) {
116
- if (isAcceptFileUseMb.value) {
117
- setErrors(i18next.t('custom:invalid_file_size_mb', { size: acceptFileSizeMb.value }))
118
- } else {
119
- setErrors(i18next.t('custom:invalid_file_size_kb', { size: acceptFileSizeKb.value }))
120
- }
121
-
122
- return false
123
- }
124
-
125
- setErrors('')
126
-
127
- return true
128
- }
129
-
130
- const checkMaxSize = (file: File): boolean => {
131
- if (acceptFileSizeKb.value) {
132
- return file.size / 1000 <= acceptFileSizeKb.value
133
- }
134
-
135
- return true
136
- }
137
-
138
- const onUploadProgress = (progressEvent: ProgressEvent) => {
139
- percent.value = (Math.floor((progressEvent.loaded * 100) / progressEvent.total) || 0) * 0.8
140
- }
141
-
142
- const onDownloadProgress = (progressEvent: ProgressEvent) => {
143
- if (progressEvent.total === 0) {
144
- percent.value = 100
145
-
146
- return
147
- }
148
-
149
- percent.value = (Math.floor((progressEvent.loaded * 100) / progressEvent.total) || 0) * 0.2 + 80
150
- }
151
-
152
- useWatchTrue(
153
- () => upload.status.value.isSuccess,
154
- () => {
155
- value.value = upload.data.value[props.responseKey || 'url']
156
- emits('success', upload.data.value)
157
- }
158
- )
159
-
160
- useWatchTrue(
161
- () => upload.status.value.isError,
162
- () => {
163
- setErrors(StringHelper.getError(upload.status.value.errorData))
164
- }
165
- )
166
- </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
+ :required="isRequired"
11
+ :disabled="isDisabled"
12
+ @change="handleChange"
13
+ />
14
+ <div :class="[ui.wrapper]">
15
+ <div :class="[ui.selectFileBox]">
16
+ <Button size="2xs" @click="handleOpenFile">{{ selectFileLabel || 'Choose File' }}</Button>
17
+ <p :class="ui.placeholder">
18
+ {{ selectedFile?.name ?? placeholder ?? 'No file chosen' }}
19
+ </p>
20
+ <Badge v-if="selectedFile" size="xs" variant="outline">
21
+ {{ isSelectedFileUseMb ? `${selectedFileSizeMb} MB` : `${selectedFileSizeKb} KB` }}
22
+ </Badge>
23
+ </div>
24
+ <div v-if="selectedFile">
25
+ <Icon
26
+ v-if="upload.status.value.isSuccess"
27
+ name="heroicons:check-circle-20-solid"
28
+ class="text-success"
29
+ />
30
+ <Icon
31
+ v-if="upload.status.value.isError"
32
+ name="heroicons:x-circle-20-solid"
33
+ class="text-danger"
34
+ />
35
+ <Icon
36
+ v-if="upload.status.value.isLoading"
37
+ name="i-svg-spinners:180-ring-with-bg"
38
+ class="text-primary"
39
+ />
40
+ </div>
41
+ </div>
42
+ </div>
43
+ <img v-if="imagePreviewURL && value" :src="imagePreviewURL" alt="" :class="ui.previewURL" />
44
+ </FieldWrapper>
45
+ </template>
46
+
47
+ <script lang="tsx" setup>
48
+ import { computed, ref, StringHelper, toRef, useUI, useUiConfig, useWatchTrue } from '#imports'
49
+ import { type IUploadFileProps } from './types'
50
+ import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
51
+ import { useFieldHOC } from '#core/composables/useForm'
52
+ import { type IUploadRequest, useUploadLoader } from '#core/composables/useUpload'
53
+ import { uploadFileInputClassicAuto } from '#core/ui.config'
54
+ import i18next from 'i18next'
55
+
56
+ const config = useUiConfig<typeof uploadFileInputClassicAuto>(
57
+ uploadFileInputClassicAuto,
58
+ 'uploadFileInputClassicAuto'
59
+ )
60
+
61
+ const emits = defineEmits(['success'])
62
+ const props = withDefaults(defineProps<IUploadFileProps>(), {})
63
+
64
+ const { wrapperProps, setErrors, value } = useFieldHOC<string>(props)
65
+
66
+ const request: IUploadRequest = {
67
+ pathURL: props.uploadPathURL,
68
+ requestOptions: props.requestOptions,
69
+ }
70
+
71
+ const upload = useUploadLoader(request)
72
+
73
+ const fileInput = ref<HTMLInputElement>()
74
+ const selectedFile = ref<File | undefined>()
75
+ const percent = ref<number>(0)
76
+
77
+ const selectedFileSizeKb = computed(() => ((selectedFile.value?.size || 0) / 1000).toFixed(2))
78
+ const selectedFileSizeMb = computed(() =>
79
+ ((selectedFile.value?.size || 0) / 1000 / 1000).toFixed(2)
80
+ )
81
+
82
+ const isSelectedFileUseMb = computed(() => (selectedFile.value?.size || 0) / 1000 > 1024)
83
+
84
+ const acceptFileSizeKb = computed(() => props.maxSize)
85
+ const acceptFileSizeMb = computed(() => ((acceptFileSizeKb.value || 0) / 1024).toFixed(2))
86
+ const isAcceptFileUseMb = computed(() => acceptFileSizeKb.value && acceptFileSizeKb.value > 1024)
87
+ const acceptFile = computed(() =>
88
+ typeof props.accept === 'string' ? props.accept : props.accept?.join(',')
89
+ )
90
+
91
+ const { ui } = useUI('uploadFileInputClassicAuto', toRef(props, 'ui'), config)
92
+
93
+ const handleOpenFile = () => {
94
+ fileInput.value?.click()
95
+ }
96
+
97
+ const handleChange = (e: Event) => {
98
+ const file = (e.target as HTMLInputElement).files?.[0]
99
+ const result = handleCheckFileCondition(file)
100
+
101
+ if (result && file) {
102
+ selectedFile.value = file
103
+ const formData = new FormData()
104
+
105
+ formData.append(props.bodyKey || 'file', file)
106
+ upload.run(formData, { data: { onUploadProgress, onDownloadProgress } })
107
+ }
108
+ }
109
+
110
+ const handleCheckFileCondition = (file: File | undefined): boolean => {
111
+ if (!file) return false
112
+
113
+ const maxSize = checkMaxSize(file)
114
+
115
+ if (!maxSize) {
116
+ if (isAcceptFileUseMb.value) {
117
+ setErrors(i18next.t('custom:invalid_file_size_mb', { size: acceptFileSizeMb.value }))
118
+ } else {
119
+ setErrors(i18next.t('custom:invalid_file_size_kb', { size: acceptFileSizeKb.value }))
120
+ }
121
+
122
+ return false
123
+ }
124
+
125
+ setErrors('')
126
+
127
+ return true
128
+ }
129
+
130
+ const checkMaxSize = (file: File): boolean => {
131
+ if (acceptFileSizeKb.value) {
132
+ return file.size / 1000 <= acceptFileSizeKb.value
133
+ }
134
+
135
+ return true
136
+ }
137
+
138
+ const onUploadProgress = (progressEvent: ProgressEvent) => {
139
+ percent.value = (Math.floor((progressEvent.loaded * 100) / progressEvent.total) || 0) * 0.8
140
+ }
141
+
142
+ const onDownloadProgress = (progressEvent: ProgressEvent) => {
143
+ if (progressEvent.total === 0) {
144
+ percent.value = 100
145
+
146
+ return
147
+ }
148
+
149
+ percent.value = (Math.floor((progressEvent.loaded * 100) / progressEvent.total) || 0) * 0.2 + 80
150
+ }
151
+
152
+ useWatchTrue(
153
+ () => upload.status.value.isSuccess,
154
+ () => {
155
+ value.value = upload.data.value[props.responseKey || 'url']
156
+ emits('success', upload.data.value)
157
+ }
158
+ )
159
+
160
+ useWatchTrue(
161
+ () => upload.status.value.isError,
162
+ () => {
163
+ setErrors(StringHelper.getError(upload.status.value.errorData))
164
+ }
165
+ )
166
+ </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>
@@ -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>