@formisch/preact 0.9.3 → 0.9.5
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 +1 -1
- package/dist/index.js +10 -1
- package/package.json +13 -13
package/dist/index.d.ts
CHANGED
|
@@ -1027,7 +1027,7 @@ type FormProps<TSchema extends Schema = Schema> = Omit<JSX.FormHTMLAttributes<HT
|
|
|
1027
1027
|
/**
|
|
1028
1028
|
* The submit handler called when the form is submitted and validation succeeds.
|
|
1029
1029
|
*/
|
|
1030
|
-
readonly onSubmit:
|
|
1030
|
+
readonly onSubmit: SubmitEventHandler<TSchema>;
|
|
1031
1031
|
};
|
|
1032
1032
|
/**
|
|
1033
1033
|
* Form component that manages form submission and applies internal state.
|
package/dist/index.js
CHANGED
|
@@ -558,6 +558,7 @@ function focus(form, config) {
|
|
|
558
558
|
function getAllErrors(form) {
|
|
559
559
|
let allErrors = null;
|
|
560
560
|
walkFieldStore(form[INTERNAL], (internalFieldStore) => {
|
|
561
|
+
if (internalFieldStore.kind === "array") internalFieldStore.items.value;
|
|
561
562
|
const errors = internalFieldStore.errors.value;
|
|
562
563
|
if (errors) if (allErrors) allErrors.push(...errors);
|
|
563
564
|
else allErrors = [...errors];
|
|
@@ -610,7 +611,15 @@ function insert(form, config) {
|
|
|
610
611
|
const newItems = [...items];
|
|
611
612
|
newItems.splice(insertIndex, 0, createId());
|
|
612
613
|
internalArrayStore.items.value = newItems;
|
|
613
|
-
for (let index = items.length; index > insertIndex; index--)
|
|
614
|
+
for (let index = items.length; index > insertIndex; index--) {
|
|
615
|
+
if (!internalArrayStore.children[index]) {
|
|
616
|
+
const path = JSON.parse(internalArrayStore.name);
|
|
617
|
+
internalArrayStore.children[index] = {};
|
|
618
|
+
path.push(index);
|
|
619
|
+
initializeFieldStore(internalArrayStore.children[index], internalArrayStore.schema.item, void 0, path);
|
|
620
|
+
}
|
|
621
|
+
copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
|
|
622
|
+
}
|
|
614
623
|
if (!internalArrayStore.children[insertIndex]) {
|
|
615
624
|
const path = JSON.parse(internalArrayStore.name);
|
|
616
625
|
internalArrayStore.children[insertIndex] = {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formisch/preact",
|
|
3
3
|
"description": "The modular and type-safe form library for Preact",
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Fabian Hiller",
|
|
7
7
|
"homepage": "https://formisch.dev",
|
|
@@ -32,7 +32,17 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsdown",
|
|
37
|
+
"lint": "eslint \"src/**/*.ts*\" && tsc --noEmit",
|
|
38
|
+
"lint.fix": "eslint \"src/**/*.ts*\" --fix",
|
|
39
|
+
"format": "prettier --write ./src",
|
|
40
|
+
"format.check": "prettier --check ./src"
|
|
41
|
+
},
|
|
35
42
|
"devDependencies": {
|
|
43
|
+
"@formisch/core": "workspace:*",
|
|
44
|
+
"@formisch/eslint-config": "workspace:*",
|
|
45
|
+
"@formisch/methods": "workspace:*",
|
|
36
46
|
"@preact/preset-vite": "^2.9.3",
|
|
37
47
|
"@preact/signals": "^2.2.1",
|
|
38
48
|
"eslint": "^9.31.0",
|
|
@@ -41,10 +51,7 @@
|
|
|
41
51
|
"tsdown": "^0.16.8",
|
|
42
52
|
"typescript": "^5.8.3",
|
|
43
53
|
"valibot": "^1.2.0",
|
|
44
|
-
"vite": "^6.0.4"
|
|
45
|
-
"@formisch/methods": "0.7.0",
|
|
46
|
-
"@formisch/core": "0.6.3",
|
|
47
|
-
"@formisch/eslint-config": "0.1.0"
|
|
54
|
+
"vite": "^6.0.4"
|
|
48
55
|
},
|
|
49
56
|
"peerDependencies": {
|
|
50
57
|
"@preact/signals": "^2.0.0",
|
|
@@ -56,12 +63,5 @@
|
|
|
56
63
|
"typescript": {
|
|
57
64
|
"optional": true
|
|
58
65
|
}
|
|
59
|
-
},
|
|
60
|
-
"scripts": {
|
|
61
|
-
"build": "tsdown",
|
|
62
|
-
"lint": "eslint \"src/**/*.ts*\" && tsc --noEmit",
|
|
63
|
-
"lint.fix": "eslint \"src/**/*.ts*\" --fix",
|
|
64
|
-
"format": "prettier --write ./src",
|
|
65
|
-
"format.check": "prettier --check ./src"
|
|
66
66
|
}
|
|
67
|
-
}
|
|
67
|
+
}
|