npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-cron-ui

v1.1.0

Published

react-cron-ui 是一个用于方便输入和编辑 cron 表达式的 React 组件。它提供了直观的用户界面,使用户能够轻松创建和修改 cron 表达式。

Downloads

28

Readme

react-cron-ui

react-cron-ui 是一个用于方便输入和编辑 cron 表达式的 React 组件。它提供了直观的用户界面,使用户能够轻松创建和修改 cron 表达式。

react-cron-ui 预览

特性

  • 简单易用的 cron 表达式输入界面
  • 支持自定义人类可读的 cron 表达式解析
  • 可选显示最近 5 次执行时间
  • 兼容 React 16+ 和 Ant Design 4
  • 支持周的开始索引 sunStartIndex,周可以从 1 开始也可以从 0 开始

安装

npm install react-cron-ui

使用方法

import React, { useState } from "react";
import { Cron } from "react-cron-ui";
import "react-cron-ui/dist/esm/index.css";

function App() {
  const [express, setExpress] = useState("* * * * * *");

  return (
    <Cron
      value={express}
      onChange={(value) => {
        setExpress(value);
      }}
    ></Cron>
  );
}

export default App;

API

Cron 组件属性 (CronProps)

| 属性 | 类型 | 默认值 | 描述 | | :-----------------: | :-----------------------------: | :----------------: | :-------------------------------------------------------------------------------------------------------------------------------------: | | showResult | boolean | true | 是否显示最近 5 次执行时间的按钮,需要注意的是,这里的结果只在 SunStartIndex.Zero 下有效,因此 SunStartIndex.One 的情况下需要关闭这个功能 | | humanReadableParser | (cronExpress: string) => string | - | 自定义 cron 表达式的人类可读解析函数 | | defaultValue | string | - | 默认的 cron 表达式值 | | value | string | - | 当前的 cron 表达式值(受控模式) | | onChange | (value: string) => void | - | cron 表达式变化时的回调函数 | | sunStartIndex | SunStartIndex | SunStartIndex.Zero | 设置周的开始索引,SunStartIndex 可从组件导出,默认周从 0 开始,也就是 SunStartIndex.Zero |

其他导出

  • validCronExpress: 使用 cron-parser 对 cron 表达式进行校验的函数
  • CronProps: Cron 组件属性的 TypeScript 接口

兼容性

  • React 16+
  • Ant Design 4

许可证

MIT License

贡献

欢迎提交 issues 和 pull requests 来帮助改进这个项目。