dhtmlx-scheduler 7.2.3 → 7.2.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.
@@ -1,3 +1,4 @@
1
+ @charset "UTF-8";
1
2
  @font-face {
2
3
  font-family: 'Inter';
3
4
  font-style: normal;
@@ -1,6 +1,6 @@
1
1
  /** @license
2
2
 
3
- dhtmlxScheduler v.7.2.3 Standard
3
+ dhtmlxScheduler v.7.2.5 Standard
4
4
 
5
5
  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
6
6
 
@@ -2683,6 +2683,13 @@ function extend$j(scheduler2) {
2683
2683
  end = scheduler2.date.date_part(new Date(end));
2684
2684
  end = new Date(end * 1 - obj._end_correction);
2685
2685
  }
2686
+ if (obj.round_position && scheduler2["ignore_" + scheduler2._mode] && obj.x_unit == "day") {
2687
+ const ignore = this["ignore_" + this._mode];
2688
+ let tempEnd = scheduler2.date.add(new Date(end), -obj.x_step, obj.x_unit);
2689
+ if (ignore(tempEnd)) {
2690
+ end = tempEnd;
2691
+ }
2692
+ }
2686
2693
  }
2687
2694
  } else {
2688
2695
  if (pos.resize_from_start) {
@@ -2723,8 +2730,17 @@ function extend$j(scheduler2) {
2723
2730
  start = this._drag_start;
2724
2731
  }
2725
2732
  } else {
2726
- if (end <= start)
2727
- end = start + timeStep * 6e4;
2733
+ if (end <= start) {
2734
+ if (obj && obj.round_position) {
2735
+ if (obj.x_unit == "hour" || obj.x_unit == "minute") {
2736
+ end = scheduler2.date.add(start, obj.x_step, obj.x_unit);
2737
+ } else {
2738
+ end = scheduler2.date.add(scheduler2.date.date_part(new Date(start)), 1, obj.x_unit);
2739
+ }
2740
+ } else {
2741
+ end = start + timeStep * 6e4;
2742
+ }
2743
+ }
2728
2744
  }
2729
2745
  }
2730
2746
  var new_end = new Date(end - 1);
@@ -2803,6 +2819,14 @@ function extend$j(scheduler2) {
2803
2819
  new_end = new Date(end - 1);
2804
2820
  }
2805
2821
  }
2822
+ if (this._table_view && scheduler2["ignore_" + this._mode] && (this._drag_mode == "resize" || this._drag_mode == "new-size") && +end > +scheduler2._max_date) {
2823
+ end = new Date(scheduler2._max_date);
2824
+ const ignore = this["ignore_" + this._mode];
2825
+ while (ignore(end)) {
2826
+ end = scheduler2.date.add(end, -obj.x_step, obj.x_unit);
2827
+ }
2828
+ end = scheduler2.date.add(end, obj.x_step, obj.x_unit);
2829
+ }
2806
2830
  if (this._table_view || new_end.getDate() == new_start.getDate() && new_end.getHours() < this.config.last_hour || scheduler2._allow_dnd) {
2807
2831
  ev.start_date = new_start;
2808
2832
  ev.end_date = new Date(end);
@@ -3313,8 +3337,8 @@ function extend$j(scheduler2) {
3313
3337
  scheduler2._render_month_scale = function(div, dd, sd, rows) {
3314
3338
  var ed = scheduler2.date.add(dd, 1, "month"), view_start = new Date(sd);
3315
3339
  var cd = scheduler2._currentDate();
3316
- this.date.date_part(cd);
3317
- this.date.date_part(sd);
3340
+ cd = this.date.date_part(cd);
3341
+ sd = this.date.date_part(sd);
3318
3342
  rows = rows || Math.ceil(Math.round((ed.valueOf() - sd.valueOf()) / (60 * 60 * 24 * 1e3)) / 7);
3319
3343
  var tdwidths = [];
3320
3344
  for (var i = 0; i <= 7; i++) {
@@ -3399,9 +3423,7 @@ function extend$j(scheduler2) {
3399
3423
  };
3400
3424
  scheduler2._reset_month_scale = function(b, dd, sd, rows) {
3401
3425
  var ed = scheduler2.date.add(dd, 1, "month");
3402
- var cd = scheduler2._currentDate();
3403
- this.date.date_part(cd);
3404
- this.date.date_part(sd);
3426
+ sd = this.date.date_part(sd);
3405
3427
  rows = rows || Math.ceil(Math.round((ed.valueOf() - sd.valueOf()) / (60 * 60 * 24 * 1e3)) / 7);
3406
3428
  var height = Math.floor(b.clientHeight / rows) - this.xy.month_head_height;
3407
3429
  this._colsS.height = height + this.xy.month_head_height;
@@ -3581,7 +3603,11 @@ function extend$j(scheduler2) {
3581
3603
  } else {
3582
3604
  end_slot = Math.round(ev_length / 60 / 60 / 1e3 / 24);
3583
3605
  }
3584
- while (start_slot * dir <= end_slot * dir) {
3606
+ function condition() {
3607
+ const isDayUnit = obj.x_unit === "day";
3608
+ return isDayUnit ? start_slot * dir < end_slot * dir : start_slot * dir <= end_slot * dir;
3609
+ }
3610
+ while (condition()) {
3585
3611
  var check = scheduler2.date.add(sd, obj.x_step * dir, obj.x_unit);
3586
3612
  if (ignore && ignore(sd)) {
3587
3613
  ev_length += (check - sd) * dir;
@@ -4743,7 +4769,7 @@ function extend$e(scheduler2) {
4743
4769
  } };
4744
4770
  }
4745
4771
  function extend$d(scheduler2) {
4746
- scheduler2.config = { default_date: "%j %M %Y", month_date: "%F %Y", load_date: "%Y-%m-%d", week_date: "%l", day_date: "%D %j", hour_date: "%H:%i", month_day: "%d", date_format: "%Y-%m-%d %H:%i", api_date: "%d-%m-%Y %H:%i", parse_exact_format: false, preserve_length: true, time_step: 5, displayed_event_color: "#ff4a4a", displayed_event_text_color: "#ffef80", wide_form: 0, day_column_padding: 8, use_select_menu_space: true, fix_tab_position: true, start_on_monday: true, first_hour: 0, last_hour: 24, readonly: false, drag_resize: true, drag_move: true, drag_create: true, drag_event_body: true, dblclick_create: true, details_on_dblclick: true, edit_on_create: true, details_on_create: true, header: null, hour_size_px: 44, resize_month_events: false, resize_month_timed: false, responsive_lightbox: false, separate_short_events: true, rtl: false, cascade_event_display: false, cascade_event_count: 4, cascade_event_margin: 30, multi_day: true, multi_day_height_limit: 200, drag_lightbox: true, preserve_scroll: true, select: true, undo_deleted: true, server_utc: false, touch: true, touch_tip: true, touch_drag: 500, touch_swipe_dates: false, quick_info_detached: true, positive_closing: false, drag_highlight: true, limit_drag_out: false, icons_edit: ["icon_save", "icon_cancel"], icons_select: ["icon_details", "icon_edit", "icon_delete"], buttons_left: ["dhx_save_btn", "dhx_cancel_btn"], buttons_right: ["dhx_delete_btn"], lightbox: { sections: [{ name: "description", map_to: "text", type: "textarea", focus: true }, { name: "time", height: 72, type: "time", map_to: "auto" }] }, highlight_displayed_event: true, left_border: false, ajax_error: "alert", delay_render: 0, timeline_swap_resize: true, wai_aria_attributes: true, wai_aria_application_role: true, csp: "auto", event_attribute: "data-event-id", show_errors: true };
4772
+ scheduler2.config = { default_date: "%j %M %Y", month_date: "%F %Y", load_date: "%Y-%m-%d", week_date: "%l", day_date: "%D %j", hour_date: "%H:%i", month_day: "%d", date_format: "%Y-%m-%d %H:%i", api_date: "%d-%m-%Y %H:%i", parse_exact_format: false, preserve_length: true, time_step: 5, displayed_event_color: "#ff4a4a", displayed_event_text_color: "#ffef80", wide_form: 0, day_column_padding: 8, use_select_menu_space: true, fix_tab_position: true, start_on_monday: true, first_hour: 0, last_hour: 24, readonly: false, drag_resize: true, drag_move: true, drag_create: true, drag_event_body: true, dblclick_create: true, details_on_dblclick: true, edit_on_create: true, details_on_create: true, header: null, hour_size_px: 44, resize_month_events: false, resize_month_timed: false, responsive_lightbox: false, separate_short_events: true, rtl: false, cascade_event_display: false, cascade_event_count: 4, cascade_event_margin: 30, multi_day: true, multi_day_height_limit: 200, drag_lightbox: true, preserve_scroll: true, select: true, undo_deleted: true, server_utc: false, touch: true, touch_tip: true, touch_drag: 500, touch_swipe_dates: false, quick_info_detached: true, positive_closing: false, drag_highlight: true, limit_drag_out: false, icons_edit: ["icon_save", "icon_cancel"], icons_select: ["icon_details", "icon_edit", "icon_delete"], buttons_right: ["dhx_save_btn", "dhx_cancel_btn"], buttons_left: ["dhx_delete_btn"], lightbox: { sections: [{ name: "description", map_to: "text", type: "textarea", focus: true }, { name: "time", height: 72, type: "time", map_to: "auto" }] }, highlight_displayed_event: true, left_border: false, ajax_error: "alert", delay_render: 0, timeline_swap_resize: true, wai_aria_attributes: true, wai_aria_application_role: true, csp: "auto", event_attribute: "data-event-id", show_errors: true };
4747
4773
  scheduler2.config.buttons_left.$initial = scheduler2.config.buttons_left.join();
4748
4774
  scheduler2.config.buttons_right.$initial = scheduler2.config.buttons_right.join();
4749
4775
  scheduler2._helpers = { parseDate: function parseDate(date) {
@@ -6858,6 +6884,37 @@ function extend$6(scheduler2) {
6858
6884
  break;
6859
6885
  }
6860
6886
  });
6887
+ function getDaysInMonth(year, month) {
6888
+ return new Date(year, month + 1, 0).getDate();
6889
+ }
6890
+ scheduler2.event(lightbox, "click", function(e) {
6891
+ if (e.target.closest(".dhx_lightbox_day_select") || e.target.closest(".dhx_lightbox_month_select")) {
6892
+ const monthSelectNodes = lightbox.querySelectorAll(".dhx_lightbox_month_select");
6893
+ const daySelectNodes = lightbox.querySelectorAll(".dhx_lightbox_day_select");
6894
+ const yearSelectNodes = lightbox.querySelectorAll(".dhx_lightbox_year_select");
6895
+ if (monthSelectNodes.length && daySelectNodes.length && yearSelectNodes) {
6896
+ monthSelectNodes.forEach((select, i) => {
6897
+ const daySelect = daySelectNodes[i];
6898
+ const month = parseInt(select.value, 10);
6899
+ let year = parseInt(yearSelectNodes[i].value, 10);
6900
+ if (!year) {
6901
+ year = new Date(scheduler2.getState().date).getFullYear();
6902
+ }
6903
+ const daysInMonth = getDaysInMonth(year, month);
6904
+ const maxDays = daysInMonth || 31;
6905
+ let curDayValue = daySelect.value;
6906
+ daySelect.innerHTML = "";
6907
+ for (let day = 1; day <= maxDays; day++) {
6908
+ const option = document.createElement("option");
6909
+ option.value = day;
6910
+ option.textContent = day;
6911
+ daySelect.appendChild(option);
6912
+ }
6913
+ daySelect.value = Math.min(curDayValue, maxDays);
6914
+ });
6915
+ }
6916
+ }
6917
+ });
6861
6918
  };
6862
6919
  scheduler2.setLightboxSize = function() {
6863
6920
  return;
@@ -6906,14 +6963,14 @@ function extend$6(scheduler2) {
6906
6963
  d.className += " dhx_cal_light_responsive";
6907
6964
  d.style.visibility = "hidden";
6908
6965
  var html = this._lightbox_template;
6909
- var buttons = this.config.buttons_left;
6966
+ var buttons = this.config.buttons_right;
6910
6967
  html += "<div class='dhx_cal_lcontrols'>";
6911
6968
  var ariaAttr = "";
6912
6969
  for (var i = 0; i < buttons.length; i++) {
6913
6970
  ariaAttr = this._waiAria.lightboxButtonAttrString(buttons[i]);
6914
6971
  html += "<div " + ariaAttr + " data-action='" + buttons[i] + "' class='dhx_btn_set dhx_" + (scheduler2.config.rtl ? "right" : "left") + "_btn_set " + buttons[i] + "_set'><div class='dhx_btn_inner " + buttons[i] + "'></div><div>" + scheduler2.locale.labels[buttons[i]] + "</div></div>";
6915
6972
  }
6916
- buttons = this.config.buttons_right;
6973
+ buttons = this.config.buttons_left;
6917
6974
  var rtl = scheduler2.config.rtl;
6918
6975
  for (var i = 0; i < buttons.length; i++) {
6919
6976
  ariaAttr = this._waiAria.lightboxButtonAttrString(buttons[i]);
@@ -9139,7 +9196,7 @@ class DatePicker {
9139
9196
  }
9140
9197
  }
9141
9198
  function factoryMethod(extensionManager) {
9142
- const scheduler2 = { version: "7.2.3" };
9199
+ const scheduler2 = { version: "7.2.5" };
9143
9200
  scheduler2.$stateProvider = StateService();
9144
9201
  scheduler2.getState = scheduler2.$stateProvider.getState;
9145
9202
  extend$n(scheduler2);
@@ -10013,9 +10070,13 @@ function container_autoresize(scheduler2) {
10013
10070
  height = 190 * scheduler2.config.year_y;
10014
10071
  } else if (mode == "agenda") {
10015
10072
  height = 0;
10016
- if (checked_div.childNodes && checked_div.childNodes.length) {
10017
- for (var j = 0; j < checked_div.childNodes.length; j++) {
10018
- height += checked_div.childNodes[j].offsetHeight;
10073
+ if (checked_div.children && checked_div.children.length) {
10074
+ if (checked_div.children.length === 1 && checked_div.children[0].classList.contains("dhx_cal_agenda_no_events")) {
10075
+ height = 300;
10076
+ } else {
10077
+ for (var j = 0; j < checked_div.children.length; j++) {
10078
+ height += checked_div.children[j].offsetHeight;
10079
+ }
10019
10080
  }
10020
10081
  }
10021
10082
  if (height + 2 < scheduler2.config.min_grid_size) {
@@ -20641,6 +20702,12 @@ class Tooltip {
20641
20702
  tooltip2.top = mouse.y - tooltip2.height - offsetY;
20642
20703
  tooltip2.bottom = tooltip2.top + tooltip2.height;
20643
20704
  }
20705
+ if (tooltip2.left < 0) {
20706
+ tooltip2.left = 0;
20707
+ }
20708
+ if (tooltip2.right < 0) {
20709
+ tooltip2.right = 0;
20710
+ }
20644
20711
  return tooltip2;
20645
20712
  }
20646
20713
  _getViewPortSize() {