All Downloads are FREE. Search and download functionalities are using the official Maven repository.

components.widgets.Form.fields.StandardField.Control.tsx Maven / Gradle / Ivy

There is a newer version: 7.28.2
Show newest version
import React, { ComponentType } from 'react'
import classNames from 'classnames'

import { Factory } from '../../../../../core/factory/Factory'
import { CONTROLS } from '../../../../../core/factory/factoryLevels'

export type RangeValue = { begin: string | number | null, end: string | number | null }

export interface ControlCommonProps {
    component: string | ComponentType<{ className?: string }>
    className?: string
}

export interface Props extends ControlCommonProps {
    value?: string | number | null
    model: Record
    onChange?(event: React.ChangeEvent | RangeValue): void
    onFocus?(event: React.FocusEvent | RangeValue): void
    onBlur?(event: React.FocusEvent | RangeValue | number | string): void
    help?: string
    enabled?: boolean
    disabled?: boolean
    visible?: boolean
    autoFocus?: boolean
    placeholder?: string
}

/**
 * Контрол поля формы
 * @example
 * 
 */
export const Control = ({ component, className, ...props }: Props) => {
    if (typeof component !== 'string') {
        return React.createElement(component, { ...props, className })
    }

    return 
}

export default Control




© 2015 - 2025 Weber Informatics LLC | Privacy Policy