日本語
@eightkk/vue-weave / core / applyRecurringEdit
Function: applyRecurringEdit()
applyRecurringEdit<
E>(events,target,change,scope,options?):E[]
Defined in: src/core/recurrence.ts:987
Apply an edit of one occurrence of a recurring event to the events of a calendar and return the new events (the input is not modified). target names the occurrence (seriesId, recurrenceId, as in EventCalendarEdit.occurrence), change is its new start, end and optionally resourceId, or 'delete'.
occurrence: a change adds an override event (id<seriesId>:<recurrenceId>, the series' fields withoutrecurrence) or updates the existing one; a delete adds the start to the series'exdatesand removes the override.following: the series ends before the occurrence (UNTIL one millisecond before it, or a smaller COUNT) and, for a change, a new series (options.newSeriesId, default<seriesId>:<recurrenceId>) starts at the changed occurrence with the rest of the instances (the remaining COUNT), exdates, rdates and overrides. When the occurrence is an RDATE rather than a rule instance, the new series starts at the next rule instance (moved like the occurrence) and the changed occurrence becomes one of its RDATEs, so the rule keeps its pattern; after the last rule instance the new series has no rule. For the first occurrence it is the same asseries.series: the whole series moves by the change of the occurrence in local wall-clock time and takes its new duration; exdates, rdates, UNTIL and therecurrenceIds of overrides move with it. A delete removes the series and its overrides.
An override that series or following moves to another recurrenceId (or to the new series) and has the ID that occurrence gives it (<seriesId>:<recurrenceId>) takes the ID of its new occurrence, so it never shares an ID with an occurrence of the series; an override with another ID keeps it. When another event already has that new ID (or another moved override takes it too), the override keeps its old ID instead; when an event or an occurrence the edited series generates has the old ID as well, the edit throws, so neither the result nor its expansion has duplicate IDs.
When the change moves the occurrence to another local day, BYDAY weekdays and BYMONTHDAY days move by the same number of days; the other parts of the rule are kept. A move to another day throws an Error when it would change what the rule means: with BYDAY ordinals (such as 2MO), BYSETPOS, BYMONTHDAY days outside 1–28 (or −28 to −1) before or after the move, or BYMONTH when the occurrence moves to another month. Change the rule itself in those cases; a move within the same day always works. An override of the edited occurrence is dropped by following and series, since the change replaces it (so its ID, the default newSeriesId, is free again). The series zone is resolved as in expandRecurrence. A rule given as text is returned as text.
Throws an Error for an unknown series, an unknown scope, an ID that is already used and, with following, a recurrenceId that is neither a rule instance nor an RDATE of the series; a RangeError for invalid times.
Type Parameters
E
E extends CalendarEvent<unknown>
Parameters
events
readonly E[]
target
change
RecurringEditChange | "delete"
scope
options?
RecurringEditOptions = {}
Returns
E[]