Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

skava / @skava/ui   js

Repository URL to install this package:

Version: 2.8.8 

/ src / forms / form / typings.ts

import { Serializable } from '@skava/typings'
import { InputType } from '../input/typings.inputs'
import { InputStateType } from '../input/typings'

export interface InputStateOptions {
  // @todo !!!
}
export interface InputStateFromArgs {
  inputsList: Array<InputStateOptions>
}

/**
 * === typescript types
 */
export interface KeyValueSpreadType {
  key: string
  value: any
}
export interface GetInputValueType extends Function {
  (input: InputType, index?: number): Serializable
}

// @todo should remove
export type ClassNameArg = string | Serializable | Array<string>
export interface ObserverFormClassListType {
  input: ClassNameArg
  form: ClassNameArg
  submitButton: ClassNameArg
  cancelButton: ClassNameArg
  buttonGroup: ClassNameArg
}
export interface ObserverFormClassPropertyTypes {
  /**
   * added this
   */
  CancelCustomClass: string
  SubmitCustomClass: string
  ButtonGroupCustomClass: string
  formClassName: string
  formClassList: string
  classList: any
  cachedClassList: ObserverFormClassListType
}

export interface FormStateType {
  name: string
  hasAllValidInputs: boolean
  inputsList: Array<InputStateType>
  form: HTMLFormElement
}

export interface ObserverFormType {
  state: FormStateType
  classList?: ObserverFormClassListType
  wording?: Object
  Wrap: React.ClassicComponentClass
  Input: React.ClassicComponentClass

  onPrefil(inputState: InputStateType): InputStateType

  /**
   * @private
   */
  _onPrefil(inputState: InputStateType): InputStateType

  // renderItem
  renderInput(inputState: InputStateType): HTMLInputElement

  // this.inputsList.map(this.renderInput)
  renderInputList(): Array<HTMLInputElement>

  /**
   * @see FormState.hasAllValidInputs
   */
  validateForm(): boolean
}

export interface ObserverFormProps {
  state: FormStateType

  onHandleCancel?: Function
  cancelState?: any
}

// export { ObserverFormType as ObserverFormProps }