@finema/core 3.22.0 → 3.24.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/README.md +22 -2
- package/dist/module.d.mts +2 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +18 -15
- package/dist/runtime/components/App.vue +1 -1
- package/dist/runtime/components/DevToolsWindow/index.vue +24 -26
- package/dist/runtime/components/Dialog/index.d.vue.ts +1 -4
- package/dist/runtime/components/Dialog/index.vue +17 -17
- package/dist/runtime/components/Dialog/index.vue.d.ts +1 -4
- package/dist/runtime/components/Empty.d.vue.ts +1 -2
- package/dist/runtime/components/Empty.vue +19 -11
- package/dist/runtime/components/Empty.vue.d.ts +1 -2
- package/dist/runtime/components/FlexDeck/index.vue +21 -23
- package/dist/runtime/components/Form/FieldWrapper.vue +1 -1
- package/dist/runtime/components/Form/Fields.d.vue.ts +1 -1
- package/dist/runtime/components/Form/Fields.vue +26 -20
- package/dist/runtime/components/Form/Fields.vue.d.ts +1 -1
- package/dist/runtime/components/Form/InputCheckbox/index.vue +3 -6
- package/dist/runtime/components/Form/InputCheckboxGroup/index.vue +3 -6
- package/dist/runtime/components/Form/InputComponent/index.vue +2 -1
- package/dist/runtime/components/Form/InputCurrency/index.vue +11 -11
- package/dist/runtime/components/Form/InputDateTime/date_time_field.types.d.ts +3 -1
- package/dist/runtime/components/Form/InputDateTime/index.vue +12 -17
- package/dist/runtime/components/Form/InputDateTimeRange/date_range_time_field.types.d.ts +1 -1
- package/dist/runtime/components/Form/InputDateTimeRange/index.vue +28 -20
- package/dist/runtime/components/Form/InputMonth/index.vue +14 -12
- package/dist/runtime/components/Form/InputMonth/types.d.ts +1 -1
- package/dist/runtime/components/Form/InputNumber/index.vue +3 -6
- package/dist/runtime/components/Form/InputRadio/index.vue +3 -6
- package/dist/runtime/components/Form/InputRating/index.vue +3 -6
- package/dist/runtime/components/Form/InputSearch/index.vue +6 -7
- package/dist/runtime/components/Form/InputSelect/index.vue +6 -15
- package/dist/runtime/components/Form/InputSelectMultiple/index.vue +7 -18
- package/dist/runtime/components/Form/InputTags/index.vue +3 -6
- package/dist/runtime/components/Form/InputText/index.vue +41 -51
- package/dist/runtime/components/Form/InputTextarea/index.vue +3 -6
- package/dist/runtime/components/Form/InputTime/index.vue +32 -27
- package/dist/runtime/components/Form/InputTime/types.d.ts +1 -1
- package/dist/runtime/components/Form/InputToggle/index.vue +3 -5
- package/dist/runtime/components/Form/InputUploadDropzone/index.d.vue.ts +1 -4
- package/dist/runtime/components/Form/InputUploadDropzone/index.vue +25 -23
- package/dist/runtime/components/Form/InputUploadDropzone/index.vue.d.ts +1 -4
- package/dist/runtime/components/Form/InputUploadDropzone/types.d.ts +2 -2
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.d.vue.ts +0 -5
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +22 -23
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue.d.ts +0 -5
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/types.d.ts +3 -3
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.d.vue.ts +0 -5
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue +26 -24
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue.d.ts +0 -5
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/types.d.ts +3 -3
- package/dist/runtime/components/Form/InputUploadImageAuto/index.d.vue.ts +1 -6
- package/dist/runtime/components/Form/InputUploadImageAuto/index.vue +22 -23
- package/dist/runtime/components/Form/InputUploadImageAuto/index.vue.d.ts +1 -6
- package/dist/runtime/components/Form/InputUploadImageAuto/types.d.ts +3 -3
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImagePasteExtension.js +7 -6
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadExtension.js +13 -12
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadNode.vue +3 -1
- package/dist/runtime/components/Form/InputWYSIWYG/EditorLinkPopover.vue +20 -22
- package/dist/runtime/components/Form/InputWYSIWYG/index.vue +140 -118
- package/dist/runtime/components/Form/fileState/EmptyState.vue +1 -1
- package/dist/runtime/components/Form/fileState/FailedState.vue +4 -2
- package/dist/runtime/components/Form/fileState/MultipleFilesState.d.vue.ts +4 -4
- package/dist/runtime/components/Form/fileState/MultipleFilesState.vue +5 -5
- package/dist/runtime/components/Form/fileState/MultipleFilesState.vue.d.ts +4 -4
- package/dist/runtime/components/Form/fileState/SuccessState.d.vue.ts +2 -2
- package/dist/runtime/components/Form/fileState/SuccessState.vue +8 -13
- package/dist/runtime/components/Form/fileState/SuccessState.vue.d.ts +2 -2
- package/dist/runtime/components/Form/fileState/useFilePicker.d.ts +34 -0
- package/dist/runtime/components/Form/fileState/useFilePicker.js +48 -0
- package/dist/runtime/components/Form/fileState/useFileState.d.ts +7 -9
- package/dist/runtime/components/Form/fileState/useFileState.js +32 -120
- package/dist/runtime/components/Form/fileState/useUploadImageState.d.ts +7 -8
- package/dist/runtime/components/Form/fileState/useUploadImageState.js +27 -301
- package/dist/runtime/components/Form/fileState/useUploadState.d.ts +11 -7
- package/dist/runtime/components/Form/fileState/useUploadState.js +52 -136
- package/dist/runtime/components/Form/fileState/useUploadStateMultiple.d.ts +12 -18
- package/dist/runtime/components/Form/fileState/useUploadStateMultiple.js +88 -226
- package/dist/runtime/components/Form/types.d.ts +2 -0
- package/dist/runtime/components/Image.vue +4 -10
- package/dist/runtime/components/Loader.d.vue.ts +2 -1
- package/dist/runtime/components/Loader.vue +10 -7
- package/dist/runtime/components/Loader.vue.d.ts +2 -1
- package/dist/runtime/components/Log/LogItem.vue +1 -3
- package/dist/runtime/components/Log/index.vue +1 -3
- package/dist/runtime/components/Table/Base.d.vue.ts +15 -1
- package/dist/runtime/components/Table/Base.vue +9 -29
- package/dist/runtime/components/Table/Base.vue.d.ts +15 -1
- package/dist/runtime/components/Table/ColumnText.d.vue.ts +2 -3
- package/dist/runtime/components/Table/ColumnText.vue +1 -1
- package/dist/runtime/components/Table/ColumnText.vue.d.ts +2 -3
- package/dist/runtime/components/Table/Pagination.vue +19 -22
- package/dist/runtime/components/Table/index.d.vue.ts +1 -1
- package/dist/runtime/components/Table/index.vue +5 -7
- package/dist/runtime/components/Table/index.vue.d.ts +1 -1
- package/dist/runtime/composables/loaderList.d.ts +2 -1
- package/dist/runtime/composables/loaderList.js +3 -4
- package/dist/runtime/composables/loaderObject.d.ts +2 -1
- package/dist/runtime/composables/loaderObject.js +2 -1
- package/dist/runtime/composables/loaderPage.js +223 -350
- package/dist/runtime/composables/useConfig.js +4 -3
- package/dist/runtime/composables/useDialog.js +3 -1
- package/dist/runtime/composables/useForm.d.ts +2 -2
- package/dist/runtime/composables/useForm.js +2 -4
- package/dist/runtime/composables/useMessages.d.ts +10 -0
- package/dist/runtime/composables/useMessages.js +10 -0
- package/dist/runtime/composables/useTable.js +2 -14
- package/dist/runtime/helpers/apiBaseHelper.js +6 -24
- package/dist/runtime/helpers/apiListHelper.js +2 -5
- package/dist/runtime/helpers/apiObjectHelper.js +2 -5
- package/dist/runtime/helpers/apiPageHelper.d.ts +0 -1
- package/dist/runtime/helpers/apiPageHelper.js +19 -38
- package/dist/runtime/helpers/componentHelper.js +2 -6
- package/dist/runtime/helpers/uploadCore.d.ts +54 -0
- package/dist/runtime/helpers/uploadCore.js +81 -0
- package/dist/runtime/i18n/valibot.d.ts +5 -68
- package/dist/runtime/i18n/valibot.js +33 -29
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +42 -0
- package/dist/runtime/locale/index.d.ts +7 -0
- package/dist/runtime/locale/index.js +5 -0
- package/dist/runtime/locale/th.d.ts +43 -0
- package/dist/runtime/locale/th.js +42 -0
- package/dist/runtime/server/tsconfig.json +1 -1
- package/dist/runtime/styles/main.css +1 -1
- package/dist/runtime/utils/ParamHelper.js +1 -1
- package/dist/runtime/utils/StringHelper.js +1 -4
- package/dist/runtime/utils/TimeHelper.js +2 -2
- package/dist/runtime/utils/lodash.js +2 -2
- package/package.json +57 -36
|
@@ -73,10 +73,7 @@
|
|
|
73
73
|
v-for="(suggestion, index) in filteredSuggestions"
|
|
74
74
|
:key="suggestion"
|
|
75
75
|
:ref="(el) => setSuggestionItemRef(el, index)"
|
|
76
|
-
:class="[
|
|
77
|
-
theme.suggestionItem(),
|
|
78
|
-
{ [theme.suggestionItemActive()]: index === selectedSuggestionIndex }
|
|
79
|
-
]"
|
|
76
|
+
:class="[theme.suggestionItem(), { [theme.suggestionItemActive()]: index === selectedSuggestionIndex }]"
|
|
80
77
|
@mousedown.prevent="selectSuggestion(suggestion, index)"
|
|
81
78
|
@mouseenter="selectedSuggestionIndex = index"
|
|
82
79
|
>
|
|
@@ -124,14 +121,11 @@ const props = defineProps({
|
|
|
124
121
|
readonly: { type: Boolean, required: false },
|
|
125
122
|
required: { type: Boolean, required: false },
|
|
126
123
|
help: { type: String, required: false },
|
|
127
|
-
ui: { type: null, required: false }
|
|
124
|
+
ui: { type: null, required: false },
|
|
125
|
+
containerUi: { type: null, required: false }
|
|
128
126
|
});
|
|
129
127
|
const theme = computed(() => useUiConfig(inputTheme, "input")());
|
|
130
|
-
const {
|
|
131
|
-
value,
|
|
132
|
-
wrapperProps,
|
|
133
|
-
handleChange
|
|
134
|
-
} = useFieldHOC(props);
|
|
128
|
+
const { value, wrapperProps, handleChange } = useFieldHOC(props);
|
|
135
129
|
const isShowPassword = ref(false);
|
|
136
130
|
const inputRef = ref();
|
|
137
131
|
const showSuggestions = ref(false);
|
|
@@ -157,9 +151,7 @@ const filteredSuggestions = computed(() => {
|
|
|
157
151
|
return props.suggestions || [];
|
|
158
152
|
}
|
|
159
153
|
const inputValue = value.value.toLowerCase();
|
|
160
|
-
return props.suggestions.filter(
|
|
161
|
-
(suggestion) => suggestion.toLowerCase().includes(inputValue)
|
|
162
|
-
);
|
|
154
|
+
return props.suggestions.filter((suggestion) => suggestion.toLowerCase().includes(inputValue));
|
|
163
155
|
});
|
|
164
156
|
const onFocus = () => {
|
|
165
157
|
if (props.suggestions && props.suggestions.length > 0) {
|
|
@@ -193,7 +185,7 @@ const onKeydown = (event) => {
|
|
|
193
185
|
return;
|
|
194
186
|
}
|
|
195
187
|
event.preventDefault();
|
|
196
|
-
if (selectedSuggestionIndex.value
|
|
188
|
+
if (filteredSuggestions.value[selectedSuggestionIndex.value] !== void 0) {
|
|
197
189
|
selectSuggestion(filteredSuggestions.value[selectedSuggestionIndex.value], selectedSuggestionIndex.value);
|
|
198
190
|
}
|
|
199
191
|
break;
|
|
@@ -245,44 +237,42 @@ const scrollToSuggestionByIndex = (index) => {
|
|
|
245
237
|
}
|
|
246
238
|
}
|
|
247
239
|
};
|
|
248
|
-
const activeMaskOptions = computed(
|
|
249
|
-
()
|
|
250
|
-
if (props.maskOptions && Object.keys(props.maskOptions).length
|
|
251
|
-
|
|
252
|
-
return props.maskOptions.mask;
|
|
253
|
-
}
|
|
254
|
-
return props.maskOptions;
|
|
255
|
-
}
|
|
256
|
-
const options = {};
|
|
257
|
-
let hasIndividualProps = false;
|
|
258
|
-
if (props.mask !== void 0) {
|
|
259
|
-
options.mask = props.mask;
|
|
260
|
-
hasIndividualProps = true;
|
|
261
|
-
}
|
|
262
|
-
if (props.maskTokens !== void 0) {
|
|
263
|
-
options.tokens = props.maskTokens;
|
|
264
|
-
hasIndividualProps = true;
|
|
265
|
-
}
|
|
266
|
-
if (props.maskEager !== void 0) {
|
|
267
|
-
options.eager = props.maskEager;
|
|
268
|
-
hasIndividualProps = true;
|
|
240
|
+
const activeMaskOptions = computed(() => {
|
|
241
|
+
if (props.maskOptions && Object.keys(props.maskOptions).length > 0) {
|
|
242
|
+
if (typeof props.maskOptions.mask === "string" && Object.keys(props.maskOptions).length === 1) {
|
|
243
|
+
return props.maskOptions.mask;
|
|
269
244
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
245
|
+
return props.maskOptions;
|
|
246
|
+
}
|
|
247
|
+
const options = {};
|
|
248
|
+
let hasIndividualProps = false;
|
|
249
|
+
if (props.mask !== void 0) {
|
|
250
|
+
options.mask = props.mask;
|
|
251
|
+
hasIndividualProps = true;
|
|
252
|
+
}
|
|
253
|
+
if (props.maskTokens !== void 0) {
|
|
254
|
+
options.tokens = props.maskTokens;
|
|
255
|
+
hasIndividualProps = true;
|
|
256
|
+
}
|
|
257
|
+
if (props.maskEager !== void 0) {
|
|
258
|
+
options.eager = props.maskEager;
|
|
259
|
+
hasIndividualProps = true;
|
|
260
|
+
}
|
|
261
|
+
if (props.maskReversed !== void 0) {
|
|
262
|
+
options.reversed = props.maskReversed;
|
|
263
|
+
hasIndividualProps = true;
|
|
264
|
+
}
|
|
265
|
+
if (props.maskTokensReplace !== void 0) {
|
|
266
|
+
options.tokensReplace = props.maskTokensReplace;
|
|
267
|
+
hasIndividualProps = true;
|
|
268
|
+
}
|
|
269
|
+
if (hasIndividualProps) {
|
|
270
|
+
const keys = Object.keys(options);
|
|
271
|
+
if (keys.length === 1 && keys[0] === "mask" && typeof options.mask === "string") {
|
|
272
|
+
return options.mask;
|
|
284
273
|
}
|
|
285
|
-
return
|
|
274
|
+
return options;
|
|
286
275
|
}
|
|
287
|
-
|
|
276
|
+
return void 0;
|
|
277
|
+
});
|
|
288
278
|
</script>
|
|
@@ -43,13 +43,10 @@ const props = defineProps({
|
|
|
43
43
|
readonly: { type: Boolean, required: false },
|
|
44
44
|
required: { type: Boolean, required: false },
|
|
45
45
|
help: { type: String, required: false },
|
|
46
|
-
ui: { type: null, required: false }
|
|
46
|
+
ui: { type: null, required: false },
|
|
47
|
+
containerUi: { type: null, required: false }
|
|
47
48
|
});
|
|
48
|
-
const {
|
|
49
|
-
value,
|
|
50
|
-
wrapperProps,
|
|
51
|
-
handleChange
|
|
52
|
-
} = useFieldHOC(props);
|
|
49
|
+
const { value, wrapperProps, handleChange } = useFieldHOC(props);
|
|
53
50
|
const onChange = (value2) => {
|
|
54
51
|
handleChange(value2);
|
|
55
52
|
emits("change", value2);
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
v-model="innerValue"
|
|
5
5
|
:teleport="teleport"
|
|
6
6
|
:disabled="wrapperProps.disabled"
|
|
7
|
-
:cancel-text="
|
|
8
|
-
:select-text="
|
|
7
|
+
:cancel-text="messages.common.cancel"
|
|
8
|
+
:select-text="messages.common.select"
|
|
9
9
|
:locale="appConfig.core?.locale"
|
|
10
10
|
time-picker
|
|
11
11
|
:placeholder="wrapperProps.placeholder"
|
|
@@ -34,9 +34,11 @@
|
|
|
34
34
|
<template #clear-icon="{ clear }">
|
|
35
35
|
<Icon
|
|
36
36
|
:name="clearIcon"
|
|
37
|
-
:class="
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
:class="
|
|
38
|
+
theme.clearIcon({
|
|
39
|
+
class: [ui?.clearIcon]
|
|
40
|
+
})
|
|
41
|
+
"
|
|
40
42
|
@click.stop="clear"
|
|
41
43
|
/>
|
|
42
44
|
</template>
|
|
@@ -45,7 +47,8 @@
|
|
|
45
47
|
</template>
|
|
46
48
|
|
|
47
49
|
<script setup>
|
|
48
|
-
import
|
|
50
|
+
import { useCoreMessages } from "#core/composables/useMessages";
|
|
51
|
+
import Datepicker, {} from "@vuepic/vue-datepicker";
|
|
49
52
|
import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
|
|
50
53
|
import { computed, ref, useFieldHOC, useUiConfig, watch, useAppConfig } from "#imports";
|
|
51
54
|
import "@vuepic/vue-datepicker/dist/main.css";
|
|
@@ -72,16 +75,13 @@ const props = defineProps({
|
|
|
72
75
|
readonly: { type: Boolean, required: false },
|
|
73
76
|
required: { type: Boolean, required: false },
|
|
74
77
|
help: { type: String, required: false },
|
|
75
|
-
ui: { type: null, required: false }
|
|
78
|
+
ui: { type: null, required: false },
|
|
79
|
+
containerUi: { type: null, required: false }
|
|
76
80
|
});
|
|
77
81
|
const appConfig = useAppConfig();
|
|
78
82
|
const innerValue = ref(void 0);
|
|
79
83
|
const theme = computed(() => useUiConfig(dateTimeTheme, "dateTime")());
|
|
80
|
-
const {
|
|
81
|
-
value,
|
|
82
|
-
wrapperProps,
|
|
83
|
-
handleChange
|
|
84
|
-
} = useFieldHOC(props);
|
|
84
|
+
const { value, wrapperProps, handleChange } = useFieldHOC(props);
|
|
85
85
|
const onChange = (value2) => {
|
|
86
86
|
let timeText = void 0;
|
|
87
87
|
if (value2) {
|
|
@@ -93,20 +93,25 @@ const onChange = (value2) => {
|
|
|
93
93
|
handleChange(timeText);
|
|
94
94
|
emits("change", timeText);
|
|
95
95
|
};
|
|
96
|
-
watch(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
96
|
+
watch(
|
|
97
|
+
value,
|
|
98
|
+
(newValue) => {
|
|
99
|
+
if (newValue) {
|
|
100
|
+
const timeParts = newValue.split(":");
|
|
101
|
+
innerValue.value = {
|
|
102
|
+
hours: Number.parseInt(timeParts[0] || "0", 10),
|
|
103
|
+
minutes: Number.parseInt(timeParts[1] || "0", 10),
|
|
104
|
+
...props.enableSeconds && timeParts[2] ? {
|
|
105
|
+
seconds: Number.parseInt(timeParts[2], 10)
|
|
106
|
+
} : {}
|
|
107
|
+
};
|
|
108
|
+
} else {
|
|
109
|
+
innerValue.value = void 0;
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
immediate: true
|
|
108
114
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
});
|
|
115
|
+
);
|
|
116
|
+
const { messages } = useCoreMessages();
|
|
112
117
|
</script>
|
|
@@ -38,12 +38,10 @@ const props = defineProps({
|
|
|
38
38
|
readonly: { type: Boolean, required: false },
|
|
39
39
|
required: { type: Boolean, required: false },
|
|
40
40
|
help: { type: String, required: false },
|
|
41
|
-
ui: { type: null, required: false }
|
|
41
|
+
ui: { type: null, required: false },
|
|
42
|
+
containerUi: { type: null, required: false }
|
|
42
43
|
});
|
|
43
|
-
const {
|
|
44
|
-
value,
|
|
45
|
-
wrapperProps
|
|
46
|
-
} = useFieldHOC(props);
|
|
44
|
+
const { value, wrapperProps } = useFieldHOC(props);
|
|
47
45
|
const onChange = (bool) => {
|
|
48
46
|
emit("change", bool);
|
|
49
47
|
value.value = bool;
|
|
@@ -5,9 +5,6 @@ declare const __VLS_export: import("vue").DefineComponent<IUploadDropzoneProps,
|
|
|
5
5
|
}, string, import("vue").PublicProps, Readonly<IUploadDropzoneProps> & Readonly<{
|
|
6
6
|
onDelete?: (() => any) | undefined;
|
|
7
7
|
onChange?: ((value: File | undefined) => any) | undefined;
|
|
8
|
-
}>, {
|
|
9
|
-
selectFileLabel: string;
|
|
10
|
-
selectFileSubLabel: string;
|
|
11
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
9
|
declare const _default: typeof __VLS_export;
|
|
13
10
|
export default _default;
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
<EmptyState
|
|
10
10
|
v-if="uploadState.isEmpty.value"
|
|
11
11
|
:theme="theme"
|
|
12
|
-
:select-file-label="selectFileLabel"
|
|
13
|
-
:select-file-sub-label="selectFileSubLabel"
|
|
12
|
+
:select-file-label="selectFileLabel ?? messages.upload.selectFile"
|
|
13
|
+
:select-file-sub-label="selectFileSubLabel ?? messages.upload.dropHere"
|
|
14
14
|
:placeholder="placeholder"
|
|
15
15
|
@open-file="uploadState.handleOpenFile"
|
|
16
16
|
/>
|
|
@@ -40,12 +40,13 @@ import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
|
|
|
40
40
|
import { useFieldHOC } from "#core/composables/useForm";
|
|
41
41
|
import { uploadFileDropzoneTheme } from "#core/theme/uploadFileDropzone";
|
|
42
42
|
import { useUiConfig } from "#core/composables/useConfig";
|
|
43
|
+
import { useCoreMessages } from "#core/composables/useMessages";
|
|
43
44
|
const emits = defineEmits(["change", "delete"]);
|
|
44
45
|
const props = defineProps({
|
|
45
46
|
accept: { type: [Array, String], required: false },
|
|
46
47
|
maxSize: { type: Number, required: false },
|
|
47
|
-
selectFileLabel: { type: String, required: false
|
|
48
|
-
selectFileSubLabel: { type: String, required: false
|
|
48
|
+
selectFileLabel: { type: String, required: false },
|
|
49
|
+
selectFileSubLabel: { type: String, required: false },
|
|
49
50
|
form: { type: Object, required: false },
|
|
50
51
|
name: { type: String, required: true },
|
|
51
52
|
errorMessage: { type: String, required: false },
|
|
@@ -59,19 +60,14 @@ const props = defineProps({
|
|
|
59
60
|
readonly: { type: Boolean, required: false },
|
|
60
61
|
required: { type: Boolean, required: false },
|
|
61
62
|
help: { type: String, required: false },
|
|
62
|
-
ui: { type: null, required: false }
|
|
63
|
+
ui: { type: null, required: false },
|
|
64
|
+
containerUi: { type: null, required: false }
|
|
63
65
|
});
|
|
64
|
-
const {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
setErrors,
|
|
68
|
-
value
|
|
69
|
-
} = useFieldHOC(props);
|
|
70
|
-
const acceptedFileTypes = computed(
|
|
71
|
-
() => typeof props.accept === "string" ? props.accept : props.accept?.join(",")
|
|
72
|
-
);
|
|
66
|
+
const { messages } = useCoreMessages();
|
|
67
|
+
const { wrapperProps, handleChange: onChange, setErrors, value } = useFieldHOC(props);
|
|
68
|
+
const acceptedFileTypes = computed(() => typeof props.accept === "string" ? props.accept : props.accept?.join(","));
|
|
73
69
|
const dropzoneRef = useTemplateRef("dropzoneRef");
|
|
74
|
-
const uploadState = useFileState(
|
|
70
|
+
const uploadState = useFileState({
|
|
75
71
|
props,
|
|
76
72
|
emits,
|
|
77
73
|
onChange,
|
|
@@ -80,16 +76,22 @@ const uploadState = useFileState(
|
|
|
80
76
|
acceptedFileTypes,
|
|
81
77
|
wrapperProps,
|
|
82
78
|
dropzoneRef
|
|
83
|
-
);
|
|
84
|
-
useWatchChange(() => value.value, (newValue) => {
|
|
85
|
-
if (typeof newValue === "object" && newValue !== null) {
|
|
86
|
-
onChange(newValue);
|
|
87
|
-
} else {
|
|
88
|
-
onChange(void 0);
|
|
89
|
-
}
|
|
90
79
|
});
|
|
80
|
+
useWatchChange(
|
|
81
|
+
() => value.value,
|
|
82
|
+
(newValue) => {
|
|
83
|
+
if (typeof newValue === "object" && newValue !== null) {
|
|
84
|
+
onChange(newValue);
|
|
85
|
+
} else {
|
|
86
|
+
onChange(void 0);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
);
|
|
91
90
|
const theme = computed(
|
|
92
|
-
() => useUiConfig(
|
|
91
|
+
() => useUiConfig(
|
|
92
|
+
uploadFileDropzoneTheme,
|
|
93
|
+
"uploadFileDropzone"
|
|
94
|
+
)({
|
|
93
95
|
dragover: uploadState.dropzone.isOverDropZone.value && uploadState.isEmpty.value,
|
|
94
96
|
disabled: wrapperProps.value.disabled
|
|
95
97
|
})
|
|
@@ -5,9 +5,6 @@ declare const __VLS_export: import("vue").DefineComponent<IUploadDropzoneProps,
|
|
|
5
5
|
}, string, import("vue").PublicProps, Readonly<IUploadDropzoneProps> & Readonly<{
|
|
6
6
|
onDelete?: (() => any) | undefined;
|
|
7
7
|
onChange?: ((value: File | undefined) => any) | undefined;
|
|
8
|
-
}>, {
|
|
9
|
-
selectFileLabel: string;
|
|
10
|
-
selectFileSubLabel: string;
|
|
11
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
9
|
declare const _default: typeof __VLS_export;
|
|
13
10
|
export default _default;
|
|
@@ -6,6 +6,6 @@ export interface IUploadDropzoneProps extends IFieldProps {
|
|
|
6
6
|
selectFileSubLabel?: string;
|
|
7
7
|
}
|
|
8
8
|
export type IUploadDropzoneField = IFormFieldBase<INPUT_TYPES.UPLOAD_DROPZONE, IUploadDropzoneProps, {
|
|
9
|
-
change
|
|
10
|
-
delete
|
|
9
|
+
change?: (value: File | undefined) => void;
|
|
10
|
+
delete?: () => void;
|
|
11
11
|
}>;
|
|
@@ -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;
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
<EmptyState
|
|
10
10
|
v-if="uploadState.isEmpty.value"
|
|
11
11
|
:theme="theme"
|
|
12
|
-
:select-file-label="selectFileLabel"
|
|
13
|
-
:select-file-sub-label="selectFileSubLabel"
|
|
12
|
+
:select-file-label="selectFileLabel ?? messages.upload.selectFile"
|
|
13
|
+
:select-file-sub-label="selectFileSubLabel ?? messages.upload.dropHere"
|
|
14
14
|
:placeholder="placeholder"
|
|
15
15
|
@open-file="uploadState.handleOpenFile"
|
|
16
16
|
/>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
:theme="theme"
|
|
22
22
|
:selected-file="uploadState.selectedFile.value"
|
|
23
23
|
:percent="uploadState.percent.value"
|
|
24
|
-
:uploading-label="uploadingLabel"
|
|
24
|
+
:uploading-label="uploadingLabel ?? messages.upload.uploading"
|
|
25
25
|
/>
|
|
26
26
|
|
|
27
27
|
<!-- Success State -->
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
v-if="uploadState.isError.value"
|
|
42
42
|
:theme="theme"
|
|
43
43
|
:selected-file="uploadState.selectedFile.value"
|
|
44
|
-
:upload-failed-label="uploadFailedLabel"
|
|
45
|
-
:retry-label="retryLabel"
|
|
44
|
+
:upload-failed-label="uploadFailedLabel ?? messages.upload.uploadFailed"
|
|
45
|
+
:retry-label="retryLabel ?? messages.upload.retry"
|
|
46
46
|
@retry="uploadState.handleRetryUpload"
|
|
47
47
|
@delete="uploadState.handleDeleteFile"
|
|
48
48
|
/>
|
|
@@ -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
|
|
79
|
-
selectFileSubLabel: { type: String, required: false
|
|
80
|
-
uploadingLabel: { type: String, required: false
|
|
81
|
-
uploadFailedLabel: { type: String, required: false
|
|
82
|
-
retryLabel: { type: String, required: false
|
|
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,19 +94,14 @@ 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
|
});
|
|
98
|
-
const {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
setErrors,
|
|
102
|
-
value
|
|
103
|
-
} = useFieldHOC(props);
|
|
104
|
-
const acceptedFileTypes = computed(
|
|
105
|
-
() => typeof props.accept === "string" ? props.accept : props.accept?.join(",")
|
|
106
|
-
);
|
|
100
|
+
const { messages } = useCoreMessages();
|
|
101
|
+
const { wrapperProps, handleChange: onChange, setErrors, value } = useFieldHOC(props);
|
|
102
|
+
const acceptedFileTypes = computed(() => typeof props.accept === "string" ? props.accept : props.accept?.join(","));
|
|
107
103
|
const dropzoneRef = useTemplateRef("dropzoneRef");
|
|
108
|
-
const uploadState = useUploadState(
|
|
104
|
+
const uploadState = useUploadState({
|
|
109
105
|
props,
|
|
110
106
|
emits,
|
|
111
107
|
onChange,
|
|
@@ -114,9 +110,12 @@ const uploadState = useUploadState(
|
|
|
114
110
|
acceptedFileTypes,
|
|
115
111
|
wrapperProps,
|
|
116
112
|
dropzoneRef
|
|
117
|
-
);
|
|
113
|
+
});
|
|
118
114
|
const theme = computed(
|
|
119
|
-
() => useUiConfig(
|
|
115
|
+
() => useUiConfig(
|
|
116
|
+
uploadFileDropzoneTheme,
|
|
117
|
+
"uploadFileDropzone"
|
|
118
|
+
)({
|
|
120
119
|
dragover: uploadState.dropzone.isOverDropZone.value && uploadState.isEmpty.value,
|
|
121
120
|
disabled: wrapperProps.value.disabled,
|
|
122
121
|
failed: uploadState.upload.status.value.isError
|
|
@@ -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
|
|
24
|
-
success
|
|
25
|
-
delete
|
|
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;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
<!-- Empty State -->
|
|
9
9
|
<EmptyState
|
|
10
10
|
:theme="theme"
|
|
11
|
-
:select-file-label="selectFileLabel"
|
|
12
|
-
:select-file-sub-label="selectFileSubLabel"
|
|
11
|
+
:select-file-label="selectFileLabel ?? messages.upload.selectFile"
|
|
12
|
+
:select-file-sub-label="selectFileSubLabel ?? messages.upload.dropHere"
|
|
13
13
|
:placeholder="placeholder"
|
|
14
14
|
@open-file="uploadState.handleOpenFile"
|
|
15
15
|
/>
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
:file-items="uploadState.fileItems.value"
|
|
23
23
|
:disabled="wrapperProps.disabled"
|
|
24
24
|
:readonly="wrapperProps.readonly"
|
|
25
|
-
:upload-failed-label="uploadFailedLabel"
|
|
26
|
-
:retry-label="retryLabel"
|
|
25
|
+
:upload-failed-label="uploadFailedLabel ?? messages.upload.uploadFailed"
|
|
26
|
+
:retry-label="retryLabel ?? messages.upload.retry"
|
|
27
27
|
@preview="uploadState.handlePreview"
|
|
28
28
|
@download="handleDownloadFile"
|
|
29
29
|
@delete="uploadState.handleDeleteFile"
|
|
@@ -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
|
|
79
|
-
selectFileSubLabel: { type: String, required: false
|
|
80
|
-
uploadingLabel: { type: String, required: false
|
|
81
|
-
uploadFailedLabel: { type: String, required: false
|
|
82
|
-
retryLabel: { type: String, required: false
|
|
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,20 +94,15 @@ 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
|
});
|
|
98
|
-
const {
|
|
99
|
-
|
|
100
|
-
handleChange: onChange,
|
|
101
|
-
setErrors,
|
|
102
|
-
value
|
|
103
|
-
} = useFieldHOC(props);
|
|
100
|
+
const { messages, format } = useCoreMessages();
|
|
101
|
+
const { wrapperProps, handleChange: onChange, setErrors, value } = useFieldHOC(props);
|
|
104
102
|
const dialog = useDialog();
|
|
105
|
-
const acceptedFileTypes = computed(
|
|
106
|
-
() => typeof props.accept === "string" ? props.accept : props.accept?.join(",")
|
|
107
|
-
);
|
|
103
|
+
const acceptedFileTypes = computed(() => typeof props.accept === "string" ? props.accept : props.accept?.join(","));
|
|
108
104
|
const dropzoneRef = useTemplateRef("dropzoneRef");
|
|
109
|
-
const uploadState = useUploadStateMultiple(
|
|
105
|
+
const uploadState = useUploadStateMultiple({
|
|
110
106
|
props,
|
|
111
107
|
emits,
|
|
112
108
|
onChange,
|
|
@@ -115,9 +111,12 @@ const uploadState = useUploadStateMultiple(
|
|
|
115
111
|
acceptedFileTypes,
|
|
116
112
|
wrapperProps,
|
|
117
113
|
dropzoneRef
|
|
118
|
-
);
|
|
114
|
+
});
|
|
119
115
|
const theme = computed(
|
|
120
|
-
() => useUiConfig(
|
|
116
|
+
() => useUiConfig(
|
|
117
|
+
uploadFileDropzoneTheme,
|
|
118
|
+
"uploadFileDropzone"
|
|
119
|
+
)({
|
|
121
120
|
dragover: uploadState.dropzone.isOverDropZone.value && uploadState.isEmpty.value,
|
|
122
121
|
disabled: wrapperProps.value.disabled,
|
|
123
122
|
failed: false
|
|
@@ -131,11 +130,14 @@ const handleDownloadFile = (fileValue) => {
|
|
|
131
130
|
const handleDeleteFile = (index, fileValue) => {
|
|
132
131
|
dialog.confirm({
|
|
133
132
|
type: DialogType.ERROR,
|
|
134
|
-
title:
|
|
135
|
-
description:
|
|
133
|
+
title: messages.value.upload.remove,
|
|
134
|
+
description: format(messages.value.upload.removeConfirm, {
|
|
135
|
+
name: fileValue.name ?? ""
|
|
136
|
+
})
|
|
136
137
|
}).then(() => {
|
|
137
138
|
emits("delete", index, fileValue);
|
|
138
139
|
value.value?.splice(index, 1);
|
|
140
|
+
}).catch(() => {
|
|
139
141
|
});
|
|
140
142
|
};
|
|
141
143
|
</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;
|