dhtmlx-scheduler 7.2.0 → 7.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@
3
3
  })(this, function(exports2) {
4
4
  "use strict";/** @license
5
5
 
6
- dhtmlxScheduler v.7.2.0 Standard
6
+ dhtmlxScheduler v.7.2.1 Standard
7
7
 
8
8
  To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product), please obtain Commercial/Enterprise or Ultimate license on our site https://dhtmlx.com/docs/products/dhtmlxScheduler/#licensing or contact us at sales@dhtmlx.com
9
9
 
@@ -9124,7 +9124,7 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
9124
9124
  }
9125
9125
  }
9126
9126
  function factoryMethod(extensionManager) {
9127
- const scheduler2 = { version: "7.2.0" };
9127
+ const scheduler2 = { version: "7.2.1" };
9128
9128
  scheduler2.$stateProvider = StateService();
9129
9129
  scheduler2.getState = scheduler2.$stateProvider.getState;
9130
9130
  extend$n(scheduler2);
@@ -15400,22 +15400,7 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
15400
15400
  scheduler2.form_blocks.recurring.set_value = originalRecurringSetValue;
15401
15401
  }
15402
15402
  }
15403
- var sns = this.config.lightbox.sections;
15404
15403
  if (this.config.readonly_active) {
15405
- for (var i = 0; i < sns.length; i++) {
15406
- if (sns[i].type == "recurring") {
15407
- if (this.config.readonly_active && scheduler2.form_blocks.recurring) {
15408
- scheduler2.form_blocks.recurring.set_value = function(node, value, ev) {
15409
- var wrapper = scheduler2.$domHelpers.closest(node, ".dhx_wrap_section");
15410
- var style = "none";
15411
- wrapper.querySelector(".dhx_cal_lsection").display = style;
15412
- wrapper.querySelector(".dhx_form_repeat").display = style;
15413
- wrapper.style.display = style;
15414
- scheduler2.setLightboxSize();
15415
- };
15416
- }
15417
- }
15418
- }
15419
15404
  var forbidden_buttons = ["dhx_delete_btn", "dhx_save_btn"];
15420
15405
  var button_arrays = [scheduler2.config.buttons_left, scheduler2.config.buttons_right];
15421
15406
  for (var i = 0; i < forbidden_buttons.length; i++) {
@@ -18100,7 +18085,16 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18100
18085
  scheduler2.addEvent(nev);
18101
18086
  scheduler2._not_render = false;
18102
18087
  }
18088
+ function toUTCDate(date) {
18089
+ return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()));
18090
+ }
18091
+ function setUTCPartsToDate(d) {
18092
+ return new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds());
18093
+ }
18103
18094
  function updateFollowingEventsRRULE(ev) {
18095
+ if (ev.rrule.includes(";UNTIL=")) {
18096
+ ev.rrule = ev.rrule.split(";UNTIL=")[0];
18097
+ }
18104
18098
  let parsedRRule = rrulestr(`RRULE:${ev.rrule};UNTIL=${toIcalString(ev._end_date || ev.end_date)}`, { dtstart: ev.start_date });
18105
18099
  let newRRULE = new RRule(parsedRRule.origOptions).toString().replace("RRULE:", "");
18106
18100
  newRRULE = newRRULE.split("\n")[1];
@@ -18131,6 +18125,20 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18131
18125
  let ev = scheduler2.getEvent(id2);
18132
18126
  return !!(ev && ev._thisAndFollowing);
18133
18127
  };
18128
+ scheduler2._isFirstOccurrence = function(ev) {
18129
+ if (scheduler2._is_virtual_event(ev.id)) {
18130
+ let pid = ev.id.split("#")[0];
18131
+ let recEvent = scheduler2.getEvent(pid);
18132
+ return !!(recEvent.start_date.valueOf() === ev.start_date.valueOf());
18133
+ }
18134
+ };
18135
+ scheduler2._isExceptionFirstOccurrence = function(ev) {
18136
+ if (scheduler2._is_modified_occurrence(ev)) {
18137
+ let pid = ev.recurring_event_id;
18138
+ let recEvent = scheduler2.getEvent(pid);
18139
+ return !!(ev.original_start.valueOf() && ev.original_start.valueOf() === recEvent.start_date.valueOf());
18140
+ }
18141
+ };
18134
18142
  scheduler2._rec_temp = [];
18135
18143
  scheduler2._rec_markers_pull = {};
18136
18144
  scheduler2._rec_markers = {};
@@ -18210,19 +18218,51 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18210
18218
  }
18211
18219
  delete this._ignore_call;
18212
18220
  });
18213
- function moveToFollowingEvents(copy, newEv) {
18214
- copy.recurring_event_id = newEv.id;
18215
- copy.text = newEv.text;
18216
- scheduler2._not_render = true;
18217
- scheduler2._add_rec_marker(copy, copy._pid_time);
18218
- scheduler2.addEvent(copy);
18219
- scheduler2._not_render = false;
18221
+ function setPropsForFirstOccurrence(ev, occurrence) {
18222
+ ev._end_date = ev.end_date;
18223
+ if (scheduler2._isExceptionFirstOccurrence(occurrence)) {
18224
+ ev.start_date = occurrence.start_date;
18225
+ ev.end_date = new Date(occurrence.start_date.valueOf() + ev.duration * 1e3);
18226
+ ev._start_date = occurrence.original_start;
18227
+ ev._modified = true;
18228
+ } else {
18229
+ ev.end_date = new Date(occurrence.start_date.valueOf() + ev.duration * 1e3);
18230
+ ev.start_date = occurrence.start_date;
18231
+ ev._firstOccurrence = true;
18232
+ }
18233
+ ev._thisAndFollowing = occurrence.id;
18234
+ }
18235
+ function setPropsForStorageEvent(index, data, ev, tempEvent) {
18236
+ const targetIndex = ev._modified ? tempEvent.id : index;
18237
+ scheduler2._events[targetIndex] = { ...tempEvent, text: data.text, duration: data.duration, start_date: data.start_date, rrule: data.rrule, end_date: tempEvent._end_date, _start_date: tempEvent.start_date, _thisAndFollowing: null, _end_date: null };
18238
+ if (ev._modified) {
18239
+ delete scheduler2._events[index];
18240
+ }
18241
+ scheduler2.callEvent("onEventChanged", [scheduler2._events[targetIndex].id, scheduler2._events[targetIndex]]);
18242
+ }
18243
+ function deleteExceptionFromStorage(exception) {
18244
+ for (const i in scheduler2._events) {
18245
+ let tev = scheduler2._events[i];
18246
+ if (tev.id == exception.id) {
18247
+ delete scheduler2._events[i];
18248
+ }
18249
+ }
18250
+ }
18251
+ function updateTextEvents(id2, data) {
18252
+ for (let i in scheduler2._events) {
18253
+ let tev = scheduler2._events[i];
18254
+ if (tev.recurring_event_id == id2 || scheduler2._is_virtual_event(tev.id) && tev.id.split("#")[0] == id2) {
18255
+ tev.text = data.text;
18256
+ scheduler2.updateEvent(tev.id);
18257
+ }
18258
+ }
18220
18259
  }
18221
18260
  function deleteEventFromSeries(idTimestamp, ev) {
18222
18261
  let id2 = idTimestamp;
18223
- idTimestamp = String(id2).split("#") || ev._pid_time;
18262
+ let originalStartTimestamp = new Date(ev.original_start).valueOf();
18263
+ idTimestamp = String(id2).split("#") || ev._pid_time || originalStartTimestamp;
18224
18264
  let nid = scheduler2.uid();
18225
- let tid = idTimestamp[1] ? idTimestamp[1] : ev._pid_time;
18265
+ let tid = idTimestamp[1] ? idTimestamp[1] : ev._pid_time || originalStartTimestamp;
18226
18266
  let nev = scheduler2._copy_event(ev);
18227
18267
  nev.id = nid;
18228
18268
  nev.recurring_event_id = ev.recurring_event_id || idTimestamp[0];
@@ -18267,17 +18307,15 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18267
18307
  }
18268
18308
  scheduler2.attachEvent("onBeforeEventChanged", function(ev, e, is_new, original) {
18269
18309
  if (!is_new && ev && (scheduler2._is_virtual_event(ev.id) || scheduler2._is_modified_occurrence(ev))) {
18270
- if (original && (original.start_date.valueOf() !== ev.start_date.valueOf() || original.end_date.valueOf() !== ev.end_date.valueOf())) {
18271
- if (original.start_date.getDate() !== ev.start_date.getDate()) {
18272
- ev._beforeEventChangedFlag = "edit";
18273
- } else {
18274
- ev._beforeEventChangedFlag = "ask";
18275
- }
18276
- if (!scheduler2.config.collision_limit || scheduler2.checkCollision(ev)) {
18277
- scheduler2._events["$dnd_recurring_placeholder"] = scheduler2._lame_clone(ev);
18278
- scheduler2._showRequiredModalBox(ev.id, ev._beforeEventChangedFlag);
18279
- return false;
18280
- }
18310
+ if (original.start_date.getDate() !== ev.start_date.getDate()) {
18311
+ ev._beforeEventChangedFlag = "edit";
18312
+ } else {
18313
+ ev._beforeEventChangedFlag = "ask";
18314
+ }
18315
+ if (!scheduler2.config.collision_limit || scheduler2.checkCollision(ev)) {
18316
+ scheduler2._events["$dnd_recurring_placeholder"] = scheduler2._lame_clone(ev);
18317
+ scheduler2._showRequiredModalBox(ev.id, ev._beforeEventChangedFlag);
18318
+ return false;
18281
18319
  }
18282
18320
  }
18283
18321
  return true;
@@ -18285,8 +18323,8 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18285
18323
  scheduler2.attachEvent("onEventChanged", function(id2, event2) {
18286
18324
  if (this._loading)
18287
18325
  return true;
18288
- var ev = this.getEvent(id2);
18289
- if (this._is_virtual_event(id2) && !this._isFollowing(id2)) {
18326
+ let ev = this.getEvent(id2);
18327
+ if (this._is_virtual_event(id2)) {
18290
18328
  createException(ev);
18291
18329
  } else {
18292
18330
  if (ev.start_date) {
@@ -18331,30 +18369,32 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18331
18369
  return true;
18332
18370
  });
18333
18371
  scheduler2.attachEvent("onEventSave", function(id2, data, is_new_event) {
18334
- let tempData = { ...data };
18335
18372
  let ev = this.getEvent(id2);
18373
+ let tempEvent = scheduler2._lame_clone(ev);
18374
+ let tempDataRRULE = data.rrule;
18336
18375
  if (ev && isSeries(ev)) {
18337
18376
  if (!is_new_event && this._isFollowing(id2)) {
18338
18377
  if (ev._removeFollowing) {
18339
- ev.end_date = new Date(ev.start_date.valueOf() - 1e3);
18340
- ev._end_date = ev._shorten_end_date;
18341
- ev.start_date = ev._start_date;
18342
- if (ev.end_date.valueOf() <= ev.start_date.valueOf()) {
18378
+ let occurrence = scheduler2.getEvent(ev._thisAndFollowing);
18379
+ if (occurrence && (ev._firstOccurrence || ev._modified)) {
18343
18380
  scheduler2.hideLightbox();
18344
18381
  scheduler2.deleteEvent(ev.id);
18345
18382
  return false;
18346
- }
18347
- ev._shorten = true;
18348
- updateFollowingEventsRRULE(ev);
18349
- scheduler2.updateEvent(ev.id);
18350
- scheduler2.callEvent("onEventChanged", [ev.id, ev]);
18351
- let occurrence = scheduler2.getEvent(ev._thisAndFollowing);
18352
- if (occurrence) {
18353
- for (const i in scheduler2._events) {
18354
- let tev = scheduler2._events[i];
18355
- if (tev.recurring_event_id === id2) {
18356
- if (tev.start_date.valueOf() > tempData.start_date.valueOf()) {
18357
- deleteEventFromSeries(tev.id, tev);
18383
+ } else {
18384
+ ev.end_date = new Date(ev.start_date.valueOf() - 1e3);
18385
+ ev._end_date = ev._shorten_end_date;
18386
+ ev.start_date = ev._start_date;
18387
+ ev._shorten = true;
18388
+ updateFollowingEventsRRULE(ev);
18389
+ scheduler2.callEvent("onEventChanged", [ev.id, ev]);
18390
+ let occurrence2 = scheduler2.getEvent(ev._thisAndFollowing);
18391
+ if (occurrence2) {
18392
+ for (const i in scheduler2._events) {
18393
+ let tev = scheduler2._events[i];
18394
+ if (tev.recurring_event_id === id2) {
18395
+ if (tev.start_date.valueOf() > tempEvent.start_date.valueOf()) {
18396
+ deleteEventFromSeries(tev.id, tev);
18397
+ }
18358
18398
  }
18359
18399
  }
18360
18400
  }
@@ -18363,61 +18403,54 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18363
18403
  return false;
18364
18404
  } else {
18365
18405
  let occurrence = scheduler2.getEvent(ev._thisAndFollowing);
18366
- let futureOcurrences = [];
18367
- for (const i in scheduler2._events) {
18368
- let tev = scheduler2._events[i];
18369
- if (tev.recurring_event_id == id2) {
18370
- if (tev.start_date.valueOf() > tempData.start_date.valueOf()) {
18371
- futureOcurrences.push(tev);
18406
+ if (occurrence && ev._firstOccurrence) {
18407
+ for (const i in scheduler2._events) {
18408
+ let tev = scheduler2._events[i];
18409
+ if (tev.id == ev.id) {
18410
+ setPropsForStorageEvent(i, data, ev, tempEvent);
18372
18411
  }
18373
18412
  }
18374
- }
18375
- ev.end_date = ev._shorten_end_date;
18376
- ev._end_date = ev._shorten_end_date;
18377
- ev.start_date = ev._start_date;
18378
- ev._shorten = true;
18379
- updateFollowingEventsRRULE(ev);
18380
- scheduler2.updateEvent(ev.id);
18381
- scheduler2.callEvent("onEventChanged", [ev.id, ev]);
18382
- let followingEv = { ...tempData };
18383
- followingEv._start_date = followingEv.start_date;
18384
- followingEv._thisAndFollowing = occurrence.id;
18385
- followingEv.id = scheduler2.uid();
18386
- scheduler2.addEvent(followingEv.start_date, followingEv.end_date, followingEv.text, followingEv.id, followingEv);
18387
- for (let i = 0; i < futureOcurrences.length; i++) {
18388
- const ocr = futureOcurrences[i];
18389
- moveToFollowingEvents(ocr, followingEv);
18390
- scheduler2.callEvent("onEventChanged", [ocr.id, ocr]);
18391
- }
18392
- if (occurrence && ev._beforeEventChangedFlag) {
18393
- for (let i in scheduler2._events) {
18413
+ } else if (occurrence && ev._modified) {
18414
+ for (const i in scheduler2._events) {
18394
18415
  let tev = scheduler2._events[i];
18395
- if (tev.recurring_event_id == id2) {
18396
- if (tev.start_date.valueOf() >= tempData.start_date.valueOf()) {
18397
- deleteEventFromSeries(tev.id, tev);
18398
- }
18416
+ if (tev.recurring_event_id == id2 && tev.id == tempEvent._thisAndFollowing) {
18417
+ setPropsForStorageEvent(i, data, ev, tempEvent);
18399
18418
  }
18400
18419
  }
18420
+ } else {
18421
+ if (scheduler2._is_modified_occurrence(occurrence)) {
18422
+ deleteExceptionFromStorage(occurrence);
18423
+ }
18424
+ ev.end_date = ev._shorten_end_date;
18425
+ ev._end_date = ev._shorten_end_date;
18426
+ ev.start_date = ev._start_date;
18427
+ ev._shorten = true;
18428
+ updateFollowingEventsRRULE(ev);
18429
+ scheduler2.callEvent("onEventChanged", [ev.id, ev]);
18430
+ let followingEv = { ...tempEvent };
18431
+ followingEv.text = data.text;
18432
+ followingEv.duration = data.duration;
18433
+ followingEv.rrule = tempDataRRULE;
18434
+ followingEv._start_date = null;
18435
+ followingEv.id = scheduler2.uid();
18436
+ scheduler2.addEvent(followingEv.start_date, followingEv.end_date, followingEv.text, followingEv.id, followingEv);
18437
+ }
18438
+ if (!is_new_event) {
18439
+ updateTextEvents(id2, data);
18401
18440
  }
18402
18441
  scheduler2.hideLightbox();
18403
18442
  return false;
18404
18443
  }
18405
18444
  }
18406
- if (!is_new_event) {
18407
- for (let i in scheduler2._events) {
18408
- let tev = scheduler2._events[i];
18409
- if (tev.recurring_event_id == id2) {
18410
- tev.text = tempData.text;
18411
- scheduler2.updateEvent(tev.id);
18412
- }
18413
- }
18414
- }
18415
18445
  }
18416
- if (tempData._ocr && tempData._beforeEventChangedFlag) {
18417
- ev.start_date = tempData.start_date;
18418
- ev.end_date = tempData.end_date;
18419
- ev._start_date = tempData._start_date;
18420
- ev._end_date = tempData._end_date;
18446
+ if (!is_new_event) {
18447
+ updateTextEvents(id2, data);
18448
+ }
18449
+ if (tempEvent._ocr && tempEvent._beforeEventChangedFlag) {
18450
+ ev.start_date = tempEvent.start_date;
18451
+ ev.end_date = tempEvent.end_date;
18452
+ ev._start_date = tempEvent._start_date;
18453
+ ev._end_date = tempEvent._end_date;
18421
18454
  scheduler2.updateEvent(ev.id);
18422
18455
  return true;
18423
18456
  }
@@ -18469,6 +18502,10 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18469
18502
  ev._shorten_end_date = null;
18470
18503
  if (ev._removeFollowing)
18471
18504
  ev._removeFollowing = null;
18505
+ if (ev._firstOccurrence)
18506
+ ev._firstOccurrence = null;
18507
+ if (ev._modified)
18508
+ ev._modified = null;
18472
18509
  };
18473
18510
  scheduler2._is_virtual_event = function(id2) {
18474
18511
  return id2.toString().indexOf("#") != -1;
@@ -18489,13 +18526,23 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18489
18526
  const showRequiredLightbox = function(id3, type) {
18490
18527
  const occurrence = scheduler2.getEvent(id3);
18491
18528
  const event2 = scheduler2.getEvent(pid);
18529
+ const view = scheduler2.getView();
18530
+ if (view && occurrence[view.y_property]) {
18531
+ event2[view.y_property] = occurrence[view.y_property];
18532
+ }
18533
+ if (view && occurrence[view.property]) {
18534
+ event2[view.property] = occurrence[view.property];
18535
+ }
18492
18536
  if (type === "Occurrence") {
18493
18537
  return scheduler2.showLightbox_rec(id3);
18494
18538
  }
18495
18539
  if (type === "Following") {
18496
- if (+occurrence.start_date === +event2.start_date) {
18497
- event2._end_date = event2.end_date;
18498
- event2.end_date = new Date(occurrence.start_date.valueOf() + event2.duration * 1e3);
18540
+ if (scheduler2._isExceptionFirstOccurrence(occurrence)) {
18541
+ setPropsForFirstOccurrence(event2, occurrence);
18542
+ return scheduler2.showLightbox_rec(pid);
18543
+ }
18544
+ if (scheduler2._isFirstOccurrence(occurrence)) {
18545
+ setPropsForFirstOccurrence(event2, occurrence);
18499
18546
  return scheduler2.showLightbox_rec(pid);
18500
18547
  } else {
18501
18548
  event2._end_date = event2.end_date;
@@ -18505,9 +18552,6 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18505
18552
  event2._start_date = event2.start_date;
18506
18553
  event2.start_date = occurrence.start_date;
18507
18554
  event2._thisAndFollowing = occurrence.id;
18508
- if (event2.rrule) {
18509
- updateFollowingWithWEEKLY(pid);
18510
- }
18511
18555
  if (ev._beforeEventChangedFlag) {
18512
18556
  event2._beforeEventChangedFlag = ev._beforeEventChangedFlag;
18513
18557
  event2._shorten_end_date = new Date(originalStart.valueOf() - 1e3);
@@ -18516,6 +18560,10 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18516
18560
  }
18517
18561
  }
18518
18562
  if (type === "AllEvents") {
18563
+ if (scheduler2._isExceptionFirstOccurrence(occurrence)) {
18564
+ setPropsForFirstOccurrence(event2, occurrence);
18565
+ return scheduler2.showLightbox_rec(pid);
18566
+ }
18519
18567
  const tempStart = new Date(event2.start_date);
18520
18568
  event2._end_date = event2.end_date;
18521
18569
  event2._start_date = tempStart;
@@ -18523,6 +18571,7 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18523
18571
  event2.start_date.setMinutes(occurrence.start_date.getMinutes());
18524
18572
  event2.start_date.setSeconds(occurrence.start_date.getSeconds());
18525
18573
  event2.end_date = new Date(event2.start_date.valueOf() + event2.duration * 1e3);
18574
+ event2._thisAndFollowing = null;
18526
18575
  return scheduler2.showLightbox_rec(pid);
18527
18576
  }
18528
18577
  };
@@ -18580,6 +18629,14 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18580
18629
  pid = occurrence.id.split("#")[0];
18581
18630
  }
18582
18631
  let event2 = scheduler2.getEvent(pid);
18632
+ const view = scheduler2.getView();
18633
+ let tempEvent = scheduler2._lame_clone(event2);
18634
+ if (view && occurrence[view.y_property]) {
18635
+ tempEvent[view.y_property] = occurrence[view.y_property];
18636
+ }
18637
+ if (view && occurrence[view.property]) {
18638
+ tempEvent[view.property] = occurrence[view.property];
18639
+ }
18583
18640
  let tempStartDate;
18584
18641
  let tempEndDate;
18585
18642
  if (occurrence && occurrence._beforeEventChangedFlag) {
@@ -18587,34 +18644,53 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18587
18644
  tempEndDate = occurrence.end_date;
18588
18645
  }
18589
18646
  const handleOccurrence = function(occurrence2) {
18590
- let tempEvent = scheduler2.getEvent("$dnd_recurring_placeholder");
18647
+ let tempEvent2 = { ...event2, ...scheduler2.getEvent("$dnd_recurring_placeholder") };
18591
18648
  if (tempEndDate && tempStartDate) {
18592
- tempEvent.start_date = tempStartDate;
18593
- tempEvent.end_date = tempEndDate;
18594
- tempEvent._beforeEventChangedFlag = occurrence2._beforeEventChangedFlag;
18595
- tempEvent._ocr = true;
18649
+ tempEvent2.start_date = tempStartDate;
18650
+ tempEvent2.end_date = tempEndDate;
18651
+ tempEvent2._beforeEventChangedFlag = occurrence2._beforeEventChangedFlag;
18652
+ tempEvent2._ocr = true;
18596
18653
  }
18597
- if (!scheduler2.config.collision_limit || scheduler2.checkCollision(tempEvent)) {
18654
+ if (!scheduler2.config.collision_limit || scheduler2.checkCollision(tempEvent2)) {
18598
18655
  for (const i in scheduler2._events) {
18599
18656
  let tev = scheduler2._events[i];
18600
- if (tev.id == tempEvent.id) {
18601
- scheduler2._events[i] = { ...tempEvent };
18602
- scheduler2.callEvent("onEventSave", [scheduler2._events[i].id, scheduler2._events[i], scheduler2._new_event]);
18603
- scheduler2.callEvent("onEventChanged", [occurrence2.id, occurrence2]);
18657
+ if (i === "$dnd_recurring_placeholder") {
18658
+ continue;
18659
+ }
18660
+ if (tev.id == tempEvent2.id) {
18661
+ scheduler2._events[i] = { ...tempEvent2 };
18662
+ scheduler2.callEvent("onEventChanged", [scheduler2._events[i].id, scheduler2._events[i]]);
18604
18663
  }
18605
18664
  }
18606
18665
  }
18607
18666
  };
18608
18667
  const handleFollowing = function(occurrence2) {
18609
- let tempEvent = scheduler2._lame_clone(event2);
18668
+ let initialOccurrence = scheduler2._lame_clone(occurrence2);
18610
18669
  if (tempEndDate && tempStartDate) {
18611
18670
  occurrence2._start_date = occurrence2.start_date;
18612
18671
  occurrence2.start_date = tempStartDate;
18613
18672
  occurrence2.end_date = tempEndDate;
18614
18673
  }
18615
- if (+occurrence2.start_date === +event2.start_date) {
18616
- tempEvent._end_date = event2.end_date;
18617
- tempEvent.end_date = new Date(occurrence2.start_date.valueOf() + event2.duration * 1e3);
18674
+ if (scheduler2._isFirstOccurrence(initialOccurrence) || scheduler2._isExceptionFirstOccurrence(initialOccurrence)) {
18675
+ if (scheduler2._isExceptionFirstOccurrence(initialOccurrence)) {
18676
+ deleteExceptionFromStorage(initialOccurrence);
18677
+ }
18678
+ tempEvent._start_date = event2.start_date;
18679
+ tempEvent.start_date = occurrence2.start_date;
18680
+ tempEvent.duration = (+occurrence2.end_date - +occurrence2.start_date) / 1e3;
18681
+ tempEvent._beforeEventChangedFlag = occurrence2._beforeEventChangedFlag;
18682
+ if (tempEvent.rrule) {
18683
+ updateFollowingWithWEEKLY(tempEvent.id, tempEvent);
18684
+ }
18685
+ if (!scheduler2.config.collision_limit || scheduler2.checkCollision(tempEvent)) {
18686
+ for (const i in scheduler2._events) {
18687
+ let tev = scheduler2._events[i];
18688
+ if (tev.id == tempEvent.id) {
18689
+ scheduler2._events[i] = { ...tempEvent };
18690
+ scheduler2.callEvent("onEventChanged", [scheduler2._events[i].id, scheduler2._events[i]]);
18691
+ }
18692
+ }
18693
+ }
18618
18694
  } else {
18619
18695
  tempEvent._end_date = event2.end_date;
18620
18696
  const originalStart = occurrence2.original_start || scheduler2.date.date_part(new Date(occurrence2._start_date));
@@ -18626,29 +18702,34 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18626
18702
  if (tempEvent.rrule) {
18627
18703
  updateFollowingWithWEEKLY(tempEvent.id, tempEvent);
18628
18704
  }
18629
- }
18630
- let tempEnd = tempEvent.end_date;
18631
- tempEvent.end_date = tempEvent._end_date;
18632
- if (!scheduler2.config.collision_limit || scheduler2.checkCollision(tempEvent)) {
18633
- tempEvent.end_date = tempEnd;
18634
- for (const i in scheduler2._events) {
18635
- let tev = scheduler2._events[i];
18636
- if (tev.id == tempEvent.id) {
18637
- scheduler2._events[i] = { ...tempEvent };
18638
- scheduler2.callEvent("onEventSave", [scheduler2._events[i].id, scheduler2._events[i], scheduler2._new_event]);
18639
- scheduler2.callEvent("onEventChanged", [scheduler2._events[i].id, scheduler2._events[i]]);
18705
+ let tempEnd = tempEvent.end_date;
18706
+ tempEvent.end_date = tempEvent._end_date;
18707
+ if (!scheduler2.config.collision_limit || scheduler2.checkCollision(tempEvent)) {
18708
+ tempEvent.end_date = tempEnd;
18709
+ for (const i in scheduler2._events) {
18710
+ let tev = scheduler2._events[i];
18711
+ if (tev.id == tempEvent.id) {
18712
+ scheduler2._events[i] = { ...tempEvent };
18713
+ scheduler2.callEvent("onEventSave", [scheduler2._events[i].id, scheduler2._events[i], scheduler2._new_event]);
18714
+ scheduler2.callEvent("onEventChanged", [scheduler2._events[i].id, scheduler2._events[i]]);
18715
+ }
18640
18716
  }
18641
18717
  }
18642
18718
  }
18643
18719
  };
18644
18720
  const handleAllEvents = function(occurrence2) {
18645
- let tempEvent = scheduler2._lame_clone(event2);
18721
+ let initialOccurrence = scheduler2._lame_clone(occurrence2);
18722
+ if (scheduler2._isExceptionFirstOccurrence(initialOccurrence)) {
18723
+ deleteExceptionFromStorage(initialOccurrence);
18724
+ }
18646
18725
  if (tempEndDate && tempStartDate) {
18647
18726
  tempEvent.start_date.setHours(tempStartDate.getHours());
18648
18727
  tempEvent.start_date.setMinutes(tempStartDate.getMinutes());
18649
18728
  tempEvent.start_date.setSeconds(tempStartDate.getSeconds());
18729
+ tempEvent.duration = (+tempEndDate - +tempStartDate) / 1e3;
18650
18730
  }
18651
18731
  tempEvent._beforeEventChangedFlag = occurrence2._beforeEventChangedFlag;
18732
+ tempEvent._thisAndFollowing = null;
18652
18733
  if (!scheduler2.config.collision_limit || scheduler2.checkCollision(tempEvent)) {
18653
18734
  for (const i in scheduler2._events) {
18654
18735
  let tev = scheduler2._events[i];
@@ -18743,22 +18824,17 @@ To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product),
18743
18824
  if (!seriesExceptions) {
18744
18825
  seriesExceptions = {};
18745
18826
  }
18746
- if (!from) {
18747
- from = scheduler2._min_date;
18748
- }
18749
- if (!to) {
18750
- to = scheduler2._max_date;
18751
- }
18752
- const utcStart = new Date(Date.UTC(ev.start_date.getFullYear(), ev.start_date.getMonth(), ev.start_date.getDate(), ev.start_date.getHours(), ev.start_date.getMinutes(), ev.start_date.getSeconds()));
18827
+ from = toUTCDate(from || new Date(scheduler2._min_date.valueOf() - 1e3));
18828
+ to = toUTCDate(to || new Date(scheduler2._max_date.valueOf() - 1e3));
18829
+ const utcStart = toUTCDate(ev.start_date);
18753
18830
  let parsedRRule;
18754
18831
  if (maxCount) {
18755
18832
  parsedRRule = rrulestr(`RRULE:${ev.rrule};UNTIL=${toIcalString(ev.end_date)};COUNT=${maxCount}`, { dtstart: utcStart });
18756
18833
  } else {
18757
18834
  parsedRRule = rrulestr(`RRULE:${ev.rrule};UNTIL=${toIcalString(ev.end_date)}`, { dtstart: utcStart });
18758
18835
  }
18759
- const utcTo = new Date(Date.UTC(to.getFullYear(), to.getMonth(), to.getDate(), to.getHours(), to.getMinutes(), to.getSeconds()));
18760
- const repeatedDates = parsedRRule.between(from, utcTo).map((date) => {
18761
- const adjustedDate = new Date(date);
18836
+ const repeatedDates = parsedRRule.between(from, to, true).map((date) => {
18837
+ const adjustedDate = setUTCPartsToDate(date);
18762
18838
  adjustedDate.setHours(ev.start_date.getHours());
18763
18839
  adjustedDate.setMinutes(ev.start_date.getMinutes());
18764
18840
  adjustedDate.setSeconds(ev.start_date.getSeconds());