dhtmlx-scheduler 7.1.2 → 7.1.3

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,7 +1,16 @@
1
1
  (function(global2, factory) {
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.dhtmlxscheduler = {}));
3
3
  })(this, function(exports2) {
4
- "use strict";
4
+ "use strict";/** @license
5
+
6
+ dhtmlxScheduler v.7.1.3 Standard
7
+
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
+
10
+ (c) XB Software Ltd.
11
+
12
+ */
13
+
5
14
  function dhtmlxHook() {
6
15
  if (typeof dhtmlx != "undefined" && dhtmlx.attaches) {
7
16
  dhtmlx.attaches.attachScheduler = function(day, mode, tabs, scheduler2) {
@@ -138,7 +147,7 @@
138
147
  let unitMarkersArray = [];
139
148
  const { event: event3, layout, viewName, eventNode: eventNode2 } = settings;
140
149
  let sectionPropertyName = checkSectionPropertyName(viewName);
141
- if (scheduler2.config.multisection && sectionPropertyName) {
150
+ if (sectionPropertyName) {
142
151
  const sections = String(event3[sectionPropertyName]).split(scheduler2.config.section_delimiter);
143
152
  const formatedSections = sections.map((element) => String(element));
144
153
  const elems = [];
@@ -3193,7 +3202,7 @@
3193
3202
  } else {
3194
3203
  excludedDuration += intervalEnd.getHours() * 60 * 60 * 1e3 + intervalEnd.getMinutes() * 60 * 1e3;
3195
3204
  }
3196
- if (intervalStart.valueOf() < leftCellCutOffEnd.valueOf()) {
3205
+ if (intervalStart.valueOf() <= leftCellCutOffEnd.valueOf()) {
3197
3206
  excludedDuration += config._end_correction;
3198
3207
  }
3199
3208
  if (intervalStart.valueOf() < leftCellCutOffStart.valueOf()) {
@@ -8481,7 +8490,7 @@
8481
8490
  }
8482
8491
  class DatePicker {
8483
8492
  constructor(scheduler2, container, state = {}) {
8484
- this.state = { date: /* @__PURE__ */ new Date(), modes: ["days", "months", "years"], currentRange: [], eventDates: [], currentModeIndex: 0, ...state };
8493
+ this.state = { date: /* @__PURE__ */ new Date(), modes: ["days", "months", "years"], currentRange: [], eventDates: [], filterDays: null, currentModeIndex: 0, ...state };
8485
8494
  this.container = null;
8486
8495
  this.element = null;
8487
8496
  this.onStateChangeHandlers = [];
@@ -8589,19 +8598,21 @@
8589
8598
  }
8590
8599
  }
8591
8600
  _renderDayGridHeader(daysOfWeekContainer) {
8592
- const { date } = this.getState();
8601
+ const { date, filterDays } = this.getState();
8593
8602
  const scheduler2 = this.scheduler;
8594
8603
  let currentDate = scheduler2.date.week_start(new Date(date));
8595
8604
  const maxDate = scheduler2.date.add(scheduler2.date.week_start(new Date(date)), 1, "week");
8596
8605
  daysOfWeekContainer.classList.add("dhx_cal_datepicker_days");
8597
8606
  const labelFormat = scheduler2.date.date_to_str("%D");
8598
8607
  while (currentDate.valueOf() < maxDate.valueOf()) {
8599
- const label = labelFormat(currentDate);
8600
- const dayElement = document.createElement("div");
8601
- dayElement.setAttribute("data-day", currentDate.getDay());
8602
- dayElement.classList.add("dhx_cal_datepicker_dayname");
8603
- dayElement.innerText = label;
8604
- daysOfWeekContainer.appendChild(dayElement);
8608
+ if (!(filterDays && filterDays(currentDate))) {
8609
+ const label = labelFormat(currentDate);
8610
+ const dayElement = document.createElement("div");
8611
+ dayElement.setAttribute("data-day", currentDate.getDay());
8612
+ dayElement.classList.add("dhx_cal_datepicker_dayname");
8613
+ dayElement.innerText = label;
8614
+ daysOfWeekContainer.appendChild(dayElement);
8615
+ }
8605
8616
  currentDate = scheduler2.date.add(currentDate, 1, "day");
8606
8617
  }
8607
8618
  }
@@ -8616,7 +8627,7 @@
8616
8627
  return weeks;
8617
8628
  }
8618
8629
  _renderDayGrid(container) {
8619
- const { date, currentRange, eventDates, minWeeks } = this.getState();
8630
+ const { date, currentRange, eventDates, minWeeks, filterDays } = this.getState();
8620
8631
  let minSchedulerDate = currentRange[0];
8621
8632
  let maxSchedulerDate = currentRange[1];
8622
8633
  const eventDaysTable = eventDates.reduce((acc, date2) => {
@@ -8626,7 +8637,11 @@
8626
8637
  }, {});
8627
8638
  const daysOfWeekContainer = document.createElement("div");
8628
8639
  this._renderDayGridHeader(daysOfWeekContainer);
8640
+ const weekLength = daysOfWeekContainer.children.length;
8629
8641
  container.appendChild(daysOfWeekContainer);
8642
+ if (weekLength !== 7) {
8643
+ container.style.setProperty("--dhx-scheduler-week-length", weekLength);
8644
+ }
8630
8645
  const scheduler2 = this.scheduler;
8631
8646
  const firstDate = scheduler2.date.week_start(scheduler2.date.month_start(new Date(date)));
8632
8647
  const monthStart = scheduler2.date.month_start(new Date(date));
@@ -8649,31 +8664,33 @@
8649
8664
  this.callEvent("onDateClick", [date2, event2]);
8650
8665
  });
8651
8666
  while (currDate.valueOf() < lastDate.valueOf()) {
8652
- const dayElement = document.createElement("div");
8653
- dayElement.setAttribute("data-cell-date", scheduler2.templates.format_date(currDate));
8654
- dayElement.setAttribute("data-day", currDate.getDay());
8655
- dayElement.innerHTML = currDate.getDate();
8656
- if (currDate.valueOf() < monthStart.valueOf()) {
8657
- dayElement.classList.add("dhx_before");
8658
- } else if (currDate.valueOf() >= monthEnd.valueOf()) {
8659
- dayElement.classList.add("dhx_after");
8660
- }
8661
- if (currDate.getDay() === 0 || currDate.getDay() === 6) {
8662
- dayElement.classList.add("dhx_cal_datepicker_weekend");
8663
- }
8664
- if (currDate.valueOf() == currentCalDate.valueOf()) {
8665
- dayElement.classList.add("dhx_now");
8666
- }
8667
- if (minSchedulerDate && maxSchedulerDate) {
8668
- if (currDate.valueOf() >= minSchedulerDate.valueOf() && currDate.valueOf() < maxSchedulerDate.valueOf()) {
8669
- dayElement.classList.add("dhx_cal_datepicker_current");
8667
+ if (!(filterDays && filterDays(currDate))) {
8668
+ const dayElement = document.createElement("div");
8669
+ dayElement.setAttribute("data-cell-date", scheduler2.templates.format_date(currDate));
8670
+ dayElement.setAttribute("data-day", currDate.getDay());
8671
+ dayElement.innerHTML = currDate.getDate();
8672
+ if (currDate.valueOf() < monthStart.valueOf()) {
8673
+ dayElement.classList.add("dhx_before");
8674
+ } else if (currDate.valueOf() >= monthEnd.valueOf()) {
8675
+ dayElement.classList.add("dhx_after");
8676
+ }
8677
+ if (currDate.getDay() === 0 || currDate.getDay() === 6) {
8678
+ dayElement.classList.add("dhx_cal_datepicker_weekend");
8679
+ }
8680
+ if (currDate.valueOf() == currentCalDate.valueOf()) {
8681
+ dayElement.classList.add("dhx_now");
8682
+ }
8683
+ if (minSchedulerDate && maxSchedulerDate) {
8684
+ if (currDate.valueOf() >= minSchedulerDate.valueOf() && currDate.valueOf() < maxSchedulerDate.valueOf()) {
8685
+ dayElement.classList.add("dhx_cal_datepicker_current");
8686
+ }
8670
8687
  }
8688
+ if (eventDaysTable[currDate.valueOf()]) {
8689
+ dayElement.classList.add("dhx_cal_datepicker_event");
8690
+ }
8691
+ dayElement.classList.add("dhx_cal_datepicker_date");
8692
+ dayGridContainer.appendChild(dayElement);
8671
8693
  }
8672
- if (eventDaysTable[currDate.valueOf()]) {
8673
- dayElement.classList.add("dhx_cal_datepicker_event");
8674
- }
8675
- dayElement.classList.add("dhx_cal_datepicker_date");
8676
- dayGridContainer.appendChild(dayElement);
8677
8694
  currDate = scheduler2.date.add(currDate, 1, "day");
8678
8695
  }
8679
8696
  container.appendChild(dayGridContainer);
@@ -8756,7 +8773,7 @@
8756
8773
  }
8757
8774
  }
8758
8775
  function factoryMethod(extensionManager) {
8759
- const scheduler2 = { version: "7.1.2" };
8776
+ const scheduler2 = { version: "7.1.3" };
8760
8777
  scheduler2.$stateProvider = StateService();
8761
8778
  scheduler2.getState = scheduler2.$stateProvider.getState;
8762
8779
  extend$n(scheduler2);
@@ -9181,6 +9198,9 @@
9181
9198
  } else {
9182
9199
  let html = "";
9183
9200
  for (let day in eventsInDays) {
9201
+ if (scheduler2.ignore_agenda && scheduler2.ignore_agenda(new Date(day * 1))) {
9202
+ continue;
9203
+ }
9184
9204
  html += renderDay(new Date(day * 1), eventsInDays[day]);
9185
9205
  }
9186
9206
  scheduler2._els["dhx_cal_data"][0].innerHTML = html;
@@ -9200,7 +9220,7 @@
9200
9220
  return "";
9201
9221
  }
9202
9222
  let html = `
9203
- <div class="dhx_cal_agenda_day">
9223
+ <div class="dhx_cal_agenda_day" data-date="${scheduler2.templates.format_date(day)}" data-day="${day.getDay()}">
9204
9224
  <div class="dhx_cal_agenda_day_header">${scheduler2.templates.agenda_day(day)}</div>
9205
9225
  <div class="dhx_cal_agenda_day_events">
9206
9226
  `;
@@ -13939,6 +13959,9 @@
13939
13959
  end_date = scheduler2.date.date_part(obj.end_date);
13940
13960
  if (+end_date == +start_date || +end_date >= +start_date && (ev.end_date.getHours() !== 0 || ev.end_date.getMinutes() !== 0))
13941
13961
  end_date = scheduler2.date.add(end_date, 1, "day");
13962
+ } else {
13963
+ start_date = null;
13964
+ end_date = null;
13942
13965
  }
13943
13966
  var start = start_date || ev.start_date;
13944
13967
  var end = end_date || ev.end_date;
@@ -17686,6 +17709,12 @@
17686
17709
  scheduler2.addEvent(nev);
17687
17710
  scheduler2._not_render = false;
17688
17711
  }
17712
+ function toUTCDate(date) {
17713
+ return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()));
17714
+ }
17715
+ function setUTCPartsToDate(d) {
17716
+ return new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds());
17717
+ }
17689
17718
  scheduler2._rec_temp = [];
