@tinacms/forms
Advanced tools
Comparing version 0.4.0 to 0.4.1-alpha.0
@@ -19,3 +19,6 @@ /** | ||
/// <reference types="react" /> | ||
export interface Field { | ||
export declare type AnyField = Field & { | ||
[key: string]: any; | ||
}; | ||
export interface Field<F extends Field = AnyField> { | ||
name: string; | ||
@@ -25,7 +28,7 @@ label?: string; | ||
component: React.FC<any> | string | null; | ||
parse?: (value: any, name: string, field: Field) => any; | ||
format?: (value: any, name: string, field: Field) => any; | ||
parse?: (value: any, name: string, field: F) => any; | ||
format?: (value: any, name: string, field: F) => any; | ||
validate?(value: any, allValues: any, meta: any, field: Field): string | object | undefined; | ||
defaultValue?: any; | ||
fields?: Field[]; | ||
fields?: F[]; | ||
} |
@@ -20,7 +20,7 @@ /** | ||
import { Plugin } from '@tinacms/core'; | ||
import { Field } from './field'; | ||
export interface FormOptions<S> extends Config<S> { | ||
import { Field, AnyField } from './field'; | ||
export interface FormOptions<S, F extends Field = AnyField> extends Config<S> { | ||
id: any; | ||
label: string; | ||
fields: Field[]; | ||
fields: F[]; | ||
__type?: string; | ||
@@ -31,3 +31,3 @@ reset?(): void; | ||
} | ||
export declare class Form<S = any> implements Plugin { | ||
export declare class Form<S = any, F extends Field = AnyField> implements Plugin { | ||
private _reset; | ||
@@ -37,6 +37,6 @@ __type: string; | ||
label: string; | ||
fields: Field[]; | ||
fields: F[]; | ||
finalForm: FormApi<S>; | ||
actions: any[]; | ||
constructor({ id, label, fields, actions, reset, loadInitialValues, ...options }: FormOptions<S>); | ||
constructor({ id, label, fields, actions, reset, loadInitialValues, ...options }: FormOptions<S, F>); | ||
/** | ||
@@ -68,3 +68,3 @@ * A unique identifier for Forms. | ||
*/ | ||
updateFields(fields: Field[]): void; | ||
updateFields(fields: F[]): void; | ||
/** | ||
@@ -71,0 +71,0 @@ * Subscribes to changes to the form. The subscriber will only be called when |
@@ -6,2 +6,13 @@ # Change Log | ||
## [0.4.1-alpha.0](https://github.com/tinacms/tinacms/compare/@tinacms/forms@0.4.0...@tinacms/forms@0.4.1-alpha.0) (2020-04-14) | ||
### Bug Fixes | ||
* forms are more flexible with the shape of Fields ([90d8b0c](https://github.com/tinacms/tinacms/commit/90d8b0c)) | ||
# [0.4.0](https://github.com/tinacms/tinacms/compare/@tinacms/forms@0.3.0...@tinacms/forms@0.4.0) (2020-04-06) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@tinacms/forms", | ||
"version": "0.4.0", | ||
"version": "0.4.1-alpha.0", | ||
"main": "build/index.js", | ||
@@ -41,3 +41,3 @@ "types": "build/index.d.ts", | ||
}, | ||
"gitHead": "4d74125e00320233a6a0ad1bb9282e801c5229e0" | ||
"gitHead": "1b64eb2e2236e7df68827b806413b2fe990f8332" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27363
210