components.widgets.Form.fieldsets.TitleFieldset.TitleFieldset.jsx Maven / Gradle / Ivy
The newest version!
import React, { useContext } from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
import HelpPopover from '../../fields/StandardField/HelpPopover'
import { withFieldsetHeader } from '../withFieldsetHeader'
import DefaultFieldset from '../DefaultFieldset'
import { FactoryContext } from '../../../../../core/factory/context'
import { FactoryLevels } from '../../../../../core/factory/factoryLevels'
import Label from '../../fields/StandardField/Label'
function TitleFieldset({
render,
rows,
label,
showLine,
className,
subTitle,
help,
disabled,
badge,
description,
type,
}) {
const { getComponent } = useContext(FactoryContext)
const FactoryBadge = getComponent('Badge', FactoryLevels.SNIPPETS)
return (
{FactoryBadge && (
{label && {label}}
)}
{subTitle && {subTitle}}
{showLine && }
{render(rows)}
)
}
TitleFieldset.propTypes = {
/**
* Функция рендера
*/
render: PropTypes.func,
/**
* Масив строк для реднра
*/
rows: PropTypes.array,
/**
* Заголовок
*/
label: PropTypes.string,
/**
* Флаг включения линии рядом с заголовком
*/
showLine: PropTypes.bool,
/**
* Класс
*/
className: PropTypes.string,
/**
* Текст подзаголовка
*/
subTitle: PropTypes.string,
/**
* Подсказка около title
*/
help: PropTypes.string,
disabled: PropTypes.bool,
badge: PropTypes.object,
}
TitleFieldset.defaultProps = {
showLine: true,
disabled: false,
}
export default withFieldsetHeader(TitleFieldset)