@finema/core 3.22.0 → 3.23.2

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 (125) hide show
  1. package/dist/module.d.mts +2 -0
  2. package/dist/module.json +2 -2
  3. package/dist/module.mjs +16 -2
  4. package/dist/runtime/components/App.vue +1 -1
  5. package/dist/runtime/components/DevToolsWindow/index.vue +1 -1
  6. package/dist/runtime/components/Dialog/index.d.vue.ts +1 -4
  7. package/dist/runtime/components/Dialog/index.vue +9 -10
  8. package/dist/runtime/components/Dialog/index.vue.d.ts +1 -4
  9. package/dist/runtime/components/Empty.d.vue.ts +0 -1
  10. package/dist/runtime/components/Empty.vue +6 -2
  11. package/dist/runtime/components/Empty.vue.d.ts +0 -1
  12. package/dist/runtime/components/FlexDeck/index.vue +86 -81
  13. package/dist/runtime/components/Form/FieldWrapper.vue +14 -14
  14. package/dist/runtime/components/Form/Fields.vue +10 -10
  15. package/dist/runtime/components/Form/InputCheckbox/index.vue +20 -19
  16. package/dist/runtime/components/Form/InputCheckboxGroup/index.vue +2 -1
  17. package/dist/runtime/components/Form/InputComponent/index.vue +2 -1
  18. package/dist/runtime/components/Form/InputCurrency/index.vue +51 -50
  19. package/dist/runtime/components/Form/InputDateTime/date_time_field.types.d.ts +1 -1
  20. package/dist/runtime/components/Form/InputDateTime/index.vue +69 -64
  21. package/dist/runtime/components/Form/InputDateTimeRange/date_range_time_field.types.d.ts +1 -1
  22. package/dist/runtime/components/Form/InputDateTimeRange/index.vue +62 -57
  23. package/dist/runtime/components/Form/InputMonth/index.vue +10 -5
  24. package/dist/runtime/components/Form/InputMonth/types.d.ts +1 -1
  25. package/dist/runtime/components/Form/InputNumber/index.vue +22 -21
  26. package/dist/runtime/components/Form/InputRadio/index.d.vue.ts +1 -1
  27. package/dist/runtime/components/Form/InputRadio/index.vue +2 -1
  28. package/dist/runtime/components/Form/InputRadio/index.vue.d.ts +1 -1
  29. package/dist/runtime/components/Form/InputRating/index.vue +2 -1
  30. package/dist/runtime/components/Form/InputSearch/index.vue +7 -2
  31. package/dist/runtime/components/Form/InputSelect/index.vue +112 -111
  32. package/dist/runtime/components/Form/InputSelectMultiple/index.vue +120 -119
  33. package/dist/runtime/components/Form/InputTags/index.vue +56 -55
  34. package/dist/runtime/components/Form/InputText/index.vue +88 -87
  35. package/dist/runtime/components/Form/InputTextarea/index.vue +20 -19
  36. package/dist/runtime/components/Form/InputTime/index.vue +45 -40
  37. package/dist/runtime/components/Form/InputTime/types.d.ts +1 -1
  38. package/dist/runtime/components/Form/InputToggle/index.vue +19 -18
  39. package/dist/runtime/components/Form/InputUploadDropzone/index.d.vue.ts +1 -4
  40. package/dist/runtime/components/Form/InputUploadDropzone/index.vue +40 -35
  41. package/dist/runtime/components/Form/InputUploadDropzone/index.vue.d.ts +1 -4
  42. package/dist/runtime/components/Form/InputUploadDropzone/types.d.ts +2 -2
  43. package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.d.vue.ts +0 -5
  44. package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +63 -58
  45. package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue.d.ts +0 -5
  46. package/dist/runtime/components/Form/InputUploadDropzoneAuto/types.d.ts +3 -3
  47. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.d.vue.ts +0 -5
  48. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue +69 -60
  49. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue.d.ts +0 -5
  50. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/types.d.ts +3 -3
  51. package/dist/runtime/components/Form/InputUploadImageAuto/index.d.vue.ts +1 -6
  52. package/dist/runtime/components/Form/InputUploadImageAuto/index.vue +63 -58
  53. package/dist/runtime/components/Form/InputUploadImageAuto/index.vue.d.ts +1 -6
  54. package/dist/runtime/components/Form/InputUploadImageAuto/types.d.ts +3 -3
  55. package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadNode.vue +18 -18
  56. package/dist/runtime/components/Form/InputWYSIWYG/EditorLinkPopover.vue +65 -65
  57. package/dist/runtime/components/Form/InputWYSIWYG/README.md +96 -96
  58. package/dist/runtime/components/Form/InputWYSIWYG/index.vue +43 -42
  59. package/dist/runtime/components/Form/fileState/EmptyState.vue +21 -21
  60. package/dist/runtime/components/Form/fileState/FailedState.vue +37 -33
  61. package/dist/runtime/components/Form/fileState/LoadingState.vue +24 -24
  62. package/dist/runtime/components/Form/fileState/MultipleFilesState.d.vue.ts +4 -4
  63. package/dist/runtime/components/Form/fileState/MultipleFilesState.vue +79 -75
  64. package/dist/runtime/components/Form/fileState/MultipleFilesState.vue.d.ts +4 -4
  65. package/dist/runtime/components/Form/fileState/PreviewModal.vue +23 -23
  66. package/dist/runtime/components/Form/fileState/SuccessState.d.vue.ts +2 -2
  67. package/dist/runtime/components/Form/fileState/SuccessState.vue +8 -4
  68. package/dist/runtime/components/Form/fileState/SuccessState.vue.d.ts +2 -2
  69. package/dist/runtime/components/Form/fileState/useFilePicker.d.ts +34 -0
  70. package/dist/runtime/components/Form/fileState/useFilePicker.js +48 -0
  71. package/dist/runtime/components/Form/fileState/useFileState.d.ts +7 -9
  72. package/dist/runtime/components/Form/fileState/useFileState.js +40 -120
  73. package/dist/runtime/components/Form/fileState/useUploadImageState.d.ts +7 -8
  74. package/dist/runtime/components/Form/fileState/useUploadImageState.js +28 -300
  75. package/dist/runtime/components/Form/fileState/useUploadState.d.ts +11 -7
  76. package/dist/runtime/components/Form/fileState/useUploadState.js +58 -131
  77. package/dist/runtime/components/Form/fileState/useUploadStateMultiple.d.ts +12 -18
  78. package/dist/runtime/components/Form/fileState/useUploadStateMultiple.js +89 -222
  79. package/dist/runtime/components/Form/index.vue +5 -5
  80. package/dist/runtime/components/Form/types.d.ts +2 -0
  81. package/dist/runtime/components/Image.vue +28 -28
  82. package/dist/runtime/components/Loader.d.vue.ts +1 -0
  83. package/dist/runtime/components/Loader.vue.d.ts +1 -0
  84. package/dist/runtime/components/Table/Base.d.vue.ts +15 -1
  85. package/dist/runtime/components/Table/Base.vue +118 -118
  86. package/dist/runtime/components/Table/Base.vue.d.ts +15 -1
  87. package/dist/runtime/components/Table/ColumnDate.vue +1 -1
  88. package/dist/runtime/components/Table/ColumnDateTime.vue +1 -1
  89. package/dist/runtime/components/Table/ColumnImage.vue +4 -4
  90. package/dist/runtime/components/Table/ColumnText.d.vue.ts +2 -3
  91. package/dist/runtime/components/Table/ColumnText.vue +11 -11
  92. package/dist/runtime/components/Table/ColumnText.vue.d.ts +2 -3
  93. package/dist/runtime/components/Table/Pagination.vue +70 -67
  94. package/dist/runtime/components/Table/Simple.vue +19 -19
  95. package/dist/runtime/components/Table/index.d.vue.ts +1 -1
  96. package/dist/runtime/components/Table/index.vue +37 -33
  97. package/dist/runtime/components/Table/index.vue.d.ts +1 -1
  98. package/dist/runtime/composables/loaderList.d.ts +2 -1
  99. package/dist/runtime/composables/loaderList.js +2 -1
  100. package/dist/runtime/composables/loaderObject.d.ts +2 -1
  101. package/dist/runtime/composables/loaderObject.js +2 -1
  102. package/dist/runtime/composables/loaderPage.js +194 -344
  103. package/dist/runtime/composables/useConfig.js +4 -3
  104. package/dist/runtime/composables/useDialog.js +5 -1
  105. package/dist/runtime/composables/useForm.d.ts +1 -1
  106. package/dist/runtime/composables/useForm.js +1 -1
  107. package/dist/runtime/composables/useMessages.d.ts +10 -0
  108. package/dist/runtime/composables/useMessages.js +10 -0
  109. package/dist/runtime/helpers/apiPageHelper.d.ts +0 -1
  110. package/dist/runtime/helpers/uploadCore.d.ts +54 -0
  111. package/dist/runtime/helpers/uploadCore.js +84 -0
  112. package/dist/runtime/i18n/valibot.d.ts +5 -68
  113. package/dist/runtime/i18n/valibot.js +33 -29
  114. package/dist/runtime/locale/en.d.ts +2 -0
  115. package/dist/runtime/locale/en.js +42 -0
  116. package/dist/runtime/locale/index.d.ts +7 -0
  117. package/dist/runtime/locale/index.js +8 -0
  118. package/dist/runtime/locale/th.d.ts +43 -0
  119. package/dist/runtime/locale/th.js +42 -0
  120. package/dist/runtime/server/tsconfig.json +3 -3
  121. package/dist/runtime/utils/ParamHelper.js +1 -1
  122. package/dist/runtime/utils/StringHelper.js +1 -4
  123. package/dist/runtime/utils/TimeHelper.js +2 -2
  124. package/dist/runtime/utils/lodash.js +2 -2
  125. package/package.json +20 -12
