sprintify-ui 0.0.194 → 0.0.196
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/sprintify-ui.es.js +6517 -6429
- package/dist/style.css +1 -1
- package/dist/types/src/components/BaseAddressForm.vue.d.ts +2 -2
- package/dist/types/src/components/BaseAutocomplete.vue.d.ts +5 -5
- package/dist/types/src/components/BaseAutocompleteDrawer.vue.d.ts +2 -2
- package/dist/types/src/components/BaseAutocompleteFetch.vue.d.ts +5 -5
- package/dist/types/src/components/BaseBelongsTo.vue.d.ts +3 -3
- package/dist/types/src/components/BaseButtonGroup.vue.d.ts +2 -2
- package/dist/types/src/components/BaseCharacterCounter.vue.d.ts +1 -1
- package/dist/types/src/components/BaseColor.vue.d.ts +2 -2
- package/dist/types/src/components/BaseDatePicker.vue.d.ts +1 -1
- package/dist/types/src/components/BaseDropdownAutocomplete.vue.d.ts +4 -4
- package/dist/types/src/components/BaseFieldI18n.vue.d.ts +2 -2
- package/dist/types/src/components/BaseFilePicker.vue.d.ts +1 -1
- package/dist/types/src/components/BaseFileUploader.vue.d.ts +2 -2
- package/dist/types/src/components/BaseForm.vue.d.ts +1 -1
- package/dist/types/src/components/BaseHasMany.vue.d.ts +2 -2
- package/dist/types/src/components/BaseInput.vue.d.ts +5 -5
- package/dist/types/src/components/BaseInputPercent.vue.d.ts +4 -4
- package/dist/types/src/components/BaseLoadingCover.vue.d.ts +2 -2
- package/dist/types/src/components/BaseMediaLibrary.vue.d.ts +4 -4
- package/dist/types/src/components/BaseModalCenter.vue.d.ts +1 -1
- package/dist/types/src/components/BaseModalSide.vue.d.ts +1 -1
- package/dist/types/src/components/BaseNavbarItemContent.vue.d.ts +1 -1
- package/dist/types/src/components/BaseNavbarSideItemContent.vue.d.ts +1 -1
- package/dist/types/src/components/BaseNumber.vue.d.ts +16 -7
- package/dist/types/src/components/BasePassword.vue.d.ts +2 -2
- package/dist/types/src/components/BaseRadioGroup.vue.d.ts +1 -1
- package/dist/types/src/components/BaseRichText.vue.d.ts +2 -2
- package/dist/types/src/components/BaseSelect.vue.d.ts +3 -3
- package/dist/types/src/components/BaseSwitch.vue.d.ts +1 -1
- package/dist/types/src/components/BaseTabItem.vue.d.ts +33 -30
- package/dist/types/src/components/BaseTabs.vue.d.ts +25 -1
- package/dist/types/src/components/BaseTagAutocomplete.vue.d.ts +4 -4
- package/dist/types/src/components/BaseTagAutocompleteFetch.vue.d.ts +2 -2
- package/dist/types/src/components/BaseTextarea.vue.d.ts +3 -3
- package/dist/types/src/components/BaseTextareaAutoresize.vue.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/BaseForm.stories.js +48 -0
- package/src/components/BaseForm.vue +10 -5
- package/src/components/BaseNumber.stories.js +19 -3
- package/src/components/BaseNumber.vue +57 -4
- package/src/components/BaseTabItem.vue +53 -22
- package/src/components/BaseTabs.stories.js +33 -2
- package/src/components/BaseTabs.vue +74 -3
- package/src/composables/field.ts +11 -4
|
@@ -56,7 +56,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
56
56
|
default: undefined;
|
|
57
57
|
type: NumberConstructor;
|
|
58
58
|
};
|
|
59
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "
|
|
59
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "blur" | "focus")[], "update:modelValue" | "blur" | "focus", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
60
60
|
/**
|
|
61
61
|
* The value of the input. Can be a number or null.
|
|
62
62
|
* 0.1 = 10%
|
|
@@ -122,11 +122,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
122
122
|
step: number;
|
|
123
123
|
required: boolean;
|
|
124
124
|
icon: string;
|
|
125
|
-
modelValue: string | number | null;
|
|
126
|
-
placeholder: string;
|
|
127
125
|
disabled: boolean;
|
|
128
|
-
min: number;
|
|
129
126
|
max: number;
|
|
127
|
+
min: number;
|
|
128
|
+
placeholder: string;
|
|
129
|
+
modelValue: string | number | null;
|
|
130
130
|
hasError: boolean;
|
|
131
131
|
preventSubmit: boolean;
|
|
132
132
|
}>;
|
|
@@ -87,10 +87,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
87
87
|
};
|
|
88
88
|
}>>, {
|
|
89
89
|
iconClass: string;
|
|
90
|
-
modelValue: boolean;
|
|
91
90
|
duration: string;
|
|
92
|
-
delay: number;
|
|
93
91
|
size: "sm" | "lg";
|
|
92
|
+
delay: number;
|
|
93
|
+
modelValue: boolean;
|
|
94
94
|
backdropClass: string;
|
|
95
95
|
}>;
|
|
96
96
|
export default _default;
|
|
@@ -115,13 +115,13 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
115
115
|
"onUpload:end"?: ((...args: any[]) => any) | undefined;
|
|
116
116
|
}, {
|
|
117
117
|
name: string;
|
|
118
|
-
|
|
118
|
+
cropper: boolean | BaseCropperConfig | null;
|
|
119
|
+
accept: string;
|
|
119
120
|
disabled: boolean;
|
|
120
|
-
min: number;
|
|
121
121
|
max: number;
|
|
122
|
+
min: number;
|
|
123
|
+
modelValue: MediaLibraryPayload | null | undefined;
|
|
122
124
|
hasError: boolean;
|
|
123
|
-
cropper: boolean | BaseCropperConfig | null;
|
|
124
|
-
accept: string;
|
|
125
125
|
maxSize: number;
|
|
126
126
|
acceptedExtensions: string[];
|
|
127
127
|
currentMedia: Media[];
|
|
@@ -59,8 +59,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
59
59
|
}>> & {
|
|
60
60
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
61
61
|
}, {
|
|
62
|
-
modelValue: boolean;
|
|
63
62
|
closeOnOutsideClick: boolean;
|
|
63
|
+
modelValue: boolean;
|
|
64
64
|
clipped: boolean;
|
|
65
65
|
maxWidth: string;
|
|
66
66
|
backdropClass: string;
|
|
@@ -43,8 +43,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
43
43
|
}>> & {
|
|
44
44
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
45
45
|
}, {
|
|
46
|
-
modelValue: boolean;
|
|
47
46
|
closeOnOutsideClick: boolean;
|
|
47
|
+
modelValue: boolean;
|
|
48
48
|
clipped: boolean;
|
|
49
49
|
maxWidth: string;
|
|
50
50
|
backdropClass: string;
|
|
@@ -45,9 +45,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
45
45
|
};
|
|
46
46
|
rounded: {
|
|
47
47
|
default: string;
|
|
48
|
-
type: PropType<"
|
|
48
|
+
type: PropType<"left" | "right" | "none" | "full">;
|
|
49
49
|
};
|
|
50
|
-
|
|
50
|
+
autoFix: {
|
|
51
|
+
default: boolean;
|
|
52
|
+
type: BooleanConstructor;
|
|
53
|
+
};
|
|
54
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "blur" | "focus" | "keydown")[], "update:modelValue" | "blur" | "focus" | "keydown", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
51
55
|
modelValue: {
|
|
52
56
|
default: undefined;
|
|
53
57
|
type: PropType<number | null>;
|
|
@@ -93,7 +97,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
93
97
|
};
|
|
94
98
|
rounded: {
|
|
95
99
|
default: string;
|
|
96
|
-
type: PropType<"
|
|
100
|
+
type: PropType<"left" | "right" | "none" | "full">;
|
|
101
|
+
};
|
|
102
|
+
autoFix: {
|
|
103
|
+
default: boolean;
|
|
104
|
+
type: BooleanConstructor;
|
|
97
105
|
};
|
|
98
106
|
}>> & {
|
|
99
107
|
onFocus?: ((...args: any[]) => any) | undefined;
|
|
@@ -104,13 +112,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
104
112
|
name: string;
|
|
105
113
|
step: number;
|
|
106
114
|
required: boolean;
|
|
107
|
-
modelValue: number | null;
|
|
108
|
-
placeholder: string;
|
|
109
115
|
disabled: boolean;
|
|
110
|
-
min: number;
|
|
111
116
|
max: number;
|
|
117
|
+
min: number;
|
|
118
|
+
placeholder: string;
|
|
119
|
+
modelValue: number | null;
|
|
112
120
|
hasError: boolean;
|
|
121
|
+
rounded: "left" | "right" | "none" | "full";
|
|
113
122
|
borderless: boolean;
|
|
114
|
-
|
|
123
|
+
autoFix: boolean;
|
|
115
124
|
}>;
|
|
116
125
|
export default _default;
|
|
@@ -54,9 +54,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
54
54
|
}, {
|
|
55
55
|
name: string;
|
|
56
56
|
required: boolean;
|
|
57
|
-
modelValue: string | null;
|
|
58
|
-
placeholder: string;
|
|
59
57
|
disabled: boolean;
|
|
58
|
+
placeholder: string;
|
|
59
|
+
modelValue: string | null;
|
|
60
60
|
hasError: boolean;
|
|
61
61
|
}>;
|
|
62
62
|
export default _default;
|
|
@@ -88,8 +88,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
88
88
|
name: string;
|
|
89
89
|
required: boolean;
|
|
90
90
|
labelClass: string;
|
|
91
|
-
modelValue: OptionValue | undefined;
|
|
92
91
|
disabled: boolean;
|
|
92
|
+
modelValue: OptionValue | undefined;
|
|
93
93
|
hasError: boolean;
|
|
94
94
|
inputClass: string;
|
|
95
95
|
}>, {
|
|
@@ -81,9 +81,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
81
81
|
}, {
|
|
82
82
|
name: string;
|
|
83
83
|
required: boolean;
|
|
84
|
-
modelValue: string | Delta | null | undefined;
|
|
85
|
-
placeholder: string;
|
|
86
84
|
disabled: boolean;
|
|
85
|
+
placeholder: string;
|
|
86
|
+
modelValue: string | Delta | null | undefined;
|
|
87
87
|
hasError: boolean;
|
|
88
88
|
enable: boolean;
|
|
89
89
|
toolbar: string | unknown[] | Record<string, any> | undefined;
|
|
@@ -79,13 +79,13 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
79
79
|
}, {
|
|
80
80
|
name: string;
|
|
81
81
|
required: boolean;
|
|
82
|
-
modelValue: (string | number | null) | undefined;
|
|
83
|
-
placeholder: string;
|
|
84
82
|
disabled: boolean;
|
|
85
|
-
|
|
83
|
+
placeholder: string;
|
|
86
84
|
options: Option[];
|
|
85
|
+
modelValue: (string | number | null) | undefined;
|
|
87
86
|
labelKey: string;
|
|
88
87
|
valueKey: string;
|
|
88
|
+
hasError: boolean;
|
|
89
89
|
}>, {
|
|
90
90
|
default: (_: {}) => any;
|
|
91
91
|
}>;
|
|
@@ -55,9 +55,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
55
55
|
name: string;
|
|
56
56
|
color: "success" | "info" | "danger" | "warning" | "dark" | "light" | "primary";
|
|
57
57
|
required: boolean;
|
|
58
|
+
size: "base" | "xs" | "sm" | "lg" | "xl";
|
|
58
59
|
modelValue: string | number | boolean | null | undefined;
|
|
59
60
|
hasError: boolean;
|
|
60
|
-
size: "base" | "xs" | "sm" | "lg" | "xl";
|
|
61
61
|
}>, {
|
|
62
62
|
default: (_: {}) => any;
|
|
63
63
|
}>;
|
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
import { PropType } from 'vue';
|
|
2
1
|
import { RouteLocationRaw } from 'vue-router';
|
|
3
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
4
|
-
to:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
disabled:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
required: true;
|
|
19
|
-
type: PropType<RouteLocationRaw>;
|
|
20
|
-
};
|
|
21
|
-
disabled: {
|
|
22
|
-
default: boolean;
|
|
23
|
-
type: BooleanConstructor;
|
|
24
|
-
};
|
|
25
|
-
activeStrategy: {
|
|
26
|
-
default: string;
|
|
27
|
-
type: PropType<"default" | "exact">;
|
|
28
|
-
};
|
|
29
|
-
}>>, {
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
to: RouteLocationRaw;
|
|
4
|
+
disabled?: boolean | undefined;
|
|
5
|
+
activeStrategy?: "default" | "exact" | undefined;
|
|
6
|
+
}>, {
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
activeStrategy: string;
|
|
9
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
10
|
+
to: RouteLocationRaw;
|
|
11
|
+
disabled?: boolean | undefined;
|
|
12
|
+
activeStrategy?: "default" | "exact" | undefined;
|
|
13
|
+
}>, {
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
activeStrategy: string;
|
|
16
|
+
}>>>, {
|
|
30
17
|
disabled: boolean;
|
|
31
|
-
activeStrategy:
|
|
18
|
+
activeStrategy: 'default' | 'exact';
|
|
32
19
|
}>, {
|
|
33
|
-
default: (_: {
|
|
20
|
+
default: (_: {
|
|
21
|
+
active: boolean;
|
|
22
|
+
}) => any;
|
|
34
23
|
}>;
|
|
35
24
|
export default _default;
|
|
25
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
26
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
27
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
28
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
29
|
+
} : {
|
|
30
|
+
type: import('vue').PropType<T[K]>;
|
|
31
|
+
required: true;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
type __VLS_WithDefaults<P, D> = {
|
|
35
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
36
|
+
default: D[K];
|
|
37
|
+
} : P[K];
|
|
38
|
+
};
|
|
36
39
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
37
40
|
new (): {
|
|
38
41
|
$slots: S;
|
|
@@ -1,7 +1,31 @@
|
|
|
1
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
size?: "xs" | "sm" | "lg" | "md" | undefined;
|
|
3
|
+
}>, {
|
|
4
|
+
size: string;
|
|
5
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
6
|
+
size?: "xs" | "sm" | "lg" | "md" | undefined;
|
|
7
|
+
}>, {
|
|
8
|
+
size: string;
|
|
9
|
+
}>>>, {
|
|
10
|
+
size: 'xs' | 'sm' | 'md' | 'lg';
|
|
11
|
+
}>, {
|
|
2
12
|
default: (_: {}) => any;
|
|
3
13
|
}>;
|
|
4
14
|
export default _default;
|
|
15
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
16
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
17
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
18
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
19
|
+
} : {
|
|
20
|
+
type: import('vue').PropType<T[K]>;
|
|
21
|
+
required: true;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
type __VLS_WithDefaults<P, D> = {
|
|
25
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
26
|
+
default: D[K];
|
|
27
|
+
} : P[K];
|
|
28
|
+
};
|
|
5
29
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
6
30
|
new (): {
|
|
7
31
|
$slots: S;
|
|
@@ -137,8 +137,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
137
137
|
type: PropType<"focus" | "always">;
|
|
138
138
|
};
|
|
139
139
|
}>> & {
|
|
140
|
-
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
141
140
|
onScrollBottom?: ((...args: any[]) => any) | undefined;
|
|
141
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
142
142
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
143
143
|
onTyping?: ((...args: any[]) => any) | undefined;
|
|
144
144
|
onOpen?: ((...args: any[]) => any) | undefined;
|
|
@@ -146,13 +146,13 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
146
146
|
filter: (option: NormalizedOption) => boolean;
|
|
147
147
|
name: string;
|
|
148
148
|
required: boolean;
|
|
149
|
-
placeholder: string;
|
|
150
149
|
disabled: boolean;
|
|
151
150
|
max: number;
|
|
152
|
-
|
|
151
|
+
placeholder: string;
|
|
152
|
+
size: "base" | "xs" | "sm";
|
|
153
153
|
loading: boolean;
|
|
154
154
|
loadingBottom: boolean;
|
|
155
|
-
|
|
155
|
+
hasError: boolean;
|
|
156
156
|
inline: boolean;
|
|
157
157
|
dropdownShow: "focus" | "always";
|
|
158
158
|
}>, {
|
|
@@ -90,14 +90,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
90
90
|
};
|
|
91
91
|
}>> & {
|
|
92
92
|
onFocus?: ((...args: any[]) => any) | undefined;
|
|
93
|
-
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
94
93
|
onScrollBottom?: ((...args: any[]) => any) | undefined;
|
|
94
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
95
95
|
onTyping?: ((...args: any[]) => any) | undefined;
|
|
96
96
|
}, {
|
|
97
97
|
required: boolean;
|
|
98
|
-
placeholder: string;
|
|
99
98
|
disabled: boolean;
|
|
100
99
|
max: number;
|
|
100
|
+
placeholder: string;
|
|
101
101
|
hasError: boolean;
|
|
102
102
|
queryKey: string;
|
|
103
103
|
}>, {
|
|
@@ -87,11 +87,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
87
87
|
type: string;
|
|
88
88
|
name: string;
|
|
89
89
|
required: boolean;
|
|
90
|
-
|
|
91
|
-
placeholder: string;
|
|
90
|
+
autocomplete: boolean;
|
|
92
91
|
disabled: boolean;
|
|
92
|
+
placeholder: string;
|
|
93
|
+
modelValue: string | null | undefined;
|
|
93
94
|
hasError: boolean;
|
|
94
|
-
autocomplete: boolean;
|
|
95
95
|
preventSubmit: boolean;
|
|
96
96
|
rows: number;
|
|
97
97
|
}>;
|
|
@@ -87,9 +87,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
87
87
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
88
88
|
}, {
|
|
89
89
|
required: boolean;
|
|
90
|
-
modelValue: string;
|
|
91
|
-
placeholder: string;
|
|
92
90
|
disabled: boolean;
|
|
91
|
+
placeholder: string;
|
|
92
|
+
modelValue: string;
|
|
93
93
|
hasError: boolean;
|
|
94
94
|
maxHeight: number;
|
|
95
95
|
rows: number;
|
package/package.json
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import BaseForm from './BaseForm.vue';
|
|
2
|
+
import BaseField from './BaseField.vue';
|
|
3
|
+
import BaseNumber from './BaseNumber.vue';
|
|
4
|
+
import BaseMediaLibrary from './BaseMediaLibrary.vue';
|
|
5
|
+
import ShowValue from '../../.storybook/components/ShowValue.vue';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Form/BaseForm',
|
|
9
|
+
component: BaseForm,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const Template = (args) => ({
|
|
13
|
+
components: {
|
|
14
|
+
ShowValue,
|
|
15
|
+
BaseForm,
|
|
16
|
+
BaseField,
|
|
17
|
+
BaseNumber,
|
|
18
|
+
BaseMediaLibrary,
|
|
19
|
+
},
|
|
20
|
+
setup() {
|
|
21
|
+
const form = ref({
|
|
22
|
+
number: 1.1,
|
|
23
|
+
});
|
|
24
|
+
return { args, form };
|
|
25
|
+
},
|
|
26
|
+
template: `
|
|
27
|
+
<BaseForm
|
|
28
|
+
method="post"
|
|
29
|
+
url="https://faker.witify.io/api/todos/422"
|
|
30
|
+
:data="form"
|
|
31
|
+
v-slot="{disabled}"
|
|
32
|
+
>
|
|
33
|
+
<BaseField class="mb-3" name="number" label="Number">
|
|
34
|
+
<BaseNumber v-model="form.number"></BaseNumber>
|
|
35
|
+
</BaseField>
|
|
36
|
+
|
|
37
|
+
<BaseField class="mb-3" name="media" label="Media">
|
|
38
|
+
<BaseMediaLibrary v-model="form.media" upload-url="https://faker.witify.io/api/todos/upload"></BaseMediaLibrary>
|
|
39
|
+
</BaseField>
|
|
40
|
+
|
|
41
|
+
<button type="submit" class="btn btn-primary" :disabled="disabled">Submit</button>
|
|
42
|
+
</BaseForm>
|
|
43
|
+
<ShowValue :value="form" />
|
|
44
|
+
`,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const Demo = Template.bind({});
|
|
48
|
+
Demo.args = {};
|
|
@@ -112,7 +112,6 @@ const emit = defineEmits(['error', 'success']);
|
|
|
112
112
|
|
|
113
113
|
const form = ref<null | HTMLFormElement>(null);
|
|
114
114
|
const loading = ref(false);
|
|
115
|
-
const disabled = ref(false);
|
|
116
115
|
const errors = ref<Record<string, string[]>>({});
|
|
117
116
|
|
|
118
117
|
const httpClient = computed((): AxiosInstance => {
|
|
@@ -291,14 +290,20 @@ function clearErrors(name = null): void {
|
|
|
291
290
|
}
|
|
292
291
|
}
|
|
293
292
|
|
|
294
|
-
|
|
295
|
-
|
|
293
|
+
const disablingFields = reactive(new Set<string>());
|
|
294
|
+
|
|
295
|
+
function disabledForm(uuid: string) {
|
|
296
|
+
disablingFields.add(uuid);
|
|
296
297
|
}
|
|
297
298
|
|
|
298
|
-
function enableForm() {
|
|
299
|
-
|
|
299
|
+
function enableForm(uuid: string) {
|
|
300
|
+
disablingFields.delete(uuid);
|
|
300
301
|
}
|
|
301
302
|
|
|
303
|
+
const disabled = computed((): boolean => {
|
|
304
|
+
return disablingFields.size > 0;
|
|
305
|
+
});
|
|
306
|
+
|
|
302
307
|
provide('form:errors', readonly(errors));
|
|
303
308
|
provide('form:getErrorMessageByName', getErrorMessageByName);
|
|
304
309
|
provide('form:clearErrors', clearErrors);
|
|
@@ -8,8 +8,6 @@ export default {
|
|
|
8
8
|
args: {
|
|
9
9
|
placeholder: 'Enter number',
|
|
10
10
|
step: 0.1,
|
|
11
|
-
min: 0,
|
|
12
|
-
max: 100,
|
|
13
11
|
},
|
|
14
12
|
};
|
|
15
13
|
|
|
@@ -19,7 +17,7 @@ const Template = (args) => ({
|
|
|
19
17
|
BaseNumber,
|
|
20
18
|
},
|
|
21
19
|
setup() {
|
|
22
|
-
const value = ref(
|
|
20
|
+
const value = ref(null);
|
|
23
21
|
return { args, value };
|
|
24
22
|
},
|
|
25
23
|
template: `
|
|
@@ -33,6 +31,24 @@ const Template = (args) => ({
|
|
|
33
31
|
export const Demo = Template.bind({});
|
|
34
32
|
Demo.args = {};
|
|
35
33
|
|
|
34
|
+
export const Min = Template.bind({});
|
|
35
|
+
Min.args = {
|
|
36
|
+
min: 10000,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const Max = Template.bind({});
|
|
40
|
+
Max.args = {
|
|
41
|
+
max: 10000,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const AutoFix = Template.bind({});
|
|
45
|
+
AutoFix.args = {
|
|
46
|
+
autoFix: true,
|
|
47
|
+
min: 10,
|
|
48
|
+
max: 20,
|
|
49
|
+
step: 0.01,
|
|
50
|
+
};
|
|
51
|
+
|
|
36
52
|
export const Disabled = Template.bind({});
|
|
37
53
|
Disabled.args = {
|
|
38
54
|
disabled: true,
|