@effect-app/vue-components 2.4.9 → 2.4.10
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/types/components/OmegaForm/OmegaArray.vue.d.ts +2 -2
- package/dist/types/components/OmegaForm/OmegaAutoGen.vue.d.ts +5 -5
- package/dist/types/components/OmegaForm/OmegaFormInput.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +11 -14
- package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +3 -2
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +94 -71
- package/dist/vue-components.es10.js +126 -140
- package/dist/vue-components.es36.js +1 -1
- package/dist/vue-components.es52.js +11 -4
- package/dist/vue-components.es53.js +4 -11
- package/package.json +1 -1
- package/src/components/OmegaForm/OmegaArray.vue +3 -2
- package/src/components/OmegaForm/OmegaAutoGen.vue +6 -5
- package/src/components/OmegaForm/OmegaFormInput.vue +3 -2
- package/src/components/OmegaForm/OmegaFormStuff.ts +16 -12
- package/src/components/OmegaForm/OmegaInput.vue +3 -2
- package/src/components/OmegaForm/useOmegaForm.ts +362 -225
|
@@ -11,7 +11,7 @@ import { MergedInputProps } from "./InputProps"
|
|
|
11
11
|
import OmegaArray from "./OmegaArray.vue"
|
|
12
12
|
import OmegaAutoGen from "./OmegaAutoGen.vue"
|
|
13
13
|
import OmegaErrorsInternal from "./OmegaErrorsInternal.vue"
|
|
14
|
-
import { BaseProps, DefaultTypeProps, FieldPath, type FormProps, generateMetaFromSchema, type MetaRecord, type NestedKeyOf, OmegaAutoGenMeta, OmegaError, type OmegaFormApi, OmegaFormState } from "./OmegaFormStuff"
|
|
14
|
+
import { BaseProps, DefaultTypeProps, FieldPath, type FormProps, generateMetaFromSchema, type MetaRecord, type NestedKeyOf, OmegaArrayProps, OmegaAutoGenMeta, OmegaError, type OmegaFormApi, OmegaFormState } from "./OmegaFormStuff"
|
|
15
15
|
import OmegaInput from "./OmegaInput.vue"
|
|
16
16
|
import OmegaTaggedUnion from "./OmegaTaggedUnion.vue"
|
|
17
17
|
import OmegaForm from "./OmegaWrapper.vue"
|
|
@@ -207,48 +207,243 @@ type __VLS_PrettifyLocal<T> =
|
|
|
207
207
|
}
|
|
208
208
|
& {}
|
|
209
209
|
|
|
210
|
+
// Type aliases for Array component slots - using cached types for performance
|
|
211
|
+
type CachedFieldApi<From, To, TypeProps = DefaultTypeProps> = import("@tanstack/vue-form").FieldApi<
|
|
212
|
+
From,
|
|
213
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
214
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>,
|
|
215
|
+
| import("@tanstack/vue-form").FieldValidateOrFn<
|
|
216
|
+
From,
|
|
217
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
218
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
219
|
+
>
|
|
220
|
+
| undefined,
|
|
221
|
+
| import("@tanstack/vue-form").FieldValidateOrFn<
|
|
222
|
+
From,
|
|
223
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
224
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
225
|
+
>
|
|
226
|
+
| undefined,
|
|
227
|
+
| import("@tanstack/vue-form").FieldAsyncValidateOrFn<
|
|
228
|
+
From,
|
|
229
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
230
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
231
|
+
>
|
|
232
|
+
| undefined,
|
|
233
|
+
| import("@tanstack/vue-form").FieldValidateOrFn<
|
|
234
|
+
From,
|
|
235
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
236
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
237
|
+
>
|
|
238
|
+
| undefined,
|
|
239
|
+
| import("@tanstack/vue-form").FieldAsyncValidateOrFn<
|
|
240
|
+
From,
|
|
241
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
242
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
243
|
+
>
|
|
244
|
+
| undefined,
|
|
245
|
+
| import("@tanstack/vue-form").FieldValidateOrFn<
|
|
246
|
+
From,
|
|
247
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
248
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
249
|
+
>
|
|
250
|
+
| undefined,
|
|
251
|
+
| import("@tanstack/vue-form").FieldAsyncValidateOrFn<
|
|
252
|
+
From,
|
|
253
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
254
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
255
|
+
>
|
|
256
|
+
| undefined,
|
|
257
|
+
| import("@tanstack/vue-form").FieldValidateOrFn<
|
|
258
|
+
From,
|
|
259
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
260
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
261
|
+
>
|
|
262
|
+
| undefined,
|
|
263
|
+
| import("@tanstack/vue-form").FieldAsyncValidateOrFn<
|
|
264
|
+
From,
|
|
265
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
266
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
267
|
+
>
|
|
268
|
+
| undefined,
|
|
269
|
+
import("@tanstack/vue-form").FormValidateOrFn<From> | undefined,
|
|
270
|
+
import("@tanstack/vue-form").FormValidateOrFn<From> | undefined,
|
|
271
|
+
import("@tanstack/vue-form").StandardSchemaV1<From, To>,
|
|
272
|
+
import("@tanstack/vue-form").FormValidateOrFn<From> | undefined,
|
|
273
|
+
import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined,
|
|
274
|
+
import("@tanstack/vue-form").FormValidateOrFn<From> | undefined,
|
|
275
|
+
import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined,
|
|
276
|
+
import("@tanstack/vue-form").FormValidateOrFn<From> | undefined,
|
|
277
|
+
import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined,
|
|
278
|
+
import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined,
|
|
279
|
+
Record<string, any> | undefined
|
|
280
|
+
>
|
|
281
|
+
|
|
282
|
+
type CachedFieldState<From, To, TypeProps = DefaultTypeProps> = import("@tanstack/vue-form").FieldState<
|
|
283
|
+
From,
|
|
284
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
285
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>,
|
|
286
|
+
| import("@tanstack/vue-form").FieldValidateOrFn<
|
|
287
|
+
From,
|
|
288
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
289
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
290
|
+
>
|
|
291
|
+
| undefined,
|
|
292
|
+
| import("@tanstack/vue-form").FieldValidateOrFn<
|
|
293
|
+
From,
|
|
294
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
295
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
296
|
+
>
|
|
297
|
+
| undefined,
|
|
298
|
+
| import("@tanstack/vue-form").FieldAsyncValidateOrFn<
|
|
299
|
+
From,
|
|
300
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
301
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
302
|
+
>
|
|
303
|
+
| undefined,
|
|
304
|
+
| import("@tanstack/vue-form").FieldValidateOrFn<
|
|
305
|
+
From,
|
|
306
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
307
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
308
|
+
>
|
|
309
|
+
| undefined,
|
|
310
|
+
| import("@tanstack/vue-form").FieldAsyncValidateOrFn<
|
|
311
|
+
From,
|
|
312
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
313
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
314
|
+
>
|
|
315
|
+
| undefined,
|
|
316
|
+
| import("@tanstack/vue-form").FieldValidateOrFn<
|
|
317
|
+
From,
|
|
318
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
319
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
320
|
+
>
|
|
321
|
+
| undefined,
|
|
322
|
+
| import("@tanstack/vue-form").FieldAsyncValidateOrFn<
|
|
323
|
+
From,
|
|
324
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
325
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
326
|
+
>
|
|
327
|
+
| undefined,
|
|
328
|
+
| import("@tanstack/vue-form").FieldValidateOrFn<
|
|
329
|
+
From,
|
|
330
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
331
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
332
|
+
>
|
|
333
|
+
| undefined,
|
|
334
|
+
| import("@tanstack/vue-form").FieldAsyncValidateOrFn<
|
|
335
|
+
From,
|
|
336
|
+
OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
337
|
+
DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>
|
|
338
|
+
>
|
|
339
|
+
| undefined,
|
|
340
|
+
import("@tanstack/vue-form").FormValidateOrFn<From> | undefined,
|
|
341
|
+
import("@tanstack/vue-form").FormValidateOrFn<From> | undefined,
|
|
342
|
+
import("@tanstack/vue-form").StandardSchemaV1<From, To>,
|
|
343
|
+
import("@tanstack/vue-form").FormValidateOrFn<From> | undefined,
|
|
344
|
+
import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined,
|
|
345
|
+
import("@tanstack/vue-form").FormValidateOrFn<From> | undefined,
|
|
346
|
+
import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined,
|
|
347
|
+
import("@tanstack/vue-form").FormValidateOrFn<From> | undefined,
|
|
348
|
+
import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined
|
|
349
|
+
>
|
|
350
|
+
|
|
210
351
|
export interface OmegaFormReturn<
|
|
211
352
|
From extends Record<PropertyKey, any>,
|
|
212
353
|
To extends Record<PropertyKey, any>,
|
|
213
354
|
TypeProps = DefaultTypeProps
|
|
214
355
|
> extends OF<From, To> {
|
|
215
|
-
// Pre-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
356
|
+
// Pre-computed type aliases - computed ONCE for performance
|
|
357
|
+
_paths: FieldPath<From>
|
|
358
|
+
_keys: DeepKeys<From>
|
|
359
|
+
|
|
360
|
+
// this crazy thing here is copied from the OmegaFormInput.vue.d.ts, with `From` removed as Generic, instead closed over from the From generic above..
|
|
361
|
+
Input: <Name extends OmegaFormReturn<From, To, TypeProps>["_paths"]>(
|
|
362
|
+
__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"],
|
|
363
|
+
__VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
|
|
364
|
+
__VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"],
|
|
365
|
+
__VLS_setup?: Promise<{
|
|
366
|
+
props:
|
|
367
|
+
& __VLS_PrettifyLocal<
|
|
368
|
+
& Pick<
|
|
369
|
+
& Partial<{}>
|
|
370
|
+
& Omit<
|
|
371
|
+
{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps,
|
|
372
|
+
never
|
|
373
|
+
>,
|
|
374
|
+
never
|
|
375
|
+
>
|
|
376
|
+
& TypeProps
|
|
377
|
+
& Partial<{}>
|
|
378
|
+
>
|
|
379
|
+
& BaseProps<From, Name>
|
|
380
|
+
& import("vue").PublicProps
|
|
381
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void
|
|
382
|
+
attrs: any
|
|
383
|
+
slots: {
|
|
384
|
+
default?(props: MergedInputProps<From, Name>): void
|
|
385
|
+
label?: (props: { required: boolean; id: string; label: string }) => void
|
|
225
386
|
}
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
) => import("vue").VNode
|
|
387
|
+
emit: {}
|
|
388
|
+
}>
|
|
389
|
+
) => import("vue").VNode & {
|
|
390
|
+
__ctx?: Awaited<typeof __VLS_setup>
|
|
391
|
+
}
|
|
229
392
|
Errors: (
|
|
230
|
-
props
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
393
|
+
__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"],
|
|
394
|
+
__VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
|
|
395
|
+
__VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"],
|
|
396
|
+
__VLS_setup?: Promise<{
|
|
397
|
+
props:
|
|
398
|
+
& __VLS_PrettifyLocal<
|
|
399
|
+
& Pick<
|
|
400
|
+
& Partial<{}>
|
|
401
|
+
& Omit<
|
|
402
|
+
{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps,
|
|
403
|
+
never
|
|
404
|
+
>,
|
|
405
|
+
never
|
|
406
|
+
>
|
|
407
|
+
& Partial<{}>
|
|
408
|
+
>
|
|
409
|
+
& import("vue").PublicProps
|
|
410
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void
|
|
411
|
+
attrs: any
|
|
412
|
+
slots: {
|
|
413
|
+
default: (props: { errors: readonly OmegaError[]; showedGeneralErrors: string[] }) => void
|
|
237
414
|
}
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
) => import("vue").VNode
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
415
|
+
emit: {}
|
|
416
|
+
}>
|
|
417
|
+
) => import("vue").VNode & {
|
|
418
|
+
__ctx?: Awaited<typeof __VLS_setup>
|
|
419
|
+
}
|
|
420
|
+
TaggedUnion: <Name extends OmegaFormReturn<From, To, TypeProps>["_keys"]>(
|
|
421
|
+
__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"],
|
|
422
|
+
__VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
|
|
423
|
+
__VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"],
|
|
424
|
+
__VLS_setup?: Promise<{
|
|
425
|
+
props:
|
|
426
|
+
& __VLS_PrettifyLocal<
|
|
427
|
+
& Pick<
|
|
428
|
+
& Partial<{}>
|
|
429
|
+
& Omit<
|
|
430
|
+
{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps,
|
|
431
|
+
never
|
|
432
|
+
>,
|
|
433
|
+
never
|
|
434
|
+
>
|
|
435
|
+
& {
|
|
436
|
+
name: Name
|
|
437
|
+
type?: "select" | "radio"
|
|
438
|
+
options: import("./InputProps").TaggedUnionOptionsArray<From, Name>
|
|
439
|
+
label?: string
|
|
440
|
+
}
|
|
441
|
+
& {}
|
|
442
|
+
>
|
|
443
|
+
& import("vue").PublicProps
|
|
444
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void
|
|
445
|
+
attrs: any
|
|
446
|
+
slots: Record<
|
|
252
447
|
string,
|
|
253
448
|
(props: {
|
|
254
449
|
field: import("@tanstack/vue-form").FieldApi<
|
|
@@ -301,62 +496,134 @@ export interface OmegaFormReturn<
|
|
|
301
496
|
>
|
|
302
497
|
}) => any
|
|
303
498
|
>
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
) => import("vue").VNode
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
499
|
+
emit: {}
|
|
500
|
+
}>
|
|
501
|
+
) => import("vue").VNode & {
|
|
502
|
+
__ctx?: Awaited<typeof __VLS_setup>
|
|
503
|
+
}
|
|
504
|
+
Array: <Name extends OmegaFormReturn<From, To, TypeProps>["_keys"]>(
|
|
505
|
+
__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"],
|
|
506
|
+
__VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
|
|
507
|
+
__VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"],
|
|
508
|
+
__VLS_setup?: Promise<{
|
|
509
|
+
props:
|
|
510
|
+
& __VLS_PrettifyLocal<
|
|
511
|
+
& Pick<
|
|
512
|
+
& Partial<{}>
|
|
513
|
+
& Omit<
|
|
514
|
+
{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps,
|
|
515
|
+
never
|
|
516
|
+
>,
|
|
517
|
+
never
|
|
518
|
+
>
|
|
519
|
+
& (Omit<OmegaArrayProps<From, To, Name>, "form">)
|
|
520
|
+
& {}
|
|
521
|
+
>
|
|
522
|
+
& import("vue").PublicProps
|
|
523
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void
|
|
524
|
+
attrs: any
|
|
525
|
+
slots: {
|
|
526
|
+
"pre-array"?: (props: {
|
|
527
|
+
field: CachedFieldApi<From, To, TypeProps>
|
|
528
|
+
state: CachedFieldState<From, To, TypeProps>
|
|
529
|
+
}) => any
|
|
530
|
+
} & {
|
|
531
|
+
default?: (props: {
|
|
532
|
+
subField: CachedFieldApi<From, To, TypeProps>
|
|
533
|
+
subState: CachedFieldState<From, To, TypeProps>
|
|
534
|
+
index: number
|
|
535
|
+
field: CachedFieldApi<From, To, TypeProps>
|
|
536
|
+
}) => any
|
|
537
|
+
} & {
|
|
538
|
+
"post-array"?: (props: {
|
|
539
|
+
field: CachedFieldApi<From, To, TypeProps>
|
|
540
|
+
state: CachedFieldState<From, To, TypeProps>
|
|
541
|
+
}) => any
|
|
542
|
+
} & {
|
|
543
|
+
field?: (props: {
|
|
544
|
+
field: CachedFieldApi<From, To, TypeProps>
|
|
545
|
+
}) => any
|
|
320
546
|
}
|
|
321
|
-
|
|
322
|
-
}
|
|
323
|
-
) => import("vue").VNode
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
547
|
+
emit: {}
|
|
548
|
+
}>
|
|
549
|
+
) => import("vue").VNode & {
|
|
550
|
+
__ctx?: Awaited<typeof __VLS_setup>
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
AutoGen: <Name extends OmegaFormReturn<From, To, TypeProps>["_keys"]>(
|
|
554
|
+
__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"],
|
|
555
|
+
__VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
|
|
556
|
+
__VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"],
|
|
557
|
+
__VLS_setup?: Promise<{
|
|
558
|
+
props:
|
|
559
|
+
& __VLS_PrettifyLocal<
|
|
560
|
+
Pick<
|
|
561
|
+
& Partial<{}>
|
|
562
|
+
& Omit<
|
|
563
|
+
{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps,
|
|
564
|
+
never
|
|
565
|
+
>,
|
|
566
|
+
never
|
|
567
|
+
> & {
|
|
568
|
+
// form: OmegaInputProps<From, To>["form"]
|
|
569
|
+
pick?: OmegaFormReturn<From, To, TypeProps>["_keys"][]
|
|
570
|
+
omit?: OmegaFormReturn<From, To, TypeProps>["_keys"][]
|
|
571
|
+
labelMap?: (key: OmegaFormReturn<From, To, TypeProps>["_keys"]) => string | undefined
|
|
572
|
+
filterMap?: <M extends OmegaAutoGenMeta<From, To, Name>>(
|
|
573
|
+
key: OmegaFormReturn<From, To, TypeProps>["_keys"],
|
|
574
|
+
meta: M
|
|
575
|
+
) => boolean | M
|
|
576
|
+
order?: OmegaFormReturn<From, To, TypeProps>["_keys"][]
|
|
577
|
+
sort?: Order.Order<OmegaAutoGenMeta<From, To, Name>>
|
|
578
|
+
} & {}
|
|
579
|
+
>
|
|
580
|
+
& import("vue").PublicProps
|
|
581
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void
|
|
582
|
+
attrs: any
|
|
583
|
+
slots: {
|
|
584
|
+
default(props: {
|
|
585
|
+
child: OmegaAutoGenMeta<From, To, Name>
|
|
586
|
+
}): void
|
|
339
587
|
}
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
) => import("vue").VNode
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
588
|
+
emit: {}
|
|
589
|
+
}>
|
|
590
|
+
) => import("vue").VNode & {
|
|
591
|
+
__ctx?: Awaited<typeof __VLS_setup>
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
Form: <K extends keyof OmegaFormState<To, From>>(
|
|
595
|
+
__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"],
|
|
596
|
+
__VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
|
|
597
|
+
__VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"],
|
|
598
|
+
__VLS_setup?: Promise<{
|
|
599
|
+
props:
|
|
600
|
+
& __VLS_PrettifyLocal<
|
|
601
|
+
Pick<
|
|
602
|
+
& Partial<{}>
|
|
603
|
+
& Omit<
|
|
604
|
+
{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps,
|
|
605
|
+
never
|
|
606
|
+
>,
|
|
607
|
+
never
|
|
608
|
+
> & {
|
|
609
|
+
// form: OmegaFormReturn<From, To, Props>
|
|
610
|
+
disabled?: boolean
|
|
611
|
+
subscribe?: K[]
|
|
612
|
+
} & {}
|
|
613
|
+
>
|
|
614
|
+
& import("vue").PublicProps
|
|
615
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void
|
|
616
|
+
attrs: any
|
|
617
|
+
slots: {
|
|
353
618
|
default(props: {
|
|
354
619
|
subscribedValues: K[] extends undefined[] ? Record<string, never> : Pick<OmegaFormState<From, To>, K>
|
|
355
|
-
}):
|
|
620
|
+
}): void
|
|
356
621
|
}
|
|
357
|
-
|
|
358
|
-
}
|
|
359
|
-
) => import("vue").VNode
|
|
622
|
+
emit: {}
|
|
623
|
+
}>
|
|
624
|
+
) => import("vue").VNode & {
|
|
625
|
+
__ctx?: Awaited<typeof __VLS_setup>
|
|
626
|
+
}
|
|
360
627
|
}
|
|
361
628
|
|
|
362
629
|
export const useOmegaForm = <
|
|
@@ -712,147 +979,17 @@ export const useOmegaForm = <
|
|
|
712
979
|
|
|
713
980
|
const errorContext = { form: formWithExtras, fieldMap }
|
|
714
981
|
|
|
715
|
-
// Pre-bound component functions with From and To already bound
|
|
716
|
-
const Input = <Name extends FieldPath<From>>(
|
|
717
|
-
props: BaseProps<From, Name> & DefaultTypeProps & {
|
|
718
|
-
key?: string | number
|
|
719
|
-
ref?: any
|
|
720
|
-
},
|
|
721
|
-
context?: {
|
|
722
|
-
slots?: {
|
|
723
|
-
default?(props: MergedInputProps<From, Name>): any
|
|
724
|
-
label?: (props: { required: boolean; id: string; label: string }) => any
|
|
725
|
-
}
|
|
726
|
-
attrs?: Record<string, any>
|
|
727
|
-
}
|
|
728
|
-
) => {
|
|
729
|
-
const InputComponent = omegaConfig?.input ?? OmegaInput
|
|
730
|
-
return h(InputComponent, {
|
|
731
|
-
...props,
|
|
732
|
-
form: formWithExtras,
|
|
733
|
-
...context?.attrs
|
|
734
|
-
}, context?.slots)
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
const Errors = (
|
|
738
|
-
props?: {
|
|
739
|
-
key?: string | number
|
|
740
|
-
ref?: any
|
|
741
|
-
},
|
|
742
|
-
context?: {
|
|
743
|
-
slots?: {
|
|
744
|
-
default: (props: { errors: readonly OmegaError[]; showedGeneralErrors: string[] }) => any
|
|
745
|
-
}
|
|
746
|
-
attrs?: Record<string, any>
|
|
747
|
-
}
|
|
748
|
-
) => {
|
|
749
|
-
return h(eHoc(errorContext)(OmegaErrorsInternal) as any, {
|
|
750
|
-
...props,
|
|
751
|
-
...context?.attrs
|
|
752
|
-
}, context?.slots)
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
const TaggedUnion = <Name extends DeepKeys<From>>(
|
|
756
|
-
props: {
|
|
757
|
-
name: Name
|
|
758
|
-
type?: "select" | "radio"
|
|
759
|
-
options: import("./InputProps").TaggedUnionOptionsArray<From, Name>
|
|
760
|
-
label?: string
|
|
761
|
-
key?: string | number
|
|
762
|
-
ref?: any
|
|
763
|
-
},
|
|
764
|
-
context?: {
|
|
765
|
-
slots?: Record<string, any>
|
|
766
|
-
attrs?: Record<string, any>
|
|
767
|
-
}
|
|
768
|
-
) => {
|
|
769
|
-
return h(OmegaTaggedUnion, {
|
|
770
|
-
...props,
|
|
771
|
-
form: formWithExtras as any,
|
|
772
|
-
...context?.attrs
|
|
773
|
-
}, context?.slots)
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
const ArrayComponent = <Name extends DeepKeys<From>>(
|
|
777
|
-
props: {
|
|
778
|
-
name: Name
|
|
779
|
-
defaultItems?: DeepValue<From, Name>
|
|
780
|
-
key?: string | number
|
|
781
|
-
ref?: any
|
|
782
|
-
},
|
|
783
|
-
context?: {
|
|
784
|
-
slots?: {
|
|
785
|
-
"pre-array"?: (props: { field: any; state: any }) => any
|
|
786
|
-
default?: (props: { subField: any; subState: any; index: number; field: any }) => any
|
|
787
|
-
"post-array"?: (props: { field: any; state: any }) => any
|
|
788
|
-
field?: (props: { field: any }) => any
|
|
789
|
-
}
|
|
790
|
-
attrs?: Record<string, any>
|
|
791
|
-
}
|
|
792
|
-
) => {
|
|
793
|
-
return h(OmegaArray, {
|
|
794
|
-
...props,
|
|
795
|
-
form: formWithExtras as any,
|
|
796
|
-
...context?.attrs
|
|
797
|
-
}, context?.slots)
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
const AutoGen = (
|
|
801
|
-
props: {
|
|
802
|
-
pick?: DeepKeys<From>[]
|
|
803
|
-
omit?: DeepKeys<From>[]
|
|
804
|
-
labelMap?: (key: DeepKeys<From>) => string | undefined
|
|
805
|
-
filterMap?: <M extends OmegaAutoGenMeta<From, To>>(key: DeepKeys<From>, meta: M) => boolean | M
|
|
806
|
-
order?: DeepKeys<From>[]
|
|
807
|
-
sort?: Order.Order<OmegaAutoGenMeta<From, To>>
|
|
808
|
-
key?: string | number
|
|
809
|
-
ref?: any
|
|
810
|
-
},
|
|
811
|
-
context?: {
|
|
812
|
-
slots?: {
|
|
813
|
-
default(props: { child: OmegaAutoGenMeta<From, To> }): any
|
|
814
|
-
}
|
|
815
|
-
attrs?: Record<string, any>
|
|
816
|
-
}
|
|
817
|
-
) => {
|
|
818
|
-
return h(OmegaAutoGen as any, {
|
|
819
|
-
...props,
|
|
820
|
-
form: formWithExtras,
|
|
821
|
-
...context?.attrs
|
|
822
|
-
}, context?.slots)
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
const Form = <K extends keyof OmegaFormState<From, To>>(
|
|
826
|
-
props: {
|
|
827
|
-
disabled?: boolean
|
|
828
|
-
subscribe?: K[]
|
|
829
|
-
key?: string | number
|
|
830
|
-
ref?: any
|
|
831
|
-
},
|
|
832
|
-
context?: {
|
|
833
|
-
slots?: {
|
|
834
|
-
default(props: {
|
|
835
|
-
subscribedValues: K[] extends undefined[] ? Record<string, never> : Pick<OmegaFormState<From, To>, K>
|
|
836
|
-
}): any
|
|
837
|
-
}
|
|
838
|
-
attrs?: Record<string, any>
|
|
839
|
-
}
|
|
840
|
-
) => {
|
|
841
|
-
return h(OmegaForm as any, {
|
|
842
|
-
...props,
|
|
843
|
-
form: formWithExtras,
|
|
844
|
-
...context?.attrs
|
|
845
|
-
}, context?.slots)
|
|
846
|
-
}
|
|
847
|
-
|
|
848
982
|
return Object.assign(formWithExtras, {
|
|
983
|
+
// Type-level properties for performance optimization (not used at runtime)
|
|
984
|
+
_paths: undefined as any,
|
|
985
|
+
_keys: undefined as any,
|
|
849
986
|
errorContext,
|
|
850
|
-
Form,
|
|
851
|
-
Input,
|
|
852
|
-
TaggedUnion,
|
|
987
|
+
Form: fHoc(formWithExtras)(OmegaForm as any) as any,
|
|
988
|
+
Input: fHoc(formWithExtras)(omegaConfig?.input ?? OmegaInput) as any,
|
|
989
|
+
TaggedUnion: fHoc(formWithExtras)(OmegaTaggedUnion) as any,
|
|
853
990
|
Field: form.Field,
|
|
854
|
-
Errors,
|
|
855
|
-
Array:
|
|
856
|
-
AutoGen
|
|
991
|
+
Errors: eHoc(errorContext)(OmegaErrorsInternal) as any,
|
|
992
|
+
Array: fHoc(formWithExtras)(OmegaArray) as any,
|
|
993
|
+
AutoGen: fHoc(formWithExtras)(OmegaAutoGen as any) as any
|
|
857
994
|
})
|
|
858
995
|
}
|