UNPKG

@lspriv/wc-plugin-ics

Version:

小程序日历组件订阅插件

67 lines (66 loc) 2.21 kB
import type { Union } from '@lspriv/wx-calendar/lib'; import { ICalTime, type WeekDay } from './time'; export interface ICalRecurDict { freq?: FrequencyValue; count?: number; interval?: number; until?: ICalTime | string; wkst?: number | string; bysecond?: number; byminute?: number; byhour?: number; byday?: string; bymonthday?: number; byyearday?: number; byweekno?: number; bymonth?: number; bysetpos?: number; } type ICalRecurParts = { [K in keyof ICalRecurDict as Uppercase<K>]: ICalRecurDict[K] extends Array<any> ? [ICalRecurDict[K]] : ICalRecurDict[K]; }; /** * This class represents the "recur" value type, with various calculation * and manipulation methods. */ export declare class ICalRecur implements ICalRecurDict { /** An object holding the BY-parts of the recurrence rule */ parts: ICalRecurParts; /** The interval value for the recurrence rule. */ interval: number; /** The week start day */ wkst: WeekDay; /** The end of the recurrence */ until?: ICalTime; /** The maximum number of occurrences */ count?: number; /** The frequency value. */ freq?: FrequencyValue; /** The class identifier. */ icalclass: "icalrecur"; /** The type name, to be used in the jCal object. */ icaltype: "recur"; constructor(data?: ICalRecurDict); fromData(data: ICalRecurDict): void; /** * The jCal representation of this recurrence type. */ toJSON(): ICalRecurDict; } /** * Convert a numeric day value into its ical representation (SU, MO, etc..) */ export declare const numericDayToIcalDay: (num: number, weekstart?: WeekDay) => string; /** * Possible frequency values for the FREQ part * (YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY) */ declare const ALLOWED_FREQ: readonly ["SECONDLY", "MINUTELY", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "YEARLY"]; type FrequencyValue = Union<typeof ALLOWED_FREQ>; export declare const stringToData: (str: string, fmtIcal: boolean) => ICalRecurDict; /** * Creates a new instance using members from the passed * data object. */ export declare const fromData: (data: ICalRecurDict) => ICalRecur; export {};