This repository has been archived by the owner on Aug 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
192 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { ErrorsStack } from '../types' | ||
import { ErrorsStack } from '../types/Errors' | ||
|
||
export class Errors { | ||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Field } from './Field' | ||
import { Form } from '../core/Form' | ||
|
||
/** | ||
* Passes function is a prop in Rule Object | ||
*/ | ||
export interface PassesFunction { | ||
(field: Field, form: Form): boolean | ||
} | ||
|
||
/** | ||
* Message function is a prop in the Rule Object | ||
*/ | ||
export interface MessageFunction { | ||
(field: Field, form: Form): string | ||
} | ||
|
||
/** | ||
* Errors Stack must be a field key with an array of strings | ||
*/ | ||
export interface ErrorsStack { | ||
[fieldKey: string]: string[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* Field object that passes the PassesFunction and MessageFunction, | ||
* it used in the Validator class. | ||
*/ | ||
export interface Field { | ||
key: string | ||
label: string | ||
value: any | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Options } from './Options' | ||
import { InterceptorManagersObject } from './Interceptors' | ||
import { Form } from '../core/Form' | ||
|
||
/** | ||
* The defaults of the form, | ||
* that can be changeable and then will affect on all the new Form instances | ||
*/ | ||
export interface FormDefaults { | ||
options: Options | ||
interceptors: InterceptorManagersObject | ||
} | ||
|
||
/** | ||
* Submit callback interface, | ||
* the function the should pass to submit method in Form class | ||
*/ | ||
export interface SubmitCallback { | ||
(form: Form): Promise<any> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { InterceptorManager } from '../core/InterceptorManager' | ||
import { Form } from '../core/Form' | ||
|
||
/** | ||
* an object that hold 2 function one for fulfill and one for reject | ||
*/ | ||
export interface InterceptorHandler { | ||
fulfilled: Function | ||
rejected: Function | ||
} | ||
|
||
/** | ||
* an object that hold only InterceptorManagers as value | ||
*/ | ||
export interface InterceptorManagersObject { | ||
beforeSubmission: InterceptorManager | ||
submissionComplete: InterceptorManager | ||
[key: string]: InterceptorManager | ||
} | ||
|
||
/** | ||
* The interface of an object with successful response from the | ||
* SubmitCallback function | ||
*/ | ||
export interface successfulResponse { | ||
form: Form | ||
response: any | ||
} | ||
|
||
/** | ||
* The interface of an object with unsuccessful response from the | ||
* SubmitCallback function | ||
*/ | ||
export interface InvalidResponse { | ||
form: Form | ||
error: any | ||
} |
Oops, something went wrong.