@vue-js-cron/core
Version:
A renderless Vue.js cron editor.
81 lines • 2.31 kB
TypeScript
import type { CronContext } from './components/cron-core';
import type { UseCronSegmentReturn } from './components/cron-segment';
export type CronFormat = 'crontab' | 'quartz' | 'spring';
export interface CronSegment {
field: FieldWrapper;
type: FieldPattern;
toCron: () => string;
toArray: () => number[];
items: Record<string, FieldItem>;
}
export type SegmentFromArray = (arr: number[], field: FieldWrapper) => CronSegment | null;
export type SegmentFromString = (str: string, field: FieldWrapper) => CronSegment | null;
export declare enum FieldPattern {
Any = "any",
Value = "value",
Range = "range",
Step = "step",
StepFrom = "stepFrom",
RangeStep = "rangeStep",
Combined = "combined",
NoSpecific = "noSpecific"
}
export declare enum TextPosition {
Prefix = "prefix",
Suffix = "suffix",
Text = "text"
}
export interface FieldItem {
value: number;
text: string;
alt: string;
}
export interface Field {
id: string;
items: FieldItem[];
onChange?: (segment: UseCronSegmentReturn, ctx: CronContext) => void;
segmentFactories?: SegmentFromString[];
default?: string;
}
export interface Period {
/**
* The id of the period
*/
id: string;
/**
* The value determines which fields are visible
*/
value: string[];
/**
* The display name of the period
*/
text?: string;
}
interface FieldContext {
format: CronFormat;
}
export declare class FieldWrapper {
field: Field;
itemMap: Record<number, FieldItem>;
ctx: FieldContext;
constructor(field: Field, ctx: FieldContext);
get id(): string;
get items(): FieldItem[];
get onChange(): ((segment: {
id: string;
items: FieldItem[];
cron: import("vue").Ref<string>;
selected: import("vue").Ref<number[]>;
error: import("vue").Ref<string>;
select: (evt: number[]) => void;
text: import("vue").Ref<string>;
prefix: import("vue").Ref<string>;
suffix: import("vue").Ref<string>;
}, ctx: CronContext) => void) | undefined;
get segmentFactories(): SegmentFromString[] | undefined;
get min(): number;
get max(): number;
getItem(value: number): FieldItem;
}
export {};
//# sourceMappingURL=types.d.ts.map