@fullcalendar/daygrid 7.0.0-beta.4 → 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} +49 -31
- package/{internal.js → esm/internal.js} +397 -272
- package/{index.global.js → global.js} +412 -273
- 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 -1208
|
@@ -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,20 +25,31 @@ 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
|
}
|
|
40
55
|
/*
|
|
@@ -46,42 +61,60 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
46
61
|
return {
|
|
47
62
|
generatorName: 'dayHeaderContent',
|
|
48
63
|
customGenerator: options.dayHeaderContent,
|
|
49
|
-
classNameGenerator: options.
|
|
64
|
+
classNameGenerator: options.dayHeaderClass,
|
|
65
|
+
innerClassNameGenerator: options.dayHeaderInnerClass,
|
|
50
66
|
didMount: options.dayHeaderDidMount,
|
|
51
67
|
willUnmount: options.dayHeaderWillUnmount,
|
|
68
|
+
align: options.dayHeaderAlign,
|
|
69
|
+
sticky: options.dayHeaderSticky,
|
|
52
70
|
};
|
|
53
71
|
}
|
|
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
|
+
}
|
|
54
76
|
/*
|
|
55
77
|
For header cells: data
|
|
56
78
|
*/
|
|
57
|
-
function buildDateDataConfigs(
|
|
58
|
-
context, colSpan = 1, keyPrefix = ''
|
|
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) {
|
|
59
83
|
const { dateEnv, viewApi, options } = context;
|
|
60
84
|
return datesRepDistinctDays
|
|
61
|
-
?
|
|
62
|
-
const dateMeta = internal$1.getDateMeta(
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
|
|
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);
|
|
67
98
|
// for DayGridHeaderCell
|
|
68
99
|
return {
|
|
69
|
-
key: keyPrefix +
|
|
100
|
+
key: keyPrefix + dateMarker.toUTCString(),
|
|
101
|
+
dateMarker,
|
|
70
102
|
renderProps,
|
|
71
|
-
attrs: Object.assign(Object.assign({ 'aria-label': fullDateStr }, (dateMeta.isToday ? { 'aria-current': 'date' } : {})), { 'data-date': internal$1.formatDayString(
|
|
103
|
+
attrs: Object.assign(Object.assign(Object.assign({ 'aria-label': fullDateStr }, (dateMeta.isToday ? { 'aria-current': 'date' } : {})), { 'data-date': internal$1.formatDayString(dateMarker) }), extraAttrs),
|
|
72
104
|
// for navlink
|
|
73
|
-
innerAttrs:
|
|
74
|
-
? internal$1.buildNavLinkAttrs(context,
|
|
105
|
+
innerAttrs: hasNavLink
|
|
106
|
+
? internal$1.buildNavLinkAttrs(context, dateMarker, undefined, fullDateStr)
|
|
75
107
|
: { 'aria-hidden': true },
|
|
76
108
|
colSpan,
|
|
77
|
-
|
|
78
|
-
className
|
|
109
|
+
hasNavLink,
|
|
110
|
+
className,
|
|
79
111
|
};
|
|
80
112
|
})
|
|
81
|
-
:
|
|
82
|
-
const dow =
|
|
113
|
+
: dateMarkers.map((dateMarker, i) => {
|
|
114
|
+
const dow = dateMarker.getUTCDay();
|
|
83
115
|
const normDate = internal$1.addDays(firstSunday, dow);
|
|
84
|
-
const
|
|
116
|
+
const dateMeta = {
|
|
117
|
+
date: dateEnv.toDate(dateMarker),
|
|
85
118
|
dow,
|
|
86
119
|
isDisabled: false,
|
|
87
120
|
isFuture: false,
|
|
@@ -89,22 +122,25 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
89
122
|
isToday: false,
|
|
90
123
|
isOther: false,
|
|
91
124
|
};
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
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];
|
|
95
132
|
// for DayGridHeaderCell
|
|
96
133
|
return {
|
|
97
134
|
key: keyPrefix + String(dow),
|
|
135
|
+
dateMarker,
|
|
98
136
|
renderProps,
|
|
99
|
-
attrs: {
|
|
100
|
-
|
|
101
|
-
},
|
|
102
|
-
// for navlink
|
|
137
|
+
attrs: Object.assign({ 'aria-label': fullWeekDayStr }, extraAttrs),
|
|
138
|
+
// NOT a navlink
|
|
103
139
|
innerAttrs: {
|
|
104
140
|
'aria-hidden': true, // label already on cell
|
|
105
141
|
},
|
|
106
142
|
colSpan,
|
|
107
|
-
className
|
|
143
|
+
className,
|
|
108
144
|
};
|
|
109
145
|
});
|
|
110
146
|
}
|
|
@@ -120,9 +156,9 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
120
156
|
}
|
|
121
157
|
// DayGridRange utils (TODO: move)
|
|
122
158
|
// -------------------------------------------------------------------------------------------------
|
|
123
|
-
function splitSegsByRow(segs,
|
|
159
|
+
function splitSegsByRow(segs, rowCount) {
|
|
124
160
|
const byRow = [];
|
|
125
|
-
for (let row = 0; row <
|
|
161
|
+
for (let row = 0; row < rowCount; row++) {
|
|
126
162
|
byRow[row] = [];
|
|
127
163
|
}
|
|
128
164
|
for (const seg of segs) {
|
|
@@ -130,15 +166,15 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
130
166
|
}
|
|
131
167
|
return byRow;
|
|
132
168
|
}
|
|
133
|
-
function splitInteractionByRow(ui,
|
|
169
|
+
function splitInteractionByRow(ui, rowCount) {
|
|
134
170
|
const byRow = [];
|
|
135
171
|
if (!ui) {
|
|
136
|
-
for (let row = 0; row <
|
|
172
|
+
for (let row = 0; row < rowCount; row++) {
|
|
137
173
|
byRow[row] = null;
|
|
138
174
|
}
|
|
139
175
|
}
|
|
140
176
|
else {
|
|
141
|
-
for (let row = 0; row <
|
|
177
|
+
for (let row = 0; row < rowCount; row++) {
|
|
142
178
|
byRow[row] = {
|
|
143
179
|
affectedInstances: ui.affectedInstances,
|
|
144
180
|
isEvent: ui.isEvent,
|
|
@@ -171,58 +207,29 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
171
207
|
);
|
|
172
208
|
}
|
|
173
209
|
|
|
174
|
-
class DayGridBlockEvent extends internal$1.BaseComponent {
|
|
175
|
-
render() {
|
|
176
|
-
let { props } = this;
|
|
177
|
-
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 })));
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
class DayGridListEvent extends internal$1.BaseComponent {
|
|
182
|
-
render() {
|
|
183
|
-
let { props, context } = this;
|
|
184
|
-
let { options } = context;
|
|
185
|
-
let { eventRange } = props;
|
|
186
|
-
let timeFormat = options.eventTimeFormat || DEFAULT_TABLE_EVENT_TIME_FORMAT;
|
|
187
|
-
let timeText = internal$1.buildEventRangeTimeText(timeFormat, eventRange,
|
|
188
|
-
/* slicedStart = */ undefined,
|
|
189
|
-
/* slicedEnd = */ undefined, props.isStart, props.isEnd, context,
|
|
190
|
-
/* defaultDisplayEventTime = */ true, props.defaultDisplayEventEnd);
|
|
191
|
-
let [tag, attrs] = internal$1.getEventTagAndAttrs(eventRange, context);
|
|
192
|
-
return (preact.createElement(internal$1.EventContainer, Object.assign({}, props, { tag: tag, attrs: attrs, className: 'fc-daygrid-dot-event fc-daygrid-event', defaultGenerator: renderInnerContent, timeText: timeText, isResizing: false, isDateSelecting: false })));
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
function renderInnerContent(renderProps) {
|
|
196
|
-
return (preact.createElement(preact.Fragment, null,
|
|
197
|
-
preact.createElement("div", { className: "fc-daygrid-event-dot", style: { borderColor: renderProps.borderColor || renderProps.backgroundColor } }),
|
|
198
|
-
renderProps.timeText && (preact.createElement("div", { className: "fc-event-time" }, renderProps.timeText)),
|
|
199
|
-
preact.createElement("div", { className: "fc-event-title" }, renderProps.event.title || preact.createElement(preact.Fragment, null, "\u00A0"))));
|
|
200
|
-
}
|
|
201
|
-
|
|
202
210
|
class DayGridMoreLink extends internal$1.BaseComponent {
|
|
203
211
|
render() {
|
|
204
212
|
let { props } = this;
|
|
205
|
-
return (preact.createElement(internal$1.MoreLinkContainer, { className:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
let
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
visibility: forcedInvisibleMap[instanceId] ? 'hidden' : '',
|
|
217
|
-
} }, 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))))));
|
|
218
|
-
})));
|
|
219
|
-
} }));
|
|
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
|
+
}))) }));
|
|
220
224
|
}
|
|
221
225
|
}
|
|
222
226
|
|
|
223
227
|
class DayGridCell extends internal$1.DateComponent {
|
|
224
228
|
constructor() {
|
|
225
229
|
super(...arguments);
|
|
230
|
+
// memo
|
|
231
|
+
this.getDateMeta = internal$1.memoize(internal$1.getDateMeta);
|
|
232
|
+
this.refineRenderProps = internal$1.memoizeObjArg(refineRenderProps);
|
|
226
233
|
// ref
|
|
227
234
|
this.rootElRef = preact.createRef();
|
|
228
235
|
this.handleBodyEl = (bodyEl) => {
|
|
@@ -256,34 +263,53 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
256
263
|
// TODO: memoize this
|
|
257
264
|
const isMonthStart = props.showDayNumber &&
|
|
258
265
|
shouldDisplayMonthStart(props.date, props.dateProfile.currentRange, dateEnv);
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
const
|
|
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),
|
|
283
|
+
});
|
|
262
284
|
if (dateMeta.isDisabled) {
|
|
263
|
-
return (preact.createElement("div", { role: 'gridcell', "aria-disabled": true, className: internal$1.
|
|
285
|
+
return (preact.createElement("div", { role: 'gridcell', "aria-disabled": true, className: internal$1.joinArrayishClassNames(internal$1.generateClassName(options.dayCellClass, renderProps), props.className, baseClassName), style: {
|
|
264
286
|
width: props.width
|
|
265
287
|
} }));
|
|
266
288
|
}
|
|
267
|
-
const hasDayNumber = props.showDayNumber || internal$1.hasCustomDayCellContent(options);
|
|
268
|
-
const isNavLink = options.navLinks;
|
|
269
289
|
const fullDateStr = internal$1.buildDateStr(context, props.date);
|
|
270
|
-
return (preact.createElement(internal$1.
|
|
271
|
-
width: props.width
|
|
272
|
-
},
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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)) })))));
|
|
281
307
|
}
|
|
282
308
|
}
|
|
283
309
|
// Utils
|
|
284
310
|
// -------------------------------------------------------------------------------------------------
|
|
285
311
|
function renderTopInner(props) {
|
|
286
|
-
return props.
|
|
312
|
+
return props.text || preact.createElement(preact.Fragment, null, "\u00A0"); // TODO: DRY?
|
|
287
313
|
}
|
|
288
314
|
function shouldDisplayMonthStart(date, currentRange, dateEnv) {
|
|
289
315
|
const { start: currentStart, end: currentEnd } = currentRange;
|
|
@@ -300,6 +326,16 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
300
326
|
// a month-start that's within the current range?
|
|
301
327
|
(dateEnv.getDay(date) === 1 && date.valueOf() < currentEnd.valueOf()));
|
|
302
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
|
+
}
|
|
303
339
|
|
|
304
340
|
function computeFgSegVerticals(segs, segHeightMap, cells, maxHeight, strictOrder, allowSlicing = true, dayMaxEvents, dayMaxEventRows) {
|
|
305
341
|
let maxCoord;
|
|
@@ -422,20 +458,19 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
422
458
|
return res;
|
|
423
459
|
}
|
|
424
460
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
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);
|
|
431
466
|
}
|
|
432
|
-
function computeColWidth(
|
|
467
|
+
function computeColWidth(colCount, colMinWidth, viewportWidth) {
|
|
433
468
|
if (viewportWidth == null) {
|
|
434
469
|
return [undefined, undefined];
|
|
435
470
|
}
|
|
436
|
-
const colTempWidth = viewportWidth /
|
|
471
|
+
const colTempWidth = viewportWidth / colCount;
|
|
437
472
|
if (colTempWidth < colMinWidth) {
|
|
438
|
-
return [colMinWidth *
|
|
473
|
+
return [colMinWidth * colCount, colMinWidth];
|
|
439
474
|
}
|
|
440
475
|
return [viewportWidth, undefined];
|
|
441
476
|
}
|
|
@@ -461,29 +496,24 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
461
496
|
/*
|
|
462
497
|
FYI, `width` is not dependable for aligning completely to farside
|
|
463
498
|
*/
|
|
464
|
-
function computeHorizontalsFromSeg(seg, colWidth,
|
|
499
|
+
function computeHorizontalsFromSeg(seg, colWidth, colCount) {
|
|
465
500
|
let fromStart;
|
|
466
501
|
let fromEnd;
|
|
467
502
|
if (colWidth != null) {
|
|
468
503
|
fromStart = seg.start * colWidth;
|
|
469
|
-
fromEnd = (
|
|
504
|
+
fromEnd = (colCount - seg.end) * colWidth;
|
|
470
505
|
}
|
|
471
506
|
else {
|
|
472
|
-
const colWidthFrac = 1 /
|
|
507
|
+
const colWidthFrac = 1 / colCount;
|
|
473
508
|
fromStart = internal$1.fracToCssDim(seg.start * colWidthFrac);
|
|
474
509
|
fromEnd = internal$1.fracToCssDim(1 - seg.end * colWidthFrac);
|
|
475
510
|
}
|
|
476
|
-
|
|
477
|
-
return { right: fromStart, left: fromEnd };
|
|
478
|
-
}
|
|
479
|
-
else {
|
|
480
|
-
return { left: fromStart, right: fromEnd };
|
|
481
|
-
}
|
|
511
|
+
return { insetInlineStart: fromStart, insetInlineEnd: fromEnd };
|
|
482
512
|
}
|
|
483
|
-
function computeColFromPosition(positionLeft, elWidth, colWidth,
|
|
484
|
-
const realColWidth = colWidth != null ? colWidth : elWidth /
|
|
513
|
+
function computeColFromPosition(positionLeft, elWidth, colWidth, colCount, isRtl) {
|
|
514
|
+
const realColWidth = colWidth != null ? colWidth : elWidth / colCount;
|
|
485
515
|
const colFromLeft = Math.floor(positionLeft / realColWidth);
|
|
486
|
-
const col = isRtl ? (
|
|
516
|
+
const col = isRtl ? (colCount - colFromLeft - 1) : colFromLeft;
|
|
487
517
|
const left = colFromLeft * realColWidth;
|
|
488
518
|
const right = left + realColWidth;
|
|
489
519
|
return { col, left, right };
|
|
@@ -506,13 +536,17 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
506
536
|
// Hit Element
|
|
507
537
|
// -------------------------------------------------------------------------------------------------
|
|
508
538
|
function getRowEl(rootEl, row) {
|
|
509
|
-
return rootEl.querySelectorAll('
|
|
539
|
+
return rootEl.querySelectorAll('[role=row]')[row];
|
|
510
540
|
}
|
|
511
541
|
function getCellEl(rowEl, col) {
|
|
512
|
-
return rowEl.querySelectorAll('
|
|
542
|
+
return rowEl.querySelectorAll('[role=gridcell]')[col];
|
|
513
543
|
}
|
|
514
544
|
// Header Formatting
|
|
515
545
|
// -------------------------------------------------------------------------------------------------
|
|
546
|
+
const dayMicroWidth = 50;
|
|
547
|
+
const dayHeaderMicroFormat = internal$1.createFormatter({
|
|
548
|
+
weekday: 'narrow'
|
|
549
|
+
});
|
|
516
550
|
function createDayHeaderFormatter(explicitFormat, datesRepDistinctDays, dateCnt) {
|
|
517
551
|
return explicitFormat || computeFallbackHeaderFormat(datesRepDistinctDays, dateCnt);
|
|
518
552
|
}
|
|
@@ -520,13 +554,23 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
520
554
|
function computeFallbackHeaderFormat(datesRepDistinctDays, dayCnt) {
|
|
521
555
|
// if more than one week row, or if there are a lot of columns with not much space,
|
|
522
556
|
// put just the day numbers will be in each cell
|
|
523
|
-
if (!datesRepDistinctDays
|
|
557
|
+
if (!datesRepDistinctDays) {
|
|
524
558
|
return internal$1.createFormatter({ weekday: 'short' }); // "Sat"
|
|
525
559
|
}
|
|
526
560
|
if (dayCnt > 1) {
|
|
527
|
-
return internal$1.createFormatter({
|
|
561
|
+
return internal$1.createFormatter({
|
|
562
|
+
weekday: 'short',
|
|
563
|
+
weekdayJustify: 'start',
|
|
564
|
+
day: 'numeric',
|
|
565
|
+
omitCommas: true,
|
|
566
|
+
});
|
|
528
567
|
}
|
|
529
|
-
return internal$1.createFormatter({
|
|
568
|
+
return internal$1.createFormatter({
|
|
569
|
+
weekday: 'long',
|
|
570
|
+
weekdayJustify: 'start',
|
|
571
|
+
day: 'numeric',
|
|
572
|
+
omitCommas: true,
|
|
573
|
+
});
|
|
530
574
|
}
|
|
531
575
|
|
|
532
576
|
class DayGridEventHarness extends preact.Component {
|
|
@@ -537,7 +581,7 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
537
581
|
}
|
|
538
582
|
render() {
|
|
539
583
|
const { props } = this;
|
|
540
|
-
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));
|
|
541
585
|
}
|
|
542
586
|
componentDidMount() {
|
|
543
587
|
const rootEl = this.rootElRef.current; // TODO: make dynamic with useEffect
|
|
@@ -567,6 +611,8 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
567
611
|
this.segHeightRefMap = new internal$1.RefMap(() => {
|
|
568
612
|
internal$1.afterSize(this.handleSegPositioning);
|
|
569
613
|
});
|
|
614
|
+
// memo
|
|
615
|
+
this.buildWeekNumberRenderProps = internal$1.memoize(buildWeekNumberRenderProps);
|
|
570
616
|
this.handleRootEl = (rootEl) => {
|
|
571
617
|
this.rootEl = rootEl;
|
|
572
618
|
internal$1.setRef(this.props.rootElRef, rootEl);
|
|
@@ -579,7 +625,7 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
579
625
|
const { props, context, headerHeightRefMap, mainHeightRefMap } = this;
|
|
580
626
|
const { cells } = props;
|
|
581
627
|
const { options } = context;
|
|
582
|
-
const
|
|
628
|
+
const weekDateMarker = props.cells[0].date;
|
|
583
629
|
const fgLiquidHeight = props.dayMaxEvents === true || props.dayMaxEventRows === true;
|
|
584
630
|
// TODO: memoize? sort all types of segs?
|
|
585
631
|
const fgEventSegs = internal$1.sortEventSegs(props.fgEventSegs, options.eventOrder);
|
|
@@ -598,24 +644,29 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
598
644
|
}
|
|
599
645
|
const highlightSegs = this.getHighlightSegs();
|
|
600
646
|
const mirrorSegs = this.getMirrorSegs();
|
|
601
|
-
const
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
{};
|
|
605
|
-
const isNavLink = options.navLinks;
|
|
606
|
-
const fullWeekStr = internal$1.buildDateStr(context, weekDate, 'week');
|
|
647
|
+
const hasNavLink = options.navLinks;
|
|
648
|
+
const fullWeekStr = internal$1.buildDateStr(context, weekDateMarker, 'week');
|
|
649
|
+
const weekNumberRenderProps = this.buildWeekNumberRenderProps(weekDateMarker, context, props.cellIsNarrow, hasNavLink);
|
|
607
650
|
return (preact.createElement("div", { role: props.role /* !!! */, "aria-label": props.role === 'row' // HACK
|
|
608
651
|
? fullWeekStr
|
|
609
652
|
: undefined // can't have label on non-role div
|
|
610
|
-
, className: internal$1.
|
|
611
|
-
|
|
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,
|
|
612
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 })),
|
|
613
663
|
this.renderFillSegs(props.businessHourSegs, 'non-business'),
|
|
614
664
|
this.renderFillSegs(props.bgEventSegs, 'bg-event'),
|
|
615
665
|
this.renderFillSegs(highlightSegs, 'highlight'),
|
|
616
|
-
|
|
617
|
-
const normalFgNodes = this.renderFgSegs(maxMainTop, renderableSegsByCol[col], segTops, props.todayRange,
|
|
618
|
-
|
|
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),
|
|
619
670
|
// content
|
|
620
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,
|
|
621
672
|
// render hooks
|
|
@@ -624,21 +675,16 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
624
675
|
fgHeight: heightsByCol[col], width: props.colWidth,
|
|
625
676
|
// refs
|
|
626
677
|
headerHeightRef: headerHeightRefMap.createRef(cell.key), mainHeightRef: mainHeightRefMap.createRef(cell.key) }));
|
|
627
|
-
})
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
Boolean(props.eventDrag), Boolean(props.eventResize), false)));
|
|
633
|
-
}
|
|
634
|
-
renderFgSegs(headerHeight, segs, segTops, todayRange, forcedInvisibleMap, isDragging, isResizing, isDateSelecting) {
|
|
678
|
+
}),
|
|
679
|
+
this.renderFgSegs(maxMainTop, mirrorSegs, segTops, props.todayRange,
|
|
680
|
+
/* isMirror = */ true)));
|
|
681
|
+
}
|
|
682
|
+
renderFgSegs(headerHeight, segs, segTops, todayRange, isMirror) {
|
|
635
683
|
var _a;
|
|
636
|
-
const { props,
|
|
637
|
-
const {
|
|
638
|
-
const
|
|
639
|
-
const colCnt = props.cells.length;
|
|
684
|
+
const { props, segHeightRefMap } = this;
|
|
685
|
+
const { colWidth, eventSelection, cellIsMicro } = props;
|
|
686
|
+
const colCount = props.cells.length;
|
|
640
687
|
const defaultDisplayEventEnd = props.cells.length === 1;
|
|
641
|
-
const isMirror = isDragging || isResizing || isDateSelecting;
|
|
642
688
|
const nodes = [];
|
|
643
689
|
for (const seg of segs) {
|
|
644
690
|
const key = getEventPartKey(seg);
|
|
@@ -647,39 +693,43 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
647
693
|
if (standinFor) {
|
|
648
694
|
continue;
|
|
649
695
|
}
|
|
650
|
-
const {
|
|
696
|
+
const { insetInlineStart, insetInlineEnd } = computeHorizontalsFromSeg(seg, colWidth, colCount);
|
|
651
697
|
const localTop = (_a = segTops.get(standinFor ? getEventPartKey(standinFor) : key)) !== null && _a !== void 0 ? _a : (isMirror ? 0 : undefined);
|
|
652
698
|
const top = headerHeight != null && localTop != null
|
|
653
699
|
? headerHeight + localTop
|
|
654
700
|
: undefined;
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
|
|
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,
|
|
658
707
|
top,
|
|
659
|
-
|
|
660
|
-
|
|
708
|
+
insetInlineStart,
|
|
709
|
+
insetInlineEnd,
|
|
710
|
+
zIndex: 0, // container inner z-indexes
|
|
661
711
|
}, heightRef: (!standinFor && !isMirror)
|
|
662
712
|
? segHeightRefMap.createRef(key)
|
|
663
|
-
: 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)))));
|
|
664
715
|
}
|
|
665
716
|
return nodes;
|
|
666
717
|
}
|
|
667
718
|
renderFillSegs(segs, fillType) {
|
|
668
719
|
const { props, context } = this;
|
|
669
|
-
const { isRtl } = context;
|
|
670
720
|
const { todayRange, colWidth } = props;
|
|
671
|
-
const
|
|
721
|
+
const colCount = props.cells.length;
|
|
672
722
|
const nodes = [];
|
|
673
723
|
for (const seg of segs) {
|
|
674
724
|
const key = internal$1.buildEventRangeKey(seg.eventRange); // TODO: use different type of key than fg!?
|
|
675
|
-
const {
|
|
725
|
+
const { insetInlineStart, insetInlineEnd } = computeHorizontalsFromSeg(seg, colWidth, colCount);
|
|
676
726
|
const isVisible = !seg.standinFor;
|
|
677
|
-
nodes.push(preact.createElement("div", { key: key, className: "
|
|
727
|
+
nodes.push(preact.createElement("div", { key: key, className: classNames__default["default"].fillY, style: {
|
|
678
728
|
visibility: isVisible ? '' : 'hidden',
|
|
679
|
-
|
|
680
|
-
|
|
729
|
+
insetInlineStart,
|
|
730
|
+
insetInlineEnd,
|
|
681
731
|
} }, fillType === 'bg-event' ?
|
|
682
|
-
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))));
|
|
683
733
|
}
|
|
684
734
|
return preact.createElement(preact.Fragment, {}, ...nodes); // TODO: shouldn't this be an array, so keyed?
|
|
685
735
|
}
|
|
@@ -743,6 +793,22 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
743
793
|
return props.dateSelectionSegs;
|
|
744
794
|
}
|
|
745
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
|
+
}
|
|
746
812
|
|
|
747
813
|
class DayGridRows extends internal$1.DateComponent {
|
|
748
814
|
constructor() {
|
|
@@ -778,45 +844,36 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
778
844
|
render() {
|
|
779
845
|
let { props, context, rowHeightRefMap } = this;
|
|
780
846
|
let { options } = context;
|
|
781
|
-
let
|
|
782
|
-
let fgEventSegsByRow = this.splitFgEventSegs(props.fgEventSegs,
|
|
783
|
-
let bgEventSegsByRow = this.splitBgEventSegs(props.bgEventSegs,
|
|
784
|
-
let businessHourSegsByRow = this.splitBusinessHourSegs(props.businessHourSegs,
|
|
785
|
-
let dateSelectionSegsByRow = this.splitDateSelectionSegs(props.dateSelectionSegs,
|
|
786
|
-
let eventDragByRow = this.splitEventDrag(props.eventDrag,
|
|
787
|
-
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);
|
|
788
854
|
let isHeightAuto = internal$1.getIsHeightAuto(options);
|
|
789
855
|
let rowHeightsRedistribute = !props.forPrint && !isHeightAuto;
|
|
790
|
-
let
|
|
791
|
-
return (preact.createElement("div", { role: 'rowgroup', className:
|
|
856
|
+
let rowBasis = computeRowBasis(props.visibleWidth, rowCount, isHeightAuto, options);
|
|
857
|
+
return (preact.createElement("div", { role: 'rowgroup', className: core.joinClassNames(props.className,
|
|
792
858
|
// HACK for Safari. Can't do break-inside:avoid with flexbox items, likely b/c it's not standard:
|
|
793
859
|
// https://stackoverflow.com/a/60256345
|
|
794
|
-
!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,
|
|
795
861
|
// if not auto-height, distribute height of container somewhat evently to rows
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
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),
|
|
799
864
|
// content
|
|
800
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,
|
|
801
866
|
// dimensions
|
|
802
|
-
colWidth: props.colWidth,
|
|
867
|
+
colWidth: props.colWidth, basis: rowBasis,
|
|
803
868
|
// refs
|
|
804
869
|
heightRef: rowHeightRefMap.createRef(cells[0].key) })))));
|
|
805
870
|
}
|
|
806
|
-
componentDidMount() {
|
|
807
|
-
this.disconnectWidth = internal$1.watchWidth(this.rootEl, (width) => {
|
|
808
|
-
this.setState({ width });
|
|
809
|
-
});
|
|
810
|
-
}
|
|
811
|
-
componentWillUnmount() {
|
|
812
|
-
this.disconnectWidth();
|
|
813
|
-
}
|
|
814
871
|
// Hit System
|
|
815
872
|
// -----------------------------------------------------------------------------------------------
|
|
816
|
-
queryHit(positionLeft, positionTop, elWidth) {
|
|
817
|
-
const { props
|
|
818
|
-
const
|
|
819
|
-
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);
|
|
820
877
|
const { row, top, bottom } = computeRowFromPosition(positionTop, props.cellRows, this.rowHeightRefMap.current);
|
|
821
878
|
const cell = props.cellRows[row][col];
|
|
822
879
|
const cellStartDate = cell.date;
|
|
@@ -827,8 +884,7 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
827
884
|
start: cellStartDate,
|
|
828
885
|
end: cellEndDate,
|
|
829
886
|
}, allDay: true }, cell.dateSpanProps),
|
|
830
|
-
|
|
831
|
-
dayEl: getCellEl(getRowEl(this.rootEl, row), col),
|
|
887
|
+
getDayEl: () => getCellEl(getRowEl(this.rootEl, row), col),
|
|
832
888
|
rect: {
|
|
833
889
|
left,
|
|
834
890
|
right,
|
|
@@ -844,40 +900,41 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
844
900
|
function isSegAllDay(seg) {
|
|
845
901
|
return seg.eventRange.def.allDay;
|
|
846
902
|
}
|
|
847
|
-
|
|
848
|
-
|
|
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) {
|
|
849
910
|
if (visibleWidth != null) {
|
|
850
911
|
// ensure a consistent row min-height modelled after a month with 6 rows respecting aspectRatio
|
|
851
912
|
// will result in same minHeight regardless of weekends, dayMinWidth, height:auto
|
|
852
|
-
const
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
// this is value that looks natural on paper for portrait/landscape
|
|
857
|
-
? '6em'
|
|
858
|
-
// don't give minHeight when single-month non-auto-height
|
|
859
|
-
// TODO: better way to detect this with DateProfile?
|
|
860
|
-
: (rowCnt > 6 || isHeightAuto)
|
|
861
|
-
? rowMinHeight
|
|
862
|
-
: undefined,
|
|
863
|
-
// isCompact?: just before most lone +more links hit bottom of cell
|
|
864
|
-
rowMinHeight < 70,
|
|
865
|
-
];
|
|
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;
|
|
866
917
|
}
|
|
867
|
-
return
|
|
918
|
+
return 0;
|
|
868
919
|
}
|
|
869
920
|
|
|
870
921
|
class DayGridHeaderCell extends internal$1.BaseComponent {
|
|
871
922
|
constructor() {
|
|
872
923
|
super(...arguments);
|
|
873
924
|
this.handleInnerEl = (innerEl) => {
|
|
874
|
-
if (this.
|
|
875
|
-
this.
|
|
876
|
-
this.
|
|
925
|
+
if (this.disconnectSize) {
|
|
926
|
+
this.disconnectSize();
|
|
927
|
+
this.disconnectSize = undefined;
|
|
877
928
|
}
|
|
878
929
|
if (innerEl) {
|
|
879
|
-
this.
|
|
930
|
+
this.disconnectSize = internal$1.watchSize(innerEl, (width, height) => {
|
|
880
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
|
+
}
|
|
881
938
|
});
|
|
882
939
|
}
|
|
883
940
|
else {
|
|
@@ -886,18 +943,54 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
886
943
|
};
|
|
887
944
|
}
|
|
888
945
|
render() {
|
|
889
|
-
const { props } = this;
|
|
946
|
+
const { props, state, context } = this;
|
|
890
947
|
const { renderConfig, dataConfig } = props;
|
|
891
948
|
// HACK
|
|
892
949
|
const isDisabled = dataConfig.renderProps.isDisabled;
|
|
893
|
-
|
|
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: {
|
|
894
983
|
width: props.colWidth != null
|
|
895
984
|
? props.colWidth * (dataConfig.colSpan || 1)
|
|
896
985
|
: undefined,
|
|
897
|
-
}, renderProps:
|
|
986
|
+
}, renderProps: finalRenderProps, generatorName: renderConfig.generatorName, customGenerator: renderConfig.customGenerator, defaultGenerator: internal$1.renderText, classNameGenerator:
|
|
898
987
|
// don't use custom classNames if disabled
|
|
899
988
|
// TODO: make DRY with DayCellContainer
|
|
900
|
-
isDisabled ? undefined : renderConfig.classNameGenerator, didMount: renderConfig.didMount, willUnmount: renderConfig.willUnmount }, (InnerContainer) => (preact.createElement(
|
|
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) })))));
|
|
901
994
|
}
|
|
902
995
|
}
|
|
903
996
|
|
|
@@ -921,8 +1014,14 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
921
1014
|
};
|
|
922
1015
|
}
|
|
923
1016
|
render() {
|
|
924
|
-
const { props } = this;
|
|
925
|
-
|
|
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);
|
|
926
1025
|
}
|
|
927
1026
|
}
|
|
928
1027
|
|
|
@@ -932,9 +1031,10 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
932
1031
|
class DayGridHeader extends internal$1.BaseComponent {
|
|
933
1032
|
render() {
|
|
934
1033
|
const { props } = this;
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
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 }))))));
|
|
938
1038
|
}
|
|
939
1039
|
}
|
|
940
1040
|
|
|
@@ -944,37 +1044,54 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
944
1044
|
this.handleScroller = (scroller) => {
|
|
945
1045
|
internal$1.setRef(this.props.scrollerRef, scroller);
|
|
946
1046
|
};
|
|
1047
|
+
this.handleTotalWidth = (totalWidth) => {
|
|
1048
|
+
this.setState({ totalWidth });
|
|
1049
|
+
};
|
|
947
1050
|
this.handleClientWidth = (clientWidth) => {
|
|
948
1051
|
this.setState({ clientWidth });
|
|
949
1052
|
};
|
|
950
|
-
this.handleEndScrollbarWidth = (endScrollbarWidth) => {
|
|
951
|
-
this.setState({ endScrollbarWidth });
|
|
952
|
-
};
|
|
953
1053
|
}
|
|
954
1054
|
render() {
|
|
955
1055
|
const { props, state, context } = this;
|
|
956
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
|
+
}
|
|
957
1065
|
const verticalScrollbars = !props.forPrint && !internal$1.getIsHeightAuto(options);
|
|
958
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);
|
|
959
1071
|
return (preact.createElement(preact.Fragment, null,
|
|
960
|
-
options.dayHeaders && (preact.createElement("div", { className: internal$1.
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
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,
|
|
965
1084
|
// HACK for Safari. Can't do break-inside:avoid with flexbox items, likely b/c it's not standard:
|
|
966
1085
|
// https://stackoverflow.com/a/60256345
|
|
967
|
-
!props.forPrint &&
|
|
968
|
-
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,
|
|
969
1088
|
// content
|
|
970
1089
|
fgEventSegs: props.fgEventSegs, bgEventSegs: props.bgEventSegs, businessHourSegs: props.businessHourSegs, dateSelectionSegs: props.dateSelectionSegs, eventDrag: props.eventDrag, eventResize: props.eventResize, eventSelection: props.eventSelection,
|
|
971
1090
|
// dimensions
|
|
972
|
-
visibleWidth:
|
|
973
|
-
state.clientWidth != null && state.endScrollbarWidth != null
|
|
974
|
-
? state.clientWidth + state.endScrollbarWidth
|
|
975
|
-
: undefined,
|
|
1091
|
+
visibleWidth: totalWidth, cellIsNarrow: cellIsNarrow, cellIsMicro: cellIsMicro,
|
|
976
1092
|
// refs
|
|
977
|
-
rowHeightRefMap: props.rowHeightRefMap }))
|
|
1093
|
+
rowHeightRefMap: props.rowHeightRefMap })),
|
|
1094
|
+
preact.createElement(internal$1.Ruler, { widthRef: this.handleTotalWidth })));
|
|
978
1095
|
}
|
|
979
1096
|
}
|
|
980
1097
|
|
|
@@ -986,43 +1103,54 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
986
1103
|
this.footerScrollerRef = preact.createRef();
|
|
987
1104
|
// Sizing
|
|
988
1105
|
// -----------------------------------------------------------------------------------------------
|
|
1106
|
+
this.handleTotalWidth = (totalWidth) => {
|
|
1107
|
+
this.setState({ totalWidth });
|
|
1108
|
+
};
|
|
989
1109
|
this.handleClientWidth = (clientWidth) => {
|
|
990
1110
|
this.setState({ clientWidth });
|
|
991
1111
|
};
|
|
992
|
-
this.handleEndScrollbarWidth = (endScrollbarWidth) => {
|
|
993
|
-
this.setState({ endScrollbarWidth });
|
|
994
|
-
};
|
|
995
1112
|
}
|
|
996
1113
|
render() {
|
|
997
1114
|
const { props, state, context } = this;
|
|
998
1115
|
const { options } = context;
|
|
1116
|
+
const { totalWidth, clientWidth } = state;
|
|
1117
|
+
const endScrollbarWidth = (totalWidth != null && clientWidth != null)
|
|
1118
|
+
? totalWidth - clientWidth
|
|
1119
|
+
: undefined;
|
|
999
1120
|
const verticalScrollbars = !props.forPrint && !internal$1.getIsHeightAuto(options);
|
|
1000
1121
|
const stickyHeaderDates = !props.forPrint && internal$1.getStickyHeaderDates(options);
|
|
1001
1122
|
const stickyFooterScrollbar = !props.forPrint && internal$1.getStickyFooterScrollbar(options);
|
|
1002
|
-
const
|
|
1003
|
-
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);
|
|
1004
1127
|
return (preact.createElement(preact.Fragment, null,
|
|
1005
|
-
options.dayHeaders && (preact.createElement("div", { className:
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
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
|
+
}) }))),
|
|
1009
1139
|
preact.createElement(internal$1.Scroller, { vertical: verticalScrollbars, horizontal: true, hideScrollbars: stickyFooterScrollbar ||
|
|
1010
1140
|
props.forPrint // prevents blank space in print-view on Safari
|
|
1011
|
-
, 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,
|
|
1012
1142
|
// HACK for Safari. Can't do break-inside:avoid with flexbox items, likely b/c it's not standard:
|
|
1013
1143
|
// https://stackoverflow.com/a/60256345
|
|
1014
|
-
!props.forPrint &&
|
|
1015
|
-
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,
|
|
1016
1146
|
// content
|
|
1017
1147
|
fgEventSegs: props.fgEventSegs, bgEventSegs: props.bgEventSegs, businessHourSegs: props.businessHourSegs, dateSelectionSegs: props.dateSelectionSegs, eventDrag: props.eventDrag, eventResize: props.eventResize, eventSelection: props.eventSelection,
|
|
1018
1148
|
// dimensions
|
|
1019
|
-
colWidth: colWidth, width: canvasWidth, visibleWidth:
|
|
1020
|
-
state.clientWidth != null && state.endScrollbarWidth != null
|
|
1021
|
-
? state.clientWidth + state.endScrollbarWidth
|
|
1022
|
-
: undefined,
|
|
1149
|
+
colWidth: colWidth, width: canvasWidth, visibleWidth: totalWidth, cellIsNarrow: cellIsNarrow, cellIsMicro: cellIsMicro,
|
|
1023
1150
|
// refs
|
|
1024
1151
|
rowHeightRefMap: props.rowHeightRefMap })),
|
|
1025
|
-
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 })));
|
|
1026
1154
|
}
|
|
1027
1155
|
// Lifecycle
|
|
1028
1156
|
// -----------------------------------------------------------------------------------------------
|
|
@@ -1077,7 +1205,7 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
1077
1205
|
}
|
|
1078
1206
|
}
|
|
1079
1207
|
};
|
|
1080
|
-
this.handleScrollEnd = (
|
|
1208
|
+
this.handleScrollEnd = (isUser) => {
|
|
1081
1209
|
if (isUser) {
|
|
1082
1210
|
this.scrollDate = null;
|
|
1083
1211
|
}
|
|
@@ -1093,7 +1221,8 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
1093
1221
|
'aria-colcount': props.cellRows[0].length,
|
|
1094
1222
|
'aria-labelledby': props.labelId,
|
|
1095
1223
|
'aria-label': props.labelStr,
|
|
1096
|
-
}, className: internal$1.
|
|
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)))));
|
|
1097
1226
|
}
|
|
1098
1227
|
// Lifecycle
|
|
1099
1228
|
// -----------------------------------------------------------------------------------------------
|
|
@@ -1131,18 +1260,19 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
1131
1260
|
}
|
|
1132
1261
|
render() {
|
|
1133
1262
|
const { props, context } = this;
|
|
1134
|
-
const {
|
|
1135
|
-
const
|
|
1136
|
-
const
|
|
1137
|
-
const
|
|
1138
|
-
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);
|
|
1139
1269
|
return (preact.createElement(internal$1.NowTimer, { unit: "day" }, (nowDate, todayRange) => {
|
|
1140
|
-
const headerTiers = this.buildDateRowConfigs(dayTableModel.headerDates, datesRepDistinctDays,
|
|
1141
|
-
return (preact.createElement(DayGridLayout, { labelId: props.labelId, labelStr: props.labelStr, dateProfile:
|
|
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,
|
|
1142
1272
|
// header content
|
|
1143
1273
|
headerTiers: headerTiers,
|
|
1144
1274
|
// body content
|
|
1145
|
-
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 }));
|
|
1146
1276
|
}));
|
|
1147
1277
|
}
|
|
1148
1278
|
}
|
|
@@ -1178,19 +1308,26 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
1178
1308
|
// TODO: instead of these date-math gymnastics (for multimonth view),
|
|
1179
1309
|
// compute dateprofiles of all months, then use start of first and end of last.
|
|
1180
1310
|
let lastMonthRenderStart = dateEnv.startOfWeek(dateEnv.startOfMonth(internal$1.addDays(currentRange.end, -1)));
|
|
1181
|
-
let
|
|
1311
|
+
let rowCount = Math.ceil(// could be partial weeks due to hiddenDays
|
|
1182
1312
|
internal$1.diffWeeks(lastMonthRenderStart, end));
|
|
1183
|
-
end = internal$1.addWeeks(end, 6 -
|
|
1313
|
+
end = internal$1.addWeeks(end, 6 - rowCount);
|
|
1184
1314
|
}
|
|
1185
1315
|
return { start, end };
|
|
1186
1316
|
}
|
|
1187
1317
|
|
|
1188
|
-
|
|
1189
|
-
|
|
1318
|
+
const OPTION_REFINERS = {
|
|
1319
|
+
dayHeaders: Boolean,
|
|
1320
|
+
dayHeaderFormat: internal$1.createFormatter,
|
|
1321
|
+
};
|
|
1322
|
+
const OPTION_DEFAULTS = {
|
|
1323
|
+
dayHeaders: true,
|
|
1324
|
+
};
|
|
1190
1325
|
|
|
1191
1326
|
var plugin = core.createPlugin({
|
|
1192
1327
|
name: '@fullcalendar/daygrid',
|
|
1193
1328
|
initialView: 'dayGridMonth',
|
|
1329
|
+
optionRefiners: OPTION_REFINERS,
|
|
1330
|
+
optionDefaults: OPTION_DEFAULTS,
|
|
1194
1331
|
views: {
|
|
1195
1332
|
dayGrid: {
|
|
1196
1333
|
component: DayGridView,
|
|
@@ -1228,8 +1365,10 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
1228
1365
|
buildDateRenderConfig: buildDateRenderConfig,
|
|
1229
1366
|
buildDateDataConfigs: buildDateDataConfigs,
|
|
1230
1367
|
createDayHeaderFormatter: createDayHeaderFormatter,
|
|
1368
|
+
dayHeaderMicroFormat: dayHeaderMicroFormat,
|
|
1369
|
+
dayMicroWidth: dayMicroWidth,
|
|
1231
1370
|
DayGridLayout: DayGridLayout,
|
|
1232
|
-
|
|
1371
|
+
computeRowBasis: computeRowBasis,
|
|
1233
1372
|
DayGridRow: DayGridRow,
|
|
1234
1373
|
DayGridRows: DayGridRows,
|
|
1235
1374
|
buildDayTableModel: buildDayTableModel,
|
|
@@ -1248,4 +1387,4 @@ FullCalendar.DayGrid = (function (exports, core, internal$1, preact) {
|
|
|
1248
1387
|
|
|
1249
1388
|
return exports;
|
|
1250
1389
|
|
|
1251
|
-
})({}, FullCalendar, FullCalendar.Internal, FullCalendar.Preact);
|
|
1390
|
+
})({}, FullCalendar, FullCalendar.Internal, FullCalendar.Preact, FullCalendar.InternalClassNames);
|