fullcalendar 6.1.17 → 6.1.19

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.
package/index.global.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- FullCalendar Standard Bundle v6.1.17
2
+ FullCalendar Standard Bundle v6.1.19
3
3
  Docs & License: https://fullcalendar.io/docs/initialize-globals
4
4
  (c) 2024 Adam Shaw
5
5
  */
@@ -1363,6 +1363,7 @@ var FullCalendar = (function (exports) {
1363
1363
  viewDidMount: identity,
1364
1364
  viewWillUnmount: identity,
1365
1365
  nowIndicator: Boolean,
1366
+ nowIndicatorSnap: identity,
1366
1367
  nowIndicatorClassNames: identity,
1367
1368
  nowIndicatorContent: identity,
1368
1369
  nowIndicatorDidMount: identity,
@@ -1545,6 +1546,7 @@ var FullCalendar = (function (exports) {
1545
1546
  eventMinWidth: 30,
1546
1547
  eventShortHeight: 30,
1547
1548
  monthStartFormat: { month: 'long', day: 'numeric' },
1549
+ nowIndicatorSnap: 'auto',
1548
1550
  };
1549
1551
  // calendar listeners
1550
1552
  // ------------------
@@ -1765,6 +1767,25 @@ var FullCalendar = (function (exports) {
1765
1767
  if (oldProps === newProps) {
1766
1768
  return true;
1767
1769
  }
1770
+ // if (debug) {
1771
+ // for (let key in newProps) {
1772
+ // if (key in oldProps && isObjValsEqual(oldProps[key], newProps[key], equalityFuncs[key])) {
1773
+ // // equal
1774
+ // } else {
1775
+ // if (debug) {
1776
+ // console.log('prop difference', key, oldProps[key], newProps[key])
1777
+ // }
1778
+ // }
1779
+ // }
1780
+ // // check for props that were omitted in the new
1781
+ // for (let key in oldProps) {
1782
+ // if (!(key in newProps)) {
1783
+ // if (debug) {
1784
+ // console.log('prop absent', key)
1785
+ // }
1786
+ // }
1787
+ // }
1788
+ // }
1768
1789
  for (let key in newProps) {
1769
1790
  if (key in oldProps && isObjValsEqual(oldProps[key], newProps[key], equalityFuncs[key])) ;
1770
1791
  else {
@@ -2355,13 +2376,14 @@ var FullCalendar = (function (exports) {
2355
2376
 
2356
2377
  /* eslint max-classes-per-file: off */
2357
2378
  class PureComponent extends x$1 {
2379
+ // debug: boolean
2358
2380
  shouldComponentUpdate(nextProps, nextState) {
2359
- if (this.debug) {
2360
- // eslint-disable-next-line no-console
2361
- console.log(getUnequalProps(nextProps, this.props), getUnequalProps(nextState, this.state));
2362
- }
2363
- return !compareObjs(this.props, nextProps, this.propEquality) ||
2364
- !compareObjs(this.state, nextState, this.stateEquality);
2381
+ const shouldUpdate = !compareObjs(this.props, nextProps, this.propEquality /*, this.debug */) ||
2382
+ !compareObjs(this.state, nextState, this.stateEquality /*, this.debug */);
2383
+ // if (this.debug && shouldUpdate) {
2384
+ // console.log('shouldUpdate!')
2385
+ // }
2386
+ return shouldUpdate;
2365
2387
  }
2366
2388
  // HACK for freakin' React StrictMode
2367
2389
  safeSetState(newState) {
@@ -2601,10 +2623,10 @@ var FullCalendar = (function (exports) {
2601
2623
  let { props, context } = this;
2602
2624
  let { options } = context;
2603
2625
  let renderProps = { view: context.viewApi };
2604
- return (y(ContentContainer, Object.assign({}, props, { elTag: props.elTag || 'div', elClasses: [
2626
+ return (y(ContentContainer, { elRef: props.elRef, elTag: props.elTag || 'div', elAttrs: props.elAttrs, elClasses: [
2605
2627
  ...buildViewClassNames(props.viewSpec),
2606
2628
  ...(props.elClasses || []),
2607
- ], renderProps: renderProps, classNameGenerator: options.viewClassNames, generatorName: undefined, didMount: options.viewDidMount, willUnmount: options.viewWillUnmount }), () => props.children));
2629
+ ], elStyle: props.elStyle, renderProps: renderProps, classNameGenerator: options.viewClassNames, generatorName: undefined, didMount: options.viewDidMount, willUnmount: options.viewWillUnmount }, () => props.children));
2608
2630
  }
2609
2631
  }
2610
2632
  function buildViewClassNames(viewSpec) {
@@ -4781,14 +4803,30 @@ var FullCalendar = (function (exports) {
4781
4803
  computeTiming() {
4782
4804
  let { props, context } = this;
4783
4805
  let unroundedNow = context.nowManager.getDateMarker();
4784
- let currentUnitStart = context.dateEnv.startOf(unroundedNow, props.unit);
4785
- let nextUnitStart = context.dateEnv.add(currentUnitStart, createDuration(1, props.unit));
4786
- let waitMs = nextUnitStart.valueOf() - unroundedNow.valueOf();
4806
+ let { nowIndicatorSnap } = context.options;
4807
+ if (nowIndicatorSnap === 'auto') {
4808
+ nowIndicatorSnap =
4809
+ // large unit?
4810
+ /year|month|week|day/.test(props.unit) ||
4811
+ // if slotDuration 30 mins for example, would NOT appear to snap (legacy behavior)
4812
+ (props.unitValue || 1) === 1;
4813
+ }
4814
+ let nowDate;
4815
+ let waitMs;
4816
+ if (nowIndicatorSnap) {
4817
+ nowDate = context.dateEnv.startOf(unroundedNow, props.unit); // aka currentUnitStart
4818
+ let nextUnitStart = context.dateEnv.add(nowDate, createDuration(1, props.unit));
4819
+ waitMs = nextUnitStart.valueOf() - unroundedNow.valueOf();
4820
+ }
4821
+ else {
4822
+ nowDate = unroundedNow;
4823
+ waitMs = 1000 * 60; // 1 minute
4824
+ }
4787
4825
  // there is a max setTimeout ms value (https://stackoverflow.com/a/3468650/96342)
4788
4826
  // ensure no longer than a day
4789
4827
  waitMs = Math.min(1000 * 60 * 60 * 24, waitMs);
4790
4828
  return {
4791
- state: { nowDate: currentUnitStart, todayRange: buildDayRange(currentUnitStart) },
4829
+ state: { nowDate, todayRange: buildDayRange(nowDate) },
4792
4830
  waitMs,
4793
4831
  };
4794
4832
  }
@@ -7059,8 +7097,11 @@ var FullCalendar = (function (exports) {
7059
7097
  class EventContainer extends BaseComponent {
7060
7098
  constructor() {
7061
7099
  super(...arguments);
7100
+ // memo
7101
+ this.buildPublicEvent = memoize((context, eventDef, eventInstance) => new EventImpl(context, eventDef, eventInstance));
7062
7102
  this.handleEl = (el) => {
7063
7103
  this.el = el;
7104
+ setRef(this.props.elRef, el);
7064
7105
  if (el) {
7065
7106
  setElSeg(el, this.props.seg);
7066
7107
  }
@@ -7073,7 +7114,7 @@ var FullCalendar = (function (exports) {
7073
7114
  const { eventRange } = seg;
7074
7115
  const { ui } = eventRange;
7075
7116
  const renderProps = {
7076
- event: new EventImpl(context, eventRange.def, eventRange.instance),
7117
+ event: this.buildPublicEvent(context, eventRange.def, eventRange.instance),
7077
7118
  view: context.viewApi,
7078
7119
  timeText: props.timeText,
7079
7120
  textColor: ui.textColor,
@@ -7092,11 +7133,11 @@ var FullCalendar = (function (exports) {
7092
7133
  isDragging: Boolean(props.isDragging),
7093
7134
  isResizing: Boolean(props.isResizing),
7094
7135
  };
7095
- return (y(ContentContainer, Object.assign({}, props /* contains children */, { elRef: this.handleEl, elClasses: [
7136
+ return (y(ContentContainer, { elRef: this.handleEl, elTag: props.elTag, elAttrs: props.elAttrs, elClasses: [
7096
7137
  ...getEventClassNames(renderProps),
7097
7138
  ...seg.eventRange.ui.classNames,
7098
7139
  ...(props.elClasses || []),
7099
- ], renderProps: renderProps, generatorName: "eventContent", customGenerator: options.eventContent, defaultGenerator: props.defaultGenerator, classNameGenerator: options.eventClassNames, didMount: options.eventDidMount, willUnmount: options.eventWillUnmount })));
7140
+ ], elStyle: props.elStyle, renderProps: renderProps, generatorName: "eventContent", customGenerator: options.eventContent, defaultGenerator: props.defaultGenerator, classNameGenerator: options.eventClassNames, didMount: options.eventDidMount, willUnmount: options.eventWillUnmount }, props.children));
7100
7141
  }
7101
7142
  componentDidUpdate(prevProps) {
7102
7143
  if (this.el && this.props.seg !== prevProps.seg) {
@@ -7123,6 +7164,9 @@ var FullCalendar = (function (exports) {
7123
7164
  Boolean(eventContentArg.isEndResizable) && (y("div", { className: "fc-event-resizer fc-event-resizer-end" }))))));
7124
7165
  }
7125
7166
  }
7167
+ StandardEvent.addPropsEquality({
7168
+ seg: isPropsEqual,
7169
+ });
7126
7170
  function renderInnerContent$1$1(innerProps) {
7127
7171
  return (y("div", { className: "fc-event-main-frame" },
7128
7172
  innerProps.timeText && (y("div", { className: "fc-event-time" }, innerProps.timeText)),
@@ -7137,7 +7181,7 @@ var FullCalendar = (function (exports) {
7137
7181
  date: context.dateEnv.toDate(props.date),
7138
7182
  view: context.viewApi,
7139
7183
  };
7140
- return (y(ContentContainer, Object.assign({}, props /* includes children */, { elTag: props.elTag || 'div', renderProps: renderProps, generatorName: "nowIndicatorContent", customGenerator: options.nowIndicatorContent, classNameGenerator: options.nowIndicatorClassNames, didMount: options.nowIndicatorDidMount, willUnmount: options.nowIndicatorWillUnmount })));
7184
+ return (y(ContentContainer, { elRef: props.elRef, elTag: props.elTag || 'div', elAttrs: props.elAttrs, elClasses: props.elClasses, elStyle: props.elStyle, renderProps: renderProps, generatorName: "nowIndicatorContent", customGenerator: options.nowIndicatorContent, classNameGenerator: options.nowIndicatorClassNames, didMount: options.nowIndicatorDidMount, willUnmount: options.nowIndicatorWillUnmount }, props.children));
7141
7185
  }));
7142
7186
 
7143
7187
  const DAY_NUM_FORMAT = createFormatter({ day: 'numeric' });
@@ -7160,12 +7204,12 @@ var FullCalendar = (function (exports) {
7160
7204
  dateEnv: context.dateEnv,
7161
7205
  monthStartFormat: options.monthStartFormat,
7162
7206
  });
7163
- return (y(ContentContainer, Object.assign({}, props /* includes children */, { elClasses: [
7207
+ return (y(ContentContainer, { elRef: props.elRef, elTag: props.elTag, elAttrs: Object.assign(Object.assign({}, props.elAttrs), (renderProps.isDisabled ? {} : { 'data-date': formatDayString(props.date) })), elClasses: [
7164
7208
  ...getDayClassNames(renderProps, context.theme),
7165
7209
  ...(props.elClasses || []),
7166
- ], elAttrs: Object.assign(Object.assign({}, props.elAttrs), (renderProps.isDisabled ? {} : { 'data-date': formatDayString(props.date) })), renderProps: renderProps, generatorName: "dayCellContent", customGenerator: options.dayCellContent, defaultGenerator: props.defaultGenerator, classNameGenerator:
7210
+ ], elStyle: props.elStyle, renderProps: renderProps, generatorName: "dayCellContent", customGenerator: options.dayCellContent, defaultGenerator: props.defaultGenerator, classNameGenerator:
7167
7211
  // don't use custom classNames if disabled
7168
- renderProps.isDisabled ? undefined : options.dayCellClassNames, didMount: options.dayCellDidMount, willUnmount: options.dayCellWillUnmount })));
7212
+ renderProps.isDisabled ? undefined : options.dayCellClassNames, didMount: options.dayCellDidMount, willUnmount: options.dayCellWillUnmount }, props.children));
7169
7213
  }
7170
7214
  }
7171
7215
  function hasCustomDayCellContent(options) {
@@ -7202,7 +7246,7 @@ var FullCalendar = (function (exports) {
7202
7246
  let text = dateEnv.format(date, format);
7203
7247
  let renderProps = { num, text, date };
7204
7248
  return (y(ContentContainer // why isn't WeekNumberContentArg being auto-detected?
7205
- , Object.assign({}, props /* includes children */, { renderProps: renderProps, generatorName: "weekNumberContent", customGenerator: options.weekNumberContent, defaultGenerator: renderInner, classNameGenerator: options.weekNumberClassNames, didMount: options.weekNumberDidMount, willUnmount: options.weekNumberWillUnmount })));
7249
+ , { elRef: props.elRef, elTag: props.elTag, elAttrs: props.elAttrs, elClasses: props.elClasses, elStyle: props.elStyle, renderProps: renderProps, generatorName: "weekNumberContent", customGenerator: options.weekNumberContent, defaultGenerator: renderInner, classNameGenerator: options.weekNumberClassNames, didMount: options.weekNumberDidMount, willUnmount: options.weekNumberWillUnmount }, props.children));
7206
7250
  }));
7207
7251
  function renderInner(innerProps) {
7208
7252
  return innerProps.text;
@@ -8724,6 +8768,17 @@ var FullCalendar = (function (exports) {
8724
8768
  let dayMarker = startOfDay(framingRange.start);
8725
8769
  let endMarker = framingRange.end;
8726
8770
  let instanceStarts = [];
8771
+ // https://github.com/fullcalendar/fullcalendar/issues/7934
8772
+ if (startTime) {
8773
+ if (startTime.milliseconds < 0) {
8774
+ // possible for next-day to have negative business hours that go into current day
8775
+ endMarker = addDays(endMarker, 1);
8776
+ }
8777
+ else if (startTime.milliseconds >= 1000 * 60 * 60 * 24) {
8778
+ // possible for prev-day to have >24hr business hours that go into current day
8779
+ dayMarker = addDays(dayMarker, -1);
8780
+ }
8781
+ }
8727
8782
  while (dayMarker < endMarker) {
8728
8783
  let instanceStart;
8729
8784
  // if everyday, or this particular day-of-week
@@ -9908,7 +9963,7 @@ var FullCalendar = (function (exports) {
9908
9963
  return sliceEventStore(props.eventStore, props.eventUiBases, props.dateProfile.activeRange, allDay ? props.nextDayThreshold : null).fg;
9909
9964
  }
9910
9965
 
9911
- const version = '6.1.17';
9966
+ const version = '6.1.19';
9912
9967
 
9913
9968
  config.touchMouseIgnoreWait = 500;
9914
9969
  let ignoreMouseDepth = 0;
@@ -12748,7 +12803,7 @@ var FullCalendar = (function (exports) {
12748
12803
  constructor() {
12749
12804
  super(...arguments);
12750
12805
  this.splitBusinessHourSegs = memoize(splitSegsByRow);
12751
- this.splitBgEventSegs = memoize(splitSegsByRow);
12806
+ this.splitBgEventSegs = memoize(splitAllDaySegsByRow);
12752
12807
  this.splitFgEventSegs = memoize(splitSegsByRow);
12753
12808
  this.splitDateSelectionSegs = memoize(splitSegsByRow);
12754
12809
  this.splitEventDrag = memoize(splitInteractionByRow);
@@ -12772,7 +12827,7 @@ var FullCalendar = (function (exports) {
12772
12827
  return (y(NowTimer, { unit: "day" }, (nowDate, todayRange) => (y(_, null, props.cells.map((cells, row) => (y(TableRow, { ref: this.rowRefs.createRef(row), key: cells.length
12773
12828
  ? cells[0].date.toISOString() /* best? or put key on cell? or use diff formatter? */
12774
12829
  : row // in case there are no cells (like when resource view is loading)
12775
- , showDayNumbers: rowCnt > 1, showWeekNumbers: props.showWeekNumbers, todayRange: todayRange, dateProfile: props.dateProfile, cells: cells, renderIntro: props.renderRowIntro, businessHourSegs: businessHourSegsByRow[row], eventSelection: props.eventSelection, bgEventSegs: bgEventSegsByRow[row].filter(isSegAllDay) /* hack */, fgEventSegs: fgEventSegsByRow[row], dateSelectionSegs: dateSelectionSegsByRow[row], eventDrag: eventDragByRow[row], eventResize: eventResizeByRow[row], dayMaxEvents: props.dayMaxEvents, dayMaxEventRows: props.dayMaxEventRows, clientWidth: props.clientWidth, clientHeight: props.clientHeight, cellMinHeight: cellMinHeight, forPrint: props.forPrint })))))));
12830
+ , showDayNumbers: rowCnt > 1, showWeekNumbers: props.showWeekNumbers, todayRange: todayRange, dateProfile: props.dateProfile, cells: cells, renderIntro: props.renderRowIntro, businessHourSegs: businessHourSegsByRow[row], eventSelection: props.eventSelection, bgEventSegs: bgEventSegsByRow[row], fgEventSegs: fgEventSegsByRow[row], dateSelectionSegs: dateSelectionSegsByRow[row], eventDrag: eventDragByRow[row], eventResize: eventResizeByRow[row], dayMaxEvents: props.dayMaxEvents, dayMaxEventRows: props.dayMaxEventRows, clientWidth: props.clientWidth, clientHeight: props.clientHeight, cellMinHeight: cellMinHeight, forPrint: props.forPrint })))))));
12776
12831
  }
12777
12832
  componentDidMount() {
12778
12833
  this.registerInteractiveComponent();
@@ -12841,6 +12896,9 @@ var FullCalendar = (function (exports) {
12841
12896
  return { start, end };
12842
12897
  }
12843
12898
  }
12899
+ function splitAllDaySegsByRow(segs, rowCnt) {
12900
+ return splitSegsByRow(segs.filter(isSegAllDay), rowCnt);
12901
+ }
12844
12902
  function isSegAllDay(seg) {
12845
12903
  return seg.eventRange.def.allDay;
12846
12904
  }