Skip to content

Commit

Permalink
Merge f38d57b into f7b06d1
Browse files Browse the repository at this point in the history
  • Loading branch information
franleplant committed Nov 24, 2017
2 parents f7b06d1 + f38d57b commit 55f59fc
Show file tree
Hide file tree
Showing 58 changed files with 1,682 additions and 1,364 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules
coverage
docs/
docsTmp/
docsContent.json
145 changes: 62 additions & 83 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
> Autogenerated from source code
# index <small>Module [src](./src/index.ts#L1)</small> <a id="#251"></a>

## Reform <small>Object literal [src](./src/index.ts#L22)</small> <a id="#252"></a>
`default` export for the entire library.

Expand All @@ -20,15 +19,14 @@

<big><pre>
{
core: [./src/core](#user-content-#178)
reactHelpers: [./src/reactHelpers](#user-content-#201)
reactMixins: [./src/reactMixins](#user-content-#233)
types: [./src/types](#user-content-#1)
validators: [./src/validators](./src/validators)
core: [./src/core](#user-content-#178)
reactHelpers: [./src/reactHelpers](#user-content-#201)
reactMixins: [./src/reactMixins](#user-content-#233)
types: [./src/types](#user-content-#1)
validators: [./src/validators](./src/validators)
}
</big></pre>
# core <small>Module [src](./src/core.ts#L1)</small> <a id="#178"></a>

## fieldIsValid <small>Function [src](./src/core.ts#L73)</small> <a id="#185"></a>

Evaluate whether a field is valid or not.
Expand Down Expand Up @@ -128,7 +126,6 @@ validateForm(fieldsValues: [Fields](#user-content-#21), rulesMap: [RulesMap](#us
</pre></big>

# reactHelpers <small>Module [src](./src/reactHelpers.ts#L1)</small> <a id="#201"></a>

## fieldErrors <small>Function [src](./src/reactHelpers.ts#L242)</small> <a id="#227"></a>

Another error helper to make displaying field errors easier. Instead of `fieldIfError` which
Expand Down Expand Up @@ -157,7 +154,7 @@ Tags


<big><pre>
fieldErrors(fieldName: string): Array\<undefined\>
fieldErrors(fieldName: string): Array\<[string, any]\>
</pre></big>

## fieldIfError <small>Function [src](./src/reactHelpers.ts#L203)</small> <a id="#223"></a>
Expand Down Expand Up @@ -347,22 +344,21 @@ validateFormFromState(): boolean
</pre></big>
# reactMixins <small>Module [src](./src/reactMixins.ts#L1)</small> <a id="#233"></a>
## IReform <small>Interface [src](./src/reactMixins.ts#L13)</small> <a id="#234"></a>
Handy interface that contains attributes corresponding to each
`Reform.reactHelpers.*` method.
<big><pre>
{
fieldErrors: [fieldErrors](#user-content-#227);
fieldIfError: [fieldIfError](#user-content-#223);
fieldIsValid: [fieldIsValid](#user-content-#218);
formIsValid: [formIsValid](#user-content-#221);
mapFieldErrors: [mapFieldErrors](#user-content-#230);
validateField: [validateField](#user-content-#206);
validateFieldFromState: [validateFieldFromState](#user-content-#210);
validateForm: [validateForm](#user-content-#213);
validateFormFromState: [validateFormFromState](#user-content-#216)
fieldErrors: [fieldErrors](#user-content-#227)
fieldIfError: [fieldIfError](#user-content-#223)
fieldIsValid: [fieldIsValid](#user-content-#218)
formIsValid: [formIsValid](#user-content-#221)
mapFieldErrors: [mapFieldErrors](#user-content-#230)
validateField: [validateField](#user-content-#206)
validateFieldFromState: [validateFieldFromState](#user-content-#210)
validateForm: [validateForm](#user-content-#213)
validateFormFromState: [validateFormFromState](#user-content-#216)
}
</big></pre>
## functionalMixin <small>Function [src](./src/reactMixins.ts#L76)</small> <a id="#248"></a>
Expand Down Expand Up @@ -415,7 +411,6 @@ objectMixin(that: [ValidationAbleInstance](#user-content-#24)): [IReform](#user-
</pre></big>
# validators <small>Module [src](./src/validators.ts#L1)</small> <a id="#169"></a>
## validatorInterface <small>Object literal [src](./src/validators.ts#L18)</small> <a id="#170"></a>
Main validator interface.
Expand All @@ -433,86 +428,86 @@ Use it if you want to add new global custom validators.
<big><pre>
{
get: get(key: string): [Validator](#user-content-#2)
set: set(key: string, value: [Validator](#user-content-#2)): void
get: get(key: string): [Validator](#user-content-#2)
set: set(key: string, value: [Validator](#user-content-#2)): void
}
</big></pre>
# types <small>Module [src](./src/types.ts#L1)</small> <a id="#1"></a>
## FieldErrors <small>Interface [src](./src/types.ts#L17)</small> <a id="#15"></a>
<big><pre>
{
\[ruleKey: string\]: boolean
\[ruleKey: string\]: boolean
}
</big></pre>
## Fields <small>Interface [src](./src/types.ts#L25)</small> <a id="#21"></a>
<big><pre>
{
\[fieldName: string\]: any
\[fieldName: string\]: any
}
</big></pre>
## FormErrors <small>Interface [src](./src/types.ts#L21)</small> <a id="#18"></a>
<big><pre>
{
\[fieldName: string\]: [FieldErrors](#user-content-#15)
\[fieldName: string\]: [FieldErrors](#user-content-#15)
}
</big></pre>
## Rules <small>Interface [src](./src/types.ts#L9)</small> <a id="#9"></a>
<big><pre>
{
\[ruleKey: string\]: boolean | string | [Validator](#user-content-#2) | any
\[ruleKey: string\]: boolean | string | [Validator](#user-content-#2) | any
}
</big></pre>
## RulesMap <small>Interface [src](./src/types.ts#L13)</small> <a id="#12"></a>
<big><pre>
{
\[fieldName: string\]: [Rules](#user-content-#9)
\[fieldName: string\]: [Rules](#user-content-#9)
}
</big></pre>
## ValidationAbleInstance <small>Interface [src](./src/types.ts#L35)</small> <a id="#24"></a>
<big><pre>
{
setState: any;
state: {
errors: [FormErrors](#user-content-#18);
fields: [Fields](#user-content-#21);
formIsDirty: boolean
};
validationMessages: {
\[ruleKey: string\]: [MessageCreator](#user-content-#36)
};
validationRules: [RulesMap](#user-content-#12)
setState: any
state:
{
errors: [FormErrors](#user-content-#18)
fields: [Fields](#user-content-#21)
formIsDirty: boolean
}
validationMessages:
{
\[ruleKey: string\]: [MessageCreator](#user-content-#36)
}
validationRules: [RulesMap](#user-content-#12)
}
</big></pre>
## Validator <small>Interface [src](./src/types.ts#L1)</small> <a id="#2"></a>
<big><pre>
{
(value: string | number | any, ruleValue: any): boolean
(value: string | number | any, ruleValue: any): boolean
}
</big></pre>
## ValidatorMap <small>Interface [src](./src/types.ts#L5)</small> <a id="#6"></a>
<big><pre>
{
\[ruleKey: string\]: [Validator](#user-content-#2)
\[ruleKey: string\]: [Validator](#user-content-#2)
}
</big></pre>
## MessageCreator <small>Type alias [src](./src/types.ts#L29)</small> <a id="#36"></a>
<big><pre>
{
(ruleArgument: any, ruleKey: string, fieldName: string): string
(ruleArgument: any, ruleKey: string, fieldName: string): string
}
</big></pre>
# officialValidators/index <small>Module [src](./src/officialValidators/index.ts#L1)</small> <a id="#124"></a>
## validatorMap <small>Object literal [src](./src/officialValidators/index.ts#L65)</small> <a id="#128"></a>
These are all the official validators HTML5 validators.
Expand Down Expand Up @@ -557,33 +552,32 @@ this.validationRules = {
<big><pre>
{
maxDate: [maxDate](#user-content-#91)
maxMonth: [maxMonth](#user-content-#101)
maxNumber: [maxNumber](#user-content-#81)
maxTime: [maxTime](#user-content-#111)
maxWeek: [maxWeek](#user-content-#121)
minDate: [minDate](#user-content-#86)
minMonth: [minMonth](#user-content-#96)
minNumber: [minNumber](#user-content-#76)
minTime: [minTime](#user-content-#106)
minWeek: [minWeek](#user-content-#116)
month: [month](#user-content-#68)
number: [Validator](#user-content-#2)
range: [Validator](#user-content-#2)
time: [time](#user-content-#64)
url: [url](#user-content-#46)
week: [week](#user-content-#72)
color: color(value: any): boolean
date: date(value: any): boolean
email: email(value: string): boolean
maxLength: maxLength(value: string, maxLength: number): boolean
minLength: minLength(value: string, minLength: number): boolean
pattern: pattern(value: string, re: RegExp): boolean
required: required(value: any): boolean
maxDate: [maxDate](#user-content-#91)
maxMonth: [maxMonth](#user-content-#101)
maxNumber: [maxNumber](#user-content-#81)
maxTime: [maxTime](#user-content-#111)
maxWeek: [maxWeek](#user-content-#121)
minDate: [minDate](#user-content-#86)
minMonth: [minMonth](#user-content-#96)
minNumber: [minNumber](#user-content-#76)
minTime: [minTime](#user-content-#106)
minWeek: [minWeek](#user-content-#116)
month: [month](#user-content-#68)
number: [Validator](#user-content-#2)
range: [Validator](#user-content-#2)
time: [time](#user-content-#64)
url: [url](#user-content-#46)
week: [week](#user-content-#72)
color: color(value: any): boolean
date: date(value: any): boolean
email: email(value: string): boolean
maxLength: maxLength(value: string, maxLength: number): boolean
minLength: minLength(value: string, minLength: number): boolean
pattern: pattern(value: string, re: RegExp): boolean
required: required(value: any): boolean
}
</big></pre>
# officialValidators/minMonth <small>Module [src](./src/officialValidators/minMonth.ts#L1)</small> <a id="#94"></a>
## minMonth <small>Function [src](./src/officialValidators/minMonth.ts#L4)</small> <a id="#95"></a>
Expand All @@ -593,7 +587,6 @@ minMonth(value: string, min: string): boolean
</pre></big>
# officialValidators/minNumber <small>Module [src](./src/officialValidators/minNumber.ts#L1)</small> <a id="#74"></a>
## minNumber <small>Function [src](./src/officialValidators/minNumber.ts#L1)</small> <a id="#75"></a>
Expand All @@ -603,7 +596,6 @@ minNumber(value: number | string, min: number | string): boolean
</pre></big>
# officialValidators/maxMonth <small>Module [src](./src/officialValidators/maxMonth.ts#L1)</small> <a id="#99"></a>
## maxMonth <small>Function [src](./src/officialValidators/maxMonth.ts#L4)</small> <a id="#100"></a>
Expand All @@ -613,7 +605,6 @@ maxMonth(value: string, max: string): boolean
</pre></big>
# officialValidators/minWeek <small>Module [src](./src/officialValidators/minWeek.ts#L1)</small> <a id="#114"></a>
## minWeek <small>Function [src](./src/officialValidators/minWeek.ts#L4)</small> <a id="#115"></a>
Expand All @@ -623,7 +614,6 @@ minWeek(value: string, min: string): boolean
</pre></big>
# officialValidators/minDate <small>Module [src](./src/officialValidators/minDate.ts#L1)</small> <a id="#84"></a>
## minDate <small>Function [src](./src/officialValidators/minDate.ts#L1)</small> <a id="#85"></a>
Expand All @@ -633,7 +623,6 @@ minDate(value: string, min: string): boolean
</pre></big>
# officialValidators/time <small>Module [src](./src/officialValidators/time.ts#L1)</small> <a id="#62"></a>
## time <small>Function [src](./src/officialValidators/time.ts#L5)</small> <a id="#63"></a>
Expand All @@ -643,7 +632,6 @@ time(value: string): boolean
</pre></big>
# officialValidators/url <small>Module [src](./src/officialValidators/url.ts#L1)</small> <a id="#42"></a>
## url <small>Function [src](./src/officialValidators/url.ts#L11)</small> <a id="#45"></a>
Expand All @@ -653,7 +641,6 @@ url(value: string): boolean
</pre></big>
# officialValidators/week <small>Module [src](./src/officialValidators/week.ts#L1)</small> <a id="#70"></a>
## week <small>Function [src](./src/officialValidators/week.ts#L6)</small> <a id="#71"></a>
Expand All @@ -663,7 +650,6 @@ week(value: string): boolean
</pre></big>
# officialValidators/maxDate <small>Module [src](./src/officialValidators/maxDate.ts#L1)</small> <a id="#89"></a>
## maxDate <small>Function [src](./src/officialValidators/maxDate.ts#L1)</small> <a id="#90"></a>
Expand All @@ -673,7 +659,6 @@ maxDate(value: string, max: string): boolean
</pre></big>
# officialValidators/maxWeek <small>Module [src](./src/officialValidators/maxWeek.ts#L1)</small> <a id="#119"></a>
## maxWeek <small>Function [src](./src/officialValidators/maxWeek.ts#L4)</small> <a id="#120"></a>
Expand All @@ -683,7 +668,6 @@ maxWeek(value: string, max: string): boolean
</pre></big>
# officialValidators/maxNumber <small>Module [src](./src/officialValidators/maxNumber.ts#L1)</small> <a id="#79"></a>
## maxNumber <small>Function [src](./src/officialValidators/maxNumber.ts#L1)</small> <a id="#80"></a>
Expand All @@ -693,7 +677,6 @@ maxNumber(value: number | string, max: number | string): boolean
</pre></big>
# officialValidators/maxTime <small>Module [src](./src/officialValidators/maxTime.ts#L1)</small> <a id="#109"></a>
## maxTime <small>Function [src](./src/officialValidators/maxTime.ts#L3)</small> <a id="#110"></a>
Expand All @@ -703,7 +686,6 @@ maxTime(value: string, max: string): boolean
</pre></big>
# officialValidators/minTime <small>Module [src](./src/officialValidators/minTime.ts#L1)</small> <a id="#104"></a>
## minTime <small>Function [src](./src/officialValidators/minTime.ts#L3)</small> <a id="#105"></a>
Expand All @@ -713,7 +695,6 @@ minTime(value: string, min: string): boolean
</pre></big>
# officialValidators/month <small>Module [src](./src/officialValidators/month.ts#L1)</small> <a id="#66"></a>
## month <small>Function [src](./src/officialValidators/month.ts#L4)</small> <a id="#67"></a>
Expand All @@ -723,13 +704,12 @@ month(value: string): boolean
</pre></big>
# utils <small>Module [src](./src/utils.ts#L1)</small> <a id="#48"></a>
## parseMonth <small>Function [src](./src/utils.ts#L3)</small> <a id="#49"></a>
<big><pre>
parseMonth(value: string): undefined
parseMonth(value: string): Array\<number\>
</pre></big>
## parseTime <small>Function [src](./src/utils.ts#L49)</small> <a id="#59"></a>
Expand All @@ -745,7 +725,7 @@ parseTime(time: string): number
<big><pre>
parseWeek(value: string): undefined
parseWeek(value: string): Array\<number\>
</pre></big>
## weeksInYear <small>Function [src](./src/utils.ts#L36)</small> <a id="#55"></a>
Expand All @@ -755,4 +735,3 @@ parseWeek(value: string): undefined
<big><pre>
weeksInYear(year: number): number
</pre></big>
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ export default class GettingStarted extends Component {
);
}
}

```

## Validators
Expand Down
Loading

0 comments on commit 55f59fc

Please sign in to comment.