@@ -1,54 +1,54 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <div
4
- ref="dropzoneRef"
5
- :class="theme.base()"
6
- >
7
- <div :class="theme.wrapper()">
8
- <!-- Empty State -->
9
- <EmptyState
10
- v-if="uploadState.isEmpty.value"
11
- :theme="theme"
12
- :select-file-label="selectFileLabel"
13
- :select-file-sub-label="selectFileSubLabel"
14
- :placeholder="placeholder"
15
- @open-file="uploadState.handleOpenFile"
16
- />
17
-
18
- <!-- Loading State -->
19
- <LoadingState
20
- v-if="uploadState.isUploading.value"
21
- :theme="theme"
22
- :selected-file="uploadState.selectedFile.value"
23
- :percent="uploadState.percent.value"
24
- :uploading-label="uploadingLabel"
25
- />
26
-
27
- <!-- Success State -->
28
- <SuccessState
29
- v-if="uploadState.isSuccess.value"
30
- :theme="theme"
31
- :value="value"
32
- :disabled="wrapperProps.disabled"
33
- :readonly="wrapperProps.readonly"
34
- @preview="uploadState.handlePreview"
35
- @download="handleDownloadFile"
36
- @delete="uploadState.handleDeleteFile"
37
- />
38
-
39
- <!-- Failed State -->
40
- <FailedState
41
- v-if="uploadState.isError.value"
42
- :theme="theme"
43
- :selected-file="uploadState.selectedFile.value"
44
- :upload-failed-label="uploadFailedLabel"
45
- :retry-label="retryLabel"
46
- @retry="uploadState.handleRetryUpload"
47
- @delete="uploadState.handleDeleteFile"
48
- />
49
- </div>
50
- </div>
51
- </FieldWrapper>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <div
4
+ ref="dropzoneRef"
5
+ :class="theme.base()"
6
+ >
7
+ <div :class="theme.wrapper()">
8
+ <!-- Empty State -->
9
+ <EmptyState
10
+ v-if="uploadState.isEmpty.value"
11
+ :theme="theme"
12
+ :select-file-label="selectFileLabel ?? messages.upload.selectFile"
13
+ :select-file-sub-label="selectFileSubLabel ?? messages.upload.dropHere"
14
+ :placeholder="placeholder"
15
+ @open-file="uploadState.handleOpenFile"
16
+ />
17
+
18
+ <!-- Loading State -->
19
+ <LoadingState
20
+ v-if="uploadState.isUploading.value"
21
+ :theme="theme"
22
+ :selected-file="uploadState.selectedFile.value"
23
+ :percent="uploadState.percent.value"
24
+ :uploading-label="uploadingLabel ?? messages.upload.uploading"
25
+ />
26
+
27
+ <!-- Success State -->
28
+ <SuccessState
29
+ v-if="uploadState.isSuccess.value"
30
+ :theme="theme"
31
+ :value="value"
32
+ :disabled="wrapperProps.disabled"
33
+ :readonly="wrapperProps.readonly"
34
+ @preview="uploadState.handlePreview"
35
+ @download="handleDownloadFile"
36
+ @delete="uploadState.handleDeleteFile"
37
+ />
38
+
39
+ <!-- Failed State -->
40
+ <FailedState
41
+ v-if="uploadState.isError.value"
42
+ :theme="theme"
43
+ :selected-file="uploadState.selectedFile.value"
44
+ :upload-failed-label="uploadFailedLabel ?? messages.upload.uploadFailed"
45
+ :retry-label="retryLabel ?? messages.upload.retry"
46
+ @retry="uploadState.handleRetryUpload"
47
+ @delete="uploadState.handleDeleteFile"
48
+ />
49
+ </div>
50
+ </div>
51
+ </FieldWrapper>
52
52
  </template>
