@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.
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Form/FieldWrapper.vue +13 -13
- package/dist/runtime/components/Form/Fields.vue +18 -14
- package/dist/runtime/components/Form/InputCheckbox/index.vue +18 -18
- package/dist/runtime/components/Form/InputCurrency/index.vue +49 -49
- package/dist/runtime/components/Form/InputNumber/index.vue +20 -20
- package/dist/runtime/components/Form/InputSelect/index.vue +38 -38
- package/dist/runtime/components/Form/InputSelectMultiple/index.vue +43 -43
- package/dist/runtime/components/Form/InputTags/index.vue +23 -23
- package/dist/runtime/components/Form/InputTextarea/index.vue +18 -18
- package/dist/runtime/components/Form/InputTime/index.vue +38 -38
- package/dist/runtime/components/Form/InputToggle/index.vue +17 -17
- package/dist/runtime/components/Form/InputUploadDropzone/index.vue +30 -30
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +50 -50
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue +31 -31
- package/dist/runtime/components/Form/InputUploadImageAuto/index.d.vue.ts +26 -0
- package/dist/runtime/components/Form/InputUploadImageAuto/index.vue +131 -0
- package/dist/runtime/components/Form/InputUploadImageAuto/index.vue.d.ts +26 -0
- package/dist/runtime/components/Form/InputUploadImageAuto/types.d.ts +37 -0
- package/dist/runtime/components/Form/InputUploadImageAuto/types.js +0 -0
- package/dist/runtime/components/Form/InputWYSIWYG/types.d.ts +15 -1
- package/dist/runtime/components/Form/fileState/EmptyState.vue +21 -21
- package/dist/runtime/components/Form/fileState/FailedState.vue +33 -33
- package/dist/runtime/components/Form/fileState/LoadingState.vue +24 -24
- package/dist/runtime/components/Form/fileState/MultipleFilesState.vue +145 -145
- package/dist/runtime/components/Form/fileState/PreviewModal.vue +23 -23
- package/dist/runtime/components/Form/fileState/useUploadImageState.d.ts +25 -0
- package/dist/runtime/components/Form/fileState/useUploadImageState.js +257 -0
- package/dist/runtime/components/Form/index.vue +5 -5
- package/dist/runtime/components/Form/types.d.ts +2 -1
- package/dist/runtime/components/Image.vue +28 -28
- package/dist/runtime/components/Log/index.vue +17 -17
- package/dist/runtime/components/Table/ColumnDate.vue +1 -1
- package/dist/runtime/components/Table/ColumnDateTime.vue +1 -1
- package/dist/runtime/components/Table/ColumnImage.vue +4 -4
- package/dist/runtime/components/Table/ColumnText.vue +1 -1
- package/dist/runtime/components/Table/Pagination.vue +46 -46
- package/dist/runtime/components/Table/Simple.vue +17 -17
- package/dist/runtime/helpers/apiPageHelper.js +4 -4
- package/dist/runtime/server/tsconfig.json +3 -3
- package/package.json +1 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FieldWrapper
|
|
3
|
-
v-bind="wrapperProps"
|
|
4
|
-
label=""
|
|
5
|
-
description=""
|
|
6
|
-
>
|
|
7
|
-
<Switch
|
|
8
|
-
:model-value="value"
|
|
9
|
-
:disabled="wrapperProps.disabled"
|
|
10
|
-
:name="name"
|
|
11
|
-
:ui="ui"
|
|
12
|
-
:label="label"
|
|
13
|
-
:description="description"
|
|
14
|
-
:loading="loading"
|
|
15
|
-
:loading-icon="loadingIcon"
|
|
16
|
-
@update:modelValue="onChange"
|
|
17
|
-
/>
|
|
18
|
-
</FieldWrapper>
|
|
2
|
+
<FieldWrapper
|
|
3
|
+
v-bind="wrapperProps"
|
|
4
|
+
label=""
|
|
5
|
+
description=""
|
|
6
|
+
>
|
|
7
|
+
<Switch
|
|
8
|
+
:model-value="value"
|
|
9
|
+
:disabled="wrapperProps.disabled"
|
|
10
|
+
:name="name"
|
|
11
|
+
:ui="ui"
|
|
12
|
+
:label="label"
|
|
13
|
+
:description="description"
|
|
14
|
+
:loading="loading"
|
|
15
|
+
:loading-icon="loadingIcon"
|
|
16
|
+
@update:modelValue="onChange"
|
|
17
|
+
/>
|
|
18
|
+
</FieldWrapper>
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
21
|
<script setup>
|
|
@@ -1,34 +1,34 @@
|
|
|
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
|
-
<!-- Success State -->
|
|
19
|
-
<SuccessState
|
|
20
|
-
v-if="uploadState.isSuccess.value"
|
|
21
|
-
:theme="theme"
|
|
22
|
-
:value="value"
|
|
23
|
-
:disabled="wrapperProps.disabled"
|
|
24
|
-
:readonly="wrapperProps.readonly"
|
|
25
|
-
@preview="uploadState.handlePreview"
|
|
26
|
-
@download="handleDownloadFile"
|
|
27
|
-
@delete="uploadState.handleDeleteFile"
|
|
28
|
-
/>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
</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"
|
|
13
|
+
:select-file-sub-label="selectFileSubLabel"
|
|
14
|
+
:placeholder="placeholder"
|
|
15
|
+
@open-file="uploadState.handleOpenFile"
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
<!-- Success State -->
|
|
19
|
+
<SuccessState
|
|
20
|
+
v-if="uploadState.isSuccess.value"
|
|
21
|
+
:theme="theme"
|
|
22
|
+
:value="value"
|
|
23
|
+
:disabled="wrapperProps.disabled"
|
|
24
|
+
:readonly="wrapperProps.readonly"
|
|
25
|
+
@preview="uploadState.handlePreview"
|
|
26
|
+
@download="handleDownloadFile"
|
|
27
|
+
@delete="uploadState.handleDeleteFile"
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</FieldWrapper>
|
|
32
32
|
</template>
|
|
33
33
|
|
|
34
34
|
<script setup>
|
|
@@ -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"
|
|
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>
|
|
52
52
|
</template>
|
|
53
53
|
|
|
54
54
|
<script setup>
|
|
@@ -1,35 +1,35 @@
|
|
|
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
|
-
</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"
|
|
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
|
+
</FieldWrapper>
|
|
33
33
|
</template>
|
|
34
34
|
|
|
35
35
|
<script setup>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IUploadImageAutoProps } from './types.js';
|
|
2
|
+
import type { IFileValue } from '#core/components/Form/types';
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<IUploadImageAutoProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
4
|
+
success: (res: IFileValue) => any;
|
|
5
|
+
delete: () => any;
|
|
6
|
+
change: (value: File | undefined) => any;
|
|
7
|
+
}, string, import("vue").PublicProps, Readonly<IUploadImageAutoProps> & Readonly<{
|
|
8
|
+
onSuccess?: ((res: IFileValue) => any) | undefined;
|
|
9
|
+
onDelete?: (() => any) | undefined;
|
|
10
|
+
onChange?: ((value: File | undefined) => any) | undefined;
|
|
11
|
+
}>, {
|
|
12
|
+
selectFileLabel: string;
|
|
13
|
+
selectFileSubLabel: string;
|
|
14
|
+
uploadingLabel: string;
|
|
15
|
+
uploadFailedLabel: string;
|
|
16
|
+
retryLabel: string;
|
|
17
|
+
bodyKey: string;
|
|
18
|
+
responseURL: string;
|
|
19
|
+
responsePath: string;
|
|
20
|
+
responseName: string;
|
|
21
|
+
responseSize: string;
|
|
22
|
+
responseID: string;
|
|
23
|
+
accept: string[] | string;
|
|
24
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,131 @@
|
|
|
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>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script setup>
|
|
55
|
+
import EmptyState from "../fileState/EmptyState.vue";
|
|
56
|
+
import SuccessState from "../fileState/SuccessState.vue";
|
|
57
|
+
import LoadingState from "../fileState/LoadingState.vue";
|
|
58
|
+
import FailedState from "../fileState/FailedState.vue";
|
|
59
|
+
import { useUploadImageState } from "../fileState/useUploadImageState";
|
|
60
|
+
import { computed, useTemplateRef } from "#imports";
|
|
61
|
+
import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
|
|
62
|
+
import { useFieldHOC } from "#core/composables/useForm";
|
|
63
|
+
import { uploadFileDropzoneTheme } from "#core/theme/uploadFileDropzone";
|
|
64
|
+
import { useUiConfig } from "#core/composables/useConfig";
|
|
65
|
+
import { downloadFileFromURL } from "#core/helpers/componentHelper";
|
|
66
|
+
const emits = defineEmits(["change", "success", "delete"]);
|
|
67
|
+
const props = defineProps({
|
|
68
|
+
requestOptions: { type: Object, required: true },
|
|
69
|
+
uploadPathURL: { type: String, required: false },
|
|
70
|
+
bodyKey: { type: String, required: false, default: "file" },
|
|
71
|
+
responseURL: { type: String, required: false, default: "url" },
|
|
72
|
+
responsePath: { type: String, required: false, default: "path" },
|
|
73
|
+
responseName: { type: String, required: false, default: "name" },
|
|
74
|
+
responseSize: { type: String, required: false, default: "size" },
|
|
75
|
+
responseID: { type: String, required: false, default: "id" },
|
|
76
|
+
accept: { type: [Array, String], required: false, default: () => ["image/*"] },
|
|
77
|
+
maxSize: { type: Number, required: false },
|
|
78
|
+
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" },
|
|
84
|
+
form: { type: Object, required: false },
|
|
85
|
+
name: { type: String, required: true },
|
|
86
|
+
errorMessage: { type: String, required: false },
|
|
87
|
+
label: { type: null, required: false },
|
|
88
|
+
description: { type: String, required: false },
|
|
89
|
+
hint: { type: String, required: false },
|
|
90
|
+
rules: { type: null, required: false },
|
|
91
|
+
autoFocus: { type: Boolean, required: false },
|
|
92
|
+
placeholder: { type: String, required: false },
|
|
93
|
+
disabled: { type: Boolean, required: false },
|
|
94
|
+
readonly: { type: Boolean, required: false },
|
|
95
|
+
required: { type: Boolean, required: false },
|
|
96
|
+
help: { type: String, required: false },
|
|
97
|
+
ui: { type: null, required: false }
|
|
98
|
+
});
|
|
99
|
+
const {
|
|
100
|
+
wrapperProps,
|
|
101
|
+
handleChange: onChange,
|
|
102
|
+
setErrors,
|
|
103
|
+
value
|
|
104
|
+
} = useFieldHOC(props);
|
|
105
|
+
const acceptedFileTypes = computed(
|
|
106
|
+
() => typeof props.accept === "string" ? props.accept : props.accept?.join(",")
|
|
107
|
+
);
|
|
108
|
+
const dropzoneRef = useTemplateRef("dropzoneRef");
|
|
109
|
+
const uploadState = useUploadImageState(
|
|
110
|
+
props,
|
|
111
|
+
emits,
|
|
112
|
+
onChange,
|
|
113
|
+
setErrors,
|
|
114
|
+
value,
|
|
115
|
+
acceptedFileTypes,
|
|
116
|
+
wrapperProps,
|
|
117
|
+
dropzoneRef
|
|
118
|
+
);
|
|
119
|
+
const theme = computed(
|
|
120
|
+
() => useUiConfig(uploadFileDropzoneTheme, "uploadFileDropzone")({
|
|
121
|
+
dragover: uploadState.dropzone.isOverDropZone.value && uploadState.isEmpty.value,
|
|
122
|
+
disabled: wrapperProps.value.disabled,
|
|
123
|
+
failed: uploadState.upload.status.value.isError
|
|
124
|
+
})
|
|
125
|
+
);
|
|
126
|
+
const handleDownloadFile = () => {
|
|
127
|
+
if (value.value?.url && value.value?.name) {
|
|
128
|
+
downloadFileFromURL(value.value.url, value.value.name);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
</script>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IUploadImageAutoProps } from './types.js';
|
|
2
|
+
import type { IFileValue } from '#core/components/Form/types';
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<IUploadImageAutoProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
4
|
+
success: (res: IFileValue) => any;
|
|
5
|
+
delete: () => any;
|
|
6
|
+
change: (value: File | undefined) => any;
|
|
7
|
+
}, string, import("vue").PublicProps, Readonly<IUploadImageAutoProps> & Readonly<{
|
|
8
|
+
onSuccess?: ((res: IFileValue) => any) | undefined;
|
|
9
|
+
onDelete?: (() => any) | undefined;
|
|
10
|
+
onChange?: ((value: File | undefined) => any) | undefined;
|
|
11
|
+
}>, {
|
|
12
|
+
selectFileLabel: string;
|
|
13
|
+
selectFileSubLabel: string;
|
|
14
|
+
uploadingLabel: string;
|
|
15
|
+
uploadFailedLabel: string;
|
|
16
|
+
retryLabel: string;
|
|
17
|
+
bodyKey: string;
|
|
18
|
+
responseURL: string;
|
|
19
|
+
responsePath: string;
|
|
20
|
+
responseName: string;
|
|
21
|
+
responseSize: string;
|
|
22
|
+
responseID: string;
|
|
23
|
+
accept: string[] | string;
|
|
24
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import type { IFieldProps, IFormFieldBase, INPUT_TYPES } from '../types.js';
|
|
3
|
+
export interface IDimensionValidation {
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
minWidth?: number;
|
|
7
|
+
minHeight?: number;
|
|
8
|
+
maxWidth?: number;
|
|
9
|
+
maxHeight?: number;
|
|
10
|
+
aspectRatio?: number;
|
|
11
|
+
aspectRatioTolerance?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface IUploadImageAutoProps extends IFieldProps {
|
|
14
|
+
requestOptions: Omit<AxiosRequestConfig, 'baseURL'> & {
|
|
15
|
+
baseURL: string;
|
|
16
|
+
};
|
|
17
|
+
uploadPathURL?: string;
|
|
18
|
+
bodyKey?: string;
|
|
19
|
+
responseURL?: string;
|
|
20
|
+
responsePath?: string;
|
|
21
|
+
responseName?: string;
|
|
22
|
+
responseSize?: string;
|
|
23
|
+
responseID?: string;
|
|
24
|
+
accept?: string[] | string;
|
|
25
|
+
maxSize?: number;
|
|
26
|
+
dimensions?: IDimensionValidation;
|
|
27
|
+
selectFileLabel?: string;
|
|
28
|
+
selectFileSubLabel?: string;
|
|
29
|
+
uploadingLabel?: string;
|
|
30
|
+
uploadFailedLabel?: string;
|
|
31
|
+
retryLabel?: string;
|
|
32
|
+
}
|
|
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;
|
|
37
|
+
}>;
|
|
File without changes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Editor } from '@tiptap/vue-3';
|
|
2
2
|
import type { IFieldProps, IFormFieldBase, INPUT_TYPES } from '#core/components/Form/types';
|
|
3
|
+
import type { AxiosRequestConfig } from 'axios';
|
|
3
4
|
export interface IWYSIWYGFieldProps extends IFieldProps {
|
|
4
5
|
editable?: boolean;
|
|
5
6
|
autofocus?: boolean;
|
|
@@ -18,7 +19,20 @@ export interface IWYSIWYGFieldProps extends IFieldProps {
|
|
|
18
19
|
codeBlock?: boolean;
|
|
19
20
|
horizontalRule?: boolean;
|
|
20
21
|
link?: boolean;
|
|
21
|
-
image?:
|
|
22
|
+
image?: {
|
|
23
|
+
requestOptions?: Omit<AxiosRequestConfig, 'baseURL'> & {
|
|
24
|
+
baseURL: string;
|
|
25
|
+
};
|
|
26
|
+
uploadPathURL?: string;
|
|
27
|
+
bodyKey?: string;
|
|
28
|
+
responseURL?: string;
|
|
29
|
+
responsePath?: string;
|
|
30
|
+
responseName?: string;
|
|
31
|
+
responseSize?: string;
|
|
32
|
+
responseID?: string;
|
|
33
|
+
accept?: string[] | string;
|
|
34
|
+
maxSize?: number;
|
|
35
|
+
} | boolean;
|
|
22
36
|
youtube?: boolean;
|
|
23
37
|
textAlign?: boolean;
|
|
24
38
|
undo?: boolean;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="theme.placeholderWrapper()">
|
|
3
|
-
<Icon
|
|
4
|
-
:name="icons.uploadIcon"
|
|
5
|
-
:class="theme.labelIcon()"
|
|
6
|
-
/>
|
|
7
|
-
<div :class="theme.labelWrapper()">
|
|
8
|
-
<p
|
|
9
|
-
class="text-primary cursor-pointer font-bold"
|
|
10
|
-
@click="$emit('openFile')"
|
|
11
|
-
>
|
|
12
|
-
{{ selectFileLabel }}
|
|
13
|
-
</p>
|
|
14
|
-
<p>{{ selectFileSubLabel }}</p>
|
|
15
|
-
</div>
|
|
16
|
-
<p
|
|
17
|
-
v-if="placeholder"
|
|
18
|
-
:class="theme.placeholder()"
|
|
19
|
-
>
|
|
20
|
-
{{ placeholder }}
|
|
21
|
-
</p>
|
|
22
|
-
</div>
|
|
2
|
+
<div :class="theme.placeholderWrapper()">
|
|
3
|
+
<Icon
|
|
4
|
+
:name="icons.uploadIcon"
|
|
5
|
+
:class="theme.labelIcon()"
|
|
6
|
+
/>
|
|
7
|
+
<div :class="theme.labelWrapper()">
|
|
8
|
+
<p
|
|
9
|
+
class="text-primary cursor-pointer font-bold"
|
|
10
|
+
@click="$emit('openFile')"
|
|
11
|
+
>
|
|
12
|
+
{{ selectFileLabel }}
|
|
13
|
+
</p>
|
|
14
|
+
<p>{{ selectFileSubLabel }}</p>
|
|
15
|
+
</div>
|
|
16
|
+
<p
|
|
17
|
+
v-if="placeholder"
|
|
18
|
+
:class="theme.placeholder()"
|
|
19
|
+
>
|
|
20
|
+
{{ placeholder }}
|
|
21
|
+
</p>
|
|
22
|
+
</div>
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
25
|
<script setup>
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="theme.onFailedWrapper()">
|
|
3
|
-
<div :class="theme.onFailedFailedImgWrapper()">
|
|
4
|
-
<Icon
|
|
5
|
-
:name="getFileIcon(selectedFile)"
|
|
6
|
-
:class="theme.onFailedFailedIconClass()"
|
|
7
|
-
/>
|
|
8
|
-
</div>
|
|
9
|
-
<div :class="theme.onFailedTextWrapper()">
|
|
10
|
-
<div class="truncate">
|
|
11
|
-
<h1 class="truncate font-bold">
|
|
12
|
-
{{ selectedFile.name }}
|
|
13
|
-
</h1>
|
|
14
|
-
<p class="text-error truncate font-light">
|
|
15
|
-
{{ uploadFailedLabel }}
|
|
16
|
-
</p>
|
|
17
|
-
<Button
|
|
18
|
-
variant="link"
|
|
19
|
-
:icon="icons.actionRetryIcon"
|
|
20
|
-
:class="theme.actionRetryBtnClass()"
|
|
21
|
-
color="primary"
|
|
22
|
-
@click="$emit('retry')"
|
|
23
|
-
>
|
|
24
|
-
{{ retryLabel }}
|
|
25
|
-
</Button>
|
|
26
|
-
</div>
|
|
27
|
-
<Icon
|
|
28
|
-
:name="icons.actionDeleteIcon"
|
|
29
|
-
:class="theme.actionDeleteIconClass()"
|
|
30
|
-
title="ลบไฟล์"
|
|
31
|
-
@click="$emit('delete')"
|
|
32
|
-
/>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
2
|
+
<div :class="theme.onFailedWrapper()">
|
|
3
|
+
<div :class="theme.onFailedFailedImgWrapper()">
|
|
4
|
+
<Icon
|
|
5
|
+
:name="getFileIcon(selectedFile)"
|
|
6
|
+
:class="theme.onFailedFailedIconClass()"
|
|
7
|
+
/>
|
|
8
|
+
</div>
|
|
9
|
+
<div :class="theme.onFailedTextWrapper()">
|
|
10
|
+
<div class="truncate">
|
|
11
|
+
<h1 class="truncate font-bold">
|
|
12
|
+
{{ selectedFile.name }}
|
|
13
|
+
</h1>
|
|
14
|
+
<p class="text-error truncate font-light">
|
|
15
|
+
{{ uploadFailedLabel }}
|
|
16
|
+
</p>
|
|
17
|
+
<Button
|
|
18
|
+
variant="link"
|
|
19
|
+
:icon="icons.actionRetryIcon"
|
|
20
|
+
:class="theme.actionRetryBtnClass()"
|
|
21
|
+
color="primary"
|
|
22
|
+
@click="$emit('retry')"
|
|
23
|
+
>
|
|
24
|
+
{{ retryLabel }}
|
|
25
|
+
</Button>
|
|
26
|
+
</div>
|
|
27
|
+
<Icon
|
|
28
|
+
:name="icons.actionDeleteIcon"
|
|
29
|
+
:class="theme.actionDeleteIconClass()"
|
|
30
|
+
title="ลบไฟล์"
|
|
31
|
+
@click="$emit('delete')"
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
35
|
</template>
|
|
36
36
|
|
|
37
37
|
<script setup>
|