-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
9cde91b
commit 4410d6c
Showing
18 changed files
with
902 additions
and
468 deletions.
There are no files selected for viewing
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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
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,65 @@ | ||
"use babel"; | ||
// @flow | ||
|
||
import { Validation } from "./ValidationHelpers"; | ||
|
||
export const VALUE_CHANGE_EVENT_TYPE = "VALUE_CHANGE"; | ||
export const INITIAL_CHANGE_EVENT_TYPE = "INITIAL_CHANGE"; | ||
export const SUBMIT_EVENT_TYPE = "SUBMIT"; | ||
export const VALIDATION_FAILED_EVENT_TYPE = "VALIDATION_FAILED"; | ||
|
||
export type ValueChangeEventType = { | ||
type: typeof VALUE_CHANGE_EVENT_TYPE, | ||
newValue: any, | ||
statePath: string, | ||
validation: Validation, | ||
}; | ||
|
||
export function createValueChangeEvent( | ||
newValue: any, | ||
statePath: string, | ||
validation: Validation, | ||
): ValueChangeEventType { | ||
return { | ||
type: VALUE_CHANGE_EVENT_TYPE, | ||
newValue, | ||
statePath, | ||
validation, | ||
}; | ||
} | ||
|
||
export type InitialChangeEventType = { | ||
type: typeof INITIAL_CHANGE_EVENT_TYPE, | ||
newValue: any, | ||
validation: Validation, | ||
}; | ||
|
||
export function createInitialChangeEvent(newInitial: any): InitialChangeEventType { | ||
return { | ||
type: INITIAL_CHANGE_EVENT_TYPE, | ||
newValue: newInitial, | ||
validation: new Validation(), | ||
}; | ||
} | ||
|
||
export type SubmitChangeEventType = { | ||
type: typeof SUBMIT_EVENT_TYPE, | ||
}; | ||
|
||
export function createSubmitChangeEvent(): SubmitChangeEventType { | ||
return { | ||
type: SUBMIT_EVENT_TYPE, | ||
}; | ||
} | ||
|
||
export type ValidationFailedEventType = { | ||
type: typeof VALIDATION_FAILED_EVENT_TYPE, | ||
validation: Validation, | ||
}; | ||
|
||
export function createValidationFailedEvent(validation: Validation): ValidationFailedEventType { | ||
return { | ||
type: VALIDATION_FAILED_EVENT_TYPE, | ||
validation: validation, | ||
}; | ||
} |
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
Oops, something went wrong.