53
53
 
54
54
  <script setup>
@@ -62,6 +62,7 @@ import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
62
62
  import { useFieldHOC } from "#core/composables/useForm";
63
63
  import { uploadFileDropzoneTheme } from "#core/theme/uploadFileDropzone";
64
64
  import { useUiConfig } from "#core/composables/useConfig";
65
+ import { useCoreMessages } from "#core/composables/useMessages";
65
66
  import { downloadFileFromURL } from "#core/helpers/componentHelper";
66
67
  const emits = defineEmits(["change", "success", "delete"]);
67
68
  const props = defineProps({
@@ -75,11 +76,11 @@ const props = defineProps({
75
76
  responseID: { type: String, required: false, default: "id" },
76
77
  accept: { type: [Array, String], required: false },
77
78
  maxSize: { type: Number, required: false },
78
- selectFileLabel: { type: String, required: false, default: "\u0E04\u0E25\u0E34\u0E01\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E1F\u0E25\u0E4C" },
79
- selectFileSubLabel: { type: String, required: false, default: "\u0E2B\u0E23\u0E37\u0E2D \u0E25\u0E32\u0E01\u0E41\u0E25\u0E30\u0E27\u0E32\u0E07\u0E17\u0E35\u0E48\u0E19\u0E35\u0E48" },
80
- uploadingLabel: { type: String, required: false, default: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E2D\u0E31\u0E1E\u0E42\u0E2B\u0E25\u0E14..." },
81
- uploadFailedLabel: { type: String, required: false, default: "\u0E2D\u0E31\u0E1E\u0E42\u0E2B\u0E25\u0E14\u0E25\u0E49\u0E21\u0E40\u0E2B\u0E25\u0E27, \u0E01\u0E23\u0E38\u0E13\u0E32\u0E25\u0E2D\u0E07\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07" },
82
- retryLabel: { type: String, required: false, default: "\u0E25\u0E2D\u0E07\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07" },
79
+ selectFileLabel: { type: String, required: false },
80
+ selectFileSubLabel: { type: String, required: false },
81
+ uploadingLabel: { type: String, required: false },
82
+ uploadFailedLabel: { type: String, required: false },
83
+ retryLabel: { type: String, required: false },
83
84
  form: { type: Object, required: false },
84
85
  name: { type: String, required: true },
85
86
  errorMessage: { type: String, required: false },
@@ -93,8 +94,12 @@ const props = defineProps({
93
94
  readonly: { type: Boolean, required: false },
94
95
  required: { type: Boolean, required: false },
95
96
  help: { type: String, required: false },
96
- ui: { type: null, required: false }
97
+ ui: { type: null, required: false },
98
+ containerUi: { type: null, required: false }
97
99
  });
100
+ const {
101
+ messages
102
+ } = useCoreMessages();
98
103
  const {
99
104
  wrapperProps,
100
105
  handleChange: onChange,
@@ -105,7 +110,7 @@ const acceptedFileTypes = computed(
105
110
  () => typeof props.accept === "string" ? props.accept : props.accept?.join(",")
106
111
  );
107
112
  const dropzoneRef = useTemplateRef("dropzoneRef");
108
- const uploadState = useUploadState(
113
+ const uploadState = useUploadState({
109
114
  props,
110
115
  emits,
111
116
  onChange,
@@ -114,7 +119,7 @@ const uploadState = useUploadState(
114
119
  acceptedFileTypes,
115
120
  wrapperProps,
116
121
  dropzoneRef
117
- );
122
+ });
118
123
  const theme = computed(
119
124
  () => useUiConfig(uploadFileDropzoneTheme, "uploadFileDropzone")({
120
125
  dragover: uploadState.dropzone.isOverDropZone.value && uploadState.isEmpty.value,
@@ -9,11 +9,6 @@ declare const __VLS_export: import("vue").DefineComponent<IUploadDropzoneAutoPro
9
9
  onDelete?: (() => any) | undefined;
10
10
  onChange?: ((value: File | undefined) => any) | undefined;
11
11
  }>, {
12
- selectFileLabel: string;
13
- selectFileSubLabel: string;
14
- uploadingLabel: string;
15
- uploadFailedLabel: string;
16
- retryLabel: string;
17
12
  bodyKey: string;
18
13
  responseURL: string;
19
14
  responsePath: string;
@@ -20,7 +20,7 @@ export interface IUploadDropzoneAutoProps extends IFieldProps {
20
20
  retryLabel?: string;
21
21
  }
22
22
  export type IUploadDropzoneAutoField = IFormFieldBase<INPUT_TYPES.UPLOAD_DROPZONE_AUTO, IUploadDropzoneAutoProps, {
23
- change: (value: File | undefined) => void;
24
- success: (res: any) => void;
25
- delete: () => void;
23
+ change?: (value: File | undefined) => void;
24
+ success?: (res: any) => void;
25
+ delete?: () => void;
26
26
  }>;
@@ -9,11 +9,6 @@ declare const __VLS_export: import("vue").DefineComponent<IUploadDropzoneAutoMul
9
9
  onDelete?: ((index: number, value: IFileValue) => any) | undefined;
10
10
  onChange?: ((value: File[] | undefined) => any) | undefined;
11
11
  }>, {
12
- selectFileLabel: string;
13
- selectFileSubLabel: string;
14
- uploadingLabel: string;
15
- uploadFailedLabel: string;
16
- retryLabel: string;
17
12
  bodyKey: string;
18
13
  responseURL: string;
19
14
  responsePath: string;
@@ -1,54 +1,54 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <div
4
- ref="dropzoneRef"
5
- :class="theme.base()"
6
- >
7
- <div :class="theme.wrapper()">
8
- <!-- Empty State -->
9
- <EmptyState
10
- :theme="theme"
11
- :select-file-label="selectFileLabel"
12
- :select-file-sub-label="selectFileSubLabel"
13
- :placeholder="placeholder"
14
- @open-file="uploadState.handleOpenFile"
15
- />
16
- </div>
17
- </div>
18
- <!-- Multiple Files State -->
19
- <MultipleFilesState
20
- v-if="!uploadState.isEmpty.value"
21
- :theme="theme"
22
- :file-items="uploadState.fileItems.value"
23
- :disabled="wrapperProps.disabled"
24
- :readonly="wrapperProps.readonly"
25
- :upload-failed-label="uploadFailedLabel"
26
- :retry-label="retryLabel"
27
- @preview="uploadState.handlePreview"
28
- @download="handleDownloadFile"
29
- @delete="uploadState.handleDeleteFile"
30
- @retry="uploadState.handleRetryUpload"
31
- />
32
-
33
- <!-- Success State -->
34
- <div
35
- v-for="(item, index) in value"
36
- :key="index"
37
- :class="theme.multipleFilesWrapper()"
38
- >
39
- <div :class="theme.fileItemWrapper()">
40
- <SuccessState
41
- :theme="theme"
42
- :value="item"
43
- :disabled="wrapperProps.disabled"
44
- :readonly="wrapperProps.readonly"
45
- @preview="uploadState.handlePreview(item)"
46
- @download="handleDownloadFile(item)"
47
- @delete="handleDeleteFile(index, item)"
48
- />
49
- </div>
50
- </div>
51
- </FieldWrapper>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <div
4
+ ref="dropzoneRef"
5
+ :class="theme.base()"
6
+ >
7
+ <div :class="theme.wrapper()">
8
+ <!-- Empty State -->
9
+ <EmptyState
10
+ :theme="theme"
11
+ :select-file-label="selectFileLabel ?? messages.upload.selectFile"
12
+ :select-file-sub-label="selectFileSubLabel ?? messages.upload.dropHere"
13
+ :placeholder="placeholder"
14
+ @open-file="uploadState.handleOpenFile"
15
+ />
16
+ </div>
17
+ </div>
18
+ <!-- Multiple Files State -->
19
+ <MultipleFilesState
20
+ v-if="!uploadState.isEmpty.value"
21
+ :theme="theme"
22
+ :file-items="uploadState.fileItems.value"
23
+ :disabled="wrapperProps.disabled"
24
+ :readonly="wrapperProps.readonly"
25
+ :upload-failed-label="uploadFailedLabel ?? messages.upload.uploadFailed"
26
+ :retry-label="retryLabel ?? messages.upload.retry"
27
+ @preview="uploadState.handlePreview"
28
+ @download="handleDownloadFile"
29
+ @delete="uploadState.handleDeleteFile"
30
+ @retry="uploadState.handleRetryUpload"
31
+ />
32
+
33
+ <!-- Success State -->
34
+ <div
35
+ v-for="(item, index) in value"
36
+ :key="index"
37
+ :class="theme.multipleFilesWrapper()"
38
+ >
39
+ <div :class="theme.fileItemWrapper()">
40
+ <SuccessState
41
+ :theme="theme"
42
+ :value="item"
43
+ :disabled="wrapperProps.disabled"
44
+ :readonly="wrapperProps.readonly"
45
+ @preview="uploadState.handlePreview(item)"
46
+ @download="handleDownloadFile(item)"
47
+ @delete="handleDeleteFile(index, item)"
48
+ />
49
+ </div>
50
+ </div>
51
+ </FieldWrapper>
52
52
  </template>
53
53
 
54
54
  <script setup>
@@ -61,6 +61,7 @@ import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
61
61
  import { useFieldHOC } from "#core/composables/useForm";
62
62
  import { uploadFileDropzoneTheme } from "#core/theme/uploadFileDropzone";
63
63
  import { useUiConfig } from "#core/composables/useConfig";
64
+ import { useCoreMessages } from "#core/composables/useMessages";
64
65
  import { downloadFileFromURL } from "#core/helpers/componentHelper";
65
66
  const emits = defineEmits(["change", "success", "delete"]);
66
67
  const props = defineProps({
@@ -75,11 +76,11 @@ const props = defineProps({
75
76
  accept: { type: [Array, String], required: false },
76
77
  maxSize: { type: Number, required: false },
77
78
  maxFiles: { type: Number, required: false },
78
- selectFileLabel: { type: String, required: false, default: "\u0E04\u0E25\u0E34\u0E01\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E1F\u0E25\u0E4C" },
79
- selectFileSubLabel: { type: String, required: false, default: "\u0E2B\u0E23\u0E37\u0E2D \u0E25\u0E32\u0E01\u0E41\u0E25\u0E30\u0E27\u0E32\u0E07\u0E17\u0E35\u0E48\u0E19\u0E35\u0E48" },
80
- uploadingLabel: { type: String, required: false, default: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E2D\u0E31\u0E1E\u0E42\u0E2B\u0E25\u0E14..." },
81
- uploadFailedLabel: { type: String, required: false, default: "\u0E2D\u0E31\u0E1E\u0E42\u0E2B\u0E25\u0E14\u0E25\u0E49\u0E21\u0E40\u0E2B\u0E25\u0E27, \u0E01\u0E23\u0E38\u0E13\u0E32\u0E25\u0E2D\u0E07\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07" },
82
- retryLabel: { type: String, required: false, default: "\u0E25\u0E2D\u0E07\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07" },
79
+ selectFileLabel: { type: String, required: false },
80
+ selectFileSubLabel: { type: String, required: false },
81
+ uploadingLabel: { type: String, required: false },
82
+ uploadFailedLabel: { type: String, required: false },
83
+ retryLabel: { type: String, required: false },
83
84
  form: { type: Object, required: false },
84
85
  name: { type: String, required: true },
85
86
  errorMessage: { type: String, required: false },
@@ -93,8 +94,13 @@ const props = defineProps({
93
94
  readonly: { type: Boolean, required: false },
94
95
  required: { type: Boolean, required: false },
95
96
  help: { type: String, required: false },
96
- ui: { type: null, required: false }
97
+ ui: { type: null, required: false },
98
+ containerUi: { type: null, required: false }
97
99
  });
100
+ const {
101
+ messages,
102
+ format
103
+ } = useCoreMessages();
98
104
  const {
99
105
  wrapperProps,
100
106
  handleChange: onChange,
@@ -106,7 +112,7 @@ const acceptedFileTypes = computed(
106
112
  () => typeof props.accept === "string" ? props.accept : props.accept?.join(",")
107
113
  );
108
114
  const dropzoneRef = useTemplateRef("dropzoneRef");
109
- const uploadState = useUploadStateMultiple(
115
+ const uploadState = useUploadStateMultiple({
110
116
  props,
111
117
  emits,
112
118
  onChange,
@@ -115,7 +121,7 @@ const uploadState = useUploadStateMultiple(
115
121
  acceptedFileTypes,
116
122
  wrapperProps,
117
123
  dropzoneRef
118
- );
124
+ });
119
125
  const theme = computed(
120
126
  () => useUiConfig(uploadFileDropzoneTheme, "uploadFileDropzone")({
121
127
  dragover: uploadState.dropzone.isOverDropZone.value && uploadState.isEmpty.value,
@@ -131,11 +137,14 @@ const handleDownloadFile = (fileValue) => {
131
137
  const handleDeleteFile = (index, fileValue) => {
132
138
  dialog.confirm({
133
139
  type: DialogType.ERROR,
134
- title: "\u0E25\u0E1A\u0E44\u0E1F\u0E25\u0E4C",
135
- description: `\u0E04\u0E38\u0E13\u0E15\u0E49\u0E2D\u0E07\u0E01\u0E32\u0E23\u0E25\u0E1A\u0E44\u0E1F\u0E25\u0E4C ${fileValue.name} \u0E43\u0E0A\u0E48\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48`
140
+ title: messages.value.upload.remove,
141
+ description: format(messages.value.upload.removeConfirm, {
142
+ name: fileValue.name ?? ""
143
+ })
136
144
  }).then(() => {
137
145
  emits("delete", index, fileValue);
138
146
  value.value?.splice(index, 1);
147
+ }).catch(() => {
139
148
  });
140
149
  };
141
150
  </script>
@@ -9,11 +9,6 @@ declare const __VLS_export: import("vue").DefineComponent<IUploadDropzoneAutoMul
9
9
  onDelete?: ((index: number, value: IFileValue) => any) | undefined;
10
10
  onChange?: ((value: File[] | undefined) => any) | undefined;
11
11
  }>, {
12
- selectFileLabel: string;
13
- selectFileSubLabel: string;
14
- uploadingLabel: string;
15
- uploadFailedLabel: string;
16
- retryLabel: string;
17
12
  bodyKey: string;
18
13
  responseURL: string;
19
14
  responsePath: string;
@@ -21,7 +21,7 @@ export interface IUploadDropzoneAutoMultipleProps extends IFieldProps {
21
21
  retryLabel?: string;
22
22
  }
23
23
  export type IUploadDropzoneAutoMultipleField = IFormFieldBase<INPUT_TYPES.UPLOAD_DROPZONE_AUTO_MULTIPLE, IUploadDropzoneAutoMultipleProps, {
24
- change: (value: File[] | undefined) => void;
25
- success: (res: any) => void;
26
- delete: (index: number, value: IFileValue) => void;
24
+ change?: (value: File[] | undefined) => void;
25
+ success?: (res: any) => void;
26
+ delete?: (index: number, value: IFileValue) => void;
27
27
  }>;
@@ -9,18 +9,13 @@ declare const __VLS_export: import("vue").DefineComponent<IUploadImageAutoProps,
9
9
  onDelete?: (() => any) | undefined;
10
10
  onChange?: ((value: File | undefined) => any) | undefined;
11
11
  }>, {
12
- selectFileLabel: string;
13
- selectFileSubLabel: string;
14
- uploadingLabel: string;
15
- uploadFailedLabel: string;
16
- retryLabel: string;
12
+ accept: string[] | string;
17
13
  bodyKey: string;
18
14
  responseURL: string;
19
15
  responsePath: string;
20
16
  responseName: string;
21
17
  responseSize: string;
22
18
  responseID: string;
23
- accept: string[] | string;
24
19
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
20
  declare const _default: typeof __VLS_export;
26
21
  export default _default;
@@ -1,54 +1,54 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <div
4
- ref="dropzoneRef"
5
- :class="theme.base()"
6
- >
7
- <div :class="theme.wrapper()">
8
- <!-- Empty State -->
9
- <EmptyState
10
- v-if="uploadState.isEmpty.value"
11
- :theme="theme"
12
- :select-file-label="selectFileLabel"
13
- :select-file-sub-label="selectFileSubLabel"
14
- :placeholder="placeholder"
15
- @open-file="uploadState.handleOpenFile"
16
- />
17
-
18
- <!-- Loading State -->
19
- <LoadingState
20
- v-if="uploadState.isUploading.value"
21
- :theme="theme"
22
- :selected-file="uploadState.selectedFile.value"
23
- :percent="uploadState.percent.value"
24
- :uploading-label="uploadingLabel"
25
- />
26
-
27
- <!-- Success State -->
28
- <SuccessState
29
- v-if="uploadState.isSuccess.value"
30
- :theme="theme"
31
- :value="value"
32
- :disabled="wrapperProps.disabled"
33
- :readonly="wrapperProps.readonly"
34
- @preview="uploadState.handlePreview"
35
- @download="handleDownloadFile"
36
- @delete="uploadState.handleDeleteFile"
37
- />
38
-
39
- <!-- Failed State -->
40
- <FailedState
41
- v-if="uploadState.isError.value"
42
- :theme="theme"
43
- :selected-file="uploadState.selectedFile.value"
44
- :upload-failed-label="uploadFailedLabel"
45
- :retry-label="retryLabel"
46
- @retry="uploadState.handleRetryUpload"
47
- @delete="uploadState.handleDeleteFile"
48
- />
49
- </div>
50
- </div>
51
- </FieldWrapper>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <div
4
+ ref="dropzoneRef"
5
+ :class="theme.base()"
6
+ >
7
+ <div :class="theme.wrapper()">
8
+ <!-- Empty State -->
9
+ <EmptyState
10
+ v-if="uploadState.isEmpty.value"
11
+ :theme="theme"
12
+ :select-file-label="selectFileLabel ?? messages.upload.selectImage"
13
+ :select-file-sub-label="selectFileSubLabel ?? messages.upload.dropHere"
14
+ :placeholder="placeholder"
15
+ @open-file="uploadState.handleOpenFile"
16
+ />
17
+
18
+ <!-- Loading State -->
19
+ <LoadingState
20
+ v-if="uploadState.isUploading.value"
21
+ :theme="theme"
22
+ :selected-file="uploadState.selectedFile.value"
23
+ :percent="uploadState.percent.value"
24
+ :uploading-label="uploadingLabel ?? messages.upload.uploading"
25
+ />
26
+
27
+ <!-- Success State -->
28
+ <SuccessState
29
+ v-if="uploadState.isSuccess.value"
30
+ :theme="theme"
31
+ :value="value"
32
+ :disabled="wrapperProps.disabled"
33
+ :readonly="wrapperProps.readonly"
34
+ @preview="uploadState.handlePreview"
35
+ @download="handleDownloadFile"
36
+ @delete="uploadState.handleDeleteFile"
37
+ />
38
+
39
+ <!-- Failed State -->
40
+ <FailedState
41
+ v-if="uploadState.isError.value"
42
+ :theme="theme"
43
+ :selected-file="uploadState.selectedFile.value"
44
+ :upload-failed-label="uploadFailedLabel ?? messages.upload.uploadFailed"
45
+ :retry-label="retryLabel ?? messages.upload.retry"
46
+ @retry="uploadState.handleRetryUpload"
47
+ @delete="uploadState.handleDeleteFile"
48
+ />
49
+ </div>
50
+ </div>
51
+ </FieldWrapper>
52
52
  </template>
53
53
 
54
54
  <script setup>
@@ -62,6 +62,7 @@ import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
62
62
  import { useFieldHOC } from "#core/composables/useForm";
63
63
  import { uploadFileDropzoneTheme } from "#core/theme/uploadFileDropzone";
64
64
  import { useUiConfig } from "#core/composables/useConfig";
65
+ import { useCoreMessages } from "#core/composables/useMessages";
65
66
  import { downloadFileFromURL } from "#core/helpers/componentHelper";
66
67
  const emits = defineEmits(["change", "success", "delete"]);
67
68
  const props = defineProps({
@@ -76,11 +77,11 @@ const props = defineProps({
76
77
  accept: { type: [Array, String], required: false, default: () => ["image/*"] },
77
78
  maxSize: { type: Number, required: false },
78
79
  dimensions: { type: Object, required: false },
79
- selectFileLabel: { type: String, required: false, default: "\u0E04\u0E25\u0E34\u0E01\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E23\u0E39\u0E1B\u0E20\u0E32\u0E1E" },
80
- selectFileSubLabel: { type: String, required: false, default: "\u0E2B\u0E23\u0E37\u0E2D \u0E25\u0E32\u0E01\u0E41\u0E25\u0E30\u0E27\u0E32\u0E07\u0E17\u0E35\u0E48\u0E19\u0E35\u0E48" },
81
- uploadingLabel: { type: String, required: false, default: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E2D\u0E31\u0E1E\u0E42\u0E2B\u0E25\u0E14..." },
82
- uploadFailedLabel: { type: String, required: false, default: "\u0E2D\u0E31\u0E1E\u0E42\u0E2B\u0E25\u0E14\u0E25\u0E49\u0E21\u0E40\u0E2B\u0E25\u0E27, \u0E01\u0E23\u0E38\u0E13\u0E32\u0E25\u0E2D\u0E07\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07" },
83
- retryLabel: { type: String, required: false, default: "\u0E25\u0E2D\u0E07\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07" },
80
+ selectFileLabel: { type: String, required: false },
81
+ selectFileSubLabel: { type: String, required: false },
82
+ uploadingLabel: { type: String, required: false },
83
+ uploadFailedLabel: { type: String, required: false },
84
+ retryLabel: { type: String, required: false },
84
85
  form: { type: Object, required: false },
85
86
  name: { type: String, required: true },
86
87
  errorMessage: { type: String, required: false },
@@ -94,8 +95,12 @@ const props = defineProps({
94
95
  readonly: { type: Boolean, required: false },
95
96
  required: { type: Boolean, required: false },
96
97
  help: { type: String, required: false },
97
- ui: { type: null, required: false }
98
+ ui: { type: null, required: false },
99
+ containerUi: { type: null, required: false }
98
100
  });
101
+ const {
102
+ messages
103
+ } = useCoreMessages();
99
104
  const {
100
105
  wrapperProps,
101
106
  handleChange: onChange,
@@ -106,7 +111,7 @@ const acceptedFileTypes = computed(
106
111
  () => typeof props.accept === "string" ? props.accept : props.accept?.join(",")
107
112
  );
108
113
  const dropzoneRef = useTemplateRef("dropzoneRef");
109
- const uploadState = useUploadImageState(
114
+ const uploadState = useUploadImageState({
110
115
  props,
111
116
  emits,
112
117
  onChange,
@@ -115,7 +120,7 @@ const uploadState = useUploadImageState(
115
120
  acceptedFileTypes,
116
121
  wrapperProps,
117
122
  dropzoneRef
118
- );
123
+ });
119
124
  const theme = computed(
120
125
  () => useUiConfig(uploadFileDropzoneTheme, "uploadFileDropzone")({
121
126
  dragover: uploadState.dropzone.isOverDropZone.value && uploadState.isEmpty.value,
@@ -9,18 +9,13 @@ declare const __VLS_export: import("vue").DefineComponent<IUploadImageAutoProps,
9
9
  onDelete?: (() => any) | undefined;
10
10
  onChange?: ((value: File | undefined) => any) | undefined;
11
11
  }>, {
12
- selectFileLabel: string;
13
- selectFileSubLabel: string;
14
- uploadingLabel: string;
15
- uploadFailedLabel: string;
16
- retryLabel: string;
12
+ accept: string[] | string;
17
13
  bodyKey: string;
18
14
  responseURL: string;
19
15
  responsePath: string;
20
16
  responseName: string;
21
17
  responseSize: string;
22
18
  responseID: string;
23
- accept: string[] | string;
24
19
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
20
  declare const _default: typeof __VLS_export;
26
21
  export default _default;
@@ -31,7 +31,7 @@ export interface IUploadImageAutoProps extends IFieldProps {
31
31
  retryLabel?: string;
32
32
  }
33
33
  export type IUploadImageAutoField = IFormFieldBase<INPUT_TYPES.UPLOAD_IMAGE_AUTO, IUploadImageAutoProps, {
34
- change: (value: File | undefined) => void;
35
- success: (res: any) => void;
36
- delete: () => void;
34
+ change?: (value: File | undefined) => void;
35
+ success?: (res: any) => void;
36
+ delete?: () => void;
37
37
  }>;
@@ -1,22 +1,22 @@
1
1
  <template>
2
- <NodeViewWrapper>
3
- <FileUpload
4
- v-model="file"
5
- accept="image/*"
6
- label="Upload an image"
7
- description="SVG, PNG, JPG or GIF"
8
- :preview="false"
9
- class="min-h-48"
10
- >
11
- <template #leading>
12
- <Avatar
13
- :icon="loading ? 'i-lucide-loader-circle' : 'i-lucide-image'"
14
- size="xl"
15
- :ui="{ icon: [loading && 'animate-spin'] }"
16
- />
17
- </template>
18
- </FileUpload>
19
- </NodeViewWrapper>
2
+ <NodeViewWrapper>
3
+ <FileUpload
4
+ v-model="file"
5
+ accept="image/*"
6
+ label="Upload an image"
7
+ description="SVG, PNG, JPG or GIF"
8
+ :preview="false"
9
+ class="min-h-48"
10
+ >
11
+ <template #leading>
12
+ <Avatar
13
+ :icon="loading ? 'i-lucide-loader-circle' : 'i-lucide-image'"
14
+ size="xl"
15
+ :ui="{ icon: [loading && 'animate-spin'] }"
16
+ />
17
+ </template>
18
+ </FileUpload>
19
+ </NodeViewWrapper>
20
20
  </template>
21
21
 
22
22
  <script setup>