/** * @file filter * @author fex * * 不建议用,以后可能会删除。可以直接用组合出来,不需要新建一个组件。 */ import React from 'react'; import cx from 'classnames'; import {FormItem, FormControlProps, FormBaseControl} from './Item'; /** * Repeat * 文档:https://baidu.gitee.io/amis/docs/components/form/repeat */ export interface RepeatControlSchema extends FormBaseControl { type: 'input-repeat'; options?: string; } const LANG: { [propName: string]: string; } = { secondly: '秒', minutely: '分', hourly: '时', daily: '天', weekdays: '周中', weekly: '周', monthly: '月', yearly: '年' }; import Select from '../../components/Select'; import InputRange from '../../components/Range'; import {Option} from './Options'; export interface RepeatProps extends FormControlProps { options?: string; placeholder?: string; } export default class RepeatControl extends React.Component { static defaultProps = { // options: 'secondly,minutely,hourly,daily,weekdays,weekly,monthly,yearly' options: 'hourly,daily,weekly,monthly', placeholder: '不重复' }; constructor(props: RepeatProps) { super(props); this.handleOptionChange = this.handleOptionChange.bind(this); this.handleChange = this.handleChange.bind(this); } handleOptionChange(option: Option) { this.props.onChange(option.value); } handleChange(value: string) { const option = this.props.value; const parts = option ? option.split(':') : []; this.props.onChange(`${parts[0]}:${value}`); } renderInput() { const value = this.props.value; const parts = value ? value.split(':') : []; let { options, placeholder, disabled, classPrefix: ns, translate: __ } = this.props; let optionsArray: Array