@fullcalendar/daygrid 7.0.0-beta.3 → 7.0.0-beta.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.
- package/LICENSE.md +1 -1
- package/README.md +6 -1
- package/{index.cjs → cjs/index.cjs} +15 -4
- package/cjs/internal.cjs +1339 -0
- package/esm/index.d.ts +23 -0
- package/{index.js → esm/index.js} +14 -3
- package/{internal.d.ts → esm/internal.d.ts} +54 -29
- package/{internal.js → esm/internal.js} +454 -280
- package/{index.global.js → global.js} +469 -281
- package/global.min.js +6 -0
- package/package.json +22 -19
- package/index.d.ts +0 -6
- package/index.global.min.js +0 -6
- package/internal.cjs +0 -1159
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar Day Grid Plugin v7.0.0-beta.
|
|
2
|
+
FullCalendar Day Grid Plugin v7.0.0-beta.5
|
|
3
3
|
Docs & License: https://fullcalendar.io/docs/month-view
|
|
4
|
-
(c)
|
|
4
|
+
(c) 2025 Adam Shaw
|
|
5
5
|
*/
|
|
6
|
-
FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
6
|
+
FullCalendar.DayGrid = (function (exports, core, internal$1, preact, classNames) {
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var classNames__default = /*#__PURE__*/_interopDefault(classNames);
|
|
12
|
+
|
|
9
13
|
class DayTableSlicer extends internal$1.Slicer {
|
|
10
14
|
constructor() {
|
|
11
15
|
super(...arguments);
|
|
@@ -21,55 +25,96 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
21
25
|
// but can share some of the same types/utils
|
|
22
26
|
// Date Cells
|
|
23
27
|
// -------------------------------------------------------------------------------------------------
|
|
24
|
-
const WEEKDAY_FORMAT = internal$1.createFormatter({ weekday: 'long' });
|
|
25
28
|
const firstSunday = new Date(259200000);
|
|
26
|
-
function buildDateRowConfigs(
|
|
27
|
-
|
|
29
|
+
function buildDateRowConfigs(dates, datesRepDistinctDays, dateProfile, todayRange, dayHeaderFormat, // TODO: rename to dateHeaderFormat?
|
|
30
|
+
context) {
|
|
31
|
+
const rowConfig = buildDateRowConfig(dates, datesRepDistinctDays, dateProfile, todayRange, dayHeaderFormat, context);
|
|
32
|
+
const majorUnit = internal$1.computeMajorUnit(dateProfile, context.dateEnv);
|
|
33
|
+
// HACK mutate isMajor
|
|
34
|
+
if (datesRepDistinctDays) {
|
|
35
|
+
for (const dataConfig of rowConfig.dataConfigs) {
|
|
36
|
+
if (internal$1.isMajorUnit(dataConfig.dateMarker, majorUnit, context.dateEnv)) {
|
|
37
|
+
dataConfig.renderProps.isMajor = true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return [rowConfig];
|
|
28
42
|
}
|
|
29
43
|
/*
|
|
30
44
|
Should this receive resource data attributes?
|
|
31
45
|
Or ResourceApi object itself?
|
|
32
46
|
*/
|
|
33
|
-
function buildDateRowConfig(
|
|
34
|
-
context, colSpan) {
|
|
47
|
+
function buildDateRowConfig(dateMarkers, datesRepDistinctDays, dateProfile, todayRange, dayHeaderFormat, // TODO: rename to dateHeaderFormat?
|
|
48
|
+
context, colSpan, isMajorMod) {
|
|
35
49
|
return {
|
|
50
|
+
isDateRow: true,
|
|
36
51
|
renderConfig: buildDateRenderConfig(context),
|
|
37
|
-
dataConfigs: buildDateDataConfigs(
|
|
52
|
+
dataConfigs: buildDateDataConfigs(dateMarkers, datesRepDistinctDays, dateProfile, todayRange, dayHeaderFormat, context, colSpan, undefined, undefined, undefined, undefined, isMajorMod)
|
|
38
53
|
};
|
|
39
54
|
}
|
|
55
|
+
/*
|
|
56
|
+
For header cells: how to connect w/ custom rendering
|
|
57
|
+
Applies to all cells in a row
|
|
58
|
+
*/
|
|
40
59
|
function buildDateRenderConfig(context) {
|
|
41
60
|
const { options } = context;
|
|
42
61
|
return {
|
|
43
62
|
generatorName: 'dayHeaderContent',
|
|
44
63
|
customGenerator: options.dayHeaderContent,
|
|
45
|
-
classNameGenerator: options.
|
|
64
|
+
classNameGenerator: options.dayHeaderClass,
|
|
65
|
+
innerClassNameGenerator: options.dayHeaderInnerClass,
|
|
46
66
|
didMount: options.dayHeaderDidMount,
|
|
47
67
|
willUnmount: options.dayHeaderWillUnmount,
|
|
68
|
+
align: options.dayHeaderAlign,
|
|
69
|
+
sticky: options.dayHeaderSticky,
|
|
48
70
|
};
|
|
49
71
|
}
|
|
50
|
-
|
|
51
|
-
|
|
72
|
+
const dowDates = [];
|
|
73
|
+
for (let dow = 0; dow < 7; dow++) {
|
|
74
|
+
dowDates.push(internal$1.addDays(new Date(259200000), dow)); // start with Sun, 04 Jan 1970 00:00:00 GMT)
|
|
75
|
+
}
|
|
76
|
+
/*
|
|
77
|
+
For header cells: data
|
|
78
|
+
*/
|
|
79
|
+
function buildDateDataConfigs(dateMarkers, datesRepDistinctDays, dateProfile, todayRange, dayHeaderFormat, // TODO: rename to dateHeaderFormat?
|
|
80
|
+
context, colSpan = 1, keyPrefix = '', extraRenderProps = {}, // TODO
|
|
81
|
+
extraAttrs = {}, // TODO
|
|
82
|
+
className = '', isMajorMod) {
|
|
52
83
|
const { dateEnv, viewApi, options } = context;
|
|
53
84
|
return datesRepDistinctDays
|
|
54
|
-
?
|
|
55
|
-
const dateMeta = internal$1.getDateMeta(
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const
|
|
85
|
+
? dateMarkers.map((dateMarker, i) => {
|
|
86
|
+
const dateMeta = internal$1.getDateMeta(dateMarker, dateEnv, dateProfile, todayRange);
|
|
87
|
+
const isMajor = isMajorMod != null && !(i % isMajorMod);
|
|
88
|
+
const [text, textParts] = dateEnv.format(dateMarker, dayHeaderFormat);
|
|
89
|
+
const hasNavLink = options.navLinks && !dateMeta.isDisabled &&
|
|
90
|
+
dateMarkers.length > 1; // don't show navlink to day if only one day
|
|
91
|
+
const renderProps = Object.assign(Object.assign(Object.assign({}, dateMeta), extraRenderProps), { text,
|
|
92
|
+
textParts,
|
|
93
|
+
get weekdayText() { return internal$1.findWeekdayText(textParts); },
|
|
94
|
+
get dayNumberText() { return datesRepDistinctDays ? internal$1.findDayNumberText(textParts) : ''; },
|
|
95
|
+
isMajor, isNarrow: false, isSticky: false, inPopover: false, level: 0, // HACK. gets overridden
|
|
96
|
+
hasNavLink, view: viewApi });
|
|
97
|
+
const fullDateStr = internal$1.buildDateStr(context, dateMarker);
|
|
98
|
+
// for DayGridHeaderCell
|
|
59
99
|
return {
|
|
60
|
-
key: keyPrefix +
|
|
100
|
+
key: keyPrefix + dateMarker.toUTCString(),
|
|
101
|
+
dateMarker,
|
|
61
102
|
renderProps,
|
|
62
|
-
attrs: { '
|
|
63
|
-
|
|
103
|
+
attrs: Object.assign(Object.assign(Object.assign({ 'aria-label': fullDateStr }, (dateMeta.isToday ? { 'aria-current': 'date' } : {})), { 'data-date': internal$1.formatDayString(dateMarker) }), extraAttrs),
|
|
104
|
+
// for navlink
|
|
105
|
+
innerAttrs: hasNavLink
|
|
106
|
+
? internal$1.buildNavLinkAttrs(context, dateMarker, undefined, fullDateStr)
|
|
107
|
+
: { 'aria-hidden': true },
|
|
64
108
|
colSpan,
|
|
65
|
-
|
|
66
|
-
className
|
|
109
|
+
hasNavLink,
|
|
110
|
+
className,
|
|
67
111
|
};
|
|
68
112
|
})
|
|
69
|
-
:
|
|
70
|
-
const dow =
|
|
113
|
+
: dateMarkers.map((dateMarker, i) => {
|
|
114
|
+
const dow = dateMarker.getUTCDay();
|
|
71
115
|
const normDate = internal$1.addDays(firstSunday, dow);
|
|
72
|
-
const
|
|
116
|
+
const dateMeta = {
|
|
117
|
+
date: dateEnv.toDate(dateMarker),
|
|
73
118
|
dow,
|
|
74
119
|
isDisabled: false,
|
|
75
120
|
isFuture: false,
|
|
@@ -77,14 +122,25 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
77
122
|
isToday: false,
|
|
78
123
|
isOther: false,
|
|
79
124
|
};
|
|
80
|
-
const
|
|
81
|
-
const
|
|
125
|
+
const isMajor = isMajorMod != null && !(i % isMajorMod);
|
|
126
|
+
const [text, textParts] = dateEnv.format(normDate, dayHeaderFormat);
|
|
127
|
+
const renderProps = Object.assign(Object.assign(Object.assign({}, dateMeta), { date: dowDates[dow], isMajor, isNarrow: false, isSticky: false, inPopover: false, hasNavLink: false, level: 0, view: viewApi, text,
|
|
128
|
+
textParts,
|
|
129
|
+
get weekdayText() { return internal$1.findWeekdayText(textParts); },
|
|
130
|
+
get dayNumberText() { return datesRepDistinctDays ? internal$1.findDayNumberText(textParts) : ''; } }), extraRenderProps);
|
|
131
|
+
const fullWeekDayStr = dateEnv.format(normDate, internal$1.WEEKDAY_ONLY_FORMAT)[0];
|
|
132
|
+
// for DayGridHeaderCell
|
|
82
133
|
return {
|
|
83
134
|
key: keyPrefix + String(dow),
|
|
135
|
+
dateMarker,
|
|
84
136
|
renderProps,
|
|
85
|
-
|
|
137
|
+
attrs: Object.assign({ 'aria-label': fullWeekDayStr }, extraAttrs),
|
|
138
|
+
// NOT a navlink
|
|
139
|
+
innerAttrs: {
|
|
140
|
+
'aria-hidden': true, // label already on cell
|
|
141
|
+
},
|
|
86
142
|
colSpan,
|
|
87
|
-
className
|
|
143
|
+
className,
|
|
88
144
|
};
|
|
89
145
|
});
|
|
90
146
|
}
|
|
@@ -100,9 +156,9 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
100
156
|
}
|
|
101
157
|
// DayGridRange utils (TODO: move)
|
|
102
158
|
// -------------------------------------------------------------------------------------------------
|
|
103
|
-
function splitSegsByRow(segs,
|
|
159
|
+
function splitSegsByRow(segs, rowCount) {
|
|
104
160
|
const byRow = [];
|
|
105
|
-
for (let row = 0; row <
|
|
161
|
+
for (let row = 0; row < rowCount; row++) {
|
|
106
162
|
byRow[row] = [];
|
|
107
163
|
}
|
|
108
164
|
for (const seg of segs) {
|
|
@@ -110,15 +166,15 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
110
166
|
}
|
|
111
167
|
return byRow;
|
|
112
168
|
}
|
|
113
|
-
function splitInteractionByRow(ui,
|
|
169
|
+
function splitInteractionByRow(ui, rowCount) {
|
|
114
170
|
const byRow = [];
|
|
115
171
|
if (!ui) {
|
|
116
|
-
for (let row = 0; row <
|
|
172
|
+
for (let row = 0; row < rowCount; row++) {
|
|
117
173
|
byRow[row] = null;
|
|
118
174
|
}
|
|
119
175
|
}
|
|
120
176
|
else {
|
|
121
|
-
for (let row = 0; row <
|
|
177
|
+
for (let row = 0; row < rowCount; row++) {
|
|
122
178
|
byRow[row] = {
|
|
123
179
|
affectedInstances: ui.affectedInstances,
|
|
124
180
|
isEvent: ui.isEvent,
|
|
@@ -151,61 +207,55 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
151
207
|
);
|
|
152
208
|
}
|
|
153
209
|
|
|
154
|
-
class DayGridBlockEvent extends internal$1.BaseComponent {
|
|
155
|
-
render() {
|
|
156
|
-
let { props } = this;
|
|
157
|
-
return (preact.createElement(internal$1.StandardEvent, Object.assign({}, props, { className: 'fc-daygrid-block-event fc-daygrid-event fc-h-event', defaultTimeFormat: DEFAULT_TABLE_EVENT_TIME_FORMAT, defaultDisplayEventEnd: props.defaultDisplayEventEnd, disableResizing: !props.eventRange.def.allDay })));
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
class DayGridListEvent extends internal$1.BaseComponent {
|
|
162
|
-
render() {
|
|
163
|
-
let { props, context } = this;
|
|
164
|
-
let { options } = context;
|
|
165
|
-
let { eventRange } = props;
|
|
166
|
-
let timeFormat = options.eventTimeFormat || DEFAULT_TABLE_EVENT_TIME_FORMAT;
|
|
167
|
-
let timeText = internal$1.buildEventRangeTimeText(timeFormat, eventRange,
|
|
168
|
-
/* slicedStart = */ undefined,
|
|
169
|
-
/* slicedEnd = */ undefined, props.isStart, props.isEnd, context,
|
|
170
|
-
/* defaultDisplayEventTime = */ true, props.defaultDisplayEventEnd);
|
|
171
|
-
let anchorAttrs = internal$1.getEventRangeAnchorAttrs(eventRange, context);
|
|
172
|
-
return (preact.createElement(internal$1.EventContainer, Object.assign({}, props, { tag: anchorAttrs ? 'a' : 'div', attrs: anchorAttrs, className: 'fc-daygrid-dot-event fc-daygrid-event', defaultGenerator: renderInnerContent, timeText: timeText, isResizing: false, isDateSelecting: false })));
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
function renderInnerContent(renderProps) {
|
|
176
|
-
return (preact.createElement(preact.Fragment, null,
|
|
177
|
-
preact.createElement("div", { className: "fc-daygrid-event-dot", style: { borderColor: renderProps.borderColor || renderProps.backgroundColor } }),
|
|
178
|
-
renderProps.timeText && (preact.createElement("div", { className: "fc-event-time" }, renderProps.timeText)),
|
|
179
|
-
preact.createElement("div", { className: "fc-event-title" }, renderProps.event.title || preact.createElement(preact.Fragment, null, "\u00A0"))));
|
|
180
|
-
}
|
|
181
|
-
|
|
182
210
|
class DayGridMoreLink extends internal$1.BaseComponent {
|
|
183
211
|
render() {
|
|
184
212
|
let { props } = this;
|
|
185
|
-
return (preact.createElement(internal$1.MoreLinkContainer, { className:
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
let
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
visibility: forcedInvisibleMap[instanceId] ? 'hidden' : '',
|
|
197
|
-
} }, hasListItemDisplay(seg) ? (preact.createElement(DayGridListEvent, Object.assign({ eventRange: eventRange, isStart: seg.isStart, isEnd: seg.isEnd, isDragging: false, isSelected: instanceId === props.eventSelection, defaultDisplayEventEnd: false }, internal$1.getEventRangeMeta(eventRange, props.todayRange)))) : (preact.createElement(DayGridBlockEvent, Object.assign({ eventRange: eventRange, isStart: seg.isStart, isEnd: seg.isEnd, isDragging: false, isResizing: false, isDateSelecting: false, isSelected: instanceId === props.eventSelection, defaultDisplayEventEnd: false }, internal$1.getEventRangeMeta(eventRange, props.todayRange))))));
|
|
198
|
-
})));
|
|
199
|
-
} }));
|
|
213
|
+
return (preact.createElement(internal$1.MoreLinkContainer, { display: 'row', className: props.className, isNarrow: props.isNarrow, isMicro: props.isMicro, dateProfile: props.dateProfile, todayRange: props.todayRange, allDayDate: props.allDayDate, segs: props.segs, hiddenSegs: props.hiddenSegs, alignElRef: props.alignElRef, alignParentTop: props.alignParentTop, dateSpanProps: props.dateSpanProps, popoverContent: () => (preact.createElement(preact.Fragment, null, props.segs.map((seg) => {
|
|
214
|
+
let { eventRange } = seg;
|
|
215
|
+
let { instanceId } = eventRange.instance;
|
|
216
|
+
let isDragging = Boolean(props.eventDrag && props.eventDrag.affectedInstances[instanceId]);
|
|
217
|
+
let isResizing = Boolean(props.eventResize && props.eventResize.affectedInstances[instanceId]);
|
|
218
|
+
let isInvisible = isDragging || isResizing;
|
|
219
|
+
return (preact.createElement("div", { key: instanceId, style: {
|
|
220
|
+
visibility: isInvisible ? 'hidden' : undefined,
|
|
221
|
+
} },
|
|
222
|
+
preact.createElement(internal$1.StandardEvent, Object.assign({ display: hasListItemDisplay(seg) ? 'list-item' : 'row', eventRange: eventRange, isStart: seg.isStart, isEnd: seg.isEnd, isDragging: isDragging, isResizing: isResizing, isMirror: false, isSelected: instanceId === props.eventSelection, defaultTimeFormat: DEFAULT_TABLE_EVENT_TIME_FORMAT, defaultDisplayEventEnd: false }, internal$1.getEventRangeMeta(eventRange, props.todayRange)))));
|
|
223
|
+
}))) }));
|
|
200
224
|
}
|
|
201
225
|
}
|
|
202
226
|
|
|
203
227
|
class DayGridCell extends internal$1.DateComponent {
|
|
204
228
|
constructor() {
|
|
205
229
|
super(...arguments);
|
|
230
|
+
// memo
|
|
231
|
+
this.getDateMeta = internal$1.memoize(internal$1.getDateMeta);
|
|
232
|
+
this.refineRenderProps = internal$1.memoizeObjArg(refineRenderProps);
|
|
206
233
|
// ref
|
|
207
234
|
this.rootElRef = preact.createRef();
|
|
208
|
-
this.
|
|
235
|
+
this.handleBodyEl = (bodyEl) => {
|
|
236
|
+
if (this.disconnectBodyHeight) {
|
|
237
|
+
this.disconnectBodyHeight();
|
|
238
|
+
this.disconnectBodyHeight = undefined;
|
|
239
|
+
internal$1.setRef(this.props.headerHeightRef, null);
|
|
240
|
+
internal$1.setRef(this.props.mainHeightRef, null);
|
|
241
|
+
}
|
|
242
|
+
if (bodyEl) {
|
|
243
|
+
// we want to fire on ANY size change, because we do more advanced stuff
|
|
244
|
+
this.disconnectBodyHeight = internal$1.watchSize(bodyEl, (_bodyWidth, bodyHeight) => {
|
|
245
|
+
const { props } = this;
|
|
246
|
+
const mainRect = bodyEl.getBoundingClientRect();
|
|
247
|
+
const rootRect = this.rootElRef.current.getBoundingClientRect();
|
|
248
|
+
const headerHeight = mainRect.top - rootRect.top;
|
|
249
|
+
if (!internal$1.isDimsEqual(this.headerHeight, headerHeight)) {
|
|
250
|
+
this.headerHeight = headerHeight;
|
|
251
|
+
internal$1.setRef(props.headerHeightRef, headerHeight);
|
|
252
|
+
}
|
|
253
|
+
if (props.fgLiquidHeight) {
|
|
254
|
+
internal$1.setRef(props.mainHeightRef, bodyHeight);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
};
|
|
209
259
|
}
|
|
210
260
|
render() {
|
|
211
261
|
let { props, context } = this;
|
|
@@ -213,43 +263,53 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
213
263
|
// TODO: memoize this
|
|
214
264
|
const isMonthStart = props.showDayNumber &&
|
|
215
265
|
shouldDisplayMonthStart(props.date, props.dateProfile.currentRange, dateEnv);
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (!internal$1.isDimsEqual(this.headerHeight, headerHeight)) {
|
|
234
|
-
this.headerHeight = headerHeight;
|
|
235
|
-
internal$1.setRef(props.headerHeightRef, headerHeight);
|
|
236
|
-
}
|
|
237
|
-
if (props.fgLiquidHeight) {
|
|
238
|
-
internal$1.setRef(props.mainHeightRef, bodyHeight);
|
|
239
|
-
}
|
|
266
|
+
const dateMeta = this.getDateMeta(props.date, dateEnv, props.dateProfile, props.todayRange);
|
|
267
|
+
const baseClassName = core.joinClassNames(props.borderStart ? classNames__default["default"].borderOnlyS : classNames__default["default"].borderNone, props.width != null ? '' : classNames__default["default"].liquid, classNames__default["default"].flexCol);
|
|
268
|
+
const hasNavLink = options.navLinks;
|
|
269
|
+
const renderProps = this.refineRenderProps({
|
|
270
|
+
date: props.date,
|
|
271
|
+
isMajor: props.isMajor,
|
|
272
|
+
isNarrow: props.isNarrow,
|
|
273
|
+
dateMeta: dateMeta,
|
|
274
|
+
hasLabel: props.showDayNumber,
|
|
275
|
+
hasMonthLabel: isMonthStart,
|
|
276
|
+
hasNavLink,
|
|
277
|
+
renderProps: props.renderProps,
|
|
278
|
+
viewApi: context.viewApi,
|
|
279
|
+
dateEnv: context.dateEnv,
|
|
280
|
+
monthStartFormat: options.monthStartFormat,
|
|
281
|
+
dayCellFormat: options.dayCellFormat,
|
|
282
|
+
businessHours: Boolean(options.businessHours),
|
|
240
283
|
});
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
internal$1.
|
|
284
|
+
if (dateMeta.isDisabled) {
|
|
285
|
+
return (preact.createElement("div", { role: 'gridcell', "aria-disabled": true, className: internal$1.joinArrayishClassNames(internal$1.generateClassName(options.dayCellClass, renderProps), props.className, baseClassName), style: {
|
|
286
|
+
width: props.width
|
|
287
|
+
} }));
|
|
288
|
+
}
|
|
289
|
+
const fullDateStr = internal$1.buildDateStr(context, props.date);
|
|
290
|
+
return (preact.createElement(internal$1.ContentContainer, { tag: "div", elRef: this.rootElRef, className: core.joinClassNames(props.className, baseClassName), attrs: Object.assign(Object.assign(Object.assign(Object.assign({}, props.attrs), { role: 'gridcell', 'aria-label': fullDateStr }), (renderProps.isToday ? { 'aria-current': 'date' } : {})), { 'data-date': internal$1.formatDayString(props.date) }), style: {
|
|
291
|
+
width: props.width,
|
|
292
|
+
}, renderProps: renderProps, generatorName: "dayCellTopContent" // !!! for top
|
|
293
|
+
, customGenerator: options.dayCellTopContent /* !!! for top */, defaultGenerator: renderTopInner, classNameGenerator: options.dayCellClass, didMount: options.dayCellDidMount, willUnmount: options.dayCellWillUnmount }, (InnerContent) => (preact.createElement(preact.Fragment, null,
|
|
294
|
+
preact.createElement("div", { className: core.joinClassNames(classNames__default["default"].rel, // puts it above bg-fills, which are positioned on TOP of this component :|
|
|
295
|
+
internal$1.generateClassName(options.dayCellTopClass, renderProps)) }, props.showDayNumber && (preact.createElement(InnerContent // the dayCellTopContent
|
|
296
|
+
, { tag: 'div', attrs: hasNavLink
|
|
297
|
+
? internal$1.buildNavLinkAttrs(context, props.date, undefined, fullDateStr)
|
|
298
|
+
: { 'aria-hidden': true } // label already on cell
|
|
299
|
+
, className: internal$1.generateClassName(options.dayCellTopInnerClass, renderProps) }))),
|
|
300
|
+
preact.createElement("div", { className: core.joinClassNames(classNames__default["default"].flexCol, props.fgLiquidHeight ? classNames__default["default"].liquid : classNames__default["default"].grow), ref: this.handleBodyEl },
|
|
301
|
+
preact.createElement("div", { className: internal$1.generateClassName(options.dayCellInnerClass, renderProps), style: { minHeight: props.fgHeight } }, props.fg),
|
|
302
|
+
preact.createElement(DayGridMoreLink, { className: classNames__default["default"].rel, allDayDate: props.date, segs: props.segs, hiddenSegs: props.hiddenSegs, alignElRef: this.rootElRef, alignParentTop: props.showDayNumber
|
|
303
|
+
? '[role=row]'
|
|
304
|
+
: `.${classNames__default["default"].internalView}`, dateSpanProps: props.dateSpanProps, dateProfile: props.dateProfile, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, todayRange: props.todayRange, isNarrow: props.isNarrow, isMicro: props.isMicro })),
|
|
305
|
+
preact.createElement("div", { className: core.joinClassNames(classNames__default["default"].rel, // puts it above bg-fills
|
|
306
|
+
internal$1.generateClassName(options.dayCellBottomClass, renderProps)) })))));
|
|
247
307
|
}
|
|
248
308
|
}
|
|
249
309
|
// Utils
|
|
250
310
|
// -------------------------------------------------------------------------------------------------
|
|
251
311
|
function renderTopInner(props) {
|
|
252
|
-
return props.
|
|
312
|
+
return props.text || preact.createElement(preact.Fragment, null, "\u00A0"); // TODO: DRY?
|
|
253
313
|
}
|
|
254
314
|
function shouldDisplayMonthStart(date, currentRange, dateEnv) {
|
|
255
315
|
const { start: currentStart, end: currentEnd } = currentRange;
|
|
@@ -266,6 +326,16 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
266
326
|
// a month-start that's within the current range?
|
|
267
327
|
(dateEnv.getDay(date) === 1 && date.valueOf() < currentEnd.valueOf()));
|
|
268
328
|
}
|
|
329
|
+
function refineRenderProps(raw) {
|
|
330
|
+
let { date, dateEnv, hasLabel, hasMonthLabel, hasNavLink, businessHours } = raw;
|
|
331
|
+
let [text, textParts] = hasLabel
|
|
332
|
+
? dateEnv.format(date, hasMonthLabel ? raw.monthStartFormat : raw.dayCellFormat)
|
|
333
|
+
: ['', []];
|
|
334
|
+
return Object.assign(Object.assign(Object.assign({}, raw.dateMeta), raw.renderProps), { text,
|
|
335
|
+
textParts, isMajor: raw.isMajor, isNarrow: raw.isNarrow, inPopover: false, hasNavLink,
|
|
336
|
+
get dayNumberText() { return internal$1.findDayNumberText(textParts); },
|
|
337
|
+
get monthText() { return internal$1.findMonthText(textParts); }, options: { businessHours }, view: raw.viewApi });
|
|
338
|
+
}
|
|
269
339
|
|
|
270
340
|
function computeFgSegVerticals(segs, segHeightMap, cells, maxHeight, strictOrder, allowSlicing = true, dayMaxEvents, dayMaxEventRows) {
|
|
271
341
|
let maxCoord;
|
|
@@ -388,20 +458,19 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
388
458
|
return res;
|
|
389
459
|
}
|
|
390
460
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
return new internal$1.DayTableModel(daySeries, /year|month|week/.test(dateProfile.currentRangeUnit));
|
|
461
|
+
function buildDayTableModel(dateProfile, dateProfileGenerator, dateEnv) {
|
|
462
|
+
const daySeries = new internal$1.DaySeriesModel(dateProfile.renderRange, dateProfileGenerator);
|
|
463
|
+
const breakOnWeeks = /year|month|week/.test(dateProfile.currentRangeUnit);
|
|
464
|
+
const majorUnit = !breakOnWeeks && internal$1.computeMajorUnit(dateProfile, dateEnv);
|
|
465
|
+
return new internal$1.DayTableModel(daySeries, breakOnWeeks, dateEnv, majorUnit);
|
|
397
466
|
}
|
|
398
|
-
function computeColWidth(
|
|
467
|
+
function computeColWidth(colCount, colMinWidth, viewportWidth) {
|
|
399
468
|
if (viewportWidth == null) {
|
|
400
469
|
return [undefined, undefined];
|
|
401
470
|
}
|
|
402
|
-
const colTempWidth = viewportWidth /
|
|
471
|
+
const colTempWidth = viewportWidth / colCount;
|
|
403
472
|
if (colTempWidth < colMinWidth) {
|
|
404
|
-
return [colMinWidth *
|
|
473
|
+
return [colMinWidth * colCount, colMinWidth];
|
|
405
474
|
}
|
|
406
475
|
return [viewportWidth, undefined];
|
|
407
476
|
}
|
|
@@ -427,29 +496,24 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
427
496
|
/*
|
|
428
497
|
FYI, `width` is not dependable for aligning completely to farside
|
|
429
498
|
*/
|
|
430
|
-
function computeHorizontalsFromSeg(seg, colWidth,
|
|
499
|
+
function computeHorizontalsFromSeg(seg, colWidth, colCount) {
|
|
431
500
|
let fromStart;
|
|
432
501
|
let fromEnd;
|
|
433
502
|
if (colWidth != null) {
|
|
434
503
|
fromStart = seg.start * colWidth;
|
|
435
|
-
fromEnd = (
|
|
504
|
+
fromEnd = (colCount - seg.end) * colWidth;
|
|
436
505
|
}
|
|
437
506
|
else {
|
|
438
|
-
const colWidthFrac = 1 /
|
|
507
|
+
const colWidthFrac = 1 / colCount;
|
|
439
508
|
fromStart = internal$1.fracToCssDim(seg.start * colWidthFrac);
|
|
440
509
|
fromEnd = internal$1.fracToCssDim(1 - seg.end * colWidthFrac);
|
|
441
510
|
}
|
|
442
|
-
|
|
443
|
-
return { right: fromStart, left: fromEnd };
|
|
444
|
-
}
|
|
445
|
-
else {
|
|
446
|
-
return { left: fromStart, right: fromEnd };
|
|
447
|
-
}
|
|
511
|
+
return { insetInlineStart: fromStart, insetInlineEnd: fromEnd };
|
|
448
512
|
}
|
|
449
|
-
function computeColFromPosition(positionLeft, elWidth, colWidth,
|
|
450
|
-
const realColWidth = colWidth != null ? colWidth : elWidth /
|
|
513
|
+
function computeColFromPosition(positionLeft, elWidth, colWidth, colCount, isRtl) {
|
|
514
|
+
const realColWidth = colWidth != null ? colWidth : elWidth / colCount;
|
|
451
515
|
const colFromLeft = Math.floor(positionLeft / realColWidth);
|
|
452
|
-
const col = isRtl ? (
|
|
516
|
+
const col = isRtl ? (colCount - colFromLeft - 1) : colFromLeft;
|
|
453
517
|
const left = colFromLeft * realColWidth;
|
|
454
518
|
const right = left + realColWidth;
|
|
455
519
|
return { col, left, right };
|
|
@@ -472,13 +536,17 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
472
536
|
// Hit Element
|
|
473
537
|
// -------------------------------------------------------------------------------------------------
|
|
474
538
|
function getRowEl(rootEl, row) {
|
|
475
|
-
return rootEl.querySelectorAll('
|
|
539
|
+
return rootEl.querySelectorAll('[role=row]')[row];
|
|
476
540
|
}
|
|
477
541
|
function getCellEl(rowEl, col) {
|
|
478
|
-
return rowEl.querySelectorAll('
|
|
542
|
+
return rowEl.querySelectorAll('[role=gridcell]')[col];
|
|
479
543
|
}
|
|
480
544
|
// Header Formatting
|
|
481
545
|
// -------------------------------------------------------------------------------------------------
|
|
546
|
+
const dayMicroWidth = 50;
|
|
547
|
+
const dayHeaderMicroFormat = internal$1.createFormatter({
|
|
548
|
+
weekday: 'narrow'
|
|
549
|
+
});
|
|
482
550
|
function createDayHeaderFormatter(explicitFormat, datesRepDistinctDays, dateCnt) {
|
|
483
551
|
return explicitFormat || computeFallbackHeaderFormat(datesRepDistinctDays, dateCnt);
|
|
484
552
|
}
|
|
@@ -486,13 +554,23 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
486
554
|
function computeFallbackHeaderFormat(datesRepDistinctDays, dayCnt) {
|
|
487
555
|
// if more than one week row, or if there are a lot of columns with not much space,
|
|
488
556
|
// put just the day numbers will be in each cell
|
|
489
|
-
if (!datesRepDistinctDays
|
|
557
|
+
if (!datesRepDistinctDays) {
|
|
490
558
|
return internal$1.createFormatter({ weekday: 'short' }); // "Sat"
|
|
491
559
|
}
|
|
492
560
|
if (dayCnt > 1) {
|
|
493
|
-
return internal$1.createFormatter({
|
|
561
|
+
return internal$1.createFormatter({
|
|
562
|
+
weekday: 'short',
|
|
563
|
+
weekdayJustify: 'start',
|
|
564
|
+
day: 'numeric',
|
|
565
|
+
omitCommas: true,
|
|
566
|
+
});
|
|
494
567
|
}
|
|
495
|
-
return internal$1.createFormatter({
|
|
568
|
+
return internal$1.createFormatter({
|
|
569
|
+
weekday: 'long',
|
|
570
|
+
weekdayJustify: 'start',
|
|
571
|
+
day: 'numeric',
|
|
572
|
+
omitCommas: true,
|
|
573
|
+
});
|
|
496
574
|
}
|
|
497
575
|
|
|
498
576
|
class DayGridEventHarness extends preact.Component {
|
|
@@ -503,7 +581,7 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
503
581
|
}
|
|
504
582
|
render() {
|
|
505
583
|
const { props } = this;
|
|
506
|
-
return (preact.createElement("div", { className:
|
|
584
|
+
return (preact.createElement("div", { className: core.joinClassNames(props.className, classNames__default["default"].abs), style: props.style, ref: this.rootElRef }, props.children));
|
|
507
585
|
}
|
|
508
586
|
componentDidMount() {
|
|
509
587
|
const rootEl = this.rootElRef.current; // TODO: make dynamic with useEffect
|
|
@@ -533,6 +611,8 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
533
611
|
this.segHeightRefMap = new internal$1.RefMap(() => {
|
|
534
612
|
internal$1.afterSize(this.handleSegPositioning);
|
|
535
613
|
});
|
|
614
|
+
// memo
|
|
615
|
+
this.buildWeekNumberRenderProps = internal$1.memoize(buildWeekNumberRenderProps);
|
|
536
616
|
this.handleRootEl = (rootEl) => {
|
|
537
617
|
this.rootEl = rootEl;
|
|
538
618
|
internal$1.setRef(this.props.rootElRef, rootEl);
|
|
@@ -545,7 +625,7 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
545
625
|
const { props, context, headerHeightRefMap, mainHeightRefMap } = this;
|
|
546
626
|
const { cells } = props;
|
|
547
627
|
const { options } = context;
|
|
548
|
-
const
|
|
628
|
+
const weekDateMarker = props.cells[0].date;
|
|
549
629
|
const fgLiquidHeight = props.dayMaxEvents === true || props.dayMaxEventRows === true;
|
|
550
630
|
// TODO: memoize? sort all types of segs?
|
|
551
631
|
const fgEventSegs = internal$1.sortEventSegs(props.fgEventSegs, options.eventOrder);
|
|
@@ -564,20 +644,29 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
564
644
|
}
|
|
565
645
|
const highlightSegs = this.getHighlightSegs();
|
|
566
646
|
const mirrorSegs = this.getMirrorSegs();
|
|
567
|
-
const
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
647
|
+
const hasNavLink = options.navLinks;
|
|
648
|
+
const fullWeekStr = internal$1.buildDateStr(context, weekDateMarker, 'week');
|
|
649
|
+
const weekNumberRenderProps = this.buildWeekNumberRenderProps(weekDateMarker, context, props.cellIsNarrow, hasNavLink);
|
|
650
|
+
return (preact.createElement("div", { role: props.role /* !!! */, "aria-label": props.role === 'row' // HACK
|
|
651
|
+
? fullWeekStr
|
|
652
|
+
: undefined // can't have label on non-role div
|
|
653
|
+
, className: internal$1.joinArrayishClassNames(options.dayRowClass, props.className, classNames__default["default"].flexRow, classNames__default["default"].rel, // origin for inlineWeekNumber?
|
|
654
|
+
classNames__default["default"].isolate, (props.forPrint && props.basis !== undefined) && // basis implies siblings (must share height)
|
|
655
|
+
classNames__default["default"].printSiblingRow), style: {
|
|
656
|
+
'flex-basis': props.basis,
|
|
574
657
|
}, ref: this.handleRootEl },
|
|
658
|
+
(props.showWeekNumbers && !props.cellIsMicro) && (preact.createElement(internal$1.ContentContainer, { tag: 'div', attrs: Object.assign(Object.assign({}, (hasNavLink
|
|
659
|
+
? internal$1.buildNavLinkAttrs(context, weekDateMarker, 'week', fullWeekStr, /* isTabbable = */ false)
|
|
660
|
+
: {})), { 'role': undefined, 'aria-hidden': true }),
|
|
661
|
+
// put above all cells (TODO: put explicit z0 on each cell?)
|
|
662
|
+
className: classNames__default["default"].z1, renderProps: weekNumberRenderProps, generatorName: "inlineWeekNumberContent", customGenerator: options.inlineWeekNumberContent, defaultGenerator: internal$1.renderText, classNameGenerator: options.inlineWeekNumberClass, didMount: options.inlineWeekNumberDidMount, willUnmount: options.inlineWeekNumberWillUnmount })),
|
|
575
663
|
this.renderFillSegs(props.businessHourSegs, 'non-business'),
|
|
576
664
|
this.renderFillSegs(props.bgEventSegs, 'bg-event'),
|
|
577
665
|
this.renderFillSegs(highlightSegs, 'highlight'),
|
|
578
|
-
|
|
579
|
-
const normalFgNodes = this.renderFgSegs(maxMainTop, renderableSegsByCol[col], segTops, props.todayRange,
|
|
580
|
-
|
|
666
|
+
props.cells.map((cell, col) => {
|
|
667
|
+
const normalFgNodes = this.renderFgSegs(maxMainTop, renderableSegsByCol[col], segTops, props.todayRange,
|
|
668
|
+
/* isMirror = */ false);
|
|
669
|
+
return (preact.createElement(DayGridCell, { key: cell.key, dateProfile: props.dateProfile, todayRange: props.todayRange, date: cell.date, isMajor: cell.isMajor, showDayNumber: props.showDayNumbers, isNarrow: props.cellIsNarrow, isMicro: props.cellIsMicro, borderStart: Boolean(col),
|
|
581
670
|
// content
|
|
582
671
|
segs: segsByCol[col], hiddenSegs: hiddenSegsByCol[col], fgLiquidHeight: fgLiquidHeight, fg: (preact.createElement(preact.Fragment, null, normalFgNodes)), eventDrag: props.eventDrag, eventResize: props.eventResize, eventSelection: props.eventSelection,
|
|
583
672
|
// render hooks
|
|
@@ -586,19 +675,16 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
586
675
|
fgHeight: heightsByCol[col], width: props.colWidth,
|
|
587
676
|
// refs
|
|
588
677
|
headerHeightRef: headerHeightRefMap.createRef(cell.key), mainHeightRef: mainHeightRefMap.createRef(cell.key) }));
|
|
589
|
-
})
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
Boolean(props.eventDrag), Boolean(props.eventResize), false)));
|
|
678
|
+
}),
|
|
679
|
+
this.renderFgSegs(maxMainTop, mirrorSegs, segTops, props.todayRange,
|
|
680
|
+
/* isMirror = */ true)));
|
|
593
681
|
}
|
|
594
|
-
renderFgSegs(headerHeight, segs, segTops, todayRange,
|
|
682
|
+
renderFgSegs(headerHeight, segs, segTops, todayRange, isMirror) {
|
|
595
683
|
var _a;
|
|
596
|
-
const { props,
|
|
597
|
-
const {
|
|
598
|
-
const
|
|
599
|
-
const colCnt = props.cells.length;
|
|
684
|
+
const { props, segHeightRefMap } = this;
|
|
685
|
+
const { colWidth, eventSelection, cellIsMicro } = props;
|
|
686
|
+
const colCount = props.cells.length;
|
|
600
687
|
const defaultDisplayEventEnd = props.cells.length === 1;
|
|
601
|
-
const isMirror = isDragging || isResizing || isDateSelecting;
|
|
602
688
|
const nodes = [];
|
|
603
689
|
for (const seg of segs) {
|
|
604
690
|
const key = getEventPartKey(seg);
|
|
@@ -607,39 +693,43 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
607
693
|
if (standinFor) {
|
|
608
694
|
continue;
|
|
609
695
|
}
|
|
610
|
-
const {
|
|
696
|
+
const { insetInlineStart, insetInlineEnd } = computeHorizontalsFromSeg(seg, colWidth, colCount);
|
|
611
697
|
const localTop = (_a = segTops.get(standinFor ? getEventPartKey(standinFor) : key)) !== null && _a !== void 0 ? _a : (isMirror ? 0 : undefined);
|
|
612
698
|
const top = headerHeight != null && localTop != null
|
|
613
699
|
? headerHeight + localTop
|
|
614
700
|
: undefined;
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
|
|
701
|
+
const isDragging = Boolean(props.eventDrag && props.eventDrag.affectedInstances[instanceId]);
|
|
702
|
+
const isResizing = Boolean(props.eventResize && props.eventResize.affectedInstances[instanceId]);
|
|
703
|
+
const isInvisible = !isMirror && (isDragging || isResizing || standinFor || top == null);
|
|
704
|
+
const isListItem = hasListItemDisplay(seg);
|
|
705
|
+
nodes.push(preact.createElement(DayGridEventHarness, { key: key, className: seg.start ? classNames__default["default"].fakeBorderS : '', style: {
|
|
706
|
+
visibility: isInvisible ? 'hidden' : undefined,
|
|
618
707
|
top,
|
|
619
|
-
|
|
620
|
-
|
|
708
|
+
insetInlineStart,
|
|
709
|
+
insetInlineEnd,
|
|
710
|
+
zIndex: 0, // container inner z-indexes
|
|
621
711
|
}, heightRef: (!standinFor && !isMirror)
|
|
622
712
|
? segHeightRefMap.createRef(key)
|
|
623
|
-
: null },
|
|
713
|
+
: null },
|
|
714
|
+
preact.createElement(internal$1.StandardEvent, Object.assign({ display: isListItem ? 'list-item' : 'row', eventRange: eventRange, isStart: seg.isStart, isEnd: seg.isEnd, isDragging: isDragging, isResizing: isResizing, isMirror: isMirror, isSelected: instanceId === eventSelection, isNarrow: props.cellIsNarrow, defaultTimeFormat: DEFAULT_TABLE_EVENT_TIME_FORMAT, defaultDisplayEventEnd: defaultDisplayEventEnd, disableResizing: isListItem, forcedTimeText: cellIsMicro ? '' : undefined }, internal$1.getEventRangeMeta(eventRange, todayRange)))));
|
|
624
715
|
}
|
|
625
716
|
return nodes;
|
|
626
717
|
}
|
|
627
718
|
renderFillSegs(segs, fillType) {
|
|
628
719
|
const { props, context } = this;
|
|
629
|
-
const { isRtl } = context;
|
|
630
720
|
const { todayRange, colWidth } = props;
|
|
631
|
-
const
|
|
721
|
+
const colCount = props.cells.length;
|
|
632
722
|
const nodes = [];
|
|
633
723
|
for (const seg of segs) {
|
|
634
724
|
const key = internal$1.buildEventRangeKey(seg.eventRange); // TODO: use different type of key than fg!?
|
|
635
|
-
const {
|
|
725
|
+
const { insetInlineStart, insetInlineEnd } = computeHorizontalsFromSeg(seg, colWidth, colCount);
|
|
636
726
|
const isVisible = !seg.standinFor;
|
|
637
|
-
nodes.push(preact.createElement("div", { key: key, className: "
|
|
727
|
+
nodes.push(preact.createElement("div", { key: key, className: classNames__default["default"].fillY, style: {
|
|
638
728
|
visibility: isVisible ? '' : 'hidden',
|
|
639
|
-
|
|
640
|
-
|
|
729
|
+
insetInlineStart,
|
|
730
|
+
insetInlineEnd,
|
|
641
731
|
} }, fillType === 'bg-event' ?
|
|
642
|
-
preact.createElement(internal$1.BgEvent, Object.assign({ eventRange: seg.eventRange, isStart: seg.isStart, isEnd: seg.isEnd }, internal$1.getEventRangeMeta(seg.eventRange, todayRange))) : (internal$1.renderFill(fillType))));
|
|
732
|
+
preact.createElement(internal$1.BgEvent, Object.assign({ eventRange: seg.eventRange, isStart: seg.isStart, isEnd: seg.isEnd, isNarrow: props.cellIsNarrow, isVertical: false }, internal$1.getEventRangeMeta(seg.eventRange, todayRange))) : (internal$1.renderFill(fillType, context.options))));
|
|
643
733
|
}
|
|
644
734
|
return preact.createElement(preact.Fragment, {}, ...nodes); // TODO: shouldn't this be an array, so keyed?
|
|
645
735
|
}
|
|
@@ -703,6 +793,22 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
703
793
|
return props.dateSelectionSegs;
|
|
704
794
|
}
|
|
705
795
|
}
|
|
796
|
+
// Utils
|
|
797
|
+
// -------------------------------------------------------------------------------------------------
|
|
798
|
+
function buildWeekNumberRenderProps(weekDateMarker, context, isNarrow, hasNavLink) {
|
|
799
|
+
const { dateEnv, options } = context;
|
|
800
|
+
const weekNum = dateEnv.computeWeekNumber(weekDateMarker);
|
|
801
|
+
const [weekNumText, weekNumTextParts] = dateEnv.format(weekDateMarker, options.weekNumberFormat || DEFAULT_WEEK_NUM_FORMAT);
|
|
802
|
+
const weekDateZoned = dateEnv.toDate(weekDateMarker);
|
|
803
|
+
return {
|
|
804
|
+
num: weekNum,
|
|
805
|
+
text: weekNumText,
|
|
806
|
+
textParts: weekNumTextParts,
|
|
807
|
+
date: weekDateZoned,
|
|
808
|
+
isNarrow,
|
|
809
|
+
hasNavLink,
|
|
810
|
+
};
|
|
811
|
+
}
|
|
706
812
|
|
|
707
813
|
class DayGridRows extends internal$1.DateComponent {
|
|
708
814
|
constructor() {
|
|
@@ -738,45 +844,36 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
738
844
|
render() {
|
|
739
845
|
let { props, context, rowHeightRefMap } = this;
|
|
740
846
|
let { options } = context;
|
|
741
|
-
let
|
|
742
|
-
let fgEventSegsByRow = this.splitFgEventSegs(props.fgEventSegs,
|
|
743
|
-
let bgEventSegsByRow = this.splitBgEventSegs(props.bgEventSegs,
|
|
744
|
-
let businessHourSegsByRow = this.splitBusinessHourSegs(props.businessHourSegs,
|
|
745
|
-
let dateSelectionSegsByRow = this.splitDateSelectionSegs(props.dateSelectionSegs,
|
|
746
|
-
let eventDragByRow = this.splitEventDrag(props.eventDrag,
|
|
747
|
-
let eventResizeByRow = this.splitEventResize(props.eventResize,
|
|
847
|
+
let rowCount = props.cellRows.length;
|
|
848
|
+
let fgEventSegsByRow = this.splitFgEventSegs(props.fgEventSegs, rowCount);
|
|
849
|
+
let bgEventSegsByRow = this.splitBgEventSegs(props.bgEventSegs, rowCount);
|
|
850
|
+
let businessHourSegsByRow = this.splitBusinessHourSegs(props.businessHourSegs, rowCount);
|
|
851
|
+
let dateSelectionSegsByRow = this.splitDateSelectionSegs(props.dateSelectionSegs, rowCount);
|
|
852
|
+
let eventDragByRow = this.splitEventDrag(props.eventDrag, rowCount);
|
|
853
|
+
let eventResizeByRow = this.splitEventResize(props.eventResize, rowCount);
|
|
748
854
|
let isHeightAuto = internal$1.getIsHeightAuto(options);
|
|
749
855
|
let rowHeightsRedistribute = !props.forPrint && !isHeightAuto;
|
|
750
|
-
let
|
|
751
|
-
return (preact.createElement("div", { className:
|
|
856
|
+
let rowBasis = computeRowBasis(props.visibleWidth, rowCount, isHeightAuto, options);
|
|
857
|
+
return (preact.createElement("div", { role: 'rowgroup', className: core.joinClassNames(props.className,
|
|
752
858
|
// HACK for Safari. Can't do break-inside:avoid with flexbox items, likely b/c it's not standard:
|
|
753
859
|
// https://stackoverflow.com/a/60256345
|
|
754
|
-
!props.forPrint &&
|
|
860
|
+
!props.forPrint && classNames__default["default"].flexCol), style: { width: props.width }, ref: this.handleRootEl }, props.cellRows.map((cells, row) => (preact.createElement(DayGridRow, { key: cells[0].key, role: 'row', dateProfile: props.dateProfile, todayRange: props.todayRange, cells: cells, cellIsNarrow: props.cellIsNarrow, cellIsMicro: props.cellIsMicro, showDayNumbers: rowCount > 1, showWeekNumbers: rowCount > 1 && options.weekNumbers, forPrint: props.forPrint,
|
|
755
861
|
// if not auto-height, distribute height of container somewhat evently to rows
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
row < rowCnt - 1 && 'fc-border-b'),
|
|
862
|
+
className: core.joinClassNames(rowHeightsRedistribute && classNames__default["default"].grow, rowCount > 1 && classNames__default["default"].breakInsideAvoid, // don't avoid breaks for single tall row
|
|
863
|
+
row < rowCount - 1 ? classNames__default["default"].borderOnlyB : classNames__default["default"].borderNone),
|
|
759
864
|
// content
|
|
760
865
|
fgEventSegs: fgEventSegsByRow[row], bgEventSegs: bgEventSegsByRow[row].filter(isSegAllDay) /* HACK */, businessHourSegs: businessHourSegsByRow[row], dateSelectionSegs: dateSelectionSegsByRow[row], eventSelection: props.eventSelection, eventDrag: eventDragByRow[row], eventResize: eventResizeByRow[row], dayMaxEvents: props.dayMaxEvents, dayMaxEventRows: props.dayMaxEventRows,
|
|
761
866
|
// dimensions
|
|
762
|
-
colWidth: props.colWidth,
|
|
867
|
+
colWidth: props.colWidth, basis: rowBasis,
|
|
763
868
|
// refs
|
|
764
869
|
heightRef: rowHeightRefMap.createRef(cells[0].key) })))));
|
|
765
870
|
}
|
|
766
|
-
componentDidMount() {
|
|
767
|
-
this.disconnectWidth = internal$1.watchWidth(this.rootEl, (width) => {
|
|
768
|
-
this.setState({ width });
|
|
769
|
-
});
|
|
770
|
-
}
|
|
771
|
-
componentWillUnmount() {
|
|
772
|
-
this.disconnectWidth();
|
|
773
|
-
}
|
|
774
871
|
// Hit System
|
|
775
872
|
// -----------------------------------------------------------------------------------------------
|
|
776
|
-
queryHit(positionLeft, positionTop, elWidth) {
|
|
777
|
-
const { props
|
|
778
|
-
const
|
|
779
|
-
const { col, left, right } = computeColFromPosition(positionLeft, elWidth, props.colWidth,
|
|
873
|
+
queryHit(isRtl, positionLeft, positionTop, elWidth) {
|
|
874
|
+
const { props } = this;
|
|
875
|
+
const colCount = props.cellRows[0].length;
|
|
876
|
+
const { col, left, right } = computeColFromPosition(positionLeft, elWidth, props.colWidth, colCount, isRtl);
|
|
780
877
|
const { row, top, bottom } = computeRowFromPosition(positionTop, props.cellRows, this.rowHeightRefMap.current);
|
|
781
878
|
const cell = props.cellRows[row][col];
|
|
782
879
|
const cellStartDate = cell.date;
|
|
@@ -787,8 +884,7 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
787
884
|
start: cellStartDate,
|
|
788
885
|
end: cellEndDate,
|
|
789
886
|
}, allDay: true }, cell.dateSpanProps),
|
|
790
|
-
|
|
791
|
-
dayEl: getCellEl(getRowEl(this.rootEl, row), col),
|
|
887
|
+
getDayEl: () => getCellEl(getRowEl(this.rootEl, row), col),
|
|
792
888
|
rect: {
|
|
793
889
|
left,
|
|
794
890
|
right,
|
|
@@ -804,40 +900,41 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
804
900
|
function isSegAllDay(seg) {
|
|
805
901
|
return seg.eventRange.def.allDay;
|
|
806
902
|
}
|
|
807
|
-
|
|
808
|
-
|
|
903
|
+
/*
|
|
904
|
+
Amount of height a row should consume prior to expanding
|
|
905
|
+
We don't want to use min-height with flexbox because we leverage min-height:auto,
|
|
906
|
+
which yields value based on natural height of events
|
|
907
|
+
*/
|
|
908
|
+
function computeRowBasis(visibleWidth, // should INCLUDE any scrollbar width to avoid oscillation
|
|
909
|
+
rowCount, isHeightAuto, options) {
|
|
809
910
|
if (visibleWidth != null) {
|
|
810
911
|
// ensure a consistent row min-height modelled after a month with 6 rows respecting aspectRatio
|
|
811
912
|
// will result in same minHeight regardless of weekends, dayMinWidth, height:auto
|
|
812
|
-
const
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
// this is value that looks natural on paper for portrait/landscape
|
|
817
|
-
? '6em'
|
|
818
|
-
// don't give minHeight when single-month non-auto-height
|
|
819
|
-
// TODO: better way to detect this with DateProfile?
|
|
820
|
-
: (rowCnt > 6 || isHeightAuto)
|
|
821
|
-
? rowMinHeight
|
|
822
|
-
: undefined,
|
|
823
|
-
// isCompact?: just before most lone +more links hit bottom of cell
|
|
824
|
-
rowMinHeight < 70,
|
|
825
|
-
];
|
|
913
|
+
const rowBasis = visibleWidth / options.aspectRatio / 6;
|
|
914
|
+
// don't give minHeight when single-month non-auto-height
|
|
915
|
+
// TODO: better way to detect this with DateProfile?
|
|
916
|
+
return (rowCount > 6 || isHeightAuto) ? rowBasis : 0;
|
|
826
917
|
}
|
|
827
|
-
return
|
|
918
|
+
return 0;
|
|
828
919
|
}
|
|
829
920
|
|
|
830
921
|
class DayGridHeaderCell extends internal$1.BaseComponent {
|
|
831
922
|
constructor() {
|
|
832
923
|
super(...arguments);
|
|
833
924
|
this.handleInnerEl = (innerEl) => {
|
|
834
|
-
if (this.
|
|
835
|
-
this.
|
|
836
|
-
this.
|
|
925
|
+
if (this.disconnectSize) {
|
|
926
|
+
this.disconnectSize();
|
|
927
|
+
this.disconnectSize = undefined;
|
|
837
928
|
}
|
|
838
929
|
if (innerEl) {
|
|
839
|
-
this.
|
|
930
|
+
this.disconnectSize = internal$1.watchSize(innerEl, (width, height) => {
|
|
840
931
|
internal$1.setRef(this.props.innerHeightRef, height);
|
|
932
|
+
/*
|
|
933
|
+
TODO: DRY with TimelineHeaderCell
|
|
934
|
+
*/
|
|
935
|
+
if (this.align === 'center' && this.isSticky) {
|
|
936
|
+
this.setState({ innerWidth: width });
|
|
937
|
+
}
|
|
841
938
|
});
|
|
842
939
|
}
|
|
843
940
|
else {
|
|
@@ -846,16 +943,54 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
846
943
|
};
|
|
847
944
|
}
|
|
848
945
|
render() {
|
|
849
|
-
const { props } = this;
|
|
946
|
+
const { props, state, context } = this;
|
|
850
947
|
const { renderConfig, dataConfig } = props;
|
|
851
|
-
|
|
948
|
+
// HACK
|
|
949
|
+
const isDisabled = dataConfig.renderProps.isDisabled;
|
|
950
|
+
const finalRenderProps = Object.assign(Object.assign({}, dataConfig.renderProps), { isNarrow: props.cellIsNarrow, level: props.rowLevel });
|
|
951
|
+
if (props.cellIsMicro) {
|
|
952
|
+
// TODO: only if not distinct dates
|
|
953
|
+
const [microText, microTextParts] = context.dateEnv.format(dataConfig.dateMarker, dayHeaderMicroFormat);
|
|
954
|
+
finalRenderProps.text = finalRenderProps.weekdayText = microText;
|
|
955
|
+
finalRenderProps.textParts = microTextParts;
|
|
956
|
+
}
|
|
957
|
+
/*
|
|
958
|
+
TODO: DRY with TimelineHeaderCell
|
|
959
|
+
*/
|
|
960
|
+
const alignInput = renderConfig.align;
|
|
961
|
+
const align = this.align =
|
|
962
|
+
typeof alignInput === 'function'
|
|
963
|
+
? alignInput({ level: props.rowLevel, inPopover: dataConfig.renderProps.inPopover, isNarrow: props.cellIsNarrow })
|
|
964
|
+
: alignInput;
|
|
965
|
+
const stickyInput = renderConfig.sticky;
|
|
966
|
+
const isSticky = this.isSticky =
|
|
967
|
+
props.rowLevel && stickyInput !== false;
|
|
968
|
+
let edgeCoord;
|
|
969
|
+
if (isSticky) {
|
|
970
|
+
if (align === 'center') {
|
|
971
|
+
if (state.innerWidth != null) {
|
|
972
|
+
edgeCoord = `calc(50% - ${state.innerWidth / 2}px)`;
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
else {
|
|
976
|
+
edgeCoord = (typeof stickyInput === 'number' ||
|
|
977
|
+
typeof stickyInput === 'string') ? stickyInput : 0;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
return (preact.createElement(internal$1.ContentContainer, { tag: 'div', attrs: Object.assign({ role: 'columnheader', 'aria-colspan': dataConfig.colSpan }, dataConfig.attrs), className: core.joinClassNames(dataConfig.className, classNames__default["default"].tight, classNames__default["default"].flexCol, props.borderStart ? classNames__default["default"].borderOnlyS : classNames__default["default"].borderNone, align === 'center' ? classNames__default["default"].alignCenter :
|
|
981
|
+
align === 'end' ? classNames__default["default"].alignEnd :
|
|
982
|
+
classNames__default["default"].alignStart, props.colWidth == null && classNames__default["default"].liquid, !isSticky && classNames__default["default"].crop), style: {
|
|
852
983
|
width: props.colWidth != null
|
|
853
984
|
? props.colWidth * (dataConfig.colSpan || 1)
|
|
854
985
|
: undefined,
|
|
855
|
-
}, renderProps:
|
|
986
|
+
}, renderProps: finalRenderProps, generatorName: renderConfig.generatorName, customGenerator: renderConfig.customGenerator, defaultGenerator: internal$1.renderText, classNameGenerator:
|
|
856
987
|
// don't use custom classNames if disabled
|
|
857
988
|
// TODO: make DRY with DayCellContainer
|
|
858
|
-
|
|
989
|
+
isDisabled ? undefined : renderConfig.classNameGenerator, didMount: renderConfig.didMount, willUnmount: renderConfig.willUnmount }, (InnerContainer) => (preact.createElement("div", { ref: this.handleInnerEl, className: core.joinClassNames(classNames__default["default"].flexCol, classNames__default["default"].rigid, isSticky && classNames__default["default"].sticky), style: {
|
|
990
|
+
left: edgeCoord,
|
|
991
|
+
right: edgeCoord,
|
|
992
|
+
} },
|
|
993
|
+
preact.createElement(InnerContainer, { tag: 'div', attrs: dataConfig.innerAttrs, className: internal$1.generateClassName(renderConfig.innerClassNameGenerator, finalRenderProps) })))));
|
|
859
994
|
}
|
|
860
995
|
}
|
|
861
996
|
|
|
@@ -879,8 +1014,14 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
879
1014
|
};
|
|
880
1015
|
}
|
|
881
1016
|
render() {
|
|
882
|
-
const { props } = this;
|
|
883
|
-
|
|
1017
|
+
const { props, context } = this;
|
|
1018
|
+
const { options } = context;
|
|
1019
|
+
return (preact.createElement("div", { role: props.role /* !!! */, "aria-rowindex": props.rowIndex != null ? 1 + props.rowIndex : undefined, className: internal$1.joinArrayishClassNames(options.dayHeaderRowClass, props.className, classNames__default["default"].flexRow, classNames__default["default"].contentBox, props.borderBottom ? classNames__default["default"].borderOnlyB : classNames__default["default"].borderNone), style: {
|
|
1020
|
+
height: props.height,
|
|
1021
|
+
} }, props.dataConfigs.map((dataConfig, cellI) => (preact.createElement(DayGridHeaderCell, { key: dataConfig.key, renderConfig: props.renderConfig, dataConfig: dataConfig, borderStart: Boolean(cellI), colWidth: props.colWidth, innerHeightRef: this.innerHeightRefMap.createRef(dataConfig.key), cellIsNarrow: props.cellIsNarrow, cellIsMicro: props.cellIsMicro, rowLevel: props.rowLevel })))));
|
|
1022
|
+
}
|
|
1023
|
+
componentWillUnmount() {
|
|
1024
|
+
internal$1.setRef(this.props.innerHeightRef, null);
|
|
884
1025
|
}
|
|
885
1026
|
}
|
|
886
1027
|
|
|
@@ -890,9 +1031,10 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
890
1031
|
class DayGridHeader extends internal$1.BaseComponent {
|
|
891
1032
|
render() {
|
|
892
1033
|
const { props } = this;
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
1034
|
+
const { headerTiers } = props;
|
|
1035
|
+
return (preact.createElement("div", { role: 'rowgroup', className: core.joinClassNames(props.className, classNames__default["default"].flexCol, props.width == null && classNames__default["default"].liquid), style: {
|
|
1036
|
+
width: props.width,
|
|
1037
|
+
} }, headerTiers.map((rowConfig, i) => (preact.createElement(DayGridHeaderRow, Object.assign({}, rowConfig, { key: i, role: 'row', borderBottom: i < headerTiers.length - 1, colWidth: props.colWidth, cellIsNarrow: props.cellIsNarrow, cellIsMicro: props.cellIsMicro, rowLevel: headerTiers.length - i - 1 }))))));
|
|
896
1038
|
}
|
|
897
1039
|
}
|
|
898
1040
|
|
|
@@ -902,37 +1044,54 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
902
1044
|
this.handleScroller = (scroller) => {
|
|
903
1045
|
internal$1.setRef(this.props.scrollerRef, scroller);
|
|
904
1046
|
};
|
|
1047
|
+
this.handleTotalWidth = (totalWidth) => {
|
|
1048
|
+
this.setState({ totalWidth });
|
|
1049
|
+
};
|
|
905
1050
|
this.handleClientWidth = (clientWidth) => {
|
|
906
1051
|
this.setState({ clientWidth });
|
|
907
1052
|
};
|
|
908
|
-
this.handleEndScrollbarWidth = (endScrollbarWidth) => {
|
|
909
|
-
this.setState({ endScrollbarWidth });
|
|
910
|
-
};
|
|
911
1053
|
}
|
|
912
1054
|
render() {
|
|
913
1055
|
const { props, state, context } = this;
|
|
914
1056
|
const { options } = context;
|
|
1057
|
+
const { totalWidth, clientWidth } = state;
|
|
1058
|
+
let endScrollbarWidth = (totalWidth != null && clientWidth != null)
|
|
1059
|
+
? totalWidth - clientWidth
|
|
1060
|
+
: undefined;
|
|
1061
|
+
// HACK when clientWidth does NOT include body-border, compared to totalWidth
|
|
1062
|
+
if (endScrollbarWidth < 3) {
|
|
1063
|
+
endScrollbarWidth = 0;
|
|
1064
|
+
}
|
|
915
1065
|
const verticalScrollbars = !props.forPrint && !internal$1.getIsHeightAuto(options);
|
|
916
1066
|
const stickyHeaderDates = !props.forPrint && internal$1.getStickyHeaderDates(options);
|
|
1067
|
+
const colCount = props.cellRows[0].length;
|
|
1068
|
+
const cellWidth = clientWidth != null ? clientWidth / colCount : undefined;
|
|
1069
|
+
const cellIsMicro = cellWidth != null && cellWidth <= dayMicroWidth;
|
|
1070
|
+
const cellIsNarrow = cellIsMicro || (cellWidth != null && cellWidth <= options.dayNarrowWidth);
|
|
917
1071
|
return (preact.createElement(preact.Fragment, null,
|
|
918
|
-
options.dayHeaders && (preact.createElement("div", { className: internal$1.
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
1072
|
+
options.dayHeaders && (preact.createElement("div", { className: core.joinClassNames(internal$1.generateClassName(options.tableHeaderClass, {
|
|
1073
|
+
isSticky: stickyHeaderDates,
|
|
1074
|
+
}), props.borderlessX && classNames__default["default"].borderlessX, classNames__default["default"].printHeader, // either flexCol or table-header-group
|
|
1075
|
+
stickyHeaderDates && classNames__default["default"].tableHeaderSticky) },
|
|
1076
|
+
preact.createElement("div", { className: classNames__default["default"].flexRow },
|
|
1077
|
+
preact.createElement(DayGridHeader, { headerTiers: props.headerTiers, cellIsNarrow: cellIsNarrow, cellIsMicro: cellIsMicro }),
|
|
1078
|
+
Boolean(endScrollbarWidth) && (preact.createElement("div", { className: internal$1.joinArrayishClassNames(internal$1.generateClassName(options.fillerClass, { isHeader: true }), classNames__default["default"].borderOnlyS), style: { minWidth: endScrollbarWidth } }))),
|
|
1079
|
+
preact.createElement("div", { className: internal$1.generateClassName(options.dayHeaderDividerClass, {
|
|
1080
|
+
isSticky: stickyHeaderDates,
|
|
1081
|
+
options: { allDaySlot: Boolean(options.allDaySlot) },
|
|
1082
|
+
}) }))),
|
|
1083
|
+
preact.createElement(internal$1.Scroller, { vertical: verticalScrollbars, className: internal$1.joinArrayishClassNames(options.tableBodyClass, props.borderlessX && classNames__default["default"].borderlessX, stickyHeaderDates && classNames__default["default"].borderlessTop, (stickyHeaderDates || props.noEdgeEffects) && classNames__default["default"].noEdgeEffects,
|
|
923
1084
|
// HACK for Safari. Can't do break-inside:avoid with flexbox items, likely b/c it's not standard:
|
|
924
1085
|
// https://stackoverflow.com/a/60256345
|
|
925
|
-
!props.forPrint &&
|
|
926
|
-
preact.createElement(DayGridRows, { dateProfile: props.dateProfile, todayRange: props.todayRange, cellRows: props.cellRows, forPrint: props.forPrint, isHitComboAllowed: props.isHitComboAllowed, className:
|
|
1086
|
+
!props.forPrint && classNames__default["default"].flexCol, verticalScrollbars && classNames__default["default"].liquid), ref: this.handleScroller, clientWidthRef: this.handleClientWidth },
|
|
1087
|
+
preact.createElement(DayGridRows, { dateProfile: props.dateProfile, todayRange: props.todayRange, cellRows: props.cellRows, forPrint: props.forPrint, isHitComboAllowed: props.isHitComboAllowed, className: classNames__default["default"].grow, dayMaxEvents: props.forPrint ? undefined : options.dayMaxEvents, dayMaxEventRows: options.dayMaxEventRows,
|
|
927
1088
|
// content
|
|
928
1089
|
fgEventSegs: props.fgEventSegs, bgEventSegs: props.bgEventSegs, businessHourSegs: props.businessHourSegs, dateSelectionSegs: props.dateSelectionSegs, eventDrag: props.eventDrag, eventResize: props.eventResize, eventSelection: props.eventSelection,
|
|
929
1090
|
// dimensions
|
|
930
|
-
visibleWidth:
|
|
931
|
-
state.clientWidth != null && state.endScrollbarWidth != null
|
|
932
|
-
? state.clientWidth + state.endScrollbarWidth
|
|
933
|
-
: undefined,
|
|
1091
|
+
visibleWidth: totalWidth, cellIsNarrow: cellIsNarrow, cellIsMicro: cellIsMicro,
|
|
934
1092
|
// refs
|
|
935
|
-
rowHeightRefMap: props.rowHeightRefMap }))
|
|
1093
|
+
rowHeightRefMap: props.rowHeightRefMap })),
|
|
1094
|
+
preact.createElement(internal$1.Ruler, { widthRef: this.handleTotalWidth })));
|
|
936
1095
|
}
|
|
937
1096
|
}
|
|
938
1097
|
|
|
@@ -944,43 +1103,54 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
944
1103
|
this.footerScrollerRef = preact.createRef();
|
|
945
1104
|
// Sizing
|
|
946
1105
|
// -----------------------------------------------------------------------------------------------
|
|
1106
|
+
this.handleTotalWidth = (totalWidth) => {
|
|
1107
|
+
this.setState({ totalWidth });
|
|
1108
|
+
};
|
|
947
1109
|
this.handleClientWidth = (clientWidth) => {
|
|
948
1110
|
this.setState({ clientWidth });
|
|
949
1111
|
};
|
|
950
|
-
this.handleEndScrollbarWidth = (endScrollbarWidth) => {
|
|
951
|
-
this.setState({ endScrollbarWidth });
|
|
952
|
-
};
|
|
953
1112
|
}
|
|
954
1113
|
render() {
|
|
955
1114
|
const { props, state, context } = this;
|
|
956
1115
|
const { options } = context;
|
|
1116
|
+
const { totalWidth, clientWidth } = state;
|
|
1117
|
+
const endScrollbarWidth = (totalWidth != null && clientWidth != null)
|
|
1118
|
+
? totalWidth - clientWidth
|
|
1119
|
+
: undefined;
|
|
957
1120
|
const verticalScrollbars = !props.forPrint && !internal$1.getIsHeightAuto(options);
|
|
958
1121
|
const stickyHeaderDates = !props.forPrint && internal$1.getStickyHeaderDates(options);
|
|
959
1122
|
const stickyFooterScrollbar = !props.forPrint && internal$1.getStickyFooterScrollbar(options);
|
|
960
|
-
const
|
|
961
|
-
const [canvasWidth, colWidth] = computeColWidth(
|
|
1123
|
+
const colCount = props.cellRows[0].length;
|
|
1124
|
+
const [canvasWidth, colWidth] = computeColWidth(colCount, props.dayMinWidth, clientWidth);
|
|
1125
|
+
const cellIsMicro = colWidth != null && colWidth <= dayMicroWidth;
|
|
1126
|
+
const cellIsNarrow = cellIsMicro || (colWidth != null && colWidth <= options.dayNarrowWidth);
|
|
962
1127
|
return (preact.createElement(preact.Fragment, null,
|
|
963
|
-
options.dayHeaders && (preact.createElement("div", { className:
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
1128
|
+
options.dayHeaders && (preact.createElement("div", { className: core.joinClassNames(internal$1.generateClassName(options.tableHeaderClass, {
|
|
1129
|
+
isSticky: stickyHeaderDates,
|
|
1130
|
+
}), props.borderlessX && classNames__default["default"].borderlessX, classNames__default["default"].printHeader, // either flexCol or table-header-group
|
|
1131
|
+
stickyHeaderDates && classNames__default["default"].tableHeaderSticky) },
|
|
1132
|
+
preact.createElement(internal$1.Scroller, { horizontal: true, hideScrollbars: true, className: classNames__default["default"].flexRow, ref: this.headerScrollerRef },
|
|
1133
|
+
preact.createElement(DayGridHeader, { headerTiers: props.headerTiers, colWidth: colWidth, width: canvasWidth, cellIsNarrow: cellIsNarrow, cellIsMicro: cellIsMicro }),
|
|
1134
|
+
Boolean(endScrollbarWidth) && (preact.createElement("div", { className: internal$1.joinArrayishClassNames(internal$1.generateClassName(options.fillerClass, { isHeader: true }), classNames__default["default"].borderOnlyS), style: { minWidth: endScrollbarWidth } }))),
|
|
1135
|
+
preact.createElement("div", { className: internal$1.generateClassName(options.dayHeaderDividerClass, {
|
|
1136
|
+
isSticky: stickyHeaderDates,
|
|
1137
|
+
options: { allDaySlot: Boolean(options.allDaySlot) },
|
|
1138
|
+
}) }))),
|
|
967
1139
|
preact.createElement(internal$1.Scroller, { vertical: verticalScrollbars, horizontal: true, hideScrollbars: stickyFooterScrollbar ||
|
|
968
1140
|
props.forPrint // prevents blank space in print-view on Safari
|
|
969
|
-
, className: internal$1.
|
|
1141
|
+
, className: internal$1.joinArrayishClassNames(options.tableBodyClass, props.borderlessX && classNames__default["default"].borderlessX, stickyHeaderDates && classNames__default["default"].borderlessTop, (stickyHeaderDates || props.noEdgeEffects) && classNames__default["default"].noEdgeEffects,
|
|
970
1142
|
// HACK for Safari. Can't do break-inside:avoid with flexbox items, likely b/c it's not standard:
|
|
971
1143
|
// https://stackoverflow.com/a/60256345
|
|
972
|
-
!props.forPrint &&
|
|
973
|
-
preact.createElement(DayGridRows, { dateProfile: props.dateProfile, todayRange: props.todayRange, cellRows: props.cellRows, forPrint: props.forPrint, isHitComboAllowed: props.isHitComboAllowed, className:
|
|
1144
|
+
!props.forPrint && classNames__default["default"].flexCol, verticalScrollbars && classNames__default["default"].liquid), ref: this.bodyScrollerRef, clientWidthRef: this.handleClientWidth },
|
|
1145
|
+
preact.createElement(DayGridRows, { dateProfile: props.dateProfile, todayRange: props.todayRange, cellRows: props.cellRows, forPrint: props.forPrint, isHitComboAllowed: props.isHitComboAllowed, className: classNames__default["default"].grow, dayMaxEvents: props.forPrint ? undefined : options.dayMaxEvents, dayMaxEventRows: options.dayMaxEventRows,
|
|
974
1146
|
// content
|
|
975
1147
|
fgEventSegs: props.fgEventSegs, bgEventSegs: props.bgEventSegs, businessHourSegs: props.businessHourSegs, dateSelectionSegs: props.dateSelectionSegs, eventDrag: props.eventDrag, eventResize: props.eventResize, eventSelection: props.eventSelection,
|
|
976
1148
|
// dimensions
|
|
977
|
-
colWidth: colWidth, width: canvasWidth, visibleWidth:
|
|
978
|
-
state.clientWidth != null && state.endScrollbarWidth != null
|
|
979
|
-
? state.clientWidth + state.endScrollbarWidth
|
|
980
|
-
: undefined,
|
|
1149
|
+
colWidth: colWidth, width: canvasWidth, visibleWidth: totalWidth, cellIsNarrow: cellIsNarrow, cellIsMicro: cellIsMicro,
|
|
981
1150
|
// refs
|
|
982
1151
|
rowHeightRefMap: props.rowHeightRefMap })),
|
|
983
|
-
Boolean(stickyFooterScrollbar) && (preact.createElement(internal$1.
|
|
1152
|
+
Boolean(stickyFooterScrollbar) && (preact.createElement(internal$1.FooterScrollbar, { isSticky: true, canvasWidth: canvasWidth, scrollerRef: this.footerScrollerRef })),
|
|
1153
|
+
preact.createElement(internal$1.Ruler, { widthRef: this.handleTotalWidth })));
|
|
984
1154
|
}
|
|
985
1155
|
// Lifecycle
|
|
986
1156
|
// -----------------------------------------------------------------------------------------------
|
|
@@ -1035,21 +1205,30 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
1035
1205
|
}
|
|
1036
1206
|
}
|
|
1037
1207
|
};
|
|
1038
|
-
this.
|
|
1039
|
-
|
|
1208
|
+
this.handleScrollEnd = (isUser) => {
|
|
1209
|
+
if (isUser) {
|
|
1210
|
+
this.scrollDate = null;
|
|
1211
|
+
}
|
|
1040
1212
|
};
|
|
1041
1213
|
}
|
|
1042
1214
|
render() {
|
|
1043
1215
|
const { props, context } = this;
|
|
1044
1216
|
const { options } = context;
|
|
1045
1217
|
const commonLayoutProps = Object.assign(Object.assign({}, props), { scrollerRef: this.scrollerRef, rowHeightRefMap: this.rowHeightRefMap });
|
|
1046
|
-
return (preact.createElement(internal$1.ViewContainer, { viewSpec: context.viewSpec,
|
|
1218
|
+
return (preact.createElement(internal$1.ViewContainer, { viewSpec: context.viewSpec, attrs: {
|
|
1219
|
+
role: 'grid',
|
|
1220
|
+
'aria-rowcount': props.headerTiers.length + props.cellRows.length,
|
|
1221
|
+
'aria-colcount': props.cellRows[0].length,
|
|
1222
|
+
'aria-labelledby': props.labelId,
|
|
1223
|
+
'aria-label': props.labelStr,
|
|
1224
|
+
}, className: internal$1.joinArrayishClassNames(props.className, classNames__default["default"].printRoot, // either flexCol or table
|
|
1225
|
+
options.tableClass), borderlessX: props.borderlessX, borderlessTop: props.borderlessTop, borderlessBottom: props.borderlessBottom, noEdgeEffects: props.noEdgeEffects }, options.dayMinWidth ? (preact.createElement(DayGridLayoutPannable, Object.assign({}, commonLayoutProps, { dayMinWidth: options.dayMinWidth }))) : (preact.createElement(DayGridLayoutNormal, Object.assign({}, commonLayoutProps)))));
|
|
1047
1226
|
}
|
|
1048
1227
|
// Lifecycle
|
|
1049
1228
|
// -----------------------------------------------------------------------------------------------
|
|
1050
1229
|
componentDidMount() {
|
|
1051
1230
|
this.resetScroll();
|
|
1052
|
-
this.scrollerRef.current.addScrollEndListener(this.
|
|
1231
|
+
this.scrollerRef.current.addScrollEndListener(this.handleScrollEnd);
|
|
1053
1232
|
}
|
|
1054
1233
|
componentDidUpdate(prevProps) {
|
|
1055
1234
|
if (prevProps.dateProfile !== this.props.dateProfile && this.context.options.scrollTimeReset) {
|
|
@@ -1057,14 +1236,13 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
1057
1236
|
}
|
|
1058
1237
|
}
|
|
1059
1238
|
componentWillUnmount() {
|
|
1060
|
-
this.scrollerRef.current.removeScrollEndListener(this.
|
|
1239
|
+
this.scrollerRef.current.removeScrollEndListener(this.handleScrollEnd);
|
|
1061
1240
|
}
|
|
1062
1241
|
// Scrolling
|
|
1063
1242
|
// -----------------------------------------------------------------------------------------------
|
|
1064
1243
|
resetScroll() {
|
|
1065
1244
|
this.scrollDate = this.props.dateProfile.currentDate;
|
|
1066
1245
|
this.updateScrollY();
|
|
1067
|
-
// updateScrollX
|
|
1068
1246
|
const scroller = this.scrollerRef.current;
|
|
1069
1247
|
scroller.scrollTo({ x: 0 });
|
|
1070
1248
|
}
|
|
@@ -1082,18 +1260,19 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
1082
1260
|
}
|
|
1083
1261
|
render() {
|
|
1084
1262
|
const { props, context } = this;
|
|
1085
|
-
const {
|
|
1086
|
-
const
|
|
1087
|
-
const
|
|
1088
|
-
const
|
|
1089
|
-
const
|
|
1263
|
+
const { dateProfile } = props;
|
|
1264
|
+
const { options, dateEnv } = context;
|
|
1265
|
+
const dayTableModel = this.buildDayTableModel(dateProfile, context.dateProfileGenerator, dateEnv);
|
|
1266
|
+
const datesRepDistinctDays = dayTableModel.rowCount === 1;
|
|
1267
|
+
const dayHeaderFormat = this.createDayHeaderFormatter(context.options.dayHeaderFormat, datesRepDistinctDays, dayTableModel.colCount);
|
|
1268
|
+
const slicedProps = this.slicer.sliceProps(props, dateProfile, options.nextDayThreshold, context, dayTableModel);
|
|
1090
1269
|
return (preact.createElement(internal$1.NowTimer, { unit: "day" }, (nowDate, todayRange) => {
|
|
1091
|
-
const headerTiers = this.buildDateRowConfigs(dayTableModel.headerDates, datesRepDistinctDays,
|
|
1092
|
-
return (preact.createElement(DayGridLayout, {
|
|
1270
|
+
const headerTiers = this.buildDateRowConfigs(dayTableModel.headerDates, datesRepDistinctDays, dateProfile, todayRange, dayHeaderFormat, context);
|
|
1271
|
+
return (preact.createElement(DayGridLayout, { labelId: props.labelId, labelStr: props.labelStr, dateProfile: dateProfile, todayRange: todayRange, cellRows: dayTableModel.cellRows, forPrint: props.forPrint, className: props.className,
|
|
1093
1272
|
// header content
|
|
1094
1273
|
headerTiers: headerTiers,
|
|
1095
1274
|
// body content
|
|
1096
|
-
fgEventSegs: slicedProps.fgEventSegs, bgEventSegs: slicedProps.bgEventSegs, businessHourSegs: slicedProps.businessHourSegs, dateSelectionSegs: slicedProps.dateSelectionSegs, eventDrag: slicedProps.eventDrag, eventResize: slicedProps.eventResize, eventSelection: slicedProps.eventSelection }));
|
|
1275
|
+
fgEventSegs: slicedProps.fgEventSegs, bgEventSegs: slicedProps.bgEventSegs, businessHourSegs: slicedProps.businessHourSegs, dateSelectionSegs: slicedProps.dateSelectionSegs, eventDrag: slicedProps.eventDrag, eventResize: slicedProps.eventResize, eventSelection: slicedProps.eventSelection, borderlessX: props.borderlessX, borderlessTop: props.borderlessTop, borderlessBottom: props.borderlessBottom, noEdgeEffects: props.noEdgeEffects }));
|
|
1097
1276
|
}));
|
|
1098
1277
|
}
|
|
1099
1278
|
}
|
|
@@ -1129,19 +1308,26 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
1129
1308
|
// TODO: instead of these date-math gymnastics (for multimonth view),
|
|
1130
1309
|
// compute dateprofiles of all months, then use start of first and end of last.
|
|
1131
1310
|
let lastMonthRenderStart = dateEnv.startOfWeek(dateEnv.startOfMonth(internal$1.addDays(currentRange.end, -1)));
|
|
1132
|
-
let
|
|
1311
|
+
let rowCount = Math.ceil(// could be partial weeks due to hiddenDays
|
|
1133
1312
|
internal$1.diffWeeks(lastMonthRenderStart, end));
|
|
1134
|
-
end = internal$1.addWeeks(end, 6 -
|
|
1313
|
+
end = internal$1.addWeeks(end, 6 - rowCount);
|
|
1135
1314
|
}
|
|
1136
1315
|
return { start, end };
|
|
1137
1316
|
}
|
|
1138
1317
|
|
|
1139
|
-
|
|
1140
|
-
|
|
1318
|
+
const OPTION_REFINERS = {
|
|
1319
|
+
dayHeaders: Boolean,
|
|
1320
|
+
dayHeaderFormat: internal$1.createFormatter,
|
|
1321
|
+
};
|
|
1322
|
+
const OPTION_DEFAULTS = {
|
|
1323
|
+
dayHeaders: true,
|
|
1324
|
+
};
|
|
1141
1325
|
|
|
1142
1326
|
var plugin = core.createPlugin({
|
|
1143
1327
|
name: '@fullcalendar/daygrid',
|
|
1144
1328
|
initialView: 'dayGridMonth',
|
|
1329
|
+
optionRefiners: OPTION_REFINERS,
|
|
1330
|
+
optionDefaults: OPTION_DEFAULTS,
|
|
1145
1331
|
views: {
|
|
1146
1332
|
dayGrid: {
|
|
1147
1333
|
component: DayGridView,
|
|
@@ -1179,8 +1365,10 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
1179
1365
|
buildDateRenderConfig: buildDateRenderConfig,
|
|
1180
1366
|
buildDateDataConfigs: buildDateDataConfigs,
|
|
1181
1367
|
createDayHeaderFormatter: createDayHeaderFormatter,
|
|
1368
|
+
dayHeaderMicroFormat: dayHeaderMicroFormat,
|
|
1369
|
+
dayMicroWidth: dayMicroWidth,
|
|
1182
1370
|
DayGridLayout: DayGridLayout,
|
|
1183
|
-
|
|
1371
|
+
computeRowBasis: computeRowBasis,
|
|
1184
1372
|
DayGridRow: DayGridRow,
|
|
1185
1373
|
DayGridRows: DayGridRows,
|
|
1186
1374
|
buildDayTableModel: buildDayTableModel,
|
|
@@ -1199,4 +1387,4 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
1199
1387
|
|
|
1200
1388
|
return exports;
|
|
1201
1389
|
|
|
1202
|
-
})({}, FullCalendar, FullCalendar.Internal, FullCalendar.Preact);
|
|
1390
|
+
})({}, FullCalendar, FullCalendar.Internal, FullCalendar.Preact, FullCalendar.InternalClassNames);
|