Function
Static Public Summary | ||
public |
Sending request |
|
public |
convertData(data: object, type: string, FileListType: function, FormDataType: function): string | FormData Convert data object to a value for sending |
|
public |
convertNameToPath(name: string): Array Convert input name to path array |
|
public |
createObject(path: Array, value: string | FileList): object Create object by path and value |
|
public |
Merge literal object deeply and concat arrays |
|
public |
Check value is an email |
|
public |
Check file extensions |
|
public |
Check file sizes are less than max |
|
public |
Get data object with values from inputs object |
|
public |
getFormOptions(form: HTMLFormElement): {ajax: {url: string, method: string, enctype: string, sendType: *}} Get ajax options from form |
|
public |
getInputData(input: HTMLInputElement | Array): object Get input value as an object keyed by input name |
|
public |
getInputName(input: HTMLInputElement | Array): string Get name from input or array of inputs |
|
public |
getInputRules(input: HTMLInputElement | HTMLSelectElement): object Get validatation options from input attribute of className |
|
public |
getInputValue(input: Element | HTMLInputElement | HTMLSelectElement | Array): string | Date | FileList | Array Get form input value |
|
public |
Create query portion of url for serialize method |
|
public |
getRadioGroupValue(inputs: Array): string | Array<string> Get value from radio group |
|
public |
getValueByName(name: string, data: object): * Get value from data object by name |
|
public |
getValueByPath(path: Array, data: object): string Get value from data object by path |
|
public |
isCheckable(params: *, data: object): * Check rule for dependencies |
|
public |
Check value is less than max number |
|
public |
Check date is less than max date |
|
public |
Check value is greater than min number |
|
public |
Check value is greater than min date |
|
public |
Test RegExp |
|
public |
Check value is not empty |
|
public |
Check value is multiple of number |
|
public |
Check value is phone number |
|
public |
Check value is url |
|
public |
validateData(rules: object, methods: object, data: object, errorMessages: object, translate: function): object<string, Array<string>> Validate data object |
|
public |
validateField(rules: object, methods: object, value: string | FileList | Array, name: string, errorMessages: object, data: object, translate: function): Array<string> Validate field |
Static Private Summary | ||
private |
initErrorMessages(rules: object, messages: object, methods: object): Object<string, Object<string, string>> Init error messages |
|
private |
Mark field as invalid |
|
private |
markField(field: Element, message: *, states: *, errors: *) Mark field |
|
private |
Mark field as valid |
Static Public
public ajax(options: Object, translate: function, RequestType: function): Promise source
import {ajax} from 'jedi-validate/src/lib/ajax.js'
Sending request
public convertData(data: object, type: string, FileListType: function, FormDataType: function): string | FormData source
import {convertData} from 'jedi-validate/src/lib/convert-data.js'
Convert data object to a value for sending
public convertNameToPath(name: string): Array source
import {convertNameToPath} from 'jedi-validate/src/lib/convert-data.js'
Convert input name to path array
Params:
Name | Type | Attribute | Description |
name | string | input name |
public createObject(path: Array, value: string | FileList): object source
import {createObject} from 'jedi-validate/src/lib/get-data.js'
Create object by path and value
public deepmerge(first: Object | Array | *, second: Object | Array | *): Object | Array | * source
import deepmerge from 'jedi-validate/src/lib/deepmerge.js'
Merge literal object deeply and concat arrays
public email(value: string): boolean source
import {email} from 'jedi-validate/src/lib/methods.js'
Check value is an email
Params:
Name | Type | Attribute | Description |
value | string |
public extension(value: FileList, extensions: string): boolean source
import {extension} from 'jedi-validate/src/lib/methods.js'
Check file extensions
Params:
Name | Type | Attribute | Description |
value | FileList | FileList |
|
extensions | string | extensions list |
public filesize(value: FileList, size: number): boolean source
import {filesize} from 'jedi-validate/src/lib/methods.js'
Check file sizes are less than max
Params:
Name | Type | Attribute | Description |
value | FileList | FileList |
|
size | number | max file size |
public getData(inputs: object): object source
import {getData} from 'jedi-validate/src/lib/get-data.js'
Get data object with values from inputs object
Params:
Name | Type | Attribute | Description |
inputs | object | inputs object |
public getFormOptions(form: HTMLFormElement): {ajax: {url: string, method: string, enctype: string, sendType: *}} source
import {getFormOptions} from 'jedi-validate/src/lib/get-options.js'
Get ajax options from form
Params:
Name | Type | Attribute | Description |
form | HTMLFormElement | form element |
public getInputData(input: HTMLInputElement | Array): object source
import {getInputData} from 'jedi-validate/src/lib/get-data.js'
Get input value as an object keyed by input name
Params:
Name | Type | Attribute | Description |
input | HTMLInputElement | Array | input element or Array of HTMLInputElements |
public getInputName(input: HTMLInputElement | Array): string source
import {getInputName} from 'jedi-validate/src/lib/get-data.js'
Get name from input or array of inputs
Params:
Name | Type | Attribute | Description |
input | HTMLInputElement | Array | input element or Array of HTMLInputElements |
public getInputRules(input: HTMLInputElement | HTMLSelectElement): object source
import {getInputRules} from 'jedi-validate/src/lib/get-options.js'
Get validatation options from input attribute of className
Params:
Name | Type | Attribute | Description |
input | HTMLInputElement | HTMLSelectElement | input for validation |
public getInputValue(input: Element | HTMLInputElement | HTMLSelectElement | Array): string | Date | FileList | Array source
import {getInputValue} from 'jedi-validate/src/lib/get-data.js'
Get form input value
Params:
Name | Type | Attribute | Description |
input | Element | HTMLInputElement | HTMLSelectElement | Array | input |
public getQueryPart(name: string, data: object | Array | string): string source
import {getQueryPart} from 'jedi-validate/src/lib/convert-data.js'
Create query portion of url for serialize method
public getRadioGroupValue(inputs: Array): string | Array<string> source
import {getRadioGroupValue} from 'jedi-validate/src/lib/get-data.js'
Get value from radio group
Params:
Name | Type | Attribute | Description |
inputs | Array | array of radio inputs |
public getValueByName(name: string, data: object): * source
import {getValueByName} from 'jedi-validate/src/lib/get-data.js'
Get value from data object by name
Return:
* |
public getValueByPath(path: Array, data: object): string source
import {getValueByPath} from 'jedi-validate/src/lib/get-data.js'
Get value from data object by path
public isCheckable(params: *, data: object): * source
import {isCheckable} from 'jedi-validate/src/lib/validate-data.js'
Check rule for dependencies
Params:
Name | Type | Attribute | Description |
params | * | validation params |
|
data | object | form data |
Return:
* | validation params or null if rule is not checkable |
public max(value: number, number: number): boolean source
import {max} from 'jedi-validate/src/lib/methods.js'
Check value is less than max number
public maxDate(date: Date, maxdate: Date): boolean source
import {maxDate} from 'jedi-validate/src/lib/methods.js'
Check date is less than max date
public min(value: number, number: number): boolean source
import {min} from 'jedi-validate/src/lib/methods.js'
Check value is greater than min number
public minDate(date: Date, mindate: Date): boolean source
import {minDate} from 'jedi-validate/src/lib/methods.js'
Check value is greater than min date
public regexp(value: string, exp: RegExp): boolean source
import {regexp} from 'jedi-validate/src/lib/methods.js'
Test RegExp
public required(value: string | FileList | Array): boolean source
import {required} from 'jedi-validate/src/lib/methods.js'
Check value is not empty
public step(value: number, number: number): boolean source
import {step} from 'jedi-validate/src/lib/methods.js'
Check value is multiple of number
public tel(value: string): boolean source
import {tel} from 'jedi-validate/src/lib/methods.js'
Check value is phone number
Params:
Name | Type | Attribute | Description |
value | string | phone number |
public url(value: string): boolean source
import {url} from 'jedi-validate/src/lib/methods.js'
Check value is url
Params:
Name | Type | Attribute | Description |
value | string | url |
public validateData(rules: object, methods: object, data: object, errorMessages: object, translate: function): object<string, Array<string>> source
import {validateData} from 'jedi-validate/src/lib/validate-data.js'
Validate data object
public validateField(rules: object, methods: object, value: string | FileList | Array, name: string, errorMessages: object, data: object, translate: function): Array<string> source
import {validateField} from 'jedi-validate/src/lib/validate-data.js'
Validate field
Static Private
private initErrorMessages(rules: object, messages: object, methods: object): Object<string, Object<string, string>> source
import {initErrorMessages} from 'jedi-validate/src/lib/utils.js'
Init error messages
private markError(field: Element, message: Element, classes: object, errors: Array<string>) source
import {markError} from 'jedi-validate/src/lib/utils.js'
Mark field as invalid
private markField(field: Element, message: *, states: *, errors: *) source
import {markField} from 'jedi-validate/src/lib/utils.js'
Mark field
Params:
Name | Type | Attribute | Description |
field | Element | ||
message | * | ||
states | * | ||
errors | * |