@finema/core 3.2.0 → 3.3.0

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 (42) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +1 -1
  3. package/dist/runtime/components/Form/FieldWrapper.vue +13 -13
  4. package/dist/runtime/components/Form/Fields.vue +18 -14
  5. package/dist/runtime/components/Form/InputCheckbox/index.vue +18 -18
  6. package/dist/runtime/components/Form/InputCurrency/index.vue +49 -49
  7. package/dist/runtime/components/Form/InputNumber/index.vue +20 -20
  8. package/dist/runtime/components/Form/InputSelect/index.vue +38 -38
  9. package/dist/runtime/components/Form/InputSelectMultiple/index.vue +43 -43
  10. package/dist/runtime/components/Form/InputTags/index.vue +23 -23
  11. package/dist/runtime/components/Form/InputTextarea/index.vue +18 -18
  12. package/dist/runtime/components/Form/InputTime/index.vue +38 -38
  13. package/dist/runtime/components/Form/InputToggle/index.vue +17 -17
  14. package/dist/runtime/components/Form/InputUploadDropzone/index.vue +30 -30
  15. package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +50 -50
  16. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue +31 -31
  17. package/dist/runtime/components/Form/InputUploadImageAuto/index.d.vue.ts +26 -0
  18. package/dist/runtime/components/Form/InputUploadImageAuto/index.vue +131 -0
  19. package/dist/runtime/components/Form/InputUploadImageAuto/index.vue.d.ts +26 -0
  20. package/dist/runtime/components/Form/InputUploadImageAuto/types.d.ts +37 -0
  21. package/dist/runtime/components/Form/InputUploadImageAuto/types.js +0 -0
  22. package/dist/runtime/components/Form/InputWYSIWYG/types.d.ts +15 -1
  23. package/dist/runtime/components/Form/fileState/EmptyState.vue +21 -21
  24. package/dist/runtime/components/Form/fileState/FailedState.vue +33 -33
  25. package/dist/runtime/components/Form/fileState/LoadingState.vue +24 -24
  26. package/dist/runtime/components/Form/fileState/MultipleFilesState.vue +145 -145
  27. package/dist/runtime/components/Form/fileState/PreviewModal.vue +23 -23
  28. package/dist/runtime/components/Form/fileState/useUploadImageState.d.ts +25 -0
  29. package/dist/runtime/components/Form/fileState/useUploadImageState.js +257 -0
  30. package/dist/runtime/components/Form/index.vue +5 -5
  31. package/dist/runtime/components/Form/types.d.ts +2 -1
  32. package/dist/runtime/components/Image.vue +28 -28
  33. package/dist/runtime/components/Log/index.vue +17 -17
  34. package/dist/runtime/components/Table/ColumnDate.vue +1 -1
  35. package/dist/runtime/components/Table/ColumnDateTime.vue +1 -1
  36. package/dist/runtime/components/Table/ColumnImage.vue +4 -4
  37. package/dist/runtime/components/Table/ColumnText.vue +1 -1
  38. package/dist/runtime/components/Table/Pagination.vue +46 -46
  39. package/dist/runtime/components/Table/Simple.vue +17 -17
  40. package/dist/runtime/helpers/apiPageHelper.js +4 -4
  41. package/dist/runtime/server/tsconfig.json +3 -3
  42. package/package.json +1 -1
@@ -1,28 +1,28 @@
1
1
  <template>
2
- <div :class="theme.onLoadingWrapper()">
3
- <div :class="theme.onLoadingPlaceholderWrapper()">
4
- <Icon
5
- :name="getFileIcon(selectedFile)"
6
- :class="theme.onLoadingPlaceholderIconClass()"
7
- />
8
- </div>
9
- <div :class="theme.onLoadingTextWrapper()">
10
- <div class="truncate">
11
- <h1 class="truncate font-bold">
12
- {{ selectedFile.name }}
13
- </h1>
14
- <p class="truncate font-light text-gray-400">
15
- {{ getFileSize(selectedFile) }} - {{ percent }}% {{ uploadingLabel }}
16
- </p>
17
- </div>
18
- <div>
19
- <Icon
20
- :name="icons.loadingIcon"
21
- :class="theme.onLoadingLoadingIconClass()"
22
- />
23
- </div>
24
- </div>
25
- </div>
2
+ <div :class="theme.onLoadingWrapper()">
3
+ <div :class="theme.onLoadingPlaceholderWrapper()">
4
+ <Icon
5
+ :name="getFileIcon(selectedFile)"
6
+ :class="theme.onLoadingPlaceholderIconClass()"
7
+ />
8
+ </div>
9
+ <div :class="theme.onLoadingTextWrapper()">
10
+ <div class="truncate">
11
+ <h1 class="truncate font-bold">
12
+ {{ selectedFile.name }}
13
+ </h1>
14
+ <p class="truncate font-light text-gray-400">
15
+ {{ getFileSize(selectedFile) }} - {{ percent }}% {{ uploadingLabel }}
16
+ </p>
17
+ </div>
18
+ <div>
19
+ <Icon
20
+ :name="icons.loadingIcon"
21
+ :class="theme.onLoadingLoadingIconClass()"
22
+ />
23
+ </div>
24
+ </div>
25
+ </div>
26
26
  </template>