17690
17719
  scheduler2._rec_markers_pull = {};
17691
17720
  scheduler2._rec_markers = {};
@@ -17984,22 +18013,17 @@
17984
18013
  if (!seriesExceptions) {
17985
18014
  seriesExceptions = {};
17986
18015
  }
17987
- if (!from) {
17988
- from = scheduler2._min_date;
17989
- }
17990
- if (!to) {
17991
- to = scheduler2._max_date;
17992
- }
17993
- 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()));
18016
+ from = toUTCDate(from || new Date(scheduler2._min_date.valueOf() - 1e3));
18017
+ to = toUTCDate(to || new Date(scheduler2._max_date.valueOf() - 1e3));
18018
+ const utcStart = toUTCDate(ev.start_date);
17994
18019
  let parsedRRule;
17995
18020
  if (maxCount) {
17996
18021
  parsedRRule = rrulestr(`RRULE:${ev.rrule};UNTIL=${toIcalString(ev.end_date)};COUNT=${maxCount}`, { dtstart: utcStart });
17997
18022
  } else {
17998
18023
  parsedRRule = rrulestr(`RRULE:${ev.rrule};UNTIL=${toIcalString(ev.end_date)}`, { dtstart: utcStart });
17999
18024
  }
18000
- const utcTo = new Date(Date.UTC(to.getFullYear(), to.getMonth(), to.getDate(), to.getHours(), to.getMinutes(), to.getSeconds()));
18001
- const repeatedDates = parsedRRule.between(from, utcTo).map((date) => {
18002
- const adjustedDate = new Date(date);
18025
+ const repeatedDates = parsedRRule.between(from, to, true).map((date) => {
18026
+ const adjustedDate = setUTCPartsToDate(date);
18003
18027
  adjustedDate.setHours(ev.start_date.getHours());
18004
18028
  adjustedDate.setMinutes(ev.start_date.getMinutes());
18005
18029
  adjustedDate.setSeconds(ev.start_date.getSeconds());
@@ -20259,7 +20283,7 @@
20259
20283
  yearBox.innerHTML = `<div class='dhx_year_month'>${this.templates.year_month(currentDate)}</div>
20260
20284
  <div class='dhx_year_grid'></div>`;
20261
20285
  const yearGrid = yearBox.querySelector(".dhx_year_grid");
20262
- const datepicker = scheduler2._createDatePicker(null, { date: currentDate, minWeeks: 6 });
20286
+ const datepicker = scheduler2._createDatePicker(null, { date: currentDate, filterDays: scheduler2.ignore_year, minWeeks: 6 });
20263
20287
  datepicker._renderDayGrid(yearGrid);
20264
20288
  datepicker.destructor();
20265
20289
  wrapper.appendChild(yearBox);