@caipira/tamandua 0.0.33 → 0.0.35
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/Form.js +2 -2
- package/dist/Form.vue_vue_type_script_setup_true_lang-O6nqLPyU.js +205 -0
- package/dist/InputSelect.js +2 -2
- package/dist/{InputSelect.vue_vue_type_script_setup_true_lang-BlA3DIYZ.js → InputSelect.vue_vue_type_script_setup_true_lang-vCtwK795.js} +4 -1
- package/dist/ModalForm.js +2 -2
- package/dist/{ModalForm.vue_vue_type_script_setup_true_lang-BSEORivR.js → ModalForm.vue_vue_type_script_setup_true_lang-Da80UtoI.js} +34 -32
- package/dist/components.js +3 -3
- package/dist/{crud-lKm5HfM4.js → crud-TcRx_r8S.js} +4 -4
- package/dist/form2.js +1 -1
- package/dist/{plugin-DF8iyfN5.js → plugin-BkoyYU7S.js} +1 -1
- package/dist/{plugin-C3jERS0X.js → plugin-BqzDqLcd.js} +1 -1
- package/dist/{plugin-Daf_swsz.js → plugin-cVdTR_s6.js} +1 -1
- package/dist/{plugins-BA8tojIo.js → plugins-MQbI25Au.js} +5 -5
- package/dist/plugins.js +5 -5
- package/dist/tamandua.js +1 -1
- package/dist/types/components/Dropdown/types.d.ts +3 -3
- package/dist/types/components/Form/Form.vue.d.ts +42 -24
- package/dist/types/components/Form/types.d.ts +8 -4
- package/dist/types/components/InputPassword/InputPassword.vue.d.ts +1 -1
- package/dist/types/components/InputPassword/index.d.ts +1 -1
- package/dist/types/components/InputPassword/types.d.ts +10 -2
- package/dist/types/components/InputPrice/InputPrice.vue.d.ts +19 -3
- package/dist/types/components/InputPrice/index.d.ts +1 -1
- package/dist/types/components/InputPrice/types.d.ts +4 -0
- package/dist/types/components/InputSelect/InputSelect.story.d.ts +3 -3
- package/dist/types/components/InputSelect/InputSelect.vue.d.ts +69 -2
- package/dist/types/components/InputSelect/index.d.ts +1 -1
- package/dist/types/components/InputSelect/types.d.ts +38 -7
- package/dist/types/components/ModalForm/ModalForm.vue.d.ts +6 -1
- package/dist/types/components/ModalForm/types.d.ts +7 -5
- package/dist/types/components/index.d.ts +4 -4
- package/dist/types/composables/useForm.d.ts +20 -0
- package/dist/types/form/crud.d.ts +4 -3
- package/dist/types/form/form-transformer.d.ts +2 -2
- package/dist/types/form/form-transformer.test.d.ts +1 -0
- package/dist/types/form/form-value-transformers.d.ts +2 -1
- package/dist/types/types/address.d.ts +8 -8
- package/dist/types/types/common.d.ts +1 -0
- package/dist/types/types/form.d.ts +14 -59
- package/package.json +8 -5
- package/dist/Form.vue_vue_type_script_setup_true_lang-CbuLc6sr.js +0 -186
- /package/dist/types/{form/form.test.d.ts → composables/useForm.test.d.ts} +0 -0
|
@@ -4,10 +4,13 @@ import { FormSchema, FormInstance } from '../../types/form.js';
|
|
|
4
4
|
import { FormEvents } from './types.js';
|
|
5
5
|
|
|
6
6
|
declare const _default: <T extends FormSchema>(__VLS_props: {
|
|
7
|
-
id?: string | undefined;
|
|
7
|
+
id?: string | number | undefined;
|
|
8
8
|
idKey?: string | undefined;
|
|
9
9
|
schema?: T | undefined;
|
|
10
|
-
formStyle?:
|
|
10
|
+
formStyle?: {
|
|
11
|
+
input?: string | undefined;
|
|
12
|
+
label?: string | undefined;
|
|
13
|
+
} | undefined;
|
|
11
14
|
showSubmit?: boolean | undefined;
|
|
12
15
|
submitLabel?: string | undefined;
|
|
13
16
|
buttonProps?: import('../index.js').ButtonProps | undefined;
|
|
@@ -18,23 +21,29 @@ declare const _default: <T extends FormSchema>(__VLS_props: {
|
|
|
18
21
|
attrs: any;
|
|
19
22
|
slots: {
|
|
20
23
|
default?(_: {
|
|
21
|
-
form: import('@vue/reactivity').DistrubuteRef<import("vue").UnwrapNestedRefs<FormInstance<T>>>;
|
|
24
|
+
form: import('@vue/reactivity').DistrubuteRef<import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>>;
|
|
22
25
|
}): any;
|
|
23
26
|
};
|
|
24
27
|
emit: FormEvents;
|
|
25
28
|
} | undefined, __VLS_expose?: ((exposed: import('vue').ShallowUnwrapRef<{
|
|
26
|
-
submit: () => Promise<
|
|
29
|
+
submit: () => Promise<{
|
|
30
|
+
isValid: boolean;
|
|
31
|
+
form: FormData | import("@/types/form.js").JSONForm;
|
|
32
|
+
}>;
|
|
27
33
|
reset: () => void;
|
|
28
|
-
setValues: (values: Partial<FormInstance<T>>) => void;
|
|
29
|
-
|
|
30
|
-
setValue: <K extends keyof T
|
|
31
|
-
getValue: (key:
|
|
34
|
+
setValues: (values: Partial<FormInstance<T extends undefined ? never : T>>) => void;
|
|
35
|
+
form: import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>;
|
|
36
|
+
setValue: <K extends keyof import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>>(key: K, value: import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>[K]) => void;
|
|
37
|
+
getValue: (key: keyof import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>) => import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>[keyof import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>];
|
|
32
38
|
}>) => void) | undefined, __VLS_setup?: Promise<{
|
|
33
39
|
props: {
|
|
34
|
-
id?: string | undefined;
|
|
40
|
+
id?: string | number | undefined;
|
|
35
41
|
idKey?: string | undefined;
|
|
36
42
|
schema?: T | undefined;
|
|
37
|
-
formStyle?:
|
|
43
|
+
formStyle?: {
|
|
44
|
+
input?: string | undefined;
|
|
45
|
+
label?: string | undefined;
|
|
46
|
+
} | undefined;
|
|
38
47
|
showSubmit?: boolean | undefined;
|
|
39
48
|
submitLabel?: string | undefined;
|
|
40
49
|
buttonProps?: import('../index.js').ButtonProps | undefined;
|
|
@@ -43,17 +52,20 @@ declare const _default: <T extends FormSchema>(__VLS_props: {
|
|
|
43
52
|
buttonWrapperClasses?: string | undefined;
|
|
44
53
|
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
|
|
45
54
|
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
46
|
-
submit: () => Promise<
|
|
55
|
+
submit: () => Promise<{
|
|
56
|
+
isValid: boolean;
|
|
57
|
+
form: FormData | import("@/types/form.js").JSONForm;
|
|
58
|
+
}>;
|
|
47
59
|
reset: () => void;
|
|
48
|
-
setValues: (values: Partial<FormInstance<T>>) => void;
|
|
49
|
-
|
|
50
|
-
setValue: <K extends keyof T
|
|
51
|
-
getValue: (key:
|
|
60
|
+
setValues: (values: Partial<FormInstance<T extends undefined ? never : T>>) => void;
|
|
61
|
+
form: import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>;
|
|
62
|
+
setValue: <K extends keyof import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>>(key: K, value: import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>[K]) => void;
|
|
63
|
+
getValue: (key: keyof import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>) => import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>[keyof import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>];
|
|
52
64
|
}>): void;
|
|
53
65
|
attrs: any;
|
|
54
66
|
slots: {
|
|
55
67
|
default?(_: {
|
|
56
|
-
form: import('@vue/reactivity').DistrubuteRef<import("vue").UnwrapNestedRefs<FormInstance<T>>>;
|
|
68
|
+
form: import('@vue/reactivity').DistrubuteRef<import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>>;
|
|
57
69
|
}): any;
|
|
58
70
|
};
|
|
59
71
|
emit: FormEvents;
|
|
@@ -62,10 +74,13 @@ declare const _default: <T extends FormSchema>(__VLS_props: {
|
|
|
62
74
|
}> & {
|
|
63
75
|
__ctx?: {
|
|
64
76
|
props: {
|
|
65
|
-
id?: string | undefined;
|
|
77
|
+
id?: string | number | undefined;
|
|
66
78
|
idKey?: string | undefined;
|
|
67
79
|
schema?: T | undefined;
|
|
68
|
-
formStyle?:
|
|
80
|
+
formStyle?: {
|
|
81
|
+
input?: string | undefined;
|
|
82
|
+
label?: string | undefined;
|
|
83
|
+
} | undefined;
|
|
69
84
|
showSubmit?: boolean | undefined;
|
|
70
85
|
submitLabel?: string | undefined;
|
|
71
86
|
buttonProps?: import('../index.js').ButtonProps | undefined;
|
|
@@ -74,17 +89,20 @@ declare const _default: <T extends FormSchema>(__VLS_props: {
|
|
|
74
89
|
buttonWrapperClasses?: string | undefined;
|
|
75
90
|
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
|
|
76
91
|
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
77
|
-
submit: () => Promise<
|
|
92
|
+
submit: () => Promise<{
|
|
93
|
+
isValid: boolean;
|
|
94
|
+
form: FormData | import("@/types/form.js").JSONForm;
|
|
95
|
+
}>;
|
|
78
96
|
reset: () => void;
|
|
79
|
-
setValues: (values: Partial<FormInstance<T>>) => void;
|
|
80
|
-
|
|
81
|
-
setValue: <K extends keyof T
|
|
82
|
-
getValue: (key:
|
|
97
|
+
setValues: (values: Partial<FormInstance<T extends undefined ? never : T>>) => void;
|
|
98
|
+
form: import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>;
|
|
99
|
+
setValue: <K extends keyof import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>>(key: K, value: import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>[K]) => void;
|
|
100
|
+
getValue: (key: keyof import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>) => import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>[keyof import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>];
|
|
83
101
|
}>): void;
|
|
84
102
|
attrs: any;
|
|
85
103
|
slots: {
|
|
86
104
|
default?(_: {
|
|
87
|
-
form: import('@vue/reactivity').DistrubuteRef<import("vue").UnwrapNestedRefs<FormInstance<T>>>;
|
|
105
|
+
form: import('@vue/reactivity').DistrubuteRef<import("vue").UnwrapNestedRefs<FormInstance<T extends undefined ? never : T>>>;
|
|
88
106
|
}): any;
|
|
89
107
|
};
|
|
90
108
|
emit: FormEvents;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { FormSubmissionFormat } from '../../enums/form.js';
|
|
2
2
|
import { ButtonVariant } from '../../enums/ui.js';
|
|
3
|
-
import { FormSchema, FormStyle, FormInstance, ValidationResult } from '../../types/form.js';
|
|
4
3
|
import { ButtonProps } from '../Button/types.js';
|
|
4
|
+
import { FormSchema, FormInstance, ValidationResult } from '../../types/form.js';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type FormStyle = {
|
|
7
|
+
[key in "label" | "input"]?: string;
|
|
8
|
+
};
|
|
9
|
+
export type FormProps<T extends FormSchema> = {
|
|
10
|
+
id?: string | number;
|
|
8
11
|
idKey?: string;
|
|
9
12
|
schema?: T;
|
|
10
13
|
formStyle?: FormStyle;
|
|
@@ -16,6 +19,7 @@ export type FormProps<T> = {
|
|
|
16
19
|
buttonWrapperClasses?: string;
|
|
17
20
|
};
|
|
18
21
|
export type FormEvents = {
|
|
19
|
-
(e: "submit", val: ValidationResult<
|
|
22
|
+
<T extends FormSubmissionFormat>(e: "submit", val: ValidationResult<T>): void;
|
|
20
23
|
<T extends FormSchema>(e: "change", val: FormInstance<T>): void;
|
|
21
24
|
};
|
|
25
|
+
export {};
|
|
@@ -2,4 +2,4 @@ import { default as InputPasswordPlugin } from './plugin.js';
|
|
|
2
2
|
import { default as InputPassword } from './InputPassword.vue';
|
|
3
3
|
|
|
4
4
|
export { InputPassword, InputPasswordPlugin };
|
|
5
|
-
export type { InputPasswordProps, InputPasswordEvents } from './types.js';
|
|
5
|
+
export type { InputPasswordProps, InputPasswordModel, InputPasswordEvents, } from './types.js';
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export type InputPasswordModel = {
|
|
2
|
+
/** Unencrypted password */
|
|
3
|
+
raw: string;
|
|
4
|
+
/** If an encryptor was passed, this prop will hold the encrypted value */
|
|
5
|
+
hash?: string;
|
|
6
|
+
/** Strength of the password */
|
|
7
|
+
strength?: number;
|
|
8
|
+
/** Date of creation or last update */
|
|
9
|
+
updatedAt?: Date;
|
|
10
|
+
};
|
|
3
11
|
export type InputPasswordProps = {
|
|
4
12
|
autocomplete?: string;
|
|
5
13
|
encryptor?: (value: string) => Promise<string>;
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { InputPriceModel } from './types.js';
|
|
2
|
+
|
|
3
|
+
declare const _default: import('vue').DefineComponent<{
|
|
4
|
+
modelValue: import("vue").PropType<InputPriceModel>;
|
|
5
|
+
resource: {
|
|
6
|
+
type: import("vue").PropType<() => any>;
|
|
7
|
+
};
|
|
8
|
+
disabled: {
|
|
9
|
+
type: import("vue").PropType<boolean>;
|
|
10
|
+
};
|
|
11
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
|
+
modelValue: import("vue").PropType<InputPriceModel>;
|
|
13
|
+
resource: {
|
|
14
|
+
type: import("vue").PropType<() => any>;
|
|
15
|
+
};
|
|
16
|
+
disabled: {
|
|
17
|
+
type: import("vue").PropType<boolean>;
|
|
18
|
+
};
|
|
19
|
+
}>>, {}, {}>;
|
|
4
20
|
export default _default;
|
|
@@ -2,4 +2,4 @@ import { default as InputPricePlugin } from './plugin.js';
|
|
|
2
2
|
import { default as InputPrice } from './InputPrice.vue';
|
|
3
3
|
|
|
4
4
|
export { InputPrice, InputPricePlugin };
|
|
5
|
-
export type { InputPriceProps, InputPriceEvents } from './types.js';
|
|
5
|
+
export type { InputPriceModel, InputPriceProps, InputPriceEvents, } from './types.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { InputSelectOption } from './types.js';
|
|
1
2
|
import { APISearchFilters } from '../../types/api.js';
|
|
2
|
-
import { SelectOption } from '../../types/form.js';
|
|
3
3
|
import { Pagination } from '../../types/ui.js';
|
|
4
4
|
|
|
5
5
|
declare const _default: {
|
|
@@ -30,10 +30,10 @@ export declare const Select: (args: any) => {
|
|
|
30
30
|
}[];
|
|
31
31
|
value3: import('vue').Ref<never[]>;
|
|
32
32
|
search(filters?: APISearchFilters): Promise<{
|
|
33
|
-
items:
|
|
33
|
+
items: InputSelectOption[];
|
|
34
34
|
pagination: Pagination;
|
|
35
35
|
}>;
|
|
36
|
-
mapper(book: any):
|
|
36
|
+
mapper(book: any): InputSelectOption;
|
|
37
37
|
};
|
|
38
38
|
template: string;
|
|
39
39
|
};
|
|
@@ -1,10 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ElementSize, ElementPosition } from '../../enums/ui.js';
|
|
2
|
+
import { InputSelectProps, InputSelectOption } from './types.js';
|
|
3
|
+
|
|
4
|
+
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputSelectProps>, {
|
|
5
|
+
size: ElementSize;
|
|
6
|
+
options: () => never[];
|
|
7
|
+
mapper: (i: any) => InputSelectOption;
|
|
8
|
+
filter: (input: string, option: InputSelectOption) => boolean;
|
|
9
|
+
tooltip: string;
|
|
10
|
+
multiple: boolean;
|
|
11
|
+
placeholder: string;
|
|
12
|
+
isSearchable: boolean;
|
|
13
|
+
dropdownPlacement: ElementPosition;
|
|
14
|
+
/**
|
|
15
|
+
* CSS Classes
|
|
16
|
+
*/
|
|
17
|
+
widthClass: string;
|
|
18
|
+
borderClass: string;
|
|
19
|
+
roundnessClass: string;
|
|
20
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
21
|
+
"update:model-value": (val: any) => void;
|
|
22
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputSelectProps>, {
|
|
23
|
+
size: ElementSize;
|
|
24
|
+
options: () => never[];
|
|
25
|
+
mapper: (i: any) => InputSelectOption;
|
|
26
|
+
filter: (input: string, option: InputSelectOption) => boolean;
|
|
27
|
+
tooltip: string;
|
|
28
|
+
multiple: boolean;
|
|
29
|
+
placeholder: string;
|
|
30
|
+
isSearchable: boolean;
|
|
31
|
+
dropdownPlacement: ElementPosition;
|
|
32
|
+
/**
|
|
33
|
+
* CSS Classes
|
|
34
|
+
*/
|
|
35
|
+
widthClass: string;
|
|
36
|
+
borderClass: string;
|
|
37
|
+
roundnessClass: string;
|
|
38
|
+
}>>> & {
|
|
39
|
+
"onUpdate:model-value"?: ((val: any) => any) | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
filter: (input: string, option: InputSelectOption) => boolean;
|
|
42
|
+
size: ElementSize;
|
|
43
|
+
multiple: boolean;
|
|
44
|
+
options: InputSelectOption[];
|
|
45
|
+
placeholder: string;
|
|
46
|
+
mapper: (i: any) => InputSelectOption;
|
|
47
|
+
tooltip: string;
|
|
48
|
+
isSearchable: boolean;
|
|
49
|
+
dropdownPlacement: "top-start" | "top" | "top-end" | "right-start" | "right" | "right-end" | "bottom-end" | "bottom" | "bottom-start" | "left-end" | "left" | "left-start";
|
|
50
|
+
widthClass: string;
|
|
51
|
+
borderClass: string;
|
|
52
|
+
roundnessClass: string;
|
|
3
53
|
}, {}>, {
|
|
4
54
|
selection?(_: {}): any;
|
|
5
55
|
default?(_: any): any;
|
|
6
56
|
}>;
|
|
7
57
|
export default _default;
|
|
58
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
59
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
60
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
61
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
62
|
+
} : {
|
|
63
|
+
type: import('vue').PropType<T[K]>;
|
|
64
|
+
required: true;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
type __VLS_WithDefaults<P, D> = {
|
|
68
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
69
|
+
default: D[K];
|
|
70
|
+
}> : P[K];
|
|
71
|
+
};
|
|
72
|
+
type __VLS_Prettify<T> = {
|
|
73
|
+
[K in keyof T]: T[K];
|
|
74
|
+
} & {};
|
|
8
75
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
9
76
|
new (): {
|
|
10
77
|
$slots: S;
|
|
@@ -2,4 +2,4 @@ import { default as InputSelectPlugin } from './plugin.js';
|
|
|
2
2
|
import { default as InputSelect } from './InputSelect.vue';
|
|
3
3
|
|
|
4
4
|
export { InputSelect, InputSelectPlugin };
|
|
5
|
-
export type { InputSelectProps, InputSelectEvents } from './types.js';
|
|
5
|
+
export type { InputSelectValue, InputSelectProps, InputSelectOption, InputSelectEvents, } from './types.js';
|
|
@@ -1,15 +1,46 @@
|
|
|
1
|
-
import { ElementSize, ElementPosition } from '../../enums/ui.js';
|
|
2
|
-
import { SelectValue, SelectOption } from '../../types/form.js';
|
|
1
|
+
import { Icon, ElementSize, ElementPosition } from '../../enums/ui.js';
|
|
3
2
|
import { APISearchFilters } from '../../types/api.js';
|
|
4
3
|
import { Pagination } from '../../types/ui.js';
|
|
5
4
|
|
|
5
|
+
export type SelectValuePrimitives = string | number;
|
|
6
|
+
export type InputSelectValue = SelectValuePrimitives | Array<SelectValuePrimitives>;
|
|
7
|
+
export type InputSelectOption = {
|
|
8
|
+
/** Optional icon, to be appended to the label */
|
|
9
|
+
icon?: `${Icon}`;
|
|
10
|
+
/** Option label, either a string or an object containing the props necessary to render the option */
|
|
11
|
+
label: string | object;
|
|
12
|
+
/** Optional type, used to diferentiate options from one another */
|
|
13
|
+
type?: string;
|
|
14
|
+
/** Optional renderer, containing the fully resolved path to the component that will be used
|
|
15
|
+
* to render the option
|
|
16
|
+
*/
|
|
17
|
+
renderer?: string;
|
|
18
|
+
} & ({
|
|
19
|
+
/** If true, the option is a group label and can't be selected */
|
|
20
|
+
isGroupLabel: boolean;
|
|
21
|
+
value?: never;
|
|
22
|
+
action?: never;
|
|
23
|
+
} | {
|
|
24
|
+
/** Option value */
|
|
25
|
+
value: InputSelectValue;
|
|
26
|
+
action?: never;
|
|
27
|
+
isGroupLabel?: never;
|
|
28
|
+
} | {
|
|
29
|
+
/** Action to be executed once the option is selected */
|
|
30
|
+
action: (filters?: APISearchFilters) => Promise<{
|
|
31
|
+
items: unknown[];
|
|
32
|
+
pagination: Pagination;
|
|
33
|
+
}> | Promise<void> | void;
|
|
34
|
+
value?: never;
|
|
35
|
+
isGroupLabel?: never;
|
|
36
|
+
});
|
|
6
37
|
export type InputSelectProps = {
|
|
7
38
|
size?: ElementSize;
|
|
8
|
-
options?:
|
|
9
|
-
/** Mapper to convert search results to
|
|
10
|
-
mapper?: (i: any) =>
|
|
39
|
+
options?: InputSelectOption[];
|
|
40
|
+
/** Mapper to convert search results to InputSelectOption */
|
|
41
|
+
mapper?: (i: any) => InputSelectOption;
|
|
11
42
|
/** Filter function */
|
|
12
|
-
filter?: (input: string, option:
|
|
43
|
+
filter?: (input: string, option: InputSelectOption) => boolean;
|
|
13
44
|
tooltip?: string;
|
|
14
45
|
disabled?: boolean;
|
|
15
46
|
resource?: (filters?: APISearchFilters | undefined) => Promise<{
|
|
@@ -17,7 +48,7 @@ export type InputSelectProps = {
|
|
|
17
48
|
pagination: Pagination;
|
|
18
49
|
}>;
|
|
19
50
|
multiple?: boolean;
|
|
20
|
-
modelValue?:
|
|
51
|
+
modelValue?: InputSelectValue;
|
|
21
52
|
placeholder?: string;
|
|
22
53
|
initialValue?: any;
|
|
23
54
|
/** Indicates whether the user can search the options */
|
|
@@ -6,6 +6,11 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
6
6
|
}>, {
|
|
7
7
|
open: (key: string, id?: string | undefined) => void;
|
|
8
8
|
delete: () => void;
|
|
9
|
+
submit: () => Promise<{
|
|
10
|
+
isValid: boolean;
|
|
11
|
+
form: FormData | import("../../index.js").JSONForm;
|
|
12
|
+
} | undefined>;
|
|
13
|
+
reset: () => void;
|
|
9
14
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
15
|
saved: () => void;
|
|
11
16
|
closed: () => void;
|
|
@@ -16,7 +21,7 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
16
21
|
onClosed?: (() => any) | undefined;
|
|
17
22
|
onSaved?: (() => any) | undefined;
|
|
18
23
|
}, {
|
|
19
|
-
options: import("
|
|
24
|
+
options: import("../index.js").InputSelectOption[];
|
|
20
25
|
formClass: string;
|
|
21
26
|
}, {}>;
|
|
22
27
|
export default _default;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InputSelectOption } from '../InputSelect/types.js';
|
|
2
|
+
import { ComponentExposed } from 'vue-component-type-helpers';
|
|
3
|
+
import { default as Form } from '../Form/Form.vue';
|
|
2
4
|
|
|
3
|
-
export type
|
|
5
|
+
export type FormItem = {
|
|
4
6
|
key: string;
|
|
5
7
|
title: string;
|
|
6
|
-
component:
|
|
8
|
+
component: ComponentExposed<typeof Form>;
|
|
7
9
|
pinnable?: boolean;
|
|
8
10
|
};
|
|
9
11
|
export type ModalFormProps = {
|
|
10
|
-
forms:
|
|
11
|
-
options?:
|
|
12
|
+
forms: FormItem[];
|
|
13
|
+
options?: InputSelectOption[];
|
|
12
14
|
formClass?: string;
|
|
13
15
|
};
|
|
14
16
|
export type ModalFormEvents = {
|
|
@@ -15,11 +15,11 @@ import { Link, LinkProps, LinkEvents } from './Link/index.js';
|
|
|
15
15
|
import { InputTextarea, InputTextareaProps, InputTextareaEvents } from './InputTextarea/index.js';
|
|
16
16
|
import { InputText, InputTextProps, InputTextEvents } from './InputText/index.js';
|
|
17
17
|
import { InputSwitch, InputSwitchProps, InputSwitchEvents } from './InputSwitch/index.js';
|
|
18
|
-
import { InputSelect, InputSelectProps, InputSelectEvents } from './InputSelect/index.js';
|
|
18
|
+
import { InputSelect, InputSelectValue, InputSelectProps, InputSelectOption, InputSelectEvents } from './InputSelect/index.js';
|
|
19
19
|
import { InputRadio, InputRadioProps, InputRadioGroupProps, InputRadioGroupEvents } from './InputRadio/index.js';
|
|
20
|
-
import { InputPrice, InputPriceProps, InputPriceEvents } from './InputPrice/index.js';
|
|
20
|
+
import { InputPrice, InputPriceModel, InputPriceProps, InputPriceEvents } from './InputPrice/index.js';
|
|
21
21
|
import { InputPhone, InputPhoneProps, InputPhoneEvents } from './InputPhone/index.js';
|
|
22
|
-
import { InputPassword, InputPasswordProps, InputPasswordEvents } from './InputPassword/index.js';
|
|
22
|
+
import { InputPassword, InputPasswordModel, InputPasswordProps, InputPasswordEvents } from './InputPassword/index.js';
|
|
23
23
|
import { InputMultiplier, InputMultiplierProps, InputMultiplierEvents } from './InputMultiplier/index.js';
|
|
24
24
|
import { InputDate, InputDateProps, InputDateEvents } from './InputDate/index.js';
|
|
25
25
|
import { InputColor, InputColorProps, InputColorEvents } from './InputColor/index.js';
|
|
@@ -43,4 +43,4 @@ import { Backdrop, BackdropProps, BackdropEvents } from './Backdrop/index.js';
|
|
|
43
43
|
import { Avatar, AvatarProps } from './Avatar/index.js';
|
|
44
44
|
|
|
45
45
|
export { Avatar, Backdrop, Button, ChartLine, ChartTreemap, Drawer, Dropdown, FileDrop, Form, FormItem, GraphyEmpty, GraphyLabel, GraphyPrice, GraphySubtitle, GraphyTitle, Icon, InputAvatar, InputCheckbox, InputColor, InputDate, InputMultiplier, InputPassword, InputPhone, InputPrice, InputRadio, InputSelect, InputSwitch, InputText, InputTextarea, Link, Modal, ModalForm, Pagination, Popconfirm, Popover, ProgressCircle, ProgressLine, SensitiveInfo, Skeleton, Tab, Table, Tag, Toast, };
|
|
46
|
-
export type { AvatarProps, BackdropProps, BackdropEvents, ButtonProps, ButtonEvents, ChartLineProps, ChartTreemapProps, DrawerProps, DrawerEvents, DropdownProps, DropdownEvents, FileDropProps, FileDropEvents, FormProps, FormEvents, FormItemProps, GraphyEmptyProps, GraphyLabelProps, GraphyPriceProps, GraphySubtitleProps, GraphyTitleProps, IconProps, InputAvatarProps, InputAvatarEvents, InputCheckboxProps, InputCheckboxEvents, InputColorProps, InputColorEvents, InputDateProps, InputDateEvents, InputMultiplierEvents, InputPasswordProps, InputPasswordEvents, InputPhoneProps, InputPhoneEvents, InputPriceProps, InputPriceEvents, InputRadioProps, InputRadioGroupProps, InputRadioGroupEvents, InputSelectProps, InputSelectEvents, InputSwitchProps, InputSwitchEvents, InputMultiplierProps, InputTextProps, InputTextEvents, InputTextareaProps, InputTextareaEvents, LinkProps, LinkEvents, ModalProps, ModalEvents, ModalFormProps, ModalFormEvents, PaginationProps, PaginationEvents, PopconfirmProps, PopconfirmEvents, PopoverProps, ProgressCircleProps, ProgressLineProps, SensitiveInfoProps, SkeletonProps, TabProps, TableProps, TableEvents, TagEvents, TagProps, ToastProps, ToastEvents, };
|
|
46
|
+
export type { AvatarProps, BackdropProps, BackdropEvents, ButtonProps, ButtonEvents, ChartLineProps, ChartTreemapProps, DrawerProps, DrawerEvents, DropdownProps, DropdownEvents, FileDropProps, FileDropEvents, FormProps, FormEvents, FormItemProps, GraphyEmptyProps, GraphyLabelProps, GraphyPriceProps, GraphySubtitleProps, GraphyTitleProps, IconProps, InputAvatarProps, InputAvatarEvents, InputCheckboxProps, InputCheckboxEvents, InputColorProps, InputColorEvents, InputDateProps, InputDateEvents, InputMultiplierEvents, InputPasswordModel, InputPasswordProps, InputPasswordEvents, InputPhoneProps, InputPhoneEvents, InputPriceModel, InputPriceProps, InputPriceEvents, InputRadioProps, InputRadioGroupProps, InputRadioGroupEvents, InputSelectValue, InputSelectProps, InputSelectOption, InputSelectEvents, InputSwitchProps, InputSwitchEvents, InputMultiplierProps, InputTextProps, InputTextEvents, InputTextareaProps, InputTextareaEvents, LinkProps, LinkEvents, ModalProps, ModalEvents, ModalFormProps, ModalFormEvents, PaginationProps, PaginationEvents, PopconfirmProps, PopconfirmEvents, PopoverProps, ProgressCircleProps, ProgressLineProps, SensitiveInfoProps, SkeletonProps, TabProps, TableProps, TableEvents, TagEvents, TagProps, ToastProps, ToastEvents, };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FormSubmissionFormat } from '../enums/form.js';
|
|
2
|
+
import { FormSchema, FormInstance } from '../types/form.js';
|
|
3
|
+
import { Ref, UnwrapNestedRefs } from 'vue';
|
|
4
|
+
|
|
5
|
+
export default function useForm<TSchema extends FormSchema = FormSchema>(options: {
|
|
6
|
+
id?: Ref<string | number>;
|
|
7
|
+
idKey?: string;
|
|
8
|
+
schema: TSchema;
|
|
9
|
+
format?: FormSubmissionFormat;
|
|
10
|
+
}): {
|
|
11
|
+
form: UnwrapNestedRefs<FormInstance<TSchema>>;
|
|
12
|
+
setValue: <K extends keyof UnwrapNestedRefs<FormInstance<TSchema>>>(key: K, value: UnwrapNestedRefs<FormInstance<TSchema>>[K]) => void;
|
|
13
|
+
setValues: (values: Partial<FormInstance<TSchema>>) => void;
|
|
14
|
+
getValue: (key: keyof UnwrapNestedRefs<FormInstance<TSchema>>) => UnwrapNestedRefs<FormInstance<TSchema>>[keyof UnwrapNestedRefs<FormInstance<TSchema>>];
|
|
15
|
+
reset: () => void;
|
|
16
|
+
submit: () => Promise<{
|
|
17
|
+
isValid: boolean;
|
|
18
|
+
form: FormData | import('../types/form.js').JSONForm;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FormStates } from '../enums/form.js';
|
|
2
|
-
import {
|
|
2
|
+
import { ComponentExposed } from 'vue-component-type-helpers';
|
|
3
|
+
import { default as ModalForm } from '../components/ModalForm/ModalForm.vue';
|
|
3
4
|
|
|
4
5
|
export default class CrudService {
|
|
5
6
|
id: string;
|
|
@@ -11,7 +12,7 @@ export default class CrudService {
|
|
|
11
12
|
EDIT: string;
|
|
12
13
|
};
|
|
13
14
|
isLoading: boolean;
|
|
14
|
-
formReference:
|
|
15
|
+
formReference: ComponentExposed<typeof ModalForm> | undefined;
|
|
15
16
|
constructor(entity: string, formReference: any);
|
|
16
17
|
get isEditing(): boolean;
|
|
17
18
|
get isCreating(): boolean;
|
|
@@ -20,7 +21,7 @@ export default class CrudService {
|
|
|
20
21
|
edit(id: string): void;
|
|
21
22
|
close(): void;
|
|
22
23
|
reset(): void;
|
|
23
|
-
save(): void
|
|
24
|
+
save(): Promise<void>;
|
|
24
25
|
onSave(close?: boolean): void;
|
|
25
26
|
delete(): void;
|
|
26
27
|
onDelete(close?: boolean): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FormSchema, FormInstance,
|
|
1
|
+
import { JSONForm, FormSchema, FormInstance, FormDataForm } from '../types/form.js';
|
|
2
2
|
import { FormSubmissionFormat } from '../enums/form.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Transforms the form values to a format that conforms to the submission format
|
|
6
6
|
*/
|
|
7
|
-
export declare const transformForm: <F extends FormSubmissionFormat, S extends FormSchema>(form: FormInstance<S>, schema:
|
|
7
|
+
export declare const transformForm: <F extends FormSubmissionFormat, S extends FormSchema>(form: FormInstance<S>, schema: S, format: F) => Promise<F extends FormSubmissionFormat.FormData ? FormDataForm : JSONForm>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InputPasswordModel } from '../components/InputPassword/types.js';
|
|
2
|
+
import { InputPriceModel } from '../components/InputPrice/types.js';
|
|
2
3
|
import { Country } from '../types/address.js';
|
|
3
4
|
|
|
4
5
|
declare const formValueDateTransformer: (date: Date) => string;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Country = {
|
|
2
2
|
name: string;
|
|
3
3
|
dialCode: string;
|
|
4
4
|
flag: string;
|
|
5
5
|
iso2: string;
|
|
6
6
|
order: string;
|
|
7
|
-
}
|
|
8
|
-
export
|
|
7
|
+
};
|
|
8
|
+
export type CountryStateOption = {
|
|
9
9
|
uuid: string;
|
|
10
10
|
name: string;
|
|
11
|
-
}
|
|
12
|
-
export
|
|
11
|
+
};
|
|
12
|
+
export type AddressResource = {
|
|
13
13
|
city?: string;
|
|
14
14
|
complement?: string;
|
|
15
15
|
country?: string;
|
|
@@ -22,8 +22,8 @@ export interface AddressResource {
|
|
|
22
22
|
street?: string;
|
|
23
23
|
town?: string;
|
|
24
24
|
zipCode?: string;
|
|
25
|
-
}
|
|
26
|
-
export
|
|
25
|
+
};
|
|
26
|
+
export type AddressModel = {
|
|
27
27
|
city?: string;
|
|
28
28
|
complement?: string;
|
|
29
29
|
country?: Country;
|
|
@@ -36,4 +36,4 @@ export interface AddressModel {
|
|
|
36
36
|
street?: string;
|
|
37
37
|
town?: string;
|
|
38
38
|
zipCode?: string;
|
|
39
|
-
}
|
|
39
|
+
};
|