27
27
 
28
28
  <script setup>
@@ -1,149 +1,149 @@
1
1
  <template>
2
- <div :class="theme.multipleFilesWrapper()">
3
- <div
4
- v-for="(item, index) in fileItems"
5
- :key="index"
6
- :class="theme.fileItemWrapper()"
7
- >
8
- <!-- Uploading State -->
9
- <div
10
- v-if="item.state === UploadState.UPLOADING"
11
- :class="theme.uploadingItemWrapper()"
12
- >
13
- <div :class="theme.uploadingIconWrapper()">
14
- <Icon
15
- :name="icons.filePreviewIcon"
16
- :class="theme.uploadingIconClass()"
17
- />
18
- </div>
19
- <div :class="theme.uploadingTextWrapper()">
20
- <h1 class="truncate font-bold">
21
- {{ item.file.name }}
22
- </h1>
23
- <div class="flex items-center gap-2">
24
- <div :class="theme.progressBarWrapper()">
25
- <div
26
- :class="theme.progressBarFill()"
27
- :style="{ width: `${item.progress}%` }"
28
- />
29
- </div>
30
- <p class="text-sm text-gray-400">
31
- {{ item.progress }}%
32
- </p>
33
- </div>
34
- </div>
35
- </div>
36
-
37
- <!-- Success State -->
38
- <div
39
- v-else-if="item.state === UploadState.SUCCESS && item.value"
40
- :class="theme.successItemWrapper()"
41
- >
42
- <div
43
- v-if="isImageFromPath(item.value.path)"
44
- :class="theme.successImgWrapper()"
45
- >
46
- <img
47
- :src="item.value.url"
48
- :class="theme.successImgClass()"
49
- alt="img-preview"
50
- />
51
- </div>
52
- <div
53
- v-else
54
- :class="theme.successFileWrapper()"
55
- >
56
- <Icon
57
- :name="icons.filePreviewIcon"
58
- :class="theme.successFileClass()"
59
- />
60
- </div>
61
- <div :class="theme.successTextWrapper()">
62
- <div class="truncate">
63
- <h1 class="truncate font-bold">
64
- {{ item.value.name }}
65
- </h1>
66
- <p class="truncate text-sm font-light text-gray-400">
67
- {{ getFileSizeFromValue(item.value) }}
68
- </p>
69
- </div>
70
- <div :class="theme.actionWrapper()">
71
- <a
72
- v-if="isPDFFromPath(item.value.path)"
73
- :href="item.value.url"
74
- target="_blank"
75
- class="flex"
76
- >
77
- <Icon
78
- :name="icons.actionPreviewIcon"
79
- :class="theme.actionIconClass()"
80
- title="ดูตัวอย่าง"
81
- />
82
- </a>
83
- <Icon
84
- v-if="isImageFromPath(item.value.path) || isVideoFromPath(item.value.path)"
85
- :name="icons.actionPreviewIcon"
86
- :class="theme.actionIconClass()"
87
- title="ดูตัวอย่าง"
88
- @click="$emit('preview', item.value)"
89
- />
90
- <Icon
91
- :name="icons.actionDownloadIcon"
92
- :class="theme.actionIconClass()"
93
- title="ดาวน์โหลดไฟล์"
94
- @click="$emit('download', item.value)"
95
- />
96
- <Icon
97
- v-if="!disabled && !readonly"
98
- :name="icons.actionDeleteIcon"
99
- :class="theme.actionIconClass()"
100
- title="ลบไฟล์"
101
- @click="$emit('delete', index)"
102
- />
103
- </div>
104
- </div>
105
- </div>
106
-
107
- <!-- Error State -->
108
- <div
109
- v-else-if="item.state === UploadState.ERROR"
110
- :class="theme.errorItemWrapper()"
111
- >
112
- <div :class="theme.errorIconWrapper()">
113
- <Icon
114
- :name="icons.errorIcon"
115
- :class="theme.errorIconClass()"
116
- />
117
- </div>
118
- <div :class="theme.errorTextWrapper()">
119
- <h1 class="truncate font-bold">
120
- {{ item.file.name }}
121
- </h1>
122
- <p class="text-error-500 text-sm">
123
- {{ item.error || uploadFailedLabel }}
124
- </p>
125
- </div>
126
- <div :class="theme.errorActionWrapper()">
127
- <Button
128
- variant="link"
129
- :icon="icons.actionRetryIcon"
130
- :class="theme.actionRetryBtnClass()"
131
- color="primary"
132
- @click="$emit('retry', index)"
133
- >
134
- {{ retryLabel }}
135
- </Button>
136
- <Icon
137
- v-if="!disabled && !readonly"
138
- :name="icons.actionDeleteIcon"
139
- :class="theme.actionIconClass()"
140
- title="ลบไฟล์"
141
- @click="$emit('delete', index)"
142
- />
143
- </div>
144
- </div>
145
- </div>
146
- </div>
2
+ <div :class="theme.multipleFilesWrapper()">
3
+ <div
4
+ v-for="(item, index) in fileItems"
5
+ :key="index"
6
+ :class="theme.fileItemWrapper()"
7
+ >
8
+ <!-- Uploading State -->
9
+ <div
10
+ v-if="item.state === UploadState.UPLOADING"
11
+ :class="theme.uploadingItemWrapper()"
12
+ >
13
+ <div :class="theme.uploadingIconWrapper()">
14
+ <Icon
15
+ :name="icons.filePreviewIcon"
16
+ :class="theme.uploadingIconClass()"
17
+ />
18
+ </div>
19
+ <div :class="theme.uploadingTextWrapper()">
20
+ <h1 class="truncate font-bold">
21
+ {{ item.file.name }}
22
+ </h1>
23
+ <div class="flex items-center gap-2">
24
+ <div :class="theme.progressBarWrapper()">
25
+ <div
26
+ :class="theme.progressBarFill()"
27
+ :style="{ width: `${item.progress}%` }"
28
+ />
29
+ </div>
30
+ <p class="text-sm text-gray-400">
31
+ {{ item.progress }}%
32
+ </p>
33
+ </div>
34
+ </div>
35
+ </div>
36
+
37
+ <!-- Success State -->
38
+ <div
39
+ v-else-if="item.state === UploadState.SUCCESS && item.value"
40
+ :class="theme.successItemWrapper()"
41
+ >
42
+ <div
43
+ v-if="isImageFromPath(item.value.path)"
44
+ :class="theme.successImgWrapper()"
45
+ >
46
+ <img
47
+ :src="item.value.url"
48
+ :class="theme.successImgClass()"
49
+ alt="img-preview"
50
+ />
51
+ </div>
52
+ <div
53
+ v-else
54
+ :class="theme.successFileWrapper()"
55
+ >
56
+ <Icon
57
+ :name="icons.filePreviewIcon"
58
+ :class="theme.successFileClass()"
59
+ />
60
+ </div>
61
+ <div :class="theme.successTextWrapper()">
62
+ <div class="truncate">
63
+ <h1 class="truncate font-bold">
64
+ {{ item.value.name }}
65
+ </h1>
66
+ <p class="truncate text-sm font-light text-gray-400">
67
+ {{ getFileSizeFromValue(item.value) }}
68
+ </p>
69
+ </div>
70
+ <div :class="theme.actionWrapper()">
71
+ <a
72
+ v-if="isPDFFromPath(item.value.path)"
73
+ :href="item.value.url"
74
+ target="_blank"
75
+ class="flex"
76
+ >
77
+ <Icon
78
+ :name="icons.actionPreviewIcon"
79
+ :class="theme.actionIconClass()"
80
+ title="ดูตัวอย่าง"
81
+ />
82
+ </a>
83
+ <Icon
84
+ v-if="isImageFromPath(item.value.path) || isVideoFromPath(item.value.path)"
85
+ :name="icons.actionPreviewIcon"
86
+ :class="theme.actionIconClass()"
87
+ title="ดูตัวอย่าง"
88
+ @click="$emit('preview', item.value)"
89
+ />
90
+ <Icon
91
+ :name="icons.actionDownloadIcon"
92
+ :class="theme.actionIconClass()"
93
+ title="ดาวน์โหลดไฟล์"
94
+ @click="$emit('download', item.value)"
95
+ />
96
+ <Icon
97
+ v-if="!disabled && !readonly"
98
+ :name="icons.actionDeleteIcon"
99
+ :class="theme.actionIconClass()"
100
+ title="ลบไฟล์"
101
+ @click="$emit('delete', index)"
102
+ />
103
+ </div>
104
+ </div>
105
+ </div>
106
+
107
+ <!-- Error State -->
108
+ <div
109
+ v-else-if="item.state === UploadState.ERROR"
110
+ :class="theme.errorItemWrapper()"
111
+ >
112
+ <div :class="theme.errorIconWrapper()">
113
+ <Icon
114
+ :name="icons.errorIcon"
115
+ :class="theme.errorIconClass()"
116
+ />
117
+ </div>
118
+ <div :class="theme.errorTextWrapper()">
119
+ <h1 class="truncate font-bold">
120
+ {{ item.file.name }}
121
+ </h1>
122
+ <p class="text-error-500 text-sm">
123
+ {{ item.error || uploadFailedLabel }}
124
+ </p>
125
+ </div>
126
+ <div :class="theme.errorActionWrapper()">
127
+ <Button
128
+ variant="link"
129
+ :icon="icons.actionRetryIcon"
130
+ :class="theme.actionRetryBtnClass()"
131
+ color="primary"
132
+ @click="$emit('retry', index)"
133
+ >
134
+ {{ retryLabel }}
135
+ </Button>
136
+ <Icon
137
+ v-if="!disabled && !readonly"
138
+ :name="icons.actionDeleteIcon"
139
+ :class="theme.actionIconClass()"
140
+ title="ลบไฟล์"
141
+ @click="$emit('delete', index)"
142
+ />
143
+ </div>
144
+ </div>
145
+ </div>
146
+ </div>
147
147
  </template>
