@finema/core 1.4.116 → 1.4.118
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/Fields.vue +8 -0
- package/dist/runtime/components/Form/InputSelect/types.d.ts +2 -1
- package/dist/runtime/components/Form/InputSelectMultiple/index.vue +52 -0
- package/dist/runtime/components/Form/InputSelectMultiple/types.d.ts +15 -0
- package/dist/runtime/components/Form/InputSelectMultiple/types.mjs +0 -0
- package/dist/runtime/components/Form/types.d.ts +3 -1
- package/dist/runtime/components/Form/types.mjs +1 -0
- package/dist/runtime/utils/ObjectHelper.mjs +8 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -63,6 +63,14 @@
|
|
|
63
63
|
v-bind="getFieldBinding(option)"
|
|
64
64
|
v-on="option.on ?? {}"
|
|
65
65
|
/>
|
|
66
|
+
<FormInputSelectMultiple
|
|
67
|
+
v-else-if="option.type === INPUT_TYPES.SELECT_MULTIPLE"
|
|
68
|
+
:class="option.class"
|
|
69
|
+
:form="form"
|
|
70
|
+
:options="option.props.options"
|
|
71
|
+
v-bind="getFieldBinding(option)"
|
|
72
|
+
v-on="option.on ?? {}"
|
|
73
|
+
/>
|
|
66
74
|
<FormInputRadio
|
|
67
75
|
v-else-if="option.type === INPUT_TYPES.RADIO"
|
|
68
76
|
:class="option.class"
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { IFieldProps, IFormFieldBase, INPUT_TYPES } from '#core/components/Form/types';
|
|
2
2
|
import { type IOption } from '#core/types/common';
|
|
3
|
+
import type { SelectSize } from '#ui/types';
|
|
3
4
|
export interface ISelectFieldProps extends IFieldProps {
|
|
4
5
|
color?: string;
|
|
5
6
|
icon?: string;
|
|
6
|
-
size?:
|
|
7
|
+
size?: SelectSize;
|
|
7
8
|
searchablePlaceholder?: string;
|
|
8
9
|
loading?: boolean;
|
|
9
10
|
uiMenu?: object | any;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
+
<USelectMenu
|
|
4
|
+
:model-value="value || []"
|
|
5
|
+
searchable
|
|
6
|
+
multiple
|
|
7
|
+
:options="options"
|
|
8
|
+
:placeholder="placeholder || label"
|
|
9
|
+
:disabled="wrapperProps.isDisabled"
|
|
10
|
+
:loading="loading"
|
|
11
|
+
:searchable-placeholder="searchablePlaceholder"
|
|
12
|
+
value-attribute="value"
|
|
13
|
+
option-attribute="label"
|
|
14
|
+
:icon="icon"
|
|
15
|
+
:color="color"
|
|
16
|
+
:size="size"
|
|
17
|
+
:ui="ui"
|
|
18
|
+
:ui-menu="uiMenu"
|
|
19
|
+
@update:model-value="value = $event"
|
|
20
|
+
>
|
|
21
|
+
<template #label>
|
|
22
|
+
<div v-if="ArrayHelper.toArray(value).length > 0" class="flex flex-wrap gap-x-2 gap-y-1">
|
|
23
|
+
<Badge v-for="_value in ArrayHelper.toArray(value)" :key="_value">
|
|
24
|
+
<div class="flex items-center gap-x-1">
|
|
25
|
+
{{ options.find((item) => item.value === _value)?.label || _value }}
|
|
26
|
+
<Icon
|
|
27
|
+
name="i-heroicons:x-circle-20-solid"
|
|
28
|
+
class="size-4 cursor-pointer hover:text-gray-200"
|
|
29
|
+
@click.prevent="handleDelete(_value)"
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
</Badge>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
</USelectMenu>
|
|
36
|
+
</FieldWrapper>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script lang="ts" setup>
|
|
40
|
+
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
41
|
+
import { useFieldHOC } from '#core/composables/useForm'
|
|
42
|
+
import type { ISelectMultipleFieldProps } from '#core/components/Form/InputSelectMultiple/types'
|
|
43
|
+
import { ArrayHelper } from '#core/utils/ArrayHelper'
|
|
44
|
+
|
|
45
|
+
const props = withDefaults(defineProps<ISelectMultipleFieldProps>(), {})
|
|
46
|
+
|
|
47
|
+
const { value, wrapperProps } = useFieldHOC<any[]>(props)
|
|
48
|
+
|
|
49
|
+
const handleDelete = (_value: any) => {
|
|
50
|
+
value.value = ArrayHelper.toArray(value.value).filter((item: any) => item !== _value)
|
|
51
|
+
}
|
|
52
|
+
</script>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IFieldProps, IFormFieldBase, INPUT_TYPES } from '#core/components/Form/types';
|
|
2
|
+
import { type IOption } from '#core/types/common';
|
|
3
|
+
import type { SelectSize } from '#ui/types';
|
|
4
|
+
export interface ISelectMultipleFieldProps extends IFieldProps {
|
|
5
|
+
color?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
size?: SelectSize;
|
|
8
|
+
searchablePlaceholder?: string;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
uiMenu?: object | any;
|
|
11
|
+
options: IOption[];
|
|
12
|
+
}
|
|
13
|
+
export type ISelectMultipleField = IFormFieldBase<INPUT_TYPES.SELECT_MULTIPLE, ISelectMultipleFieldProps, {
|
|
14
|
+
change?: (value: string) => void;
|
|
15
|
+
}>;
|
|
File without changes
|
|
@@ -19,6 +19,7 @@ import type { IUploadDropzoneAutoMultipleField } from '#core/components/Form/Inp
|
|
|
19
19
|
import type { IUploadDropzoneImageAutoMultipleField } from '#core/components/Form/InputUploadDropzoneImageAutoMultiple/types';
|
|
20
20
|
import type { IWYSIWYGField } from '#core/components/Form/InputWYSIWYG/types';
|
|
21
21
|
import type { ITagsField } from '#core/components/Form/InputTags/types';
|
|
22
|
+
import type { ISelectMultipleField } from '#core/components/Form/InputSelectMultiple/types';
|
|
22
23
|
export declare const enum INPUT_TYPES {
|
|
23
24
|
TEXT = "TEXT",
|
|
24
25
|
NUMBER = "NUMBER",
|
|
@@ -28,6 +29,7 @@ export declare const enum INPUT_TYPES {
|
|
|
28
29
|
STATIC = "STATIC",
|
|
29
30
|
TOGGLE = "TOGGLE",
|
|
30
31
|
SELECT = "SELECT",
|
|
32
|
+
SELECT_MULTIPLE = "SELECT_MULTIPLE",
|
|
31
33
|
RADIO = "RADIO",
|
|
32
34
|
CHECKBOX = "CHECKBOX",
|
|
33
35
|
DATE_TIME = "DATE_TIME",
|
|
@@ -72,7 +74,7 @@ export interface IFormFieldBase<I extends INPUT_TYPES, P extends IFieldProps, O>
|
|
|
72
74
|
props: P;
|
|
73
75
|
on?: O;
|
|
74
76
|
}
|
|
75
|
-
export type IFormField = ITextField | INumberField | IStaticField | ICheckboxField | IRadioField | ISelectField | IToggleField | ITextareaField | IDateTimeField | IDateTimeRangeField | IUploadFileClassicField | IUploadFileField | IUploadImageAutoField | IUploadDropzoneField | IUploadDropzoneAutoField | IUploadDropzoneAutoMultipleField | IUploadDropzoneImageAutoMultipleField | IWYSIWYGField | ITagsField | IFormFieldBase<INPUT_TYPES.COMPONENT, any, any>;
|
|
77
|
+
export type IFormField = ITextField | INumberField | IStaticField | ICheckboxField | IRadioField | ISelectField | ISelectMultipleField | IToggleField | ITextareaField | IDateTimeField | IDateTimeRangeField | IUploadFileClassicField | IUploadFileField | IUploadImageAutoField | IUploadDropzoneField | IUploadDropzoneAutoField | IUploadDropzoneAutoMultipleField | IUploadDropzoneImageAutoMultipleField | IWYSIWYGField | ITagsField | IFormFieldBase<INPUT_TYPES.COMPONENT, any, any>;
|
|
76
78
|
export interface IFileValue {
|
|
77
79
|
url: string;
|
|
78
80
|
path?: string;
|
|
@@ -7,6 +7,7 @@ export var INPUT_TYPES = /* @__PURE__ */ ((INPUT_TYPES2) => {
|
|
|
7
7
|
INPUT_TYPES2["STATIC"] = "STATIC";
|
|
8
8
|
INPUT_TYPES2["TOGGLE"] = "TOGGLE";
|
|
9
9
|
INPUT_TYPES2["SELECT"] = "SELECT";
|
|
10
|
+
INPUT_TYPES2["SELECT_MULTIPLE"] = "SELECT_MULTIPLE";
|
|
10
11
|
INPUT_TYPES2["RADIO"] = "RADIO";
|
|
11
12
|
INPUT_TYPES2["CHECKBOX"] = "CHECKBOX";
|
|
12
13
|
INPUT_TYPES2["DATE_TIME"] = "DATE_TIME";
|
|
@@ -66,7 +66,14 @@ export class ObjectHelper {
|
|
|
66
66
|
if (process.env.NODE_ENV !== "production") {
|
|
67
67
|
console.error("API ERROR", error);
|
|
68
68
|
}
|
|
69
|
-
let newError =
|
|
69
|
+
let newError = {
|
|
70
|
+
code: "SOMETHING_WENT_WRONG",
|
|
71
|
+
message: "Something went wrong"
|
|
72
|
+
};
|
|
73
|
+
try {
|
|
74
|
+
newError = JSON.parse(error.response?.request?.response || "{}");
|
|
75
|
+
} catch (e) {
|
|
76
|
+
}
|
|
70
77
|
if (!error.response?.status) {
|
|
71
78
|
newError = {
|
|
72
79
|
code: "NETWORK_ERROR",
|