dhtmlx-scheduler 7.0.3 → 7.0.5

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.
@@ -524,14 +524,14 @@
524
524
  scheduler2._init_once = function() {
525
525
  };
526
526
  };
527
- var layout = { navbar: { render: function(config) {
527
+ const layout = { navbar: { render: function(config) {
528
528
  return scheduler2._init_nav_bar(config);
529
529
  } }, header: { render: function(config) {
530
- var element = document.createElement("div");
530
+ const element = document.createElement("div");
531
531
  element.className = "dhx_cal_header";
532
532
  return element;
533
533
  } }, dataArea: { render: function(config) {
534
- var element = document.createElement("div");
534
+ const element = document.createElement("div");
535
535
  element.className = "dhx_cal_data";
536
536
  return element;
537
537
  } }, html_element: { render: function(config) {
@@ -541,25 +541,25 @@
541
541
  return !!(element.querySelector(".dhx_cal_header") && element.querySelector(".dhx_cal_data") && element.querySelector(".dhx_cal_navline"));
542
542
  }
543
543
  function createDefaultHeader(scheduler3) {
544
- var views = ["day", "week", "month"];
545
- var date = ["date"];
546
- var nav = ["prev", "today", "next"];
544
+ const views = ["day", "week", "month"];
545
+ const date = ["date"];
546
+ const nav = ["prev", "today", "next"];
547
547
  if (scheduler3.matrix) {
548
- for (var i in scheduler3.matrix) {
548
+ for (const i in scheduler3.matrix) {
549
549
  views.push(i);
550
550
  }
551
551
  }
552
552
  if (scheduler3._props) {
553
- for (var i in scheduler3._props) {
553
+ for (const i in scheduler3._props) {
554
554
  views.push(i);
555
555
  }
556
556
  }
557
557
  if (scheduler3._grid && scheduler3._grid.names) {
558
- for (var i in scheduler3._grid.names) {
558
+ for (const i in scheduler3._grid.names) {
559
559
  views.push(i);
560
560
  }
561
561
  }
562
- var optionalViews = ["map", "agenda", "week_agenda", "year"];
562
+ const optionalViews = ["map", "agenda", "week_agenda", "year"];
563
563
  optionalViews.forEach(function(viewName) {
564
564
  if (scheduler3[viewName + "_view"]) {
565
565
  views.push(viewName);
@@ -701,16 +701,16 @@
701
701
  }
702
702
  };
703
703
  scheduler2.get_elements = function() {
704
- var els = this._obj.getElementsByTagName("DIV");
705
- for (var i = 0; i < els.length; i++) {
706
- var class_name = scheduler2._getClassName(els[i]);
707
- var attr_value = els[i].getAttribute("data-tab") || els[i].getAttribute("name") || "";
704
+ const els = this._obj.getElementsByTagName("DIV");
705
+ for (let i = 0; i < els.length; i++) {
706
+ let class_name = scheduler2._getClassName(els[i]);
707
+ const attr_value = els[i].getAttribute("data-tab") || els[i].getAttribute("name") || "";
708
708
  if (class_name)
709
709
  class_name = class_name.split(" ")[0];
710
710
  if (!this._els[class_name])
711
711
  this._els[class_name] = [];
712
712
  this._els[class_name].push(els[i]);
713
- var label = scheduler2.locale.labels[attr_value + "_tab"] || scheduler2.locale.labels[attr_value || class_name];
713
+ let label = scheduler2.locale.labels[attr_value + "_tab"] || scheduler2.locale.labels[attr_value || class_name];
714
714
  if (typeof label !== "string" && attr_value && !els[i].innerHTML)
715
715
  label = attr_value.split("_")[0];
716
716
  if (label) {
@@ -719,14 +719,14 @@
719
719
  }
720
720
  }
721
721
  };
722
- var domEventsScope = scheduler2._createDomEventScope();
722
+ const domEventsScope = scheduler2._createDomEventScope();
723
723
  scheduler2.unset_actions = function() {
724
724
  domEventsScope.detachAll();
725
725
  };
726
726
  scheduler2.set_actions = function() {
727
- for (var a in this._els) {
727
+ for (const a in this._els) {
728
728
  if (this._click[a]) {
729
- for (var i = 0; i < this._els[a].length; i++) {
729
+ for (let i = 0; i < this._els[a].length; i++) {
730
730
  const element = this._els[a][i];
731
731
  const handler = this._click[a].bind(element);
732
732
  domEventsScope.attach(element, "click", handler);
@@ -752,13 +752,11 @@
752
752
  domEventsScope.attach(this._obj, "dblclick", function(e) {
753
753
  scheduler2._on_dbl_click(e);
754
754
  });
755
- domEventsScope.attach(this._obj, "contextmenu", function(e) {
755
+ domEventsScope.attach(this._obj, "contextmenu", function(event2) {
756
756
  if (scheduler2.checkEvent("onContextMenu")) {
757
- e.preventDefault();
757
+ event2.preventDefault();
758
758
  }
759
- var ev = e;
760
- var src = ev.target || ev.srcElement;
761
- var returnValue = scheduler2.callEvent("onContextMenu", [scheduler2._locate_event(src), ev]);
759
+ const returnValue = scheduler2.callEvent("onContextMenu", [scheduler2._locate_event(event2.target), event2]);
762
760
  return returnValue;
763
761
  });
764
762
  };
@@ -775,13 +773,15 @@
775
773
  this.callEvent("onEventSelected", [id2]);
776
774
  };
777
775
  scheduler2.unselect = function(id2) {
778
- if (id2 && id2 != this._select_id)
776
+ if (id2 && id2 != this._select_id) {
779
777
  return;
780
- var t = this._select_id;
778
+ }
779
+ const previousSelection = this._select_id;
781
780
  this._select_id = null;
782
- if (t && this.getEvent(t))
783
- this.updateEvent(t);
784
- this.callEvent("onEventUnselected", [t]);
781
+ if (previousSelection && this.getEvent(previousSelection)) {
782
+ this.updateEvent(previousSelection);
783
+ }
784
+ this.callEvent("onEventUnselected", [previousSelection]);
785
785
  };
786
786
  scheduler2.getState = function() {
787
787
  return { mode: this._mode, date: new Date(this._date), min_date: new Date(this._min_date), max_date: new Date(this._max_date), editor_id: this._edit_id, lightbox_id: this._lightbox_id, new_event: this._new_event, select_id: this._select_id, expanded: this.expanded, drag_id: this._drag_id, drag_mode: this._drag_mode };
@@ -794,8 +794,7 @@
794
794
  scheduler2._ignore_next_click = false;
795
795
  return false;
796
796
  }
797
- var trg = e.target;
798
- var id2 = scheduler2._locate_event(trg);
797
+ const id2 = scheduler2._locate_event(e.target);
799
798
  if (!id2) {
800
799
  scheduler2.callEvent("onEmptyClick", [scheduler2.getActionData(e).date, e]);
801
800
  } else {
@@ -804,8 +803,8 @@
804
803
  }
805
804
  if (id2 && scheduler2.config.select) {
806
805
  scheduler2.select(id2);
807
- const icon = trg.closest(".dhx_menu_icon");
808
- var mask = scheduler2._getClassName(icon);
806
+ const icon = e.target.closest(".dhx_menu_icon");
807
+ const mask = scheduler2._getClassName(icon);
809
808
  if (mask.indexOf("_icon") != -1)
810
809
  scheduler2._click.buttons[mask.split(" ")[1].replace("icon_", "")](id2);
811
810
  } else {
@@ -817,7 +816,7 @@
817
816
  }, dhx_cal_prev_button: function() {
818
817
  scheduler2._click.dhx_cal_next_button(0, -1);
819
818
  }, dhx_cal_next_button: function(dummy, step) {
820
- var def_step = 1;
819
+ let def_step = 1;
821
820
  if (scheduler2.config.rtl) {
822
821
  step = -step;
823
822
  def_step = -def_step;
@@ -828,12 +827,12 @@
828
827
  scheduler2.setCurrentView(scheduler2._currentDate());
829
828
  }
830
829
  }, dhx_cal_tab: function() {
831
- var name = this.getAttribute("data-tab");
832
- var deprecated_name = this.getAttribute("name");
833
- var mode = name || deprecated_name.substring(0, deprecated_name.search("_tab"));
830
+ const name = this.getAttribute("data-tab");
831
+ const deprecated_name = this.getAttribute("name");
832
+ const mode = name || deprecated_name.substring(0, deprecated_name.search("_tab"));
834
833
  scheduler2.setCurrentView(scheduler2._date, mode);
835
834
  }, buttons: { delete: function(id2) {
836
- var c = scheduler2.locale.labels.confirm_deleting;
835
+ const c = scheduler2.locale.labels.confirm_deleting;
837
836
  scheduler2._dhtmlx_confirm({ message: c, title: scheduler2.locale.labels.title_confirm_deleting, callback: function() {
838
837
  scheduler2.deleteEvent(id2);
839
838
  }, config: { ok: scheduler2.locale.labels.icon_delete } });
@@ -852,45 +851,47 @@
852
851
  if (!message2)
853
852
  return callback();
854
853
  config = config || {};
855
- var opts = { ...config, text: message2 };
856
- if (title)
854
+ const opts = { ...config, text: message2 };
855
+ if (title) {
857
856
  opts.title = title;
857
+ }
858
858
  if (callback) {
859
859
  opts.callback = function(result) {
860
- if (result)
860
+ if (result) {
861
861
  callback();
862
+ }
862
863
  };
863
864
  }
864
865
  scheduler2.confirm(opts);
865
866
  };
866
867
  scheduler2.addEventNow = function(start, end, e) {
867
- var base = {};
868
+ let base = {};
868
869
  if (scheduler2._isObject(start) && !scheduler2._isDate(start)) {
869
870
  base = start;
870
871
  start = null;
871
872
  }
872
- var d = (this.config.event_duration || this.config.time_step) * 6e4;
873
+ const duration = (this.config.event_duration || this.config.time_step) * 6e4;
873
874
  if (!start)
874
- start = base.start_date || Math.round(scheduler2._currentDate().valueOf() / d) * d;
875
- var start_date = new Date(start);
875
+ start = base.start_date || Math.round(scheduler2._currentDate().valueOf() / duration) * duration;
876
+ let start_date = new Date(start);
876
877
  if (!end) {
877
- var start_hour = this.config.first_hour;
878
+ let start_hour = this.config.first_hour;
878
879
  if (start_hour > start_date.getHours()) {
879
880
  start_date.setHours(start_hour);
880
881
  start = start_date.valueOf();
881
882
  }
882
- end = start.valueOf() + d;
883
+ end = start.valueOf() + duration;
883
884
  }
884
- var end_date = new Date(end);
885
+ let end_date = new Date(end);
885
886
  if (start_date.valueOf() == end_date.valueOf())
886
- end_date.setTime(end_date.valueOf() + d);
887
+ end_date.setTime(end_date.valueOf() + duration);
887
888
  base.start_date = base.start_date || start_date;
888
889
  base.end_date = base.end_date || end_date;
889
890
  base.text = base.text || this.locale.labels.new_event;
890
891
  base.id = this._drag_id = base.id || this.uid();
891
892
  this._drag_mode = "new-size";
892
893
  this._loading = true;
893
- var eventId = this.addEvent(base);
894
+ const eventId = this.addEvent(base);
894
895
  this.callEvent("onEventCreated", [this._drag_id, e]);
895
896
  this._loading = false;
896
897
  this._drag_event = {};
@@ -898,10 +899,10 @@
898
899
  return eventId;
899
900
  };
900
901
  scheduler2._on_dbl_click = function(e, src) {
901
- src = src || (e.target || e.srcElement);
902
+ src = src || e.target;
902
903
  if (this.config.readonly)
903
904
  return;
904
- var name = scheduler2._getClassName(src).split(" ")[0];
905
+ const name = scheduler2._getClassName(src).split(" ")[0];
905
906
  switch (name) {
906
907
  case "dhx_scale_holder":
907
908
  case "dhx_scale_holder_now":
@@ -917,8 +918,8 @@
917
918
  case "dhx_cal_agenda_event_line":
918
919
  case "dhx_grid_event":
919
920
  case "dhx_cal_event_line":
920
- case "dhx_cal_event_clear":
921
- var id2 = this._locate_event(src);
921
+ case "dhx_cal_event_clear": {
922
+ const id2 = this._locate_event(src);
922
923
  if (!this.callEvent("onDblClick", [id2, e]))
923
924
  return;
924
925
  if (this.config.details_on_dblclick || this._table_view || !this.getEvent(id2)._timed || !this.config.select)
@@ -926,25 +927,27 @@
926
927
  else
927
928
  this.edit(id2);
928
929
  break;
930
+ }
929
931
  case "dhx_time_block":
930
932
  case "dhx_cal_container":
931
933
  return;
932
- default:
933
- var t = this["dblclick_" + name];
934
- if (t) {
935
- t.call(this, e);
934
+ default: {
935
+ const viewHandler = this["dblclick_" + name];
936
+ if (viewHandler) {
937
+ viewHandler.call(this, e);
936
938
  } else {
937
939
  if (src.parentNode && src != this)
938
940
  return scheduler2._on_dbl_click(e, src.parentNode);
939
941
  }
940
942
  break;
943
+ }
941
944
  }
942
945
  };
943
946
  scheduler2._get_column_index = function(x_pos) {
944
- var column = 0;
947
+ let column = 0;
945
948
  if (this._cols) {
946
- var width = 0;
947
- var i = 0;
949
+ let width = 0;
950
+ let i = 0;
948
951
  while (width + this._cols[i] < x_pos && i < this._cols.length) {
949
952
  width += this._cols[i];
950
953
  i++;
@@ -964,20 +967,20 @@
964
967
  if (!this._cols) {
965
968
  return pos;
966
969
  } else {
967
- var column = this._get_column_index(pos.x);
970
+ const column = this._get_column_index(pos.x);
968
971
  pos.x = Math.min(this._cols.length - 1, Math.max(0, Math.ceil(column) - 1));
969
972
  pos.y = Math.max(0, Math.ceil(pos.y * 60 / (this.config.time_step * this.config.hour_size_px)) - 1) + this.config.first_hour * (60 / this.config.time_step);
970
973
  return pos;
971
974
  }
972
975
  };
973
976
  scheduler2._mouse_coords = function(ev) {
974
- var pos;
975
- var b = document.body;
976
- var d = document.documentElement;
977
+ let pos;
978
+ const body = document.body;
979
+ const documentElement = document.documentElement;
977
980
  if (!this.$env.isIE && (ev.pageX || ev.pageY))
978
981
  pos = { x: ev.pageX, y: ev.pageY };
979
982
  else
980
- pos = { x: ev.clientX + (b.scrollLeft || d.scrollLeft || 0) - b.clientLeft, y: ev.clientY + (b.scrollTop || d.scrollTop || 0) - b.clientTop };
983
+ pos = { x: ev.clientX + (body.scrollLeft || documentElement.scrollLeft || 0) - body.clientLeft, y: ev.clientY + (body.scrollTop || documentElement.scrollTop || 0) - body.clientTop };
981
984
  if (this.config.rtl && this._colsS) {
982
985
  pos.x = this.$container.querySelector(".dhx_cal_data").offsetWidth - pos.x;
983
986
  pos.x += this.$domHelpers.getAbsoluteLeft(this._obj);
@@ -987,20 +990,20 @@
987
990
  } else {
988
991
  pos.x -= this.$domHelpers.getAbsoluteLeft(this._obj) + (this._table_view ? 0 : this.xy.scale_width);
989
992
  }
990
- var dataArea = this.$container.querySelector(".dhx_cal_data");
993
+ const dataArea = this.$container.querySelector(".dhx_cal_data");
991
994
  pos.y -= this.$domHelpers.getAbsoluteTop(dataArea) - this._els["dhx_cal_data"][0].scrollTop;
992
995
  pos.ev = ev;
993
- var handler = this["mouse_" + this._mode];
996
+ const handler = this["mouse_" + this._mode];
994
997
  if (handler) {
995
998
  pos = handler.call(this, pos);
996
999
  } else {
997
1000
  if (!this._table_view) {
998
1001
  pos = this._week_indexes_from_pos(pos);
999
1002
  } else {
1000
- var column = this._get_column_index(pos.x);
1003
+ const column = this._get_column_index(pos.x);
1001
1004
  if (!this._cols || !this._colsS)
1002
1005
  return pos;
1003
- var dy = 0;
1006
+ let dy = 0;
1004
1007
  for (dy = 1; dy < this._colsS.heights.length; dy++)
1005
1008
  if (this._colsS.heights[dy] > pos.y)
1006
1009
  break;
@@ -1022,11 +1025,11 @@
1022
1025
  };
1023
1026
  scheduler2._close_not_saved = function() {
1024
1027
  if ((/* @__PURE__ */ new Date()).valueOf() - (scheduler2._new_event || 0) > 500 && scheduler2._edit_id) {
1025
- var c = scheduler2.locale.labels.confirm_closing;
1026
- scheduler2._dhtmlx_confirm({ message: c, title: scheduler2.locale.labels.title_confirm_closing, callback: function() {
1028
+ const confirmationText = scheduler2.locale.labels.confirm_closing;
1029
+ scheduler2._dhtmlx_confirm({ message: confirmationText, title: scheduler2.locale.labels.title_confirm_closing, callback: function() {
1027
1030
  scheduler2.editStop(scheduler2.config.positive_closing);
1028
1031
  } });
1029
- if (c) {
1032
+ if (confirmationText) {
1030
1033
  this._drag_id = this._drag_pos = this._drag_mode = null;
1031
1034
  }
1032
1035
  }
@@ -1041,26 +1044,28 @@
1041
1044
  if (!(old_pos && this._drag_pos)) {
1042
1045
  return true;
1043
1046
  }
1044
- var delay2 = 100, d_pos = 5;
1047
+ const delay2 = 100;
1048
+ const d_pos = 5;
1045
1049
  return !!(this._drag_pos.has_moved || !this._drag_pos.timestamp || new_pos.timestamp - this._drag_pos.timestamp > delay2 || diff(old_pos.ev.clientX, new_pos.ev.clientX, d_pos) || diff(old_pos.ev.clientY, new_pos.ev.clientY, d_pos));
1046
1050
  };
1047
1051
  scheduler2._correct_drag_start_date = function(start) {
1048
- var obj;
1052
+ let obj;
1049
1053
  if (scheduler2.matrix)
1050
1054
  obj = scheduler2.matrix[scheduler2._mode];
1051
1055
  obj = obj || { x_step: 1, x_unit: "day" };
1052
1056
  start = new Date(start);
1053
- var len = 1;
1057
+ let len = 1;
1054
1058
  if (obj._start_correction || obj._end_correction)
1055
1059
  len = (obj.last_hour || 0) * 60 - (start.getHours() * 60 + start.getMinutes()) || 1;
1056
1060
  return start * 1 + (scheduler2._get_fictional_event_length(start, len, obj) - len);
1057
1061
  };
1058
1062
  scheduler2._correct_drag_end_date = function(start, duration) {
1059
- var obj;
1060
- if (scheduler2.matrix)
1063
+ let obj;
1064
+ if (scheduler2.matrix) {
1061
1065
  obj = scheduler2.matrix[scheduler2._mode];
1066
+ }
1062
1067
  obj = obj || { x_step: 1, x_unit: "day" };
1063
- var end = start * 1 + scheduler2._get_fictional_event_length(start, duration, obj);
1068
+ const end = start * 1 + scheduler2._get_fictional_event_length(start, duration, obj);
1064
1069
  return new Date(end * 1 - (scheduler2._get_fictional_event_length(end, -1, obj, -1) + 1));
1065
1070
  };
1066
1071
  scheduler2._on_mouse_move = function(e) {
@@ -1984,9 +1989,9 @@
1984
1989
  const intervalStart = new Date(Math.max(check.valueOf(), startDate.valueOf()));
1985
1990
  const intervalEnd = endDate;
1986
1991
  const leftCellCutOffStart = new Date(intervalStart.getFullYear(), intervalStart.getMonth(), intervalStart.getDate(), config.first_hour);
1987
- const leftCellCutOffEnd = new Date(intervalStart.getFullYear(), intervalStart.getMonth(), intervalStart.getDate(), config.last_hour);
1992
+ const leftCellCutOffEnd = new Date(intervalStart.getFullYear(), intervalStart.getMonth(), intervalStart.getDate(), config.last_hour || 24);
1988
1993
  const rightCellCutOffStart = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate(), config.first_hour);
1989
- const rightCellCutOffEnd = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate(), config.last_hour);
1994
+ const rightCellCutOffEnd = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate(), config.last_hour || 24);
1990
1995
  if (intervalEnd.valueOf() > rightCellCutOffEnd.valueOf()) {
1991
1996
  excludedDuration += intervalEnd - rightCellCutOffEnd;
1992
1997
  }
@@ -2699,7 +2704,7 @@
2699
2704
  };
2700
2705
  }
2701
2706
  var isWindowAwailable = typeof window !== "undefined";
2702
- const env = { isIE: isWindowAwailable && (navigator.userAgent.indexOf("MSIE") >= 0 || navigator.userAgent.indexOf("Trident") >= 0), isIE6: isWindowAwailable && (!XMLHttpRequest && navigator.userAgent.indexOf("MSIE") >= 0), isIE7: isWindowAwailable && (navigator.userAgent.indexOf("MSIE 7.0") >= 0 && navigator.userAgent.indexOf("Trident") < 0), isIE8: isWindowAwailable && (navigator.userAgent.indexOf("MSIE 8.0") >= 0 && navigator.userAgent.indexOf("Trident") >= 0), isOpera: isWindowAwailable && navigator.userAgent.indexOf("Opera") >= 0, isChrome: isWindowAwailable && navigator.userAgent.indexOf("Chrome") >= 0, isKHTML: isWindowAwailable && (navigator.userAgent.indexOf("Safari") >= 0 || navigator.userAgent.indexOf("Konqueror") >= 0), isFF: isWindowAwailable && navigator.userAgent.indexOf("Firefox") >= 0, isIPad: isWindowAwailable && navigator.userAgent.search(/iPad/gi) >= 0, isEdge: isWindowAwailable && navigator.userAgent.indexOf("Edge") != -1, isNode: !isWindowAwailable || typeof navigator == "undefined" };
2707
+ const env = { isIE: isWindowAwailable && (navigator.userAgent.indexOf("MSIE") >= 0 || navigator.userAgent.indexOf("Trident") >= 0), isOpera: isWindowAwailable && navigator.userAgent.indexOf("Opera") >= 0, isChrome: isWindowAwailable && navigator.userAgent.indexOf("Chrome") >= 0, isKHTML: isWindowAwailable && (navigator.userAgent.indexOf("Safari") >= 0 || navigator.userAgent.indexOf("Konqueror") >= 0), isFF: isWindowAwailable && navigator.userAgent.indexOf("Firefox") >= 0, isIPad: isWindowAwailable && navigator.userAgent.search(/iPad/gi) >= 0, isEdge: isWindowAwailable && navigator.userAgent.indexOf("Edge") != -1, isNode: !isWindowAwailable || typeof navigator == "undefined" };
2703
2708
  function extend$g(scheduler2) {
2704
2709
  scheduler2.destructor = function() {
2705
2710
  scheduler2.callEvent("onDestroy", []);
@@ -3021,10 +3026,10 @@
3021
3026
  };
3022
3027
  };
3023
3028
  var csp_str_to_date = function(format, utc) {
3029
+ const mask = format.match(/%[a-zA-Z]/g);
3024
3030
  return function(date) {
3025
3031
  var set = [0, 0, 1, 0, 0, 0];
3026
3032
  var temp = date.match(/[a-zA-Z]+|[0-9]+/g);
3027
- var mask = format.match(/%[a-zA-Z]/g);
3028
3033
  for (var i = 0; i < mask.length; i++) {
3029
3034
  switch (mask[i]) {
3030
3035
  case "%j":
@@ -3071,18 +3076,23 @@
3071
3076
  return new Date(set[0], set[1], set[2], set[3], set[4], set[5]);
3072
3077
  };
3073
3078
  };
3074
- var canUseCsp = false;
3075
- (function() {
3079
+ let cspEnabled = void 0;
3080
+ function checkIfCSPEnabled() {
3076
3081
  try {
3077
- new Function("canUseCsp = false;");
3082
+ new Function("cspEnabled = false;");
3083
+ cspEnabled = false;
3078
3084
  } catch (e) {
3079
- canUseCsp = true;
3085
+ cspEnabled = true;
3080
3086
  }
3081
- })();
3087
+ return cspEnabled;
3088
+ }
3082
3089
  function useCsp() {
3083
3090
  var result = false;
3084
3091
  if (scheduler2.config.csp === "auto") {
3085
- result = canUseCsp;
3092
+ if (cspEnabled === void 0) {
3093
+ cspEnabled = checkIfCSPEnabled();
3094
+ }
3095
+ result = cspEnabled;
3086
3096
  } else {
3087
3097
  result = scheduler2.config.csp;
3088
3098
  }
@@ -3097,14 +3107,6 @@
3097
3107
  var t = scheduler2.locale.date.month_full_hash = {};
3098
3108
  for (var i = 0; i < s.length; i++)
3099
3109
  t[s[i]] = i;
3100
- }, _bind_host_object: function(method) {
3101
- if (method.bind) {
3102
- return method.bind(scheduler2);
3103
- } else {
3104
- return function() {
3105
- return method.apply(scheduler2, arguments);
3106
- };
3107
- }
3108
3110
  }, date_part: function(date) {
3109
3111
  var old = new Date(date);
3110
3112
  date.setHours(0);
@@ -3228,7 +3230,7 @@
3228
3230
  if (utc)
3229
3231
  format = format.replace(/date\.get/g, "date.getUTC");
3230
3232
  var func = new Function("date", 'return "' + format + '";');
3231
- return scheduler2.date._bind_host_object(func);
3233
+ return func.bind(scheduler2);
3232
3234
  }, str_to_date: function(format, utc, exactFormat) {
3233
3235
  var stringToDateMethod = useCsp() ? csp_str_to_date : generateStringToDate;
3234
3236
  var parseExactFormat = stringToDateMethod(format, utc);
@@ -3924,6 +3926,7 @@
3924
3926
  ev._sweek = Math.floor((this._correct_shift(sd.valueOf(), 1) - this._min_date.valueOf()) / (60 * 60 * 1e3 * 24 * cols));
3925
3927
  var isAnyCellVisible = scheduler2._is_any_multiday_cell_visible(sd, ed, ev);
3926
3928
  if (!isAnyCellVisible) {
3929
+ start_date = null;
3927
3930
  continue;
3928
3931
  }
3929
3932
  var stack = weeks[ev._sweek];
@@ -4035,7 +4038,7 @@
4035
4038
  parentWidth -= this.config.day_column_padding;
4036
4039
  }
4037
4040
  var width = Math.floor((parentWidth - menu_offset) / ev_count);
4038
- var left = ev_sorder * width + (ev_sorder > 0 ? 2 : 1);
4041
+ var left = ev_sorder * width + 1;
4039
4042
  if (!ev._inner)
4040
4043
  width = width * (ev_count - ev_sorder);
4041
4044
  if (this.config.cascade_event_display) {
@@ -4150,7 +4153,7 @@
4150
4153
  if (this.config.cascade_event_display) {
4151
4154
  cs2 += " dhx_cal_event_cascade";
4152
4155
  }
4153
- var boxWidth = w;
4156
+ var boxWidth = w - 1;
4154
4157
  var html = '<div event_id="' + id2 + '" ' + this.config.event_attribute + '="' + id2 + '" class="' + cs2 + '" style="position:absolute; top:' + y + "px; " + (this.config.rtl ? "right:" : "left:") + x + "px; width:" + boxWidth + "px; height:" + h + "px;" + (style || "") + '"></div>';
4155
4158
  d.innerHTML = html;
4156
4159
  var container = d.cloneNode(true).firstChild;
@@ -4924,7 +4927,8 @@
4924
4927
  return node.innerHTML || "";
4925
4928
  }, focus: function(node) {
4926
4929
  } }, textarea: { render: function(sns) {
4927
- return "<div class='dhx_cal_ltext'><textarea></textarea></div>";
4930
+ const placeholder = sns.placeholder ? `placeholder='${sns.placeholder}'` : "";
4931
+ return `<div class='dhx_cal_ltext'><textarea ${placeholder}></textarea></div>`;
4928
4932
  }, set_value: function(node, value, ev) {
4929
4933
  scheduler2.form_blocks.textarea._get_input(node).value = value || "";
4930
4934
  }, get_value: function(node, ev) {
@@ -7496,6 +7500,7 @@
7496
7500
  const monthStart = scheduler2.date.month_start(new Date(date));
7497
7501
  const monthEnd = scheduler2.date.add(scheduler2.date.month_start(new Date(date)), 1, "month");
7498
7502
  let lastDate = scheduler2.date.add(scheduler2.date.month_start(new Date(date)), 1, "month");
7503
+ const currentCalDate = scheduler2.date.date_part(scheduler2._currentDate());
7499
7504
  if (lastDate.getDay() !== 0) {
7500
7505
  lastDate = scheduler2.date.add(scheduler2.date.week_start(lastDate), 1, "week");
7501
7506
  }
@@ -7524,6 +7529,9 @@
7524
7529
  if (currDate.getDay() === 0 || currDate.getDay() === 6) {
7525
7530
  dayElement.classList.add("dhx_cal_datepicker_weekend");
7526
7531
  }
7532
+ if (currDate.valueOf() == currentCalDate.valueOf()) {
7533
+ dayElement.classList.add("dhx_now");
7534
+ }
7527
7535
  if (minSchedulerDate && maxSchedulerDate) {
7528
7536
  if (currDate.valueOf() >= minSchedulerDate.valueOf() && currDate.valueOf() < maxSchedulerDate.valueOf()) {
7529
7537
  dayElement.classList.add("dhx_cal_datepicker_current");
@@ -7616,7 +7624,7 @@
7616
7624
  }
7617
7625
  }
7618
7626
  function factoryMethod(extensionManager) {
7619
- const scheduler2 = { version: "7.0.3" };
7627
+ const scheduler2 = { version: "7.0.5" };
7620
7628
  extend$n(scheduler2);
7621
7629
  extend$i(scheduler2);
7622
7630
  extend$j(scheduler2);
@@ -8043,6 +8051,11 @@
8043
8051
  scheduler2._els["dhx_cal_data"][0].innerHTML = html;
8044
8052
  }
8045
8053
  scheduler2._els["dhx_cal_data"][0].scrollTop = scrollTop;
8054
+ let t = scheduler2._els["dhx_cal_data"][0].querySelectorAll(".dhx_cal_agenda_event_line");
8055
+ scheduler2._rendered = [];
8056
+ for (var i = 0; i < t.length - 1; i++) {
8057
+ scheduler2._rendered[i] = t[i];
8058
+ }
8046
8059
  }
8047
8060
  function renderEmptyView() {
8048
8061
  return `<div class="dhx_cal_agenda_no_events">${scheduler2.locale.labels.agenda_tab}</div>`;
@@ -9336,7 +9349,7 @@
9336
9349
  div.style.width = scheduler2._cols[dayIndex] + "px";
9337
9350
  div.style.height = (scheduler2._colsS.heights[weekNumber + 1] - top || scheduler2._colsS.height) + "px";
9338
9351
  var container = scheduler2.$container.querySelector(".dhx_cal_data");
9339
- var datatable = container.querySelector("table");
9352
+ var datatable = container.querySelector(".dhx_cal_month_table");
9340
9353
  if (datatable.nextSibling) {
9341
9354
  container.insertBefore(div, datatable.nextSibling);
9342
9355
  } else {
@@ -10922,7 +10935,17 @@
10922
10935
  function mousedownHandler(e) {
10923
10936
  if (!scheduler2.config.key_nav)
10924
10937
  return true;
10925
- var dataAreaClick = scheduler2.$keyboardNavigation.isChildOf(e.target || e.srcElement, scheduler2.$container.querySelector(".dhx_cal_data"));
10938
+ const view = scheduler2.getView();
10939
+ let dataAreaClick = false;
10940
+ if (scheduler2.getState().mode === "month") {
10941
+ dataAreaClick = scheduler2.$keyboardNavigation.isChildOf(e.target || e.srcElement, scheduler2.$container.querySelector(".dhx_cal_month_table"));
10942
+ } else if (view && view.layout === "timeline") {
10943
+ dataAreaClick = scheduler2.$keyboardNavigation.isChildOf(e.target || e.srcElement, scheduler2.$container.querySelector(".dhx_timeline_data_col"));
10944
+ } else {
10945
+ const listOfScales = scheduler2.$container.querySelectorAll(".dhx_scale_holder");
10946
+ const arrOfScales = Array.from(listOfScales);
10947
+ dataAreaClick = arrOfScales.some((scale) => scale === e.target.parentNode);
10948
+ }
10926
10949
  var pos = scheduler2.getActionData(e);
10927
10950
  var focusNode;
10928
10951
  if (scheduler2._locate_event(e.target || e.srcElement)) {