148
148
 
149
149
  <script setup>
@@ -1,29 +1,29 @@
1
1
  <template>
2
- <Modal
3
- :close="{ onClick: () => emits('close', false) }"
4
- :dismissible="false"
5
- :title="value?.name"
2
+ <Modal
3
+ :close="{ onClick: () => emits('close', false) }"
4
+ :dismissible="false"
5
+ :title="value?.name"
6
6
  :ui="{
7
7
  content: 'max-w-3xl'
8
- }"
9
- >
10
- <template #body>
11
- <div class="flex justify-center">
12
- <img
13
- v-if="value && isImageFromPath(value.path)"
14
- :src="value.url"
15
- alt="img-preview"
16
- class="max-h-96 max-w-full rounded-lg"
17
- />
18
- <video
19
- v-else-if="value && isVideoFromPath(value.path)"
20
- :src="value.url"
21
- controls
22
- class="max-h-96 max-w-full"
23
- />
24
- </div>
25
- </template>
26
- </Modal>
8
+ }"
9
+ >
10
+ <template #body>
11
+ <div class="flex justify-center">
12
+ <img
13
+ v-if="value && isImageFromPath(value.path)"
14
+ :src="value.url"
15
+ alt="img-preview"
16
+ class="max-h-96 max-w-full rounded-lg"
17
+ />
18
+ <video
19
+ v-else-if="value && isVideoFromPath(value.path)"
20
+ :src="value.url"
21
+ controls
22
+ class="max-h-96 max-w-full"
23
+ />
24
+ </div>
25
+ </template>
26
+ </Modal>
27
27
  </template>
