formsy-react
Advanced tools
Comparing version 2.0.0-beta.7 to 2.0.0-beta.8
@@ -7,2 +7,11 @@ ### Changelog | ||
#### [v2.0.0-beta.7](https://github.com/formsy/formsy-react/compare/v2.0.0-beta.6...v2.0.0-beta.7) | ||
> 14 December 2019 | ||
- Dependabot Automatic Library Bumps [`#305`](https://github.com/formsy/formsy-react/pull/305) | ||
- Updated API.md to make emphasis in the double quote validation argument [`#304`](https://github.com/formsy/formsy-react/pull/304) | ||
- Fix wrapper unregister on unmount. [`#282`](https://github.com/formsy/formsy-react/pull/282) | ||
- Fix wrapper unregister on unmount. (#282) [`#261`](https://github.com/formsy/formsy-react/issues/261) | ||
#### [v2.0.0-beta.6](https://github.com/formsy/formsy-react/compare/v2.0.0-beta.5...v2.0.0-beta.6) | ||
@@ -9,0 +18,0 @@ |
@@ -84,6 +84,6 @@ import React from 'react'; | ||
attachToForm: (component: any) => void; | ||
detachFromForm: (component: InputComponent) => void; | ||
detachFromForm: <V>(component: InputComponent<V>) => void; | ||
isFormDisabled: boolean; | ||
isValidValue: (component: any, value: any) => boolean; | ||
validate: (component: InputComponent) => void; | ||
validate: <V_1>(component: InputComponent<V_1>) => void; | ||
}; | ||
@@ -105,4 +105,4 @@ }; | ||
resetModel: IResetModel; | ||
setValue: ISetInputValue; | ||
runValidation: (component: InputComponent, value?: any) => { | ||
setValue: ISetInputValue<any>; | ||
runValidation: <V>(component: InputComponent<V>, value?: V) => { | ||
isRequired: boolean; | ||
@@ -113,7 +113,7 @@ isValid: boolean; | ||
attachToForm: (component: any) => void; | ||
detachFromForm: (component: InputComponent) => void; | ||
detachFromForm: <V>(component: InputComponent<V>) => void; | ||
isChanged: () => boolean; | ||
submit: (event: any) => void; | ||
updateInputsWithError: IUpdateInputsWithError; | ||
validate: (component: InputComponent) => void; | ||
validate: <V>(component: InputComponent<V>) => void; | ||
validateForm: () => void; | ||
@@ -386,4 +386,4 @@ render: () => React.DetailedReactHTMLElement<{ | ||
} | ||
declare const addValidationRule: (name: string, func: ValidationFunction) => void; | ||
declare const addValidationRule: <V>(name: string, func: ValidationFunction<V>) => void; | ||
export { addValidationRule, propTypes, validationRules, Wrapper as withFormsy }; | ||
export default Formsy; |
import React, { ComponentClass } from 'react'; | ||
import { WrapperProps, WrapperState } from './Wrapper'; | ||
export declare type Value = any; | ||
export interface Values { | ||
[key: string]: Value; | ||
[key: string]: any; | ||
} | ||
@@ -10,10 +9,11 @@ export declare type IModel = any; | ||
export declare type IResetModel = (model?: IModel) => void; | ||
export declare type ISetInputValue = (name: string, value: Value, validate?: boolean) => void; | ||
export declare type ISetInputValue<V> = (name: string, value: V, validate?: boolean) => void; | ||
export declare type IUpdateInputsWithError = (errors: any, invalidate?: boolean) => void; | ||
export declare type ValidationFunction = (values: Values, value: Value, extra?: any) => boolean; | ||
export declare type Validation = string | boolean | ValidationFunction; | ||
export interface Validations { | ||
[key: string]: Validation; | ||
export declare type ValidationFunction<V> = (values: Values, value: V, extra?: any) => boolean | string; | ||
export declare type Validation<V> = string | boolean | ValidationFunction<V>; | ||
export declare type Validations<V> = ValidationsStructure<V> | string | object; | ||
export interface ValidationsStructure<V> { | ||
[key: string]: Validation<V>; | ||
} | ||
export declare type RequiredValidation = string | boolean | Validations; | ||
export declare type RequiredValidation<V> = boolean | Validations<V>; | ||
export interface ComponentWithStaticAttributes extends ComponentClass { | ||
@@ -24,5 +24,5 @@ string?: any; | ||
export declare type WrappedComponentClass = React.FC | ComponentWithStaticAttributes; | ||
export interface InputComponent extends React.Component<WrapperProps, WrapperState> { | ||
validations?: Validations; | ||
requiredValidations?: Validations; | ||
export interface InputComponent<V> extends React.Component<WrapperProps<V>, WrapperState<V>> { | ||
validations?: Validations<V>; | ||
requiredValidations?: Validations<V>; | ||
} |
import { Validations, Values } from './interfaces'; | ||
declare const _default: { | ||
arraysDiffer(a: unknown[], b: unknown[]): boolean; | ||
objectsDiffer(a: object, b: object): boolean; | ||
isSame(a: unknown, b: unknown): boolean; | ||
find<T>(collection: T[], fn: (item: T) => boolean): T; | ||
runRules(value: any, currentValues: Values, validations: Validations, validationRules: Validations): { | ||
errors: string[]; | ||
failed: string[]; | ||
success: string[]; | ||
}; | ||
export declare function isArray(value: unknown): value is unknown[]; | ||
export declare function isObject(value: unknown): value is object; | ||
export declare function isTypeUndefined(value: unknown): value is undefined; | ||
export declare function isDate(value: unknown): value is Date; | ||
export declare function isFunction(value: unknown): value is Function; | ||
export declare function isString(value: unknown): value is string; | ||
export declare function isNumber(value: unknown): value is number; | ||
export declare function isValueStringEmpty(value: string): boolean; | ||
export declare function isValueNullOrUndefined(value: unknown): boolean; | ||
export declare function isValueUndefined(value: unknown): boolean; | ||
export declare function noop(): void; | ||
export declare function cloneIfObject(value: unknown): unknown; | ||
export declare function isSame(a: unknown, b: unknown): any; | ||
export declare function runRules<V>(value: V, currentValues: Values, validations: Validations<V>, validationRules: Validations<V>): { | ||
errors: string[]; | ||
failed: string[]; | ||
success: string[]; | ||
}; | ||
export default _default; |
import { ValidationFunction } from './interfaces'; | ||
declare const validations: { | ||
[key: string]: ValidationFunction; | ||
}; | ||
interface Validations<V> { | ||
[key: string]: ValidationFunction<V>; | ||
} | ||
declare const validations: Validations<any>; | ||
export default validations; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Validations, RequiredValidation, Value } from './interfaces'; | ||
import { RequiredValidation, Validations } from './interfaces'; | ||
declare const propTypes: { | ||
@@ -11,12 +11,12 @@ innerRef: PropTypes.Requireable<(...args: any[]) => any>; | ||
}; | ||
export interface WrapperProps { | ||
export interface WrapperProps<V> { | ||
innerRef?: (ref: any) => void; | ||
name: string; | ||
required?: RequiredValidation; | ||
required?: RequiredValidation<V>; | ||
validationError?: any; | ||
validationErrors?: any; | ||
validations?: Validations | string; | ||
value?: Value; | ||
validations?: Validations<V>; | ||
value?: V; | ||
} | ||
export interface WrapperState { | ||
export interface WrapperState<V> { | ||
[key: string]: unknown; | ||
@@ -30,5 +30,5 @@ externalError: null; | ||
validationError: any[]; | ||
value: any; | ||
value: V; | ||
} | ||
export interface PassDownProps extends WrapperProps { | ||
export interface InjectedProps<V> { | ||
errorMessage: any; | ||
@@ -42,11 +42,12 @@ errorMessages: any; | ||
isValid: boolean; | ||
isValidValue: (value: Value) => boolean; | ||
isValidValue: (value: V) => boolean; | ||
ref?: any; | ||
resetValue: any; | ||
setValidations: any; | ||
setValue: (value: Value) => void; | ||
setValue: (value: V) => void; | ||
showError: boolean; | ||
showRequired: boolean; | ||
} | ||
export declare type PassDownProps<V> = WrapperProps<V> & InjectedProps<V>; | ||
export { propTypes }; | ||
export default function <T>(WrappedComponent: React.ComponentType<T & PassDownProps>): React.ComponentType<T & WrapperProps>; | ||
export default function <T, V>(WrappedComponent: React.ComponentType<T & PassDownProps<V>>): React.ComponentType<Omit<T & WrapperProps<V>, keyof InjectedProps<V>>>; |
{ | ||
"name": "formsy-react", | ||
"version": "2.0.0-beta.7", | ||
"version": "2.0.0-beta.8", | ||
"description": "A form input builder and validator for React", | ||
@@ -76,7 +76,7 @@ "keywords": [ | ||
"@types/react-dom": "^16.8.5", | ||
"@typescript-eslint/eslint-plugin": "^1.13.0", | ||
"@typescript-eslint/parser": "^1.13.0", | ||
"@typescript-eslint/eslint-plugin": "^2.14.0", | ||
"@typescript-eslint/parser": "^2.14.0", | ||
"auto-changelog": "^1.14.1", | ||
"babel-eslint": "^10.0.2", | ||
"babel-jest": "^24.8.0", | ||
"babel-jest": "^25.1.0", | ||
"babel-loader": "^8.0.6", | ||
@@ -87,3 +87,3 @@ "babelrc-rollup": "^3.0.0", | ||
"eslint": "^6.1.0", | ||
"eslint-config-airbnb": "^17.1.1", | ||
"eslint-config-airbnb": "^18.0.1", | ||
"eslint-config-prettier": "^6.0.0", | ||
@@ -95,4 +95,4 @@ "eslint-config-react": "^1.1.7", | ||
"eslint-plugin-react": "^7.14.3", | ||
"husky": "^3.0.2", | ||
"jest": "^24.8.0", | ||
"husky": "^4.2.1", | ||
"jest": "^25.1.0", | ||
"np": "^5.1.1", | ||
@@ -108,3 +108,3 @@ "prettier": "^1.18.2", | ||
"rollup-plugin-peer-deps-external": "^2.2.0", | ||
"sinon": "^7.3.2", | ||
"sinon": "^8.0.2", | ||
"typescript": "^3.5.3" | ||
@@ -111,0 +111,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
766776
6679