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.
@@ -3285,7 +3285,7 @@ div.dhx_timeline_label_column_header .dhx_timeline_label_content_wrapper {
3285
3285
  }
3286
3286
  .dhx_cal_datepicker_days {
3287
3287
  display: grid;
3288
- grid-template-columns: repeat(7, 1fr);
3288
+ grid-template-columns: repeat(var(--dhx-scheduler-week-length, 7), 1fr);
3289
3289
  gap: 4px;
3290
3290
  }
3291
3291
  .dhx_cal_datepicker_dayname,
@@ -1,3 +1,12 @@
1
+ /** @license
2
+
3
+ dhtmlxScheduler v.7.1.3 Standard
4
+
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
+
7
+ (c) XB Software Ltd.
8
+
9
+ */
1
10
  function dhtmlxHook() {
2
11
  if (typeof dhtmlx != "undefined" && dhtmlx.attaches) {
3
12
  dhtmlx.attaches.attachScheduler = function(day, mode, tabs, scheduler2) {
@@ -134,7 +143,7 @@ function dragHighlightPos(scheduler2) {
134
143
  let unitMarkersArray = [];
135
144
  const { event: event3, layout, viewName, eventNode: eventNode2 } = settings;
136
145
  let sectionPropertyName = checkSectionPropertyName(viewName);
137
- if (scheduler2.config.multisection && sectionPropertyName) {
146
+ if (sectionPropertyName) {
138
147
  const sections = String(event3[sectionPropertyName]).split(scheduler2.config.section_delimiter);
139
148
  const formatedSections = sections.map((element) => String(element));
140
149
  const elems = [];
@@ -3189,7 +3198,7 @@ function extend$j(scheduler2) {
3189
3198
  } else {
3190
3199
  excludedDuration += intervalEnd.getHours() * 60 * 60 * 1e3 + intervalEnd.getMinutes() * 60 * 1e3;
3191
3200
  }
3192
- if (intervalStart.valueOf() < leftCellCutOffEnd.valueOf()) {
3201
+ if (intervalStart.valueOf() <= leftCellCutOffEnd.valueOf()) {
3193
3202
  excludedDuration += config._end_correction;
3194
3203
  }
3195
3204
  if (intervalStart.valueOf() < leftCellCutOffStart.valueOf()) {
@@ -8477,7 +8486,7 @@ function i18nFactory() {
8477
8486
  }
8478
8487
  class DatePicker {
8479
8488
  constructor(scheduler2, container, state = {}) {
8480
- this.state = { date: /* @__PURE__ */ new Date(), modes: ["days", "months", "years"], currentRange: [], eventDates: [], currentModeIndex: 0, ...state };
8489
+ this.state = { date: /* @__PURE__ */ new Date(), modes: ["days", "months", "years"], currentRange: [], eventDates: [], filterDays: null, currentModeIndex: 0, ...state };
8481
8490
  this.container = null;
8482
8491
  this.element = null;
8483
8492
  this.onStateChangeHandlers = [];
@@ -8585,19 +8594,21 @@ class DatePicker {
8585
8594
  }
8586
8595
  }
8587
8596
  _renderDayGridHeader(daysOfWeekContainer) {
8588
- const { date } = this.getState();
8597
+ const { date, filterDays } = this.getState();
8589
8598
  const scheduler2 = this.scheduler;
8590
8599
  let currentDate = scheduler2.date.week_start(new Date(date));
8591
8600
  const maxDate = scheduler2.date.add(scheduler2.date.week_start(new Date(date)), 1, "week");
8592
8601
  daysOfWeekContainer.classList.add("dhx_cal_datepicker_days");
8593
8602
  const labelFormat = scheduler2.date.date_to_str("%D");
8594
8603
  while (currentDate.valueOf() < maxDate.valueOf()) {
8595
- const label = labelFormat(currentDate);
8596
- const dayElement = document.createElement("div");
8597
- dayElement.setAttribute("data-day", currentDate.getDay());
8598
- dayElement.classList.add("dhx_cal_datepicker_dayname");
8599
- dayElement.innerText = label;
8600
- daysOfWeekContainer.appendChild(dayElement);
8604
+ if (!(filterDays && filterDays(currentDate))) {
8605
+ const label = labelFormat(currentDate);
8606
+ const dayElement = document.createElement("div");
8607
+ dayElement.setAttribute("data-day", currentDate.getDay());
8608
+ dayElement.classList.add("dhx_cal_datepicker_dayname");
8609
+ dayElement.innerText = label;
8610
+ daysOfWeekContainer.appendChild(dayElement);
8611
+ }
8601
8612
  currentDate = scheduler2.date.add(currentDate, 1, "day");
8602
8613
  }
8603
8614
  }
@@ -8612,7 +8623,7 @@ class DatePicker {
8612
8623
  return weeks;
8613
8624
  }
8614
8625
  _renderDayGrid(container) {
8615
- const { date, currentRange, eventDates, minWeeks } = this.getState();
8626
+ const { date, currentRange, eventDates, minWeeks, filterDays } = this.getState();
8616
8627
  let minSchedulerDate = currentRange[0];
8617
8628
  let maxSchedulerDate = currentRange[1];
8618
8629
  const eventDaysTable = eventDates.reduce((acc, date2) => {
@@ -8622,7 +8633,11 @@ class DatePicker {
8622
8633
  }, {});
8623
8634
  const daysOfWeekContainer = document.createElement("div");
8624
8635
  this._renderDayGridHeader(daysOfWeekContainer);
8636
+ const weekLength = daysOfWeekContainer.children.length;
8625
8637
  container.appendChild(daysOfWeekContainer);
8638
+ if (weekLength !== 7) {
8639
+ container.style.setProperty("--dhx-scheduler-week-length", weekLength);
8640
+ }
8626
8641
  const scheduler2 = this.scheduler;
8627
8642
  const firstDate = scheduler2.date.week_start(scheduler2.date.month_start(new Date(date)));
8628
8643
  const monthStart = scheduler2.date.month_start(new Date(date));
@@ -8645,31 +8660,33 @@ class DatePicker {
8645
8660
  this.callEvent("onDateClick", [date2, event2]);
8646
8661
  });
8647
8662
  while (currDate.valueOf() < lastDate.valueOf()) {
8648
- const dayElement = document.createElement("div");
8649
- dayElement.setAttribute("data-cell-date", scheduler2.templates.format_date(currDate));
8650
- dayElement.setAttribute("data-day", currDate.getDay());
8651
- dayElement.innerHTML = currDate.getDate();
8652
- if (currDate.valueOf() < monthStart.valueOf()) {
8653
- dayElement.classList.add("dhx_before");
8654
- } else if (currDate.valueOf() >= monthEnd.valueOf()) {
8655
- dayElement.classList.add("dhx_after");
8656
- }
8657
- if (currDate.getDay() === 0 || currDate.getDay() === 6) {
8658
- dayElement.classList.add("dhx_cal_datepicker_weekend");
8659
- }
8660
- if (currDate.valueOf() == currentCalDate.valueOf()) {
8661
- dayElement.classList.add("dhx_now");
8662
- }
8663
- if (minSchedulerDate && maxSchedulerDate) {
8664
- if (currDate.valueOf() >= minSchedulerDate.valueOf() && currDate.valueOf() < maxSchedulerDate.valueOf()) {
8665
- dayElement.classList.add("dhx_cal_datepicker_current");
8663
+ if (!(filterDays && filterDays(currDate))) {
8664
+ const dayElement = document.createElement("div");
8665
+ dayElement.setAttribute("data-cell-date", scheduler2.templates.format_date(currDate));
8666
+ dayElement.setAttribute("data-day", currDate.getDay());
8667
+ dayElement.innerHTML = currDate.getDate();
8668
+ if (currDate.valueOf() < monthStart.valueOf()) {
8669
+ dayElement.classList.add("dhx_before");
8670
+ } else if (currDate.valueOf() >= monthEnd.valueOf()) {
8671
+ dayElement.classList.add("dhx_after");
8672
+ }
8673
+ if (currDate.getDay() === 0 || currDate.getDay() === 6) {
8674
+ dayElement.classList.add("dhx_cal_datepicker_weekend");
8675
+ }
8676
+ if (currDate.valueOf() == currentCalDate.valueOf()) {
8677
+ dayElement.classList.add("dhx_now");
8678
+ }
8679
+ if (minSchedulerDate && maxSchedulerDate) {
8680
+ if (currDate.valueOf() >= minSchedulerDate.valueOf() && currDate.valueOf() < maxSchedulerDate.valueOf()) {
8681
+ dayElement.classList.add("dhx_cal_datepicker_current");
8682
+ }
8666
8683
  }
8684
+ if (eventDaysTable[currDate.valueOf()]) {
8685
+ dayElement.classList.add("dhx_cal_datepicker_event");
8686
+ }
8687
+ dayElement.classList.add("dhx_cal_datepicker_date");
8688
+ dayGridContainer.appendChild(dayElement);
8667
8689
  }
8668
- if (eventDaysTable[currDate.valueOf()]) {
8669
- dayElement.classList.add("dhx_cal_datepicker_event");
8670
- }
8671
- dayElement.classList.add("dhx_cal_datepicker_date");
8672
- dayGridContainer.appendChild(dayElement);
8673
8690
  currDate = scheduler2.date.add(currDate, 1, "day");
8674
8691
  }
8675
8692
  container.appendChild(dayGridContainer);
@@ -8752,7 +8769,7 @@ class DatePicker {
8752
8769
  }
8753
8770
  }
8754
8771
  function factoryMethod(extensionManager) {
8755
- const scheduler2 = { version: "7.1.2" };
8772
+ const scheduler2 = { version: "7.1.3" };
8756
8773
  scheduler2.$stateProvider = StateService();
8757
8774
  scheduler2.getState = scheduler2.$stateProvider.getState;
8758
8775
  extend$n(scheduler2);
@@ -9177,6 +9194,9 @@ function agenda_view(scheduler2) {
9177
9194
  } else {
9178
9195
  let html = "";
9179
9196
  for (let day in eventsInDays) {
9197
+ if (scheduler2.ignore_agenda && scheduler2.ignore_agenda(new Date(day * 1))) {
9198
+ continue;
9199
+ }
9180
9200
  html += renderDay(new Date(day * 1), eventsInDays[day]);
9181
9201
  }
9182
9202
  scheduler2._els["dhx_cal_data"][0].innerHTML = html;
@@ -9196,7 +9216,7 @@ function agenda_view(scheduler2) {
9196
9216
  return "";
9197
9217
  }
9198
9218
  let html = `
9199
- <div class="dhx_cal_agenda_day">
9219
+ <div class="dhx_cal_agenda_day" data-date="${scheduler2.templates.format_date(day)}" data-day="${day.getDay()}">
9200
9220
  <div class="dhx_cal_agenda_day_header">${scheduler2.templates.agenda_day(day)}</div>
9201
9221
  <div class="dhx_cal_agenda_day_events">
9202
9222
  `;
@@ -13935,6 +13955,9 @@ function minical(scheduler2) {
13935
13955
  end_date = scheduler2.date.date_part(obj.end_date);
13936
13956
  if (+end_date == +start_date || +end_date >= +start_date && (ev.end_date.getHours() !== 0 || ev.end_date.getMinutes() !== 0))
13937
13957
  end_date = scheduler2.date.add(end_date, 1, "day");
13958
+ } else {
13959
+ start_date = null;
13960
+ end_date = null;
13938
13961
  }
13939
13962
  var start = start_date || ev.start_date;
13940
13963
  var end = end_date || ev.end_date;
@@ -17682,6 +17705,12 @@ function recurring(scheduler2) {
17682
17705
  scheduler2.addEvent(nev);
17683
17706
  scheduler2._not_render = false;
17684
17707
  }
17708
+ function toUTCDate(date) {
17709
+ return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()));
17710
+ }
17711
+ function setUTCPartsToDate(d) {
17712
+ return new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds());
17713
+ }
17685
17714
  scheduler2._rec_temp = [];
17686
17715
  scheduler2._rec_markers_pull = {};
17687
17716
  scheduler2._rec_markers = {};
@@ -17980,22 +18009,17 @@ function recurring(scheduler2) {
17980
18009
  if (!seriesExceptions) {
17981
18010
  seriesExceptions = {};
17982
18011
  }
17983
- if (!from) {
17984
- from = scheduler2._min_date;
17985
- }
17986
- if (!to) {
17987
- to = scheduler2._max_date;
17988
- }
17989
- 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()));
18012
+ from = toUTCDate(from || new Date(scheduler2._min_date.valueOf() - 1e3));
18013
+ to = toUTCDate(to || new Date(scheduler2._max_date.valueOf() - 1e3));
18014
+ const utcStart = toUTCDate(ev.start_date);
17990
18015
  let parsedRRule;
17991
18016
  if (maxCount) {
17992
18017
  parsedRRule = rrulestr(`RRULE:${ev.rrule};UNTIL=${toIcalString(ev.end_date)};COUNT=${maxCount}`, { dtstart: utcStart });
17993
18018
  } else {
17994
18019
  parsedRRule = rrulestr(`RRULE:${ev.rrule};UNTIL=${toIcalString(ev.end_date)}`, { dtstart: utcStart });
17995
18020
  }
17996
- const utcTo = new Date(Date.UTC(to.getFullYear(), to.getMonth(), to.getDate(), to.getHours(), to.getMinutes(), to.getSeconds()));
17997
- const repeatedDates = parsedRRule.between(from, utcTo).map((date) => {
17998
- const adjustedDate = new Date(date);
18021
+ const repeatedDates = parsedRRule.between(from, to, true).map((date) => {
18022
+ const adjustedDate = setUTCPartsToDate(date);
17999
18023
  adjustedDate.setHours(ev.start_date.getHours());
18000
18024
  adjustedDate.setMinutes(ev.start_date.getMinutes());
18001
18025
  adjustedDate.setSeconds(ev.start_date.getSeconds());
@@ -20255,7 +20279,7 @@ function year_view(scheduler2) {
20255
20279
  yearBox.innerHTML = `<div class='dhx_year_month'>${this.templates.year_month(currentDate)}</div>
20256
20280
  <div class='dhx_year_grid'></div>`;
20257
20281
  const yearGrid = yearBox.querySelector(".dhx_year_grid");
20258
- const datepicker = scheduler2._createDatePicker(null, { date: currentDate, minWeeks: 6 });
20282
+ const datepicker = scheduler2._createDatePicker(null, { date: currentDate, filterDays: scheduler2.ignore_year, minWeeks: 6 });
20259
20283
  datepicker._renderDayGrid(yearGrid);
20260
20284
  datepicker.destructor();
20261
20285
  wrapper.appendChild(yearBox);