28
28
 
29
29
  <script setup>
@@ -0,0 +1,25 @@
1
+ import type { TemplateRef } from 'vue';
2
+ import type { IUploadImageAutoProps } from '../InputUploadImageAuto/types.js';
3
+ import type { IFileValue } from '#core/components/Form/types';
4
+ export declare enum UploadState {
5
+ EMPTY = "empty",
6
+ UPLOADING = "uploading",
7
+ SUCCESS = "success",
8
+ ERROR = "error"
9
+ }
10
+ export declare const useUploadImageState: (props: IUploadImageAutoProps, emits: any, onChange: (value: IFileValue | undefined) => void, setErrors: (error: string) => void, value: any, acceptedFileTypes: any, wrapperProps: any, dropzoneRef: TemplateRef<HTMLDivElement | undefined>) => {
11
+ currentState: import("vue").ComputedRef<UploadState>;
12
+ isEmpty: import("vue").ComputedRef<boolean>;
13
+ isUploading: import("vue").ComputedRef<boolean>;
14
+ isSuccess: import("vue").ComputedRef<boolean>;
15
+ isError: import("vue").ComputedRef<boolean>;
16
+ selectedFile: import("vue").Ref<File | undefined, File | undefined>;
17
+ upload: import("../../../helpers/apiObjectHelper.js").IUseObjectLoader<any, any, Record<string, any>>;
18
+ dropzone: import("@vueuse/core").UseDropZoneReturn;
19
+ percent: import("vue").Ref<number, number>;
20
+ handleInputChange: (event: Event) => void;
21
+ handleOpenFile: () => void;
22
+ handleDeleteFile: () => void;
23
+ handleRetryUpload: () => void;
24
+ handlePreview: () => void;
25
+ };