sprintify-ui 0.0.102 → 0.0.104
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 +9541 -9273
- package/dist/style.css +1 -1
- package/dist/types/src/components/BaseAutocomplete.vue.d.ts +23 -3
- package/dist/types/src/components/BaseAutocompleteFetch.vue.d.ts +26 -8
- package/dist/types/src/components/BaseBelongsTo.vue.d.ts +26 -8
- package/dist/types/src/components/BaseDropdown.vue.d.ts +9 -0
- package/dist/types/src/components/BaseDropdownAutocomplete.vue.d.ts +123 -0
- package/dist/types/src/components/BaseHasMany.vue.d.ts +5 -5
- package/dist/types/src/components/BaseTable.vue.d.ts +2 -2
- package/dist/types/src/components/BaseTagAutocompleteFetch.vue.d.ts +5 -5
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/BaseAutocomplete.stories.js +6 -0
- package/src/components/BaseAutocomplete.vue +65 -15
- package/src/components/BaseAutocompleteDropdown.vue +2 -2
- package/src/components/BaseAutocompleteFetch.stories.js +6 -0
- package/src/components/BaseAutocompleteFetch.vue +34 -8
- package/src/components/BaseBelongsTo.stories.js +6 -0
- package/src/components/BaseBelongsTo.vue +17 -7
- package/src/components/BaseButtonGroup.vue +1 -1
- package/src/components/BaseColor.vue +3 -3
- package/src/components/BaseDropdown.stories.js +1 -1
- package/src/components/BaseDropdown.vue +15 -9
- package/src/components/BaseDropdownAutocomplete.stories.js +178 -0
- package/src/components/BaseDropdownAutocomplete.vue +225 -0
- package/src/components/BaseHasMany.vue +6 -5
- package/src/components/BaseRadioGroup.vue +4 -1
- package/src/components/BaseTable.vue +1 -1
- package/src/components/BaseTagAutocomplete.vue +4 -4
- package/src/components/BaseTagAutocompleteFetch.vue +5 -5
- package/src/components/index.ts +2 -0
- package/src/types/index.ts +1 -1
- package/dist/types/src/components/BaseFormField.d.ts +0 -81
- package/dist/types/src/components/BaseLocaleForm.vue.d.ts +0 -439
- package/dist/types/src/components/BaseNumberForm.vue.d.ts +0 -401
- package/dist/types/src/components/BasePasswordForm.vue.d.ts +0 -384
- package/dist/types/src/components/BaseTextareaForm.vue.d.ts +0 -413
- package/src/components/BaseFormField.ts +0 -117
- package/src/components/BaseLocaleForm.vue +0 -142
- package/src/components/BaseNumberForm.vue +0 -67
- package/src/components/BasePasswordForm.vue +0 -59
- package/src/components/BaseTextareaForm.vue +0 -101
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
import { PropType } from 'vue';
|
|
2
|
-
declare const _default: import("vue").DefineComponent<{
|
|
3
|
-
modelValue: {
|
|
4
|
-
required: true;
|
|
5
|
-
type: PropType<string | null>;
|
|
6
|
-
};
|
|
7
|
-
type: {
|
|
8
|
-
type: StringConstructor;
|
|
9
|
-
default: string;
|
|
10
|
-
};
|
|
11
|
-
rows: {
|
|
12
|
-
default: number;
|
|
13
|
-
type: NumberConstructor;
|
|
14
|
-
};
|
|
15
|
-
min: {
|
|
16
|
-
default: undefined;
|
|
17
|
-
type: NumberConstructor;
|
|
18
|
-
};
|
|
19
|
-
max: {
|
|
20
|
-
default: undefined;
|
|
21
|
-
type: NumberConstructor;
|
|
22
|
-
};
|
|
23
|
-
}, unknown, unknown, {
|
|
24
|
-
normalizedModelValue(): string;
|
|
25
|
-
}, {
|
|
26
|
-
transformInputValue(event: Event | null): string | null;
|
|
27
|
-
}, import("vue").ComponentOptionsMixin, import("vue").DefineComponent<{
|
|
28
|
-
name: {
|
|
29
|
-
required: true;
|
|
30
|
-
type: StringConstructor;
|
|
31
|
-
};
|
|
32
|
-
placeholder: {
|
|
33
|
-
default: string;
|
|
34
|
-
type: StringConstructor;
|
|
35
|
-
};
|
|
36
|
-
label: {
|
|
37
|
-
default: string;
|
|
38
|
-
type: StringConstructor;
|
|
39
|
-
};
|
|
40
|
-
disabled: {
|
|
41
|
-
type: BooleanConstructor;
|
|
42
|
-
default: boolean;
|
|
43
|
-
};
|
|
44
|
-
required: {
|
|
45
|
-
default: boolean;
|
|
46
|
-
type: BooleanConstructor;
|
|
47
|
-
};
|
|
48
|
-
autofocus: {
|
|
49
|
-
default: boolean;
|
|
50
|
-
type: BooleanConstructor;
|
|
51
|
-
};
|
|
52
|
-
preventSubmit: {
|
|
53
|
-
default: boolean;
|
|
54
|
-
type: BooleanConstructor;
|
|
55
|
-
};
|
|
56
|
-
}, unknown, unknown, {
|
|
57
|
-
form(): ({
|
|
58
|
-
new (...args: any[]): {
|
|
59
|
-
$: import("vue").ComponentInternalInstance;
|
|
60
|
-
$data: {};
|
|
61
|
-
$props: Partial<{
|
|
62
|
-
axiosInstance: import("axios").AxiosInstance | null;
|
|
63
|
-
format: import("../types").DataFormat;
|
|
64
|
-
beforeSubmit: (next: () => void) => void;
|
|
65
|
-
successHandler: (response: any) => void;
|
|
66
|
-
errorHandler: (error: import("axios").AxiosError<any, any>) => void;
|
|
67
|
-
loadingMaskClass: string;
|
|
68
|
-
showNotificationOnError: boolean;
|
|
69
|
-
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
70
|
-
url: {
|
|
71
|
-
required: true;
|
|
72
|
-
type: StringConstructor;
|
|
73
|
-
};
|
|
74
|
-
method: {
|
|
75
|
-
required: true;
|
|
76
|
-
type: PropType<import("../types").Method>;
|
|
77
|
-
validator: (value: string) => boolean;
|
|
78
|
-
};
|
|
79
|
-
data: {
|
|
80
|
-
required: true;
|
|
81
|
-
type: PropType<Record<string, any>>;
|
|
82
|
-
};
|
|
83
|
-
axiosInstance: {
|
|
84
|
-
default: null;
|
|
85
|
-
type: PropType<import("axios").AxiosInstance | null>;
|
|
86
|
-
};
|
|
87
|
-
format: {
|
|
88
|
-
type: PropType<import("../types").DataFormat>;
|
|
89
|
-
default: import("../types").DataFormat;
|
|
90
|
-
validator: (value: string) => boolean;
|
|
91
|
-
};
|
|
92
|
-
beforeSubmit: {
|
|
93
|
-
default: (next: () => void) => void;
|
|
94
|
-
type: PropType<(next: () => void) => void>;
|
|
95
|
-
};
|
|
96
|
-
successHandler: {
|
|
97
|
-
default: undefined;
|
|
98
|
-
type: PropType<(response: any) => void>;
|
|
99
|
-
};
|
|
100
|
-
errorHandler: {
|
|
101
|
-
default: (error: import("axios").AxiosError<any, any>) => void;
|
|
102
|
-
type: PropType<(error: import("axios").AxiosError<any, any>) => void>;
|
|
103
|
-
};
|
|
104
|
-
loadingMaskClass: {
|
|
105
|
-
default: string;
|
|
106
|
-
type: StringConstructor;
|
|
107
|
-
};
|
|
108
|
-
showNotificationOnError: {
|
|
109
|
-
default: boolean;
|
|
110
|
-
type: BooleanConstructor;
|
|
111
|
-
};
|
|
112
|
-
}>> & {
|
|
113
|
-
onError?: ((...args: any[]) => any) | undefined;
|
|
114
|
-
onSuccess?: ((...args: any[]) => any) | undefined;
|
|
115
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "axiosInstance" | "format" | "beforeSubmit" | "successHandler" | "errorHandler" | "loadingMaskClass" | "showNotificationOnError">;
|
|
116
|
-
$attrs: {
|
|
117
|
-
[x: string]: unknown;
|
|
118
|
-
};
|
|
119
|
-
$refs: {
|
|
120
|
-
[x: string]: unknown;
|
|
121
|
-
};
|
|
122
|
-
$slots: Readonly<{
|
|
123
|
-
[name: string]: import("vue").Slot | undefined;
|
|
124
|
-
}>;
|
|
125
|
-
$root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null;
|
|
126
|
-
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null;
|
|
127
|
-
$emit: (event: "success" | "error", ...args: any[]) => void;
|
|
128
|
-
$el: any;
|
|
129
|
-
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
130
|
-
url: {
|
|
131
|
-
required: true;
|
|
132
|
-
type: StringConstructor;
|
|
133
|
-
};
|
|
134
|
-
method: {
|
|
135
|
-
required: true;
|
|
136
|
-
type: PropType<import("../types").Method>;
|
|
137
|
-
validator: (value: string) => boolean;
|
|
138
|
-
};
|
|
139
|
-
data: {
|
|
140
|
-
required: true;
|
|
141
|
-
type: PropType<Record<string, any>>;
|
|
142
|
-
};
|
|
143
|
-
axiosInstance: {
|
|
144
|
-
default: null;
|
|
145
|
-
type: PropType<import("axios").AxiosInstance | null>;
|
|
146
|
-
};
|
|
147
|
-
format: {
|
|
148
|
-
type: PropType<import("../types").DataFormat>;
|
|
149
|
-
default: import("../types").DataFormat;
|
|
150
|
-
validator: (value: string) => boolean;
|
|
151
|
-
};
|
|
152
|
-
beforeSubmit: {
|
|
153
|
-
default: (next: () => void) => void;
|
|
154
|
-
type: PropType<(next: () => void) => void>;
|
|
155
|
-
};
|
|
156
|
-
successHandler: {
|
|
157
|
-
default: undefined;
|
|
158
|
-
type: PropType<(response: any) => void>;
|
|
159
|
-
};
|
|
160
|
-
errorHandler: {
|
|
161
|
-
default: (error: import("axios").AxiosError<any, any>) => void;
|
|
162
|
-
type: PropType<(error: import("axios").AxiosError<any, any>) => void>;
|
|
163
|
-
};
|
|
164
|
-
loadingMaskClass: {
|
|
165
|
-
default: string;
|
|
166
|
-
type: StringConstructor;
|
|
167
|
-
};
|
|
168
|
-
showNotificationOnError: {
|
|
169
|
-
default: boolean;
|
|
170
|
-
type: BooleanConstructor;
|
|
171
|
-
};
|
|
172
|
-
}>> & {
|
|
173
|
-
onError?: ((...args: any[]) => any) | undefined;
|
|
174
|
-
onSuccess?: ((...args: any[]) => any) | undefined;
|
|
175
|
-
}, {
|
|
176
|
-
submit: () => void;
|
|
177
|
-
errors: import("vue").Ref<Record<string, string[]>>;
|
|
178
|
-
hasErrors: import("vue").ComputedRef<boolean>;
|
|
179
|
-
clearErrors: (name?: null) => void;
|
|
180
|
-
disabled: import("vue").Ref<boolean>;
|
|
181
|
-
loading: import("vue").Ref<boolean>;
|
|
182
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("success" | "error")[], string, {
|
|
183
|
-
axiosInstance: import("axios").AxiosInstance | null;
|
|
184
|
-
format: import("../types").DataFormat;
|
|
185
|
-
beforeSubmit: (next: () => void) => void;
|
|
186
|
-
successHandler: (response: any) => void;
|
|
187
|
-
errorHandler: (error: import("axios").AxiosError<any, any>) => void;
|
|
188
|
-
loadingMaskClass: string;
|
|
189
|
-
showNotificationOnError: boolean;
|
|
190
|
-
}, {}, string> & {
|
|
191
|
-
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
192
|
-
created?: ((() => void) | (() => void)[]) | undefined;
|
|
193
|
-
beforeMount?: ((() => void) | (() => void)[]) | undefined;
|
|
194
|
-
mounted?: ((() => void) | (() => void)[]) | undefined;
|
|
195
|
-
beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
|
|
196
|
-
updated?: ((() => void) | (() => void)[]) | undefined;
|
|
197
|
-
activated?: ((() => void) | (() => void)[]) | undefined;
|
|
198
|
-
deactivated?: ((() => void) | (() => void)[]) | undefined;
|
|
199
|
-
beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
|
|
200
|
-
beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
|
|
201
|
-
destroyed?: ((() => void) | (() => void)[]) | undefined;
|
|
202
|
-
unmounted?: ((() => void) | (() => void)[]) | undefined;
|
|
203
|
-
renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
|
|
204
|
-
renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
|
|
205
|
-
errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null, info: string) => boolean | void)[]) | undefined;
|
|
206
|
-
};
|
|
207
|
-
$forceUpdate: () => void;
|
|
208
|
-
$nextTick: typeof import("vue").nextTick;
|
|
209
|
-
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R) => any : (...args: any) => any, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
|
|
210
|
-
} & Readonly<import("vue").ExtractPropTypes<{
|
|
211
|
-
url: {
|
|
212
|
-
required: true;
|
|
213
|
-
type: StringConstructor;
|
|
214
|
-
};
|
|
215
|
-
method: {
|
|
216
|
-
required: true;
|
|
217
|
-
type: PropType<import("../types").Method>;
|
|
218
|
-
validator: (value: string) => boolean;
|
|
219
|
-
};
|
|
220
|
-
data: {
|
|
221
|
-
required: true;
|
|
222
|
-
type: PropType<Record<string, any>>;
|
|
223
|
-
};
|
|
224
|
-
axiosInstance: {
|
|
225
|
-
default: null;
|
|
226
|
-
type: PropType<import("axios").AxiosInstance | null>;
|
|
227
|
-
};
|
|
228
|
-
format: {
|
|
229
|
-
type: PropType<import("../types").DataFormat>;
|
|
230
|
-
default: import("../types").DataFormat;
|
|
231
|
-
validator: (value: string) => boolean;
|
|
232
|
-
};
|
|
233
|
-
beforeSubmit: {
|
|
234
|
-
default: (next: () => void) => void;
|
|
235
|
-
type: PropType<(next: () => void) => void>;
|
|
236
|
-
};
|
|
237
|
-
successHandler: {
|
|
238
|
-
default: undefined;
|
|
239
|
-
type: PropType<(response: any) => void>;
|
|
240
|
-
};
|
|
241
|
-
errorHandler: {
|
|
242
|
-
default: (error: import("axios").AxiosError<any, any>) => void;
|
|
243
|
-
type: PropType<(error: import("axios").AxiosError<any, any>) => void>;
|
|
244
|
-
};
|
|
245
|
-
loadingMaskClass: {
|
|
246
|
-
default: string;
|
|
247
|
-
type: StringConstructor;
|
|
248
|
-
};
|
|
249
|
-
showNotificationOnError: {
|
|
250
|
-
default: boolean;
|
|
251
|
-
type: BooleanConstructor;
|
|
252
|
-
};
|
|
253
|
-
}>> & {
|
|
254
|
-
onError?: ((...args: any[]) => any) | undefined;
|
|
255
|
-
onSuccess?: ((...args: any[]) => any) | undefined;
|
|
256
|
-
} & import("vue").ShallowUnwrapRef<{
|
|
257
|
-
submit: () => void;
|
|
258
|
-
errors: import("vue").Ref<Record<string, string[]>>;
|
|
259
|
-
hasErrors: import("vue").ComputedRef<boolean>;
|
|
260
|
-
clearErrors: (name?: null) => void;
|
|
261
|
-
disabled: import("vue").Ref<boolean>;
|
|
262
|
-
loading: import("vue").Ref<boolean>;
|
|
263
|
-
}> & {} & import("vue").ComponentCustomProperties & {};
|
|
264
|
-
__isFragment?: undefined;
|
|
265
|
-
__isTeleport?: undefined;
|
|
266
|
-
__isSuspense?: undefined;
|
|
267
|
-
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
268
|
-
url: {
|
|
269
|
-
required: true;
|
|
270
|
-
type: StringConstructor;
|
|
271
|
-
};
|
|
272
|
-
method: {
|
|
273
|
-
required: true;
|
|
274
|
-
type: PropType<import("../types").Method>;
|
|
275
|
-
validator: (value: string) => boolean;
|
|
276
|
-
};
|
|
277
|
-
data: {
|
|
278
|
-
required: true;
|
|
279
|
-
type: PropType<Record<string, any>>;
|
|
280
|
-
};
|
|
281
|
-
axiosInstance: {
|
|
282
|
-
default: null;
|
|
283
|
-
type: PropType<import("axios").AxiosInstance | null>;
|
|
284
|
-
};
|
|
285
|
-
format: {
|
|
286
|
-
type: PropType<import("../types").DataFormat>;
|
|
287
|
-
default: import("../types").DataFormat;
|
|
288
|
-
validator: (value: string) => boolean;
|
|
289
|
-
};
|
|
290
|
-
beforeSubmit: {
|
|
291
|
-
default: (next: () => void) => void;
|
|
292
|
-
type: PropType<(next: () => void) => void>;
|
|
293
|
-
};
|
|
294
|
-
successHandler: {
|
|
295
|
-
default: undefined;
|
|
296
|
-
type: PropType<(response: any) => void>;
|
|
297
|
-
};
|
|
298
|
-
errorHandler: {
|
|
299
|
-
default: (error: import("axios").AxiosError<any, any>) => void;
|
|
300
|
-
type: PropType<(error: import("axios").AxiosError<any, any>) => void>;
|
|
301
|
-
};
|
|
302
|
-
loadingMaskClass: {
|
|
303
|
-
default: string;
|
|
304
|
-
type: StringConstructor;
|
|
305
|
-
};
|
|
306
|
-
showNotificationOnError: {
|
|
307
|
-
default: boolean;
|
|
308
|
-
type: BooleanConstructor;
|
|
309
|
-
};
|
|
310
|
-
}>> & {
|
|
311
|
-
onError?: ((...args: any[]) => any) | undefined;
|
|
312
|
-
onSuccess?: ((...args: any[]) => any) | undefined;
|
|
313
|
-
}, {
|
|
314
|
-
submit: () => void;
|
|
315
|
-
errors: import("vue").Ref<Record<string, string[]>>;
|
|
316
|
-
hasErrors: import("vue").ComputedRef<boolean>;
|
|
317
|
-
clearErrors: (name?: null) => void;
|
|
318
|
-
disabled: import("vue").Ref<boolean>;
|
|
319
|
-
loading: import("vue").Ref<boolean>;
|
|
320
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("success" | "error")[], "success" | "error", {
|
|
321
|
-
axiosInstance: import("axios").AxiosInstance | null;
|
|
322
|
-
format: import("../types").DataFormat;
|
|
323
|
-
beforeSubmit: (next: () => void) => void;
|
|
324
|
-
successHandler: (response: any) => void;
|
|
325
|
-
errorHandler: (error: import("axios").AxiosError<any, any>) => void;
|
|
326
|
-
loadingMaskClass: string;
|
|
327
|
-
showNotificationOnError: boolean;
|
|
328
|
-
}, {}, string> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
329
|
-
$slots: {
|
|
330
|
-
default: (_: {
|
|
331
|
-
errors: Record<string, string[]>;
|
|
332
|
-
loading: boolean;
|
|
333
|
-
disabled: boolean;
|
|
334
|
-
submit: () => void;
|
|
335
|
-
}) => any;
|
|
336
|
-
loading: (_: {}) => any;
|
|
337
|
-
};
|
|
338
|
-
})) | null;
|
|
339
|
-
errors(): any;
|
|
340
|
-
labelValue(): string;
|
|
341
|
-
}, {
|
|
342
|
-
inputListener(payload: any): void;
|
|
343
|
-
errorMessage(name?: string | null): any;
|
|
344
|
-
hasError(name?: string | null): boolean;
|
|
345
|
-
clearErrors(name?: string | null): void;
|
|
346
|
-
disableForm(): void;
|
|
347
|
-
enableForm(): void;
|
|
348
|
-
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
349
|
-
name: {
|
|
350
|
-
required: true;
|
|
351
|
-
type: StringConstructor;
|
|
352
|
-
};
|
|
353
|
-
placeholder: {
|
|
354
|
-
default: string;
|
|
355
|
-
type: StringConstructor;
|
|
356
|
-
};
|
|
357
|
-
label: {
|
|
358
|
-
default: string;
|
|
359
|
-
type: StringConstructor;
|
|
360
|
-
};
|
|
361
|
-
disabled: {
|
|
362
|
-
type: BooleanConstructor;
|
|
363
|
-
default: boolean;
|
|
364
|
-
};
|
|
365
|
-
required: {
|
|
366
|
-
default: boolean;
|
|
367
|
-
type: BooleanConstructor;
|
|
368
|
-
};
|
|
369
|
-
autofocus: {
|
|
370
|
-
default: boolean;
|
|
371
|
-
type: BooleanConstructor;
|
|
372
|
-
};
|
|
373
|
-
preventSubmit: {
|
|
374
|
-
default: boolean;
|
|
375
|
-
type: BooleanConstructor;
|
|
376
|
-
};
|
|
377
|
-
}>> & {
|
|
378
|
-
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
379
|
-
}, {
|
|
380
|
-
required: boolean;
|
|
381
|
-
label: string;
|
|
382
|
-
disabled: boolean;
|
|
383
|
-
placeholder: string;
|
|
384
|
-
preventSubmit: boolean;
|
|
385
|
-
autofocus: boolean;
|
|
386
|
-
}>, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
387
|
-
modelValue: {
|
|
388
|
-
required: true;
|
|
389
|
-
type: PropType<string | null>;
|
|
390
|
-
};
|
|
391
|
-
type: {
|
|
392
|
-
type: StringConstructor;
|
|
393
|
-
default: string;
|
|
394
|
-
};
|
|
395
|
-
rows: {
|
|
396
|
-
default: number;
|
|
397
|
-
type: NumberConstructor;
|
|
398
|
-
};
|
|
399
|
-
min: {
|
|
400
|
-
default: undefined;
|
|
401
|
-
type: NumberConstructor;
|
|
402
|
-
};
|
|
403
|
-
max: {
|
|
404
|
-
default: undefined;
|
|
405
|
-
type: NumberConstructor;
|
|
406
|
-
};
|
|
407
|
-
}>>, {
|
|
408
|
-
type: string;
|
|
409
|
-
max: number;
|
|
410
|
-
min: number;
|
|
411
|
-
rows: number;
|
|
412
|
-
}>;
|
|
413
|
-
export default _default;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'vue';
|
|
2
|
-
import BaseForm from './BaseForm.vue';
|
|
3
|
-
|
|
4
|
-
export default defineComponent({
|
|
5
|
-
props: {
|
|
6
|
-
name: {
|
|
7
|
-
required: true,
|
|
8
|
-
type: String,
|
|
9
|
-
},
|
|
10
|
-
placeholder: {
|
|
11
|
-
default: '',
|
|
12
|
-
type: String,
|
|
13
|
-
},
|
|
14
|
-
label: {
|
|
15
|
-
default: '',
|
|
16
|
-
type: String,
|
|
17
|
-
},
|
|
18
|
-
disabled: {
|
|
19
|
-
type: Boolean,
|
|
20
|
-
default: false,
|
|
21
|
-
},
|
|
22
|
-
required: {
|
|
23
|
-
default: false,
|
|
24
|
-
type: Boolean,
|
|
25
|
-
},
|
|
26
|
-
autofocus: {
|
|
27
|
-
default: false,
|
|
28
|
-
type: Boolean,
|
|
29
|
-
},
|
|
30
|
-
preventSubmit: {
|
|
31
|
-
default: false,
|
|
32
|
-
type: Boolean,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
emits: ['update:modelValue'],
|
|
36
|
-
computed: {
|
|
37
|
-
form(): typeof BaseForm | null {
|
|
38
|
-
let parent = this.$parent;
|
|
39
|
-
for (let i = 0; i < 20; i++) {
|
|
40
|
-
if (parent == null) {
|
|
41
|
-
throw new Error(
|
|
42
|
-
'A BaseForm field component must be in a BaseForm component'
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
if (parent.$options.__name == 'BaseForm') {
|
|
46
|
-
return parent as unknown as typeof BaseForm;
|
|
47
|
-
}
|
|
48
|
-
parent = parent.$parent;
|
|
49
|
-
}
|
|
50
|
-
return null;
|
|
51
|
-
},
|
|
52
|
-
errors() {
|
|
53
|
-
if (!this.form) {
|
|
54
|
-
return {};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return this.form.errors;
|
|
58
|
-
},
|
|
59
|
-
labelValue(): string {
|
|
60
|
-
if (this.label != '' && this.label != null && this.label != undefined) {
|
|
61
|
-
return this.label;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (this.label === '') {
|
|
65
|
-
return '';
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (this.$te(this.name)) {
|
|
69
|
-
return this.$t(this.name);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return this.name;
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
methods: {
|
|
76
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
|
-
inputListener(payload: any) {
|
|
78
|
-
this.clearErrors();
|
|
79
|
-
this.$emit('update:modelValue', payload);
|
|
80
|
-
},
|
|
81
|
-
errorMessage(name: string | null = null) {
|
|
82
|
-
if (name == null) {
|
|
83
|
-
name = this.name;
|
|
84
|
-
}
|
|
85
|
-
if (this.hasError(name)) {
|
|
86
|
-
return this.errors[name][0];
|
|
87
|
-
}
|
|
88
|
-
return null;
|
|
89
|
-
},
|
|
90
|
-
hasError(name: string | null = null) {
|
|
91
|
-
if (name == null) {
|
|
92
|
-
name = this.name;
|
|
93
|
-
}
|
|
94
|
-
return (
|
|
95
|
-
Object.keys(this.errors).length > 0 &&
|
|
96
|
-
Object.prototype.hasOwnProperty.call(this.errors, name) &&
|
|
97
|
-
this.errors[name].length > 0
|
|
98
|
-
);
|
|
99
|
-
},
|
|
100
|
-
clearErrors(name: string | null = null) {
|
|
101
|
-
if (name == null) {
|
|
102
|
-
name = this.name;
|
|
103
|
-
}
|
|
104
|
-
this.form?.clearErrors(name);
|
|
105
|
-
},
|
|
106
|
-
disableForm() {
|
|
107
|
-
if (this.form) {
|
|
108
|
-
this.form.disabled = true;
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
enableForm() {
|
|
112
|
-
if (this.form) {
|
|
113
|
-
this.form.disabled = false;
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
});
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="">
|
|
3
|
-
<BaseInputLabel
|
|
4
|
-
v-if="label"
|
|
5
|
-
:label="label"
|
|
6
|
-
classes="form-input-label mb-2"
|
|
7
|
-
:required="required"
|
|
8
|
-
/>
|
|
9
|
-
<div class="space-y-1">
|
|
10
|
-
<div v-for="(locale, key, index) in localesInternal" :key="key">
|
|
11
|
-
<label
|
|
12
|
-
:for="name"
|
|
13
|
-
:class="[
|
|
14
|
-
layout == 'header'
|
|
15
|
-
? 'border-b-none flex items-center rounded-t border border-slate-300 bg-slate-50 py-1.5 px-2 text-sm text-slate-700'
|
|
16
|
-
: 'mb-1.5 flex items-center text-sm text-slate-700',
|
|
17
|
-
]"
|
|
18
|
-
>
|
|
19
|
-
<div
|
|
20
|
-
v-if="layout == 'header'"
|
|
21
|
-
class="mr-2 h-2.5 w-2.5 rounded-full"
|
|
22
|
-
:style="{ backgroundColor: colors[index] }"
|
|
23
|
-
/>
|
|
24
|
-
<Icon
|
|
25
|
-
v-if="layout == 'header'"
|
|
26
|
-
icon="heroicons:language-solid"
|
|
27
|
-
class="mr-1"
|
|
28
|
-
/>
|
|
29
|
-
<span>{{ locale }}</span>
|
|
30
|
-
</label>
|
|
31
|
-
<component
|
|
32
|
-
:is="component"
|
|
33
|
-
:model-value="formattedValue[key]"
|
|
34
|
-
:name="`${name}.${key}`"
|
|
35
|
-
:required="required"
|
|
36
|
-
v-bind="props"
|
|
37
|
-
:placeholder="placeholder"
|
|
38
|
-
:input-class="inputClass + ' border-t-0 rounded-t-none w-full'"
|
|
39
|
-
@update:model-value="onInput($event, key + '')"
|
|
40
|
-
/>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|
|
45
|
-
|
|
46
|
-
<script lang="ts">
|
|
47
|
-
import { defineComponent, PropType } from 'vue';
|
|
48
|
-
import { get, isPlainObject } from 'lodash';
|
|
49
|
-
import objectHash from 'object-hash';
|
|
50
|
-
import { Locales } from '@/types';
|
|
51
|
-
import { config } from '@/index';
|
|
52
|
-
import BaseFormField from './BaseFormField';
|
|
53
|
-
import BaseInputLabel from './BaseInputLabel.vue';
|
|
54
|
-
|
|
55
|
-
type Value = { [locale: string]: string | number | boolean };
|
|
56
|
-
|
|
57
|
-
export default defineComponent({
|
|
58
|
-
components: { BaseInputLabel },
|
|
59
|
-
extends: BaseFormField,
|
|
60
|
-
props: {
|
|
61
|
-
modelValue: {
|
|
62
|
-
required: true,
|
|
63
|
-
type: [Object, null, undefined] as PropType<Value | null | undefined>,
|
|
64
|
-
},
|
|
65
|
-
locales: {
|
|
66
|
-
default: undefined,
|
|
67
|
-
type: Object as PropType<Locales>,
|
|
68
|
-
},
|
|
69
|
-
component: {
|
|
70
|
-
default: 'VInput',
|
|
71
|
-
type: String,
|
|
72
|
-
},
|
|
73
|
-
props: {
|
|
74
|
-
default: undefined,
|
|
75
|
-
type: Object,
|
|
76
|
-
},
|
|
77
|
-
defaultValue: {
|
|
78
|
-
default: '',
|
|
79
|
-
type: [String, Boolean, Number] as PropType<string | boolean | number>,
|
|
80
|
-
},
|
|
81
|
-
layout: {
|
|
82
|
-
default: 'header',
|
|
83
|
-
type: String,
|
|
84
|
-
},
|
|
85
|
-
inputClass: {
|
|
86
|
-
default: undefined,
|
|
87
|
-
type: String,
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
data() {
|
|
91
|
-
return {
|
|
92
|
-
colors: ['#10b981', '#06b6d4', '#a855f7'],
|
|
93
|
-
};
|
|
94
|
-
},
|
|
95
|
-
computed: {
|
|
96
|
-
localesInternal(): Locales {
|
|
97
|
-
if (this.locales) {
|
|
98
|
-
return this.locales;
|
|
99
|
-
}
|
|
100
|
-
return config.locales;
|
|
101
|
-
},
|
|
102
|
-
formattedValue(): Value {
|
|
103
|
-
// Get current value
|
|
104
|
-
let value = {} as Value;
|
|
105
|
-
if (this.modelValue && isPlainObject(this.modelValue)) {
|
|
106
|
-
value = this.modelValue as Value;
|
|
107
|
-
}
|
|
108
|
-
// Fill missing locales
|
|
109
|
-
Object.keys(this.localesInternal).forEach((locale) => {
|
|
110
|
-
const currentValue = get(this.modelValue, locale);
|
|
111
|
-
if (!currentValue) {
|
|
112
|
-
value[locale] = this.defaultValue;
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
return value;
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
created() {
|
|
119
|
-
// If formatted value is different, send event to parent
|
|
120
|
-
if (
|
|
121
|
-
!this.modelValue ||
|
|
122
|
-
objectHash(this.formattedValue) !== objectHash(this.modelValue)
|
|
123
|
-
) {
|
|
124
|
-
const formattedValue = this.formattedValue;
|
|
125
|
-
this.inputListener(formattedValue);
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
methods: {
|
|
129
|
-
getLabel(locale: string): string {
|
|
130
|
-
if (Object.keys(this.localesInternal).length > 1) {
|
|
131
|
-
return `${this.label} (${locale})`;
|
|
132
|
-
}
|
|
133
|
-
return this.label;
|
|
134
|
-
},
|
|
135
|
-
onInput(value: string, locale: string) {
|
|
136
|
-
const formattedValue = this.formattedValue;
|
|
137
|
-
formattedValue[locale] = value;
|
|
138
|
-
this.inputListener(formattedValue);
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
});
|
|
142
|
-
</script>
|