@formisch/qwik 0.7.4 → 0.8.0
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/index.d.ts +16 -4
- package/dist/index.qwik.js +6 -2
- package/package.json +4 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { JSXOutput, NoSerialize, PropsOf, QRL, ReadonlySignal } from "@qwik.dev/core";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _qwik_dev_core_internal3 from "@qwik.dev/core/internal";
|
|
4
4
|
|
|
5
5
|
//#region ../../packages/core/dist/index.qwik.d.ts
|
|
6
6
|
|
|
@@ -868,6 +868,10 @@ interface FieldStore<TSchema extends Schema = Schema, TFieldPath extends Require
|
|
|
868
868
|
* Whether the field is valid according to the schema.
|
|
869
869
|
*/
|
|
870
870
|
readonly isValid: ReadonlySignal<boolean>;
|
|
871
|
+
/**
|
|
872
|
+
* Sets the field input value programmatically.
|
|
873
|
+
*/
|
|
874
|
+
readonly onInput: QRL<(value: PartialValues<PathValue<v.InferInput<TSchema>, TFieldPath>>) => void>;
|
|
871
875
|
/**
|
|
872
876
|
* The props to spread onto the field element for integration.
|
|
873
877
|
*/
|
|
@@ -966,7 +970,7 @@ interface FieldProps<TSchema extends Schema = Schema, TFieldPath extends Require
|
|
|
966
970
|
*
|
|
967
971
|
* @returns The UI of the field to be rendered.
|
|
968
972
|
*/
|
|
969
|
-
declare const Field: <TSchema extends Schema, TFieldPath extends RequiredPath>(props:
|
|
973
|
+
declare const Field: <TSchema extends Schema, TFieldPath extends RequiredPath>(props: _qwik_dev_core_internal3.PublicProps<FieldProps<TSchema, TFieldPath>>, key: string | null, flags: number, dev?: _qwik_dev_core_internal3.DevJSX) => JSXOutput;
|
|
970
974
|
//#endregion
|
|
971
975
|
//#region src/components/FieldArray/FieldArray.d.ts
|
|
972
976
|
/**
|
|
@@ -994,7 +998,7 @@ interface FieldArrayProps<TSchema extends Schema = Schema, TFieldArrayPath exten
|
|
|
994
998
|
*
|
|
995
999
|
* @returns The UI of the field array to be rendered.
|
|
996
1000
|
*/
|
|
997
|
-
declare const FieldArray: <TSchema extends Schema, TFieldArrayPath extends RequiredPath>(props:
|
|
1001
|
+
declare const FieldArray: <TSchema extends Schema, TFieldArrayPath extends RequiredPath>(props: _qwik_dev_core_internal3.PublicProps<FieldArrayProps<TSchema, TFieldArrayPath>>, key: string | null, flags: number, dev?: _qwik_dev_core_internal3.DevJSX) => JSXOutput;
|
|
998
1002
|
//#endregion
|
|
999
1003
|
//#region src/components/Form/Form.d.ts
|
|
1000
1004
|
/**
|
|
@@ -1016,7 +1020,7 @@ type FormProps<TSchema extends Schema = Schema> = Omit<PropsOf<'form'>, 'onSubmi
|
|
|
1016
1020
|
*
|
|
1017
1021
|
* @returns The a native form element.
|
|
1018
1022
|
*/
|
|
1019
|
-
declare const Form: <TSchema extends Schema>(props:
|
|
1023
|
+
declare const Form: <TSchema extends Schema>(props: _qwik_dev_core_internal3.PublicProps<FormProps<TSchema>>, key: string | null, flags: number, dev?: _qwik_dev_core_internal3.DevJSX) => JSXOutput;
|
|
1020
1024
|
//#endregion
|
|
1021
1025
|
//#region src/hooks/useField/useField.d.ts
|
|
1022
1026
|
/**
|
|
@@ -1031,6 +1035,9 @@ interface UseFieldConfig<TSchema extends Schema = Schema, TFieldPath extends Req
|
|
|
1031
1035
|
/**
|
|
1032
1036
|
* Creates a reactive field store of a specific field within a form store.
|
|
1033
1037
|
*
|
|
1038
|
+
* @param form The form store instance.
|
|
1039
|
+
* @param config The field configuration.
|
|
1040
|
+
*
|
|
1034
1041
|
* @returns The field store with reactive properties and element props.
|
|
1035
1042
|
*/
|
|
1036
1043
|
declare function useField<TSchema extends Schema, TFieldPath extends RequiredPath>(form: FormStore<TSchema>, config: UseFieldConfig<TSchema, TFieldPath>): FieldStore<TSchema, TFieldPath>;
|
|
@@ -1048,6 +1055,9 @@ interface UseFieldArrayConfig<TSchema extends Schema = Schema, TFieldArrayPath e
|
|
|
1048
1055
|
/**
|
|
1049
1056
|
* Creates a reactive field array store of a specific field array within a form store.
|
|
1050
1057
|
*
|
|
1058
|
+
* @param form The form store instance.
|
|
1059
|
+
* @param config The field array configuration.
|
|
1060
|
+
*
|
|
1051
1061
|
* @returns The field array store with reactive properties for array management.
|
|
1052
1062
|
*/
|
|
1053
1063
|
declare function useFieldArray<TSchema extends Schema, TFieldArrayPath extends RequiredPath>(form: FormStore<TSchema>, config: UseFieldArrayConfig<TSchema, TFieldArrayPath>): FieldArrayStore<TSchema, TFieldArrayPath>;
|
|
@@ -1057,6 +1067,8 @@ declare function useFieldArray<TSchema extends Schema, TFieldArrayPath extends R
|
|
|
1057
1067
|
* Creates a reactive form store from a form configuration. The form store
|
|
1058
1068
|
* manages form state and provides reactive properties.
|
|
1059
1069
|
*
|
|
1070
|
+
* @param configQrl The QRL containing the form configuration.
|
|
1071
|
+
*
|
|
1060
1072
|
* @returns The form store with reactive properties.
|
|
1061
1073
|
*/
|
|
1062
1074
|
declare function useFormQrl<TSchema extends Schema>(configQrl: QRL<FormConfig<TSchema>>): FormStore<TSchema>;
|
package/dist/index.qwik.js
CHANGED
|
@@ -65,7 +65,7 @@ function initializeFieldStore(internalFieldStore, schema, initialInput, path, nu
|
|
|
65
65
|
initializeFieldStore(internalFieldStore.children[index], schema.item, initialInput[index], path);
|
|
66
66
|
path.pop();
|
|
67
67
|
}
|
|
68
|
-
} else for (let index = 0; index < schema.items; index++) {
|
|
68
|
+
} else for (let index = 0; index < schema.items.length; index++) {
|
|
69
69
|
internalFieldStore.children[index] = {};
|
|
70
70
|
path.push(index);
|
|
71
71
|
initializeFieldStore(internalFieldStore.children[index], schema.items[index], initialInput?.[index], path);
|
|
@@ -378,7 +378,7 @@ function setNestedInput(internalFieldStore, input) {
|
|
|
378
378
|
}
|
|
379
379
|
for (let index = 0; index < arrayInput.length; index++) setNestedInput(internalFieldStore.children[index], arrayInput[index]);
|
|
380
380
|
internalFieldStore.input.value = input == null ? input : true;
|
|
381
|
-
internalFieldStore.isDirty.value = internalFieldStore.startInput.value !== internalFieldStore.input.value || internalFieldStore.startItems.value.length !== items.length;
|
|
381
|
+
internalFieldStore.isDirty.value = internalFieldStore.startInput.value !== internalFieldStore.input.value || internalFieldStore.startItems.value.length !== internalFieldStore.items.value.length;
|
|
382
382
|
} else if (internalFieldStore.kind === "object") {
|
|
383
383
|
for (const key in internalFieldStore.children) setNestedInput(internalFieldStore.children[key], input?.[key]);
|
|
384
384
|
internalFieldStore.input.value = input == null ? input : true;
|
|
@@ -829,6 +829,10 @@ function useField(form, config) {
|
|
|
829
829
|
isTouched: createComputed$(() => getFieldBool(internalFieldStore.value, "isTouched")),
|
|
830
830
|
isDirty: createComputed$(() => getFieldBool(internalFieldStore.value, "isDirty")),
|
|
831
831
|
isValid: createComputed$(() => !getFieldBool(internalFieldStore.value, "errors")),
|
|
832
|
+
onInput: $((value) => {
|
|
833
|
+
setFieldInput(internalFormStore, pathSignal.value, value);
|
|
834
|
+
validateIfRequired(internalFormStore, internalFieldStore.value, "input");
|
|
835
|
+
}),
|
|
832
836
|
props: {
|
|
833
837
|
get name() {
|
|
834
838
|
return internalFieldStore.value.name;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formisch/qwik",
|
|
3
3
|
"description": "The modular and type-safe form library for Qwik",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Fabian Hiller",
|
|
7
7
|
"homepage": "https://formisch.dev",
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@eslint/js": "^9.31.0",
|
|
40
39
|
"@qwik.dev/core": "2.0.0-beta.5",
|
|
41
40
|
"@types/node": "24.0.13",
|
|
42
41
|
"eslint": "9.31.0",
|
|
@@ -45,12 +44,12 @@
|
|
|
45
44
|
"prettier": "3.6.2",
|
|
46
45
|
"tsdown": "0.12.9",
|
|
47
46
|
"typescript": "5.8.3",
|
|
48
|
-
"typescript-eslint": "8.36.0",
|
|
49
47
|
"valibot": "^1.2.0",
|
|
50
48
|
"vite": "7.0.4",
|
|
51
49
|
"vite-tsconfig-paths": "^5.1.4",
|
|
52
|
-
"@formisch/core": "0.
|
|
53
|
-
"@formisch/
|
|
50
|
+
"@formisch/core": "0.5.0",
|
|
51
|
+
"@formisch/eslint-config": "0.1.0",
|
|
52
|
+
"@formisch/methods": "0.6.0"
|
|
54
53
|
},
|
|
55
54
|
"peerDependencies": {
|
|
56
55
|
"@qwik.dev/core": ">=2",
|