@teamnovu/kit-vue-forms 0.0.7 → 0.0.8
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/composables/useField.d.ts +0 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.mjs +5 -8
- package/dist/types/util.d.ts +4 -0
- package/package.json +1 -1
- package/src/composables/useField.ts +0 -2
- package/src/index.ts +1 -2
- package/src/types/util.ts +7 -0
|
@@ -4,8 +4,6 @@ import { ValidationErrors } from '../types/validation';
|
|
|
4
4
|
export interface UseFieldOptions<T, K extends string> {
|
|
5
5
|
value?: MaybeRef<T>;
|
|
6
6
|
initialValue?: MaybeRefOrGetter<Readonly<T>>;
|
|
7
|
-
type?: MaybeRef<string>;
|
|
8
|
-
required?: MaybeRef<boolean>;
|
|
9
7
|
path: K;
|
|
10
8
|
errors?: MaybeRef<ValidationErrors>;
|
|
11
9
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export { useForm } from './composables/useForm';
|
|
2
2
|
export type { UseFormOptions } from './composables/useForm';
|
|
3
|
-
export { useField } from './composables/useField';
|
|
4
3
|
export type { UseFieldOptions } from './composables/useField';
|
|
5
4
|
export type { ValidationStrategy, ValidationErrorMessage as ErrorMessage, ValidationResult, ErrorBag, Validator, ValidationFunction, ValidationErrors } from './types/validation';
|
|
6
5
|
export type { DeepPartial } from './utils/type-helpers';
|
|
7
6
|
export type { Form, FormField } from './types/form';
|
|
8
|
-
export type { SplitPath, Paths, PickProps } from './types/util';
|
|
7
|
+
export type { SplitPath, Paths, PickProps, ObjectOf, EntityPaths } from './types/util';
|
|
9
8
|
export { default as Field } from './components/Field.vue';
|
|
10
9
|
export type { FieldProps } from './components/Field.vue';
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var R = (e, r, t) =>
|
|
4
|
-
import { toValue as
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var K = (e, r, t) => r in e ? x(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
|
+
var R = (e, r, t) => K(e, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
import { toValue as W, toRaw as q, computed as d, unref as c, reactive as b, watch as F, toRefs as O, toRef as S, ref as A, isRef as _, getCurrentScope as I, onBeforeUnmount as J, defineComponent as T, renderSlot as B, normalizeProps as G, guardReactiveProps as L } from "vue";
|
|
5
5
|
import "zod";
|
|
6
6
|
function y(e) {
|
|
7
|
-
const r =
|
|
7
|
+
const r = W(e), t = q(r);
|
|
8
8
|
return structuredClone(t);
|
|
9
9
|
}
|
|
10
10
|
function N(e) {
|
|
@@ -411,8 +411,6 @@ const pr = /* @__PURE__ */ T({
|
|
|
411
411
|
form: {},
|
|
412
412
|
value: {},
|
|
413
413
|
initialValue: {},
|
|
414
|
-
type: {},
|
|
415
|
-
required: {},
|
|
416
414
|
path: {},
|
|
417
415
|
errors: {}
|
|
418
416
|
},
|
|
@@ -426,6 +424,5 @@ const pr = /* @__PURE__ */ T({
|
|
|
426
424
|
});
|
|
427
425
|
export {
|
|
428
426
|
pr as Field,
|
|
429
|
-
k as useField,
|
|
430
427
|
vr as useForm
|
|
431
428
|
};
|
package/dist/types/util.d.ts
CHANGED
|
@@ -24,3 +24,7 @@ export type ButLast<T extends string> = T extends `${infer Rest}.${infer Last}`
|
|
|
24
24
|
export type EntityPaths<T> = ButLast<Paths<T>> & Paths<T>;
|
|
25
25
|
export type PickEntity<Entity, PropertyKeys extends string> = PropertyKeys extends unknown ? PickProps<Entity, EntityPaths<Entity> & PropertyKeys> & FormDataDefault : never;
|
|
26
26
|
export type RestPath<T extends string, P extends string> = P extends `${T}.${infer Rest}` ? Rest : never;
|
|
27
|
+
export type RootPath<P extends string> = P extends `${infer TRoot}.${string}` ? TRoot : P;
|
|
28
|
+
export type ObjectOf<TPath extends string, T> = {
|
|
29
|
+
[K in RootPath<TPath>]: RestPath<K, TPath> extends never ? T : ObjectOf<RestPath<K, TPath>, T>;
|
|
30
|
+
};
|
package/package.json
CHANGED
|
@@ -6,8 +6,6 @@ import { cloneRefValue } from '../utils/general'
|
|
|
6
6
|
export interface UseFieldOptions<T, K extends string> {
|
|
7
7
|
value?: MaybeRef<T>
|
|
8
8
|
initialValue?: MaybeRefOrGetter<Readonly<T>>
|
|
9
|
-
type?: MaybeRef<string>
|
|
10
|
-
required?: MaybeRef<boolean>
|
|
11
9
|
path: K
|
|
12
10
|
errors?: MaybeRef<ValidationErrors>
|
|
13
11
|
}
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,6 @@ export { useForm } from './composables/useForm'
|
|
|
3
3
|
export type { UseFormOptions } from './composables/useForm'
|
|
4
4
|
|
|
5
5
|
// Field composable
|
|
6
|
-
export { useField } from './composables/useField'
|
|
7
6
|
export type { UseFieldOptions } from './composables/useField'
|
|
8
7
|
|
|
9
8
|
// Types
|
|
@@ -11,7 +10,7 @@ export type { ValidationStrategy, ValidationErrorMessage as ErrorMessage, Valida
|
|
|
11
10
|
export type { DeepPartial } from './utils/type-helpers'
|
|
12
11
|
|
|
13
12
|
export type { Form, FormField } from './types/form'
|
|
14
|
-
export type { SplitPath, Paths, PickProps } from './types/util'
|
|
13
|
+
export type { SplitPath, Paths, PickProps, ObjectOf, EntityPaths } from './types/util'
|
|
15
14
|
|
|
16
15
|
export { default as Field } from './components/Field.vue'
|
|
17
16
|
export type { FieldProps } from './components/Field.vue'
|
package/src/types/util.ts
CHANGED
|
@@ -71,3 +71,10 @@ export type PickEntity<Entity, PropertyKeys extends string> =
|
|
|
71
71
|
|
|
72
72
|
export type RestPath<T extends string, P extends string> =
|
|
73
73
|
P extends `${T}.${infer Rest}` ? Rest : never
|
|
74
|
+
|
|
75
|
+
export type RootPath<P extends string> =
|
|
76
|
+
P extends `${infer TRoot}.${string}` ? TRoot : P
|
|
77
|
+
|
|
78
|
+
export type ObjectOf<TPath extends string, T> = {
|
|
79
|
+
[K in RootPath<TPath>]: RestPath<K, TPath> extends never ? T : ObjectOf<RestPath<K, TPath>, T>
|
|
80
|
+
}
|