@finema/core 3.7.0 → 3.8.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 +7 -2
- package/dist/runtime/components/FlexDeck/index.vue +79 -79
- package/dist/runtime/components/Form/FieldWrapper.vue +13 -13
- package/dist/runtime/components/Form/Fields.vue +13 -13
- package/dist/runtime/components/Form/InputCheckbox/index.vue +18 -18
- package/dist/runtime/components/Form/InputCheckboxGroup/index.vue +21 -21
- package/dist/runtime/components/Form/InputCurrency/index.vue +49 -49
- package/dist/runtime/components/Form/InputDateTime/date_time_field.types.d.ts +1 -0
- package/dist/runtime/components/Form/InputDateTime/index.d.vue.ts +1 -0
- package/dist/runtime/components/Form/InputDateTime/index.vue +63 -61
- package/dist/runtime/components/Form/InputDateTime/index.vue.d.ts +1 -0
- package/dist/runtime/components/Form/InputDateTimeRange/index.vue +57 -56
- package/dist/runtime/components/Form/InputNumber/index.vue +20 -20
- package/dist/runtime/components/Form/InputSelect/index.vue +46 -46
- package/dist/runtime/components/Form/InputSelectMultiple/index.vue +62 -62
- package/dist/runtime/components/Form/InputTags/index.vue +54 -54
- 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 +50 -50
- package/dist/runtime/components/Form/InputUploadImageAuto/index.vue +50 -50
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadExtension.d.ts +9 -0
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadExtension.js +38 -0
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadNode.d.vue.ts +4 -0
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadNode.vue +104 -0
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadNode.vue.d.ts +4 -0
- package/dist/runtime/components/Form/InputWYSIWYG/EditorLinkPopover.d.vue.ts +8 -0
- package/dist/runtime/components/Form/InputWYSIWYG/EditorLinkPopover.vue +147 -0
- package/dist/runtime/components/Form/InputWYSIWYG/EditorLinkPopover.vue.d.ts +8 -0
- package/dist/runtime/components/Form/InputWYSIWYG/index.d.vue.ts +14 -2
- package/dist/runtime/components/Form/InputWYSIWYG/index.vue +309 -210
- package/dist/runtime/components/Form/InputWYSIWYG/index.vue.d.ts +14 -2
- package/dist/runtime/components/Form/InputWYSIWYG/types.d.ts +12 -52
- 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 +75 -75
- package/dist/runtime/components/Form/fileState/PreviewModal.vue +23 -23
- package/dist/runtime/components/Form/index.vue +5 -5
- 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 +16 -16
- package/dist/runtime/server/tsconfig.json +3 -3
- package/package.json +3 -11
- package/dist/runtime/components/Form/InputWYSIWYG/UploadImageForm.d.vue.ts +0 -12
- package/dist/runtime/components/Form/InputWYSIWYG/UploadImageForm.vue +0 -38
- package/dist/runtime/components/Form/InputWYSIWYG/UploadImageForm.vue.d.ts +0 -12
|
@@ -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,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"
|
|
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>
|
|
52
52
|
</template>
|
|
53
53
|
|
|
54
54
|
<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>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Node, mergeAttributes } from "@tiptap/core";
|
|
2
|
+
import { VueNodeViewRenderer } from "@tiptap/vue-3";
|
|
3
|
+
import ImageUploadNodeComponent from "./EditorImageUploadNode.vue";
|
|
4
|
+
export const ImageUpload = Node.create({
|
|
5
|
+
name: "imageUpload",
|
|
6
|
+
group: "block",
|
|
7
|
+
atom: true,
|
|
8
|
+
draggable: true,
|
|
9
|
+
addAttributes() {
|
|
10
|
+
return {};
|
|
11
|
+
},
|
|
12
|
+
parseHTML() {
|
|
13
|
+
return [{
|
|
14
|
+
tag: 'div[data-type="image-upload"]'
|
|
15
|
+
}];
|
|
16
|
+
},
|
|
17
|
+
renderHTML({
|
|
18
|
+
HTMLAttributes
|
|
19
|
+
}) {
|
|
20
|
+
return ["div", mergeAttributes(HTMLAttributes, {
|
|
21
|
+
"data-type": "image-upload"
|
|
22
|
+
})];
|
|
23
|
+
},
|
|
24
|
+
addNodeView() {
|
|
25
|
+
return VueNodeViewRenderer(ImageUploadNodeComponent);
|
|
26
|
+
},
|
|
27
|
+
addCommands() {
|
|
28
|
+
return {
|
|
29
|
+
insertImageUpload: () => ({
|
|
30
|
+
commands
|
|
31
|
+
}) => {
|
|
32
|
+
return commands.insertContent({
|
|
33
|
+
type: this.name
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeViewProps } from '@tiptap/vue-3';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,104 @@
|
|
|
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>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup>
|
|
23
|
+
import { NodeViewWrapper } from "@tiptap/vue-3";
|
|
24
|
+
import { computed, ref, watch } from "vue";
|
|
25
|
+
import { useUploadLoader } from "#core/composables/useUpload";
|
|
26
|
+
import { _get } from "#core/utils/lodash";
|
|
27
|
+
import { StringHelper } from "#core/utils/StringHelper";
|
|
28
|
+
const props = defineProps({
|
|
29
|
+
decorations: { type: Array, required: true },
|
|
30
|
+
selected: { type: Boolean, required: true },
|
|
31
|
+
updateAttributes: { type: Function, required: true },
|
|
32
|
+
deleteNode: { type: Function, required: true },
|
|
33
|
+
node: { type: null, required: true },
|
|
34
|
+
view: { type: null, required: true },
|
|
35
|
+
getPos: { type: null, required: true },
|
|
36
|
+
innerDecorations: { type: null, required: true },
|
|
37
|
+
editor: { type: Object, required: true },
|
|
38
|
+
extension: { type: Object, required: true },
|
|
39
|
+
HTMLAttributes: { type: Object, required: true }
|
|
40
|
+
});
|
|
41
|
+
const options = computed(() => props.extension.options);
|
|
42
|
+
const file = ref(null);
|
|
43
|
+
const loading = ref(false);
|
|
44
|
+
watch(file, async (newFile) => {
|
|
45
|
+
if (!newFile) return;
|
|
46
|
+
loading.value = true;
|
|
47
|
+
if (!options.value.requestOptions) {
|
|
48
|
+
console.warn("ImageUpload: requestOptions is not configured");
|
|
49
|
+
loading.value = false;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const request = {
|
|
53
|
+
requestOptions: options.value.requestOptions,
|
|
54
|
+
pathURL: options.value.uploadPathURL
|
|
55
|
+
};
|
|
56
|
+
const uploadLoader = useUploadLoader(request);
|
|
57
|
+
const formData = new FormData();
|
|
58
|
+
const bodyKey = options.value.bodyKey || "file";
|
|
59
|
+
formData.append(bodyKey, newFile);
|
|
60
|
+
uploadLoader.run({
|
|
61
|
+
data: formData
|
|
62
|
+
});
|
|
63
|
+
const stopSuccessWatch = watch(
|
|
64
|
+
() => uploadLoader.status.value.isSuccess,
|
|
65
|
+
(isSuccess) => {
|
|
66
|
+
if (isSuccess && uploadLoader.data.value) {
|
|
67
|
+
const responseURL = options.value.responseURL || "url";
|
|
68
|
+
const url = _get(uploadLoader.data.value, responseURL);
|
|
69
|
+
if (!url) {
|
|
70
|
+
console.error("ImageUpload: Could not find URL in response", uploadLoader.data.value);
|
|
71
|
+
loading.value = false;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const pos = props.getPos();
|
|
75
|
+
if (typeof pos !== "number") {
|
|
76
|
+
loading.value = false;
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
props.editor.chain().focus().deleteRange({
|
|
80
|
+
from: pos,
|
|
81
|
+
to: pos + 1
|
|
82
|
+
}).setImage({
|
|
83
|
+
src: url
|
|
84
|
+
}).run();
|
|
85
|
+
loading.value = false;
|
|
86
|
+
stopSuccessWatch();
|
|
87
|
+
stopErrorWatch();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
const stopErrorWatch = watch(
|
|
92
|
+
() => uploadLoader.status.value.isError,
|
|
93
|
+
(isError) => {
|
|
94
|
+
if (isError) {
|
|
95
|
+
const errorMsg = StringHelper.getError(uploadLoader.status.value.errorData);
|
|
96
|
+
console.error("ImageUpload error:", errorMsg);
|
|
97
|
+
loading.value = false;
|
|
98
|
+
stopSuccessWatch();
|
|
99
|
+
stopErrorWatch();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
});
|
|
104
|
+
</script>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeViewProps } from '@tiptap/vue-3';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
editor: Editor;
|
|
4
|
+
autoOpen?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|