@formisch/svelte 0.7.4 → 0.7.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.
@@ -28,6 +28,7 @@ function focus(form, config) {
28
28
  function getAllErrors(form) {
29
29
  let allErrors = null;
30
30
  walkFieldStore(form[INTERNAL], (internalFieldStore) => {
31
+ if (internalFieldStore.kind === "array") internalFieldStore.items.value;
31
32
  const errors = internalFieldStore.errors.value;
32
33
  if (errors) if (allErrors) allErrors.push(...errors);
33
34
  else allErrors = [...errors];
@@ -92,7 +93,15 @@ function insert(form, config) {
92
93
  const newItems = [...items];
93
94
  newItems.splice(insertIndex, 0, createId());
94
95
  internalArrayStore.items.value = newItems;
95
- for (let index = items.length; index > insertIndex; index--) copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
96
+ for (let index = items.length; index > insertIndex; index--) {
97
+ if (!internalArrayStore.children[index]) {
98
+ const path = JSON.parse(internalArrayStore.name);
99
+ internalArrayStore.children[index] = {};
100
+ path.push(index);
101
+ initializeFieldStore(internalArrayStore.children[index], internalArrayStore.schema.item, void 0, path);
102
+ }
103
+ copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
104
+ }
96
105
  if (!internalArrayStore.children[insertIndex]) {
97
106
  const path = JSON.parse(internalArrayStore.name);
98
107
  internalArrayStore.children[insertIndex] = {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formisch/svelte",
3
3
  "description": "The modular and type-safe form library for Svelte",
4
- "version": "0.7.4",
4
+ "version": "0.7.5",
5
5
  "license": "MIT",
6
6
  "author": "Fabian Hiller",
7
7
  "homepage": "https://formisch.dev",