Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tanstack/form-core

Package Overview
Dependencies
Maintainers
2
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/form-core - npm Package Compare versions

Comparing version 0.16.2 to 0.18.0

1

dist/esm/FieldApi.d.ts

@@ -87,2 +87,3 @@ import { Store } from '@tanstack/store';

swapValues: (aIndex: number, bIndex: number) => void;
moveValue: (aIndex: number, bIndex: number) => void;
validateSync: (value: TData | undefined, cause: ValidationCause) => {

@@ -89,0 +90,0 @@ hasErrored: boolean;

@@ -87,2 +87,3 @@ import { Store } from "@tanstack/store";

this.swapValues = (aIndex, bIndex) => this.form.swapFieldValues(this.name, aIndex, bIndex);
this.moveValue = (aIndex, bIndex) => this.form.moveFieldValues(this.name, aIndex, bIndex);
this.validateSync = (value = this.state.value, cause) => {

@@ -89,0 +90,0 @@ const validates = getSyncValidatorArray(cause, this.options);

@@ -120,2 +120,3 @@ import { Store } from '@tanstack/store';

swapFieldValues: <TField extends DeepKeys<TFormData>>(field: TField, index1: number, index2: number) => void;
moveFieldValues: <TField extends DeepKeys<TFormData>>(field: TField, index1: number, index2: number) => void;
}

@@ -357,2 +357,8 @@ import { Store } from "@tanstack/store";

};
this.moveFieldValues = (field, index1, index2) => {
this.setFieldValue(field, (prev) => {
prev.splice(index2, 0, prev.splice(index1, 1)[0]);
return prev;
});
};
this.store = new Store(

@@ -359,0 +365,0 @@ getDefaultFormState({

2

package.json
{
"name": "@tanstack/form-core",
"version": "0.16.2",
"version": "0.18.0",
"description": "Powerful, type-safe, framework agnostic forms.",

@@ -5,0 +5,0 @@ "author": "tannerlinsley",

@@ -485,2 +485,5 @@ import { Store } from '@tanstack/store'

moveValue = (aIndex: number, bIndex: number) =>
this.form.moveFieldValues(this.name, aIndex, bIndex)
validateSync = (value = this.state.value, cause: ValidationCause) => {

@@ -487,0 +490,0 @@ const validates = getSyncValidatorArray(cause, this.options)

@@ -721,2 +721,13 @@ import { Store } from '@tanstack/store'

}
moveFieldValues = <TField extends DeepKeys<TFormData>>(
field: TField,
index1: number,
index2: number,
) => {
this.setFieldValue(field, (prev: any) => {
prev.splice(index2, 0, prev.splice(index1, 1)[0])
return prev
})
}
}

@@ -723,0 +734,0 @@

@@ -161,2 +161,19 @@ import { describe, expect, it, vi } from 'vitest'

it('should move a value from an array value correctly', () => {
const form = new FormApi({
defaultValues: {
names: ['one', 'two', 'three', 'four'],
},
})
const field = new FieldApi({
form,
name: 'names',
})
field.moveValue(2, 0)
expect(field.getValue()).toStrictEqual(['three', 'one', 'two', 'four'])
})
it('should not throw errors when no meta info is stored on a field and a form re-renders', async () => {

@@ -163,0 +180,0 @@ const form = new FormApi({

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc