antd-cron-editor-asp

1.1.0 • Public • Published

cron-editor

image-20190107170123819

usage

  • npm install antd-cron-editor
  • quick start
import React from 'react';
import CronEditor from 'antd-cron-editor';
 
const Test = () => {
  const handleChange = (cronText) => {
    console.log(cronText);
  };
 
  return <CronEditor onChange={handleChange} />;
};
 
export default Test;
 
  • with input area
import React from 'react';
import { Input } from 'asp-antd-compatible';
import CronEditor from 'antd-cron-editor';
 
class Test extends React.Component {
  state = {
    value: '0-2 32,2 * * * ?',
    inputText: '0-2 32,2 * * * ?',
  };
 
  handleChange = (cronText) => {
    console.log(cronText);
    this.setState({ value: cronText, inputText: cronText });
  };
 
  handleInputChange = ({ target: { value: inputText } }) => {
    this.setState({ inputText });
  };
 
  handlePressEnter = ({ target: { value: inputText } }) => {
    this.setState({ value: inputText, inputText });
  };
 
  render() {
 
    const { value, inputText } = this.state;
 
    return (
      <div>
        <Input onChange={this.handleInputChange} onPressEnter={this.handlePressEnter} value={inputText} />
        <CronEditor onChange={this.handleChange} span={2} value={value} />
      </div>
    );
  };
}
 
export default Test;

Package Sidebar

Install

npm i antd-cron-editor-asp

Weekly Downloads

11

Version

1.1.0

License

MIT

Unpacked Size

3.12 MB

Total Files

24

Last publish

Collaborators

  • kotomi