Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions docs/reference/fieldApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,6 @@ A class representing the API for managing a form field.

- Swaps the values at the specified indices.

- ```tsx
getSubField<TSubName, TSubData>(name: TName): FieldApi<TData, TSubName, ValidatorType, TSubData>
```

- Gets a subfield instance.

- ```tsx
validate(): Promise<any>
```
Expand Down
17 changes: 0 additions & 17 deletions packages/form-core/src/FieldApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,23 +469,6 @@ export class FieldApi<
swapValues = (aIndex: number, bIndex: number) =>
this.form.swapFieldValues(this.name, aIndex, bIndex)

getSubField = <
TSubName extends DeepKeys<TData>,
TSubData extends DeepValue<TData, TSubName> = DeepValue<TData, TSubName>,
>(
name: TSubName,
): FieldApi<
TData,
TSubName,
Validator<TSubData, unknown> | undefined,
Validator<TData, unknown> | undefined,
TSubData
> =>
new FieldApi({
name: `${this.name}.${name}` as never,
form: this.form,
}) as any

validateSync = (value = this.state.value, cause: ValidationCause) => {
const validates = getSyncValidatorArray(cause, this.options)

Expand Down
20 changes: 0 additions & 20 deletions packages/form-core/src/tests/FieldApi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,26 +154,6 @@ describe('field api', () => {
expect(field.getValue()).toStrictEqual(['two', 'one'])
})

it('should get a subfield properly', () => {
const form = new FormApi({
defaultValues: {
names: {
first: 'one',
second: 'two',
},
},
})

const field = new FieldApi({
form,
name: 'names',
})

const subfield = field.getSubField('first')

expect(subfield.getValue()).toBe('one')
})

it('should not throw errors when no meta info is stored on a field and a form re-renders', async () => {
const form = new FormApi({
defaultValues: {
Expand Down