@formisch/vue 0.7.3 → 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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as v from "valibot";
2
- import * as vue3 from "vue";
2
+ import * as vue1 from "vue";
3
3
  import { ComponentPublicInstance, MaybeRefOrGetter, ShallowRef as Signal } from "vue";
4
4
 
5
5
  //#region ../../packages/core/dist/index.vue.d.ts
@@ -959,14 +959,14 @@ interface FieldProps<TSchema extends Schema = Schema, TFieldPath extends Require
959
959
  readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
960
960
  }
961
961
  declare const __VLS_export$2: <TSchema extends Schema, TFieldPath extends RequiredPath>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal$2<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
962
- props: __VLS_PrettifyLocal$2<FieldProps<TSchema, TFieldPath>> & vue3.PublicProps;
962
+ props: __VLS_PrettifyLocal$2<FieldProps<TSchema, TFieldPath>> & vue1.PublicProps;
963
963
  expose: (exposed: {}) => void;
964
964
  attrs: any;
965
965
  slots: {
966
966
  default(props: FieldStore<TSchema, TFieldPath>): any;
967
967
  };
968
968
  emit: {};
969
- }>) => vue3.VNode & {
969
+ }>) => vue1.VNode & {
970
970
  __ctx?: Awaited<typeof __VLS_setup>;
971
971
  };
972
972
  declare const _default: typeof __VLS_export$2;
@@ -987,14 +987,14 @@ interface FieldArrayProps<TSchema extends Schema = Schema, TFieldArrayPath exten
987
987
  readonly path: ValidArrayPath<v.InferInput<TSchema>, TFieldArrayPath>;
988
988
  }
989
989
  declare const __VLS_export$1: <TSchema extends Schema, TFieldArrayPath extends RequiredPath>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal$1<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
990
- props: __VLS_PrettifyLocal$1<FieldArrayProps<TSchema, TFieldArrayPath>> & vue3.PublicProps;
990
+ props: __VLS_PrettifyLocal$1<FieldArrayProps<TSchema, TFieldArrayPath>> & vue1.PublicProps;
991
991
  expose: (exposed: {}) => void;
992
992
  attrs: any;
993
993
  slots: {
994
994
  default(props: FieldArrayStore<TSchema, TFieldArrayPath>): any;
995
995
  };
996
996
  emit: {};
997
- }>) => vue3.VNode & {
997
+ }>) => vue1.VNode & {
998
998
  __ctx?: Awaited<typeof __VLS_setup>;
999
999
  };
1000
1000
  declare const _default$1: typeof __VLS_export$1;
@@ -1012,17 +1012,17 @@ interface FormProps<TSchema extends Schema = Schema> {
1012
1012
  /**
1013
1013
  * The submit handler called when the form is submitted and validation succeeds.
1014
1014
  */
1015
- onSubmit: SubmitHandler<TSchema> | SubmitEventHandler<TSchema>;
1015
+ onSubmit: SubmitEventHandler<TSchema>;
1016
1016
  }
1017
1017
  declare const __VLS_export: <TSchema extends Schema = Schema>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
1018
- props: __VLS_PrettifyLocal<FormProps<TSchema>> & vue3.PublicProps;
1018
+ props: __VLS_PrettifyLocal<FormProps<TSchema>> & vue1.PublicProps;
1019
1019
  expose: (exposed: {}) => void;
1020
1020
  attrs: any;
1021
1021
  slots: {
1022
1022
  default?: (props: {}) => any;
1023
1023
  };
1024
1024
  emit: {};
1025
- }>) => vue3.VNode & {
1025
+ }>) => vue1.VNode & {
1026
1026
  __ctx?: Awaited<typeof __VLS_setup>;
1027
1027
  };
1028
1028
  declare const _default$2: typeof __VLS_export;
package/dist/index.js CHANGED
@@ -551,6 +551,7 @@ function focus(form, config) {
551
551
  function getAllErrors(form) {
552
552
  let allErrors = null;
553
553
  walkFieldStore(form[INTERNAL], (internalFieldStore) => {
554
+ if (internalFieldStore.kind === "array") internalFieldStore.items.value;
554
555
  const errors = internalFieldStore.errors.value;
555
556
  if (errors) if (allErrors) allErrors.push(...errors);
556
557
  else allErrors = [...errors];
@@ -603,7 +604,15 @@ function insert(form, config) {
603
604
  const newItems = [...items];
604
605
  newItems.splice(insertIndex, 0, createId());
605
606
  internalArrayStore.items.value = newItems;
606
- for (let index = items.length; index > insertIndex; index--) copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
607
+ for (let index = items.length; index > insertIndex; index--) {
608
+ if (!internalArrayStore.children[index]) {
609
+ const path = JSON.parse(internalArrayStore.name);
610
+ internalArrayStore.children[index] = {};
611
+ path.push(index);
612
+ initializeFieldStore(internalArrayStore.children[index], internalArrayStore.schema.item, void 0, path);
613
+ }
614
+ copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
615
+ }
607
616
  if (!internalArrayStore.children[insertIndex]) {
608
617
  const path = JSON.parse(internalArrayStore.name);
609
618
  internalArrayStore.children[insertIndex] = {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formisch/vue",
3
3
  "description": "The modular and type-safe form library for Vue",
4
- "version": "0.7.3",
4
+ "version": "0.7.5",
5
5
  "license": "MIT",
6
6
  "author": "Fabian Hiller",
7
7
  "homepage": "https://formisch.dev",
@@ -32,7 +32,18 @@
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
+ "vite": "vite"
42
+ },
35
43
  "devDependencies": {
44
+ "@formisch/core": "workspace:*",
45
+ "@formisch/eslint-config": "workspace:*",
46
+ "@formisch/methods": "workspace:*",
36
47
  "@types/node": "^24.1.0",
37
48
  "@vue/eslint-config-typescript": "^14.6.0",
38
49
  "eslint": "^9.32.0",
@@ -42,10 +53,7 @@
42
53
  "unplugin-vue": "^7.0.0",
43
54
  "valibot": "^1.2.0",
44
55
  "vue": "^3.5.18",
45
- "vue-tsc": "^3.0.4",
46
- "@formisch/methods": "0.7.0",
47
- "@formisch/core": "0.6.3",
48
- "@formisch/eslint-config": "0.1.0"
56
+ "vue-tsc": "^3.0.4"
49
57
  },
50
58
  "peerDependencies": {
51
59
  "typescript": ">=5",
@@ -56,13 +64,5 @@
56
64
  "typescript": {
57
65
  "optional": true
58
66
  }
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
- "vite": "vite"
67
67
  }
68
- }
68
+ }
package/LICENSE.md DELETED
@@ -1,9 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) Fabian Hiller
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.