Skip to content

Commit

Permalink
fix: introduced SubmitOptions and SubmitHooks models
Browse files Browse the repository at this point in the history
  • Loading branch information
foxhound87 committed Jan 17, 2024
1 parent e593c96 commit e9b6ada
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 6.9.3 (master)
- introduced `SubmitOptions` and `SubmitHooks` models.

# 6.9.2 (master)
- deprecated `checkSVKValidationPlugin`

Expand Down
3 changes: 2 additions & 1 deletion src/Base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
import { AllowedFieldPropsTypes, FieldPropsEnum, SeparatedPropsMode } from "./models/FieldProps";
import { OptionsEnum } from "./models/OptionsModel";
import { ValidateOptions, ValidationHooks } from "./models/ValidatorInterface";
import { SubmitHooks } from "./models/SharedActionsInterface";
export default class Base implements BaseInterface {
noop = () => {};

Expand Down Expand Up @@ -334,7 +335,7 @@ export default class Base implements BaseInterface {
/**
Submit
*/
submit(hooks: any = {}, {
submit(hooks: SubmitHooks = {}, {
execOnSubmitHook = true,
execValidationHooks = true,
validate = true
Expand Down
18 changes: 16 additions & 2 deletions src/models/SharedActionsInterface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
import { ValidateOptions } from "./ValidatorInterface";

export interface SubmitOptions {
execOnSubmitHook: boolean,
execValidationHooks: boolean,
validate: boolean
};

export interface SubmitHooks {
onSubmit?(instance): void
onSuccess?(instance): void
onError?(instance): void
}

export interface SharedActionsInterface {
validate(opt?: any, obj?: any): Promise<any>;
submit(hooks: any, opt: { execOnSubmitHook: boolean, execValidationHooks: boolean, validate: boolean }): Promise<any>;
validate(opt?: ValidateOptions, obj?: ValidateOptions): Promise<any>;
submit(hooks: SubmitHooks, opt: SubmitOptions): Promise<any>;
check(prop: string, deep?: boolean): boolean;
deepCheck(type: string, prop: string, fields: any): any;
update(fields: any): void;
Expand Down
2 changes: 1 addition & 1 deletion src/models/ValidatorInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export type ExtendPlugin = ({ validator, form }: {
}) => void;

export interface ValidationPluginConfig {
package?: ValidationPackage;
package: ValidationPackage;
schema?: any;
options?: any;
extend?: ExtendPlugin;
Expand Down

0 comments on commit e9b6ada

Please sign in to comment.