DocSpace-client/packages/shared/components/cron
2024-01-25 20:05:49 +05:00
..
sub-components Shared:Components:Cron Fixed getting the first day of the week in FF 2024-01-25 20:00:30 +05:00
Cron.constants.ts Shared:Components:Cron: Refactoring and Optimization 2023-12-20 18:36:18 +05:00
Cron.part.ts Shared:Components:Cron Fixed timezone 2024-01-25 20:05:49 +05:00
Cron.stories.tsx Shared:Components:Cron Fixed getting the first day of the week in FF 2024-01-25 20:00:30 +05:00
Cron.styled.ts Shared:Components:Cron Fixed styles and removing some prefixes 2024-01-24 18:39:37 +05:00
Cron.test.tsx Shared:Tests:Unit: add i18 mock, fix warnings 2023-12-29 16:06:40 +03:00
Cron.tsx Shared:Components:Cron Refusal of transfers in favor of luxon 2024-01-25 19:42:22 +05:00
Cron.types.ts Shared:Components:Cron Refactoring types 2024-01-24 18:37:31 +05:00
Cron.utils.ts Shared:Components:Cron Refusal of transfers in favor of luxon 2024-01-25 19:42:22 +05:00
index.ts Shared:Components:Cron: Refactoring and Optimization 2023-12-20 18:36:18 +05:00
README.md Shared:Components:Cron Added README 2023-12-21 16:12:45 +05:00

Cron

The Cron component provides an interface for working with cron expressions.

Properties

Property Type Required Default Description
value string No "* * * * *" Current cron expression value.
setValue (value: string) => void Yes - Function to set a new cron expression value, similar to onChange.
onError (error?: Error) => void No - Callback function triggered when an error is detected with the value.

Property value

  • Type: string
  • Description: The current cron expression value. If not specified, the component will display the default value.

Property setValue

  • Type: (value: string) => void
  • Description: Function to set a new cron expression value. Called when the component's value changes, similar to the onChange event.

Property onError

  • Type: (error?: Error) => void
  • Description: Callback function triggered when an error is detected with the cron expression value. If specified, the component will pass error information to this function.

Usage Example

import React from "react";
import Cron from "@docspace/shared/components";

const Component = () => {
  const handleCronChange = (newCronValue) => {
    console.log("New cron value:", newCronValue);
  };

  const handleCronError = (error) => {
    console.error("Cron error:", error);
  };

  return (
    <Cron
      value="*5 * * * *"
      setValue={handleCronChange}
      onError={handleCronError}
    />
  );
};

export default Component;