1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/open-hand-choerodon-ui

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
IntlList.tsx 1.8 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
HughHzWu Отправлено 3 лет назад 988fec5
import React, { Component } from 'react';
import { observer } from 'mobx-react';
import { Config, ConfigKeys, DefaultConfig } from 'choerodon-ui/lib/configure';
import ObserverTextField from '../text-field/TextField';
import TextArea from '../text-area/TextArea';
import { ResizeType } from '../text-area/enum';
import { IntlType } from './enum';
import Form from '../form/Form';
import localeContext from '../locale-context';
import Record from '../data-set/Record';
import { Lang } from '../locale-context/enum';
export interface IntlListProps {
record?: Record;
name?: string;
lang: Lang;
maxLengths?: object;
disabled?: boolean;
readOnly?: boolean;
type?: IntlType;
rows?: number;
cols?: number;
resize?: ResizeType;
getConfig<T extends ConfigKeys>(key: T): T extends keyof DefaultConfig ? DefaultConfig[T] : Config[T];
}
@observer
export default class IntlList extends Component<IntlListProps> {
renderOptions() {
const { name, lang, maxLengths, type, rows, cols, resize, getConfig } = this.props;
const { supports } = localeContext;
const tlsKey = getConfig('tlsKey');
const FieldTag = type === IntlType.multipleLine ? TextArea : ObserverTextField;
const otherProps = type === IntlType.multipleLine ? { rows, cols, resize } : {};
return Object.keys(supports).map(key => {
const maxLengthProps = maxLengths && maxLengths[key] ? { maxLength: maxLengths[key] } : {};
return (
<FieldTag
{...maxLengthProps}
name={name ? `${tlsKey}.${name}.${key}` : key}
autoFocus={key === lang}
key={key}
{...otherProps}
/>
);
});
}
render() {
const { record, disabled, readOnly } = this.props;
return <Form disabled={disabled} readOnly={readOnly} record={record}>{this.renderOptions()}</Form>;
}
}

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/open-hand-choerodon-ui.git
git@gitlife.ru:oschina-mirror/open-hand-choerodon-ui.git
oschina-mirror
open-hand-choerodon-ui
open-hand-choerodon-ui
master