@fullcalendar/daygrid 7.0.0-beta.4 → 7.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.global.js +97 -83
- package/index.global.min.js +2 -2
- package/internal.cjs +96 -82
- package/internal.d.ts +13 -12
- package/internal.js +96 -83
- package/package.json +2 -2
package/internal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Slicer, createFormatter, getDateMeta, buildDateStr, formatDayString, buildNavLinkAttrs,
|
|
1
|
+
import { Slicer, createFormatter, addDays, getDateMeta, buildDateStr, formatDayString, buildNavLinkAttrs, joinClassNames, getDayClassName, getEventKey, BaseComponent, StandardEvent, buildEventRangeTimeText, getEventTagAndAttrs, EventContainer, MoreLinkContainer, getEventRangeMeta, DateComponent, memoize, setRef, watchSize, isDimsEqual, hasCustomDayCellContent, DayCellContainer, addMs, SegHierarchy, DaySeriesModel, DayTableModel, fracToCssDim, watchHeight, RefMap, afterSize, sortEventSegs, WeekNumberContainer, buildEventRangeKey, BgEvent, renderFill, getIsHeightAuto, ContentContainer, renderText, getStickyHeaderDates, Scroller, Ruler, getStickyFooterScrollbar, FooterScrollbar, getScrollerSyncerClass, ViewContainer, NowTimer, DateProfileGenerator, addWeeks, diffWeeks, injectStyles } from '@fullcalendar/core/internal.js';
|
|
2
2
|
import { createElement, Fragment, createRef, Component } from '@fullcalendar/core/preact.js';
|
|
3
3
|
|
|
4
4
|
class DayTableSlicer extends Slicer {
|
|
@@ -28,6 +28,7 @@ Or ResourceApi object itself?
|
|
|
28
28
|
function buildDateRowConfig(dates, datesRepDistinctDays, dateProfile, todayRange, dayHeaderFormat, // TODO: rename to dateHeaderFormat?
|
|
29
29
|
context, colSpan) {
|
|
30
30
|
return {
|
|
31
|
+
isDateRow: true,
|
|
31
32
|
renderConfig: buildDateRenderConfig(context),
|
|
32
33
|
dataConfigs: buildDateDataConfigs(dates, datesRepDistinctDays, dateProfile, todayRange, dayHeaderFormat, context, colSpan)
|
|
33
34
|
};
|
|
@@ -46,31 +47,38 @@ function buildDateRenderConfig(context) {
|
|
|
46
47
|
willUnmount: options.dayHeaderWillUnmount,
|
|
47
48
|
};
|
|
48
49
|
}
|
|
50
|
+
const dowDates = [];
|
|
51
|
+
for (let dow = 0; dow < 7; dow++) {
|
|
52
|
+
dowDates.push(addDays(new Date(259200000), dow)); // start with Sun, 04 Jan 1970 00:00:00 GMT)
|
|
53
|
+
}
|
|
49
54
|
/*
|
|
50
55
|
For header cells: data
|
|
51
56
|
*/
|
|
52
57
|
function buildDateDataConfigs(dates, datesRepDistinctDays, dateProfile, todayRange, dayHeaderFormat, // TODO: rename to dateHeaderFormat?
|
|
53
|
-
context, colSpan = 1, keyPrefix = ''
|
|
58
|
+
context, colSpan = 1, keyPrefix = '', extraRenderProps = {}, // TODO
|
|
59
|
+
extraAttrs = {}, // TODO
|
|
60
|
+
className = '') {
|
|
54
61
|
const { dateEnv, viewApi, options } = context;
|
|
55
62
|
return datesRepDistinctDays
|
|
56
63
|
? dates.map((date) => {
|
|
57
64
|
const dateMeta = getDateMeta(date, todayRange, null, dateProfile);
|
|
58
65
|
const text = dateEnv.format(date, dayHeaderFormat);
|
|
59
|
-
const renderProps = Object.assign(Object.assign({}, dateMeta), { date: dateEnv.toDate(date), view: viewApi, text });
|
|
60
|
-
const isNavLink = options.navLinks && !dateMeta.isDisabled
|
|
66
|
+
const renderProps = Object.assign(Object.assign(Object.assign({}, dateMeta), { date: dateEnv.toDate(date), view: viewApi, text }), extraRenderProps);
|
|
67
|
+
const isNavLink = options.navLinks && !dateMeta.isDisabled &&
|
|
68
|
+
dates.length > 1; // don't show navlink to day if only one day
|
|
61
69
|
const fullDateStr = buildDateStr(context, date);
|
|
62
70
|
// for DayGridHeaderCell
|
|
63
71
|
return {
|
|
64
72
|
key: keyPrefix + date.toUTCString(),
|
|
65
73
|
renderProps,
|
|
66
|
-
attrs: Object.assign(Object.assign({ 'aria-label': fullDateStr }, (dateMeta.isToday ? { 'aria-current': 'date' } : {})), { 'data-date': formatDayString(date) }),
|
|
74
|
+
attrs: Object.assign(Object.assign(Object.assign({ 'aria-label': fullDateStr }, (dateMeta.isToday ? { 'aria-current': 'date' } : {})), { 'data-date': formatDayString(date) }), extraAttrs),
|
|
67
75
|
// for navlink
|
|
68
76
|
innerAttrs: isNavLink
|
|
69
77
|
? buildNavLinkAttrs(context, date, undefined, fullDateStr)
|
|
70
78
|
: { 'aria-hidden': true },
|
|
71
79
|
colSpan,
|
|
72
80
|
isNavLink,
|
|
73
|
-
className: getDayClassName(dateMeta),
|
|
81
|
+
className: joinClassNames(className, getDayClassName(dateMeta)),
|
|
74
82
|
};
|
|
75
83
|
})
|
|
76
84
|
: dates.map((date) => {
|
|
@@ -85,21 +93,19 @@ context, colSpan = 1, keyPrefix = '') {
|
|
|
85
93
|
isOther: false,
|
|
86
94
|
};
|
|
87
95
|
const text = dateEnv.format(normDate, dayHeaderFormat);
|
|
88
|
-
const renderProps = Object.assign(Object.assign({}, dayMeta), { date, view: viewApi, text });
|
|
96
|
+
const renderProps = Object.assign(Object.assign(Object.assign({}, dayMeta), { date: dowDates[dow], view: viewApi, text }), extraRenderProps);
|
|
89
97
|
const fullWeekDayStr = dateEnv.format(normDate, WEEKDAY_FORMAT);
|
|
90
98
|
// for DayGridHeaderCell
|
|
91
99
|
return {
|
|
92
100
|
key: keyPrefix + String(dow),
|
|
93
101
|
renderProps,
|
|
94
|
-
attrs: {
|
|
95
|
-
|
|
96
|
-
},
|
|
97
|
-
// for navlink
|
|
102
|
+
attrs: Object.assign({ 'aria-label': fullWeekDayStr }, extraAttrs),
|
|
103
|
+
// NOT a navlink
|
|
98
104
|
innerAttrs: {
|
|
99
105
|
'aria-hidden': true, // label already on cell
|
|
100
106
|
},
|
|
101
107
|
colSpan,
|
|
102
|
-
className: getDayClassName(dayMeta),
|
|
108
|
+
className: joinClassNames(className, getDayClassName(dayMeta)),
|
|
103
109
|
};
|
|
104
110
|
});
|
|
105
111
|
}
|
|
@@ -218,6 +224,8 @@ class DayGridMoreLink extends BaseComponent {
|
|
|
218
224
|
class DayGridCell extends DateComponent {
|
|
219
225
|
constructor() {
|
|
220
226
|
super(...arguments);
|
|
227
|
+
// memo
|
|
228
|
+
this.getDateMeta = memoize(getDateMeta);
|
|
221
229
|
// ref
|
|
222
230
|
this.rootElRef = createRef();
|
|
223
231
|
this.handleBodyEl = (bodyEl) => {
|
|
@@ -251,8 +259,7 @@ class DayGridCell extends DateComponent {
|
|
|
251
259
|
// TODO: memoize this
|
|
252
260
|
const isMonthStart = props.showDayNumber &&
|
|
253
261
|
shouldDisplayMonthStart(props.date, props.dateProfile.currentRange, dateEnv);
|
|
254
|
-
|
|
255
|
-
const dateMeta = getDateMeta(props.date, props.todayRange, null, props.dateProfile);
|
|
262
|
+
const dateMeta = this.getDateMeta(props.date, props.todayRange, null, props.dateProfile);
|
|
256
263
|
const baseClassName = joinClassNames('fc-daygrid-day', props.borderStart && 'fc-border-s', props.width != null ? '' : 'fc-liquid', 'fc-flex-col');
|
|
257
264
|
if (dateMeta.isDisabled) {
|
|
258
265
|
return (createElement("div", { role: 'gridcell', "aria-disabled": true, className: joinClassNames(baseClassName, 'fc-day-disabled'), style: {
|
|
@@ -501,10 +508,10 @@ function computeRowFromPosition(positionTop, cellRows, rowHeightMap) {
|
|
|
501
508
|
// Hit Element
|
|
502
509
|
// -------------------------------------------------------------------------------------------------
|
|
503
510
|
function getRowEl(rootEl, row) {
|
|
504
|
-
return rootEl.querySelectorAll('
|
|
511
|
+
return rootEl.querySelectorAll('[role=row]')[row];
|
|
505
512
|
}
|
|
506
513
|
function getCellEl(rowEl, col) {
|
|
507
|
-
return rowEl.querySelectorAll('
|
|
514
|
+
return rowEl.querySelectorAll('[role=gridcell]')[col];
|
|
508
515
|
}
|
|
509
516
|
// Header Formatting
|
|
510
517
|
// -------------------------------------------------------------------------------------------------
|
|
@@ -602,13 +609,16 @@ class DayGridRow extends BaseComponent {
|
|
|
602
609
|
return (createElement("div", { role: props.role /* !!! */, "aria-label": props.role === 'row' // HACK
|
|
603
610
|
? fullWeekStr
|
|
604
611
|
: undefined // can't have label on non-role div
|
|
605
|
-
, className: joinClassNames('fc-flex-row fc-rel', props.className), style: {
|
|
606
|
-
|
|
612
|
+
, className: joinClassNames('fc-daygrid-row', props.forPrint && 'fc-daygrid-row-print', 'fc-flex-row fc-rel', props.className), style: {
|
|
613
|
+
'flex-basis': props.basis,
|
|
607
614
|
}, ref: this.handleRootEl },
|
|
615
|
+
props.showWeekNumbers && (createElement(WeekNumberContainer, { tag: 'div', attrs: Object.assign(Object.assign({}, (isNavLink
|
|
616
|
+
? buildNavLinkAttrs(context, weekDate, 'week', fullWeekStr, /* isTabbable = */ false)
|
|
617
|
+
: {})), { 'role': undefined, 'aria-hidden': true }), className: 'fc-daygrid-week-number', date: weekDate, defaultFormat: DEFAULT_WEEK_NUM_FORMAT })),
|
|
608
618
|
this.renderFillSegs(props.businessHourSegs, 'non-business'),
|
|
609
619
|
this.renderFillSegs(props.bgEventSegs, 'bg-event'),
|
|
610
620
|
this.renderFillSegs(highlightSegs, 'highlight'),
|
|
611
|
-
|
|
621
|
+
props.cells.map((cell, col) => {
|
|
612
622
|
const normalFgNodes = this.renderFgSegs(maxMainTop, renderableSegsByCol[col], segTops, props.todayRange, forcedInvisibleMap);
|
|
613
623
|
return (createElement(DayGridCell, { key: cell.key, dateProfile: props.dateProfile, todayRange: props.todayRange, date: cell.date, showDayNumber: props.showDayNumbers, isCompact: props.isCompact, isTall: props.isTall, borderStart: Boolean(col),
|
|
614
624
|
// content
|
|
@@ -619,10 +629,7 @@ class DayGridRow extends BaseComponent {
|
|
|
619
629
|
fgHeight: heightsByCol[col], width: props.colWidth,
|
|
620
630
|
// refs
|
|
621
631
|
headerHeightRef: headerHeightRefMap.createRef(cell.key), mainHeightRef: mainHeightRefMap.createRef(cell.key) }));
|
|
622
|
-
})
|
|
623
|
-
props.showWeekNumbers && (createElement(WeekNumberContainer, { tag: 'div', attrs: Object.assign(Object.assign({}, (isNavLink
|
|
624
|
-
? buildNavLinkAttrs(context, weekDate, 'week', fullWeekStr, /* isTabbable = */ false)
|
|
625
|
-
: {})), { 'role': undefined, 'aria-hidden': true }), className: 'fc-daygrid-week-number', date: weekDate, defaultFormat: DEFAULT_WEEK_NUM_FORMAT })),
|
|
632
|
+
}),
|
|
626
633
|
this.renderFgSegs(maxMainTop, mirrorSegs, segTops, props.todayRange, {}, // forcedInvisibleMap
|
|
627
634
|
Boolean(props.eventDrag), Boolean(props.eventResize), false)));
|
|
628
635
|
}
|
|
@@ -782,30 +789,22 @@ class DayGridRows extends DateComponent {
|
|
|
782
789
|
let eventResizeByRow = this.splitEventResize(props.eventResize, rowCnt);
|
|
783
790
|
let isHeightAuto = getIsHeightAuto(options);
|
|
784
791
|
let rowHeightsRedistribute = !props.forPrint && !isHeightAuto;
|
|
785
|
-
let
|
|
792
|
+
let rowBasis = computeRowBasis(props.visibleWidth, rowCnt, isHeightAuto, options);
|
|
793
|
+
let isCompact = computeRowIsCompact(props.visibleWidth, options);
|
|
786
794
|
return (createElement("div", { role: 'rowgroup', className: joinClassNames(
|
|
787
795
|
// HACK for Safari. Can't do break-inside:avoid with flexbox items, likely b/c it's not standard:
|
|
788
796
|
// https://stackoverflow.com/a/60256345
|
|
789
797
|
!props.forPrint && 'fc-flex-col', props.className), style: { width: props.width }, ref: this.handleRootEl }, props.cellRows.map((cells, row) => (createElement(DayGridRow, { key: cells[0].key, role: 'row', dateProfile: props.dateProfile, todayRange: props.todayRange, cells: cells, showDayNumbers: rowCnt > 1, showWeekNumbers: rowCnt > 1 && options.weekNumbers, forPrint: props.forPrint, isCompact: isCompact,
|
|
790
798
|
// if not auto-height, distribute height of container somewhat evently to rows
|
|
791
|
-
|
|
792
|
-
className: joinClassNames(rowHeightsRedistribute && 'fc-grow fc-basis0', rowCnt > 1 && 'fc-break-inside-avoid', // don't avoid breaks for single tall row
|
|
799
|
+
className: joinClassNames(rowHeightsRedistribute && 'fc-grow', rowCnt > 1 && 'fc-break-inside-avoid', // don't avoid breaks for single tall row
|
|
793
800
|
row < rowCnt - 1 && 'fc-border-b'),
|
|
794
801
|
// content
|
|
795
802
|
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,
|
|
796
803
|
// dimensions
|
|
797
|
-
colWidth: props.colWidth,
|
|
804
|
+
colWidth: props.colWidth, basis: rowBasis,
|
|
798
805
|
// refs
|
|
799
806
|
heightRef: rowHeightRefMap.createRef(cells[0].key) })))));
|
|
800
807
|
}
|
|
801
|
-
componentDidMount() {
|
|
802
|
-
this.disconnectWidth = watchWidth(this.rootEl, (width) => {
|
|
803
|
-
this.setState({ width });
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
componentWillUnmount() {
|
|
807
|
-
this.disconnectWidth();
|
|
808
|
-
}
|
|
809
808
|
// Hit System
|
|
810
809
|
// -----------------------------------------------------------------------------------------------
|
|
811
810
|
queryHit(positionLeft, positionTop, elWidth) {
|
|
@@ -822,8 +821,7 @@ class DayGridRows extends DateComponent {
|
|
|
822
821
|
start: cellStartDate,
|
|
823
822
|
end: cellEndDate,
|
|
824
823
|
}, allDay: true }, cell.dateSpanProps),
|
|
825
|
-
|
|
826
|
-
dayEl: getCellEl(getRowEl(this.rootEl, row), col),
|
|
824
|
+
getDayEl: () => getCellEl(getRowEl(this.rootEl, row), col),
|
|
827
825
|
rect: {
|
|
828
826
|
left,
|
|
829
827
|
right,
|
|
@@ -839,27 +837,35 @@ class DayGridRows extends DateComponent {
|
|
|
839
837
|
function isSegAllDay(seg) {
|
|
840
838
|
return seg.eventRange.def.allDay;
|
|
841
839
|
}
|
|
842
|
-
|
|
843
|
-
|
|
840
|
+
/*
|
|
841
|
+
Amount of height a row should consume prior to expanding
|
|
842
|
+
We don't want to use min-height with flexbox because we leverage min-height:auto,
|
|
843
|
+
which yields value based on natural height of events
|
|
844
|
+
*/
|
|
845
|
+
function computeRowBasis(visibleWidth, // should INCLUDE any scrollbar width to avoid oscillation
|
|
846
|
+
rowCnt, isHeightAuto, options) {
|
|
844
847
|
if (visibleWidth != null) {
|
|
845
848
|
// ensure a consistent row min-height modelled after a month with 6 rows respecting aspectRatio
|
|
846
849
|
// will result in same minHeight regardless of weekends, dayMinWidth, height:auto
|
|
847
|
-
const
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
// this is value that looks natural on paper for portrait/landscape
|
|
852
|
-
? '6em'
|
|
853
|
-
// don't give minHeight when single-month non-auto-height
|
|
854
|
-
// TODO: better way to detect this with DateProfile?
|
|
855
|
-
: (rowCnt > 6 || isHeightAuto)
|
|
856
|
-
? rowMinHeight
|
|
857
|
-
: undefined,
|
|
858
|
-
// isCompact?: just before most lone +more links hit bottom of cell
|
|
859
|
-
rowMinHeight < 70,
|
|
860
|
-
];
|
|
850
|
+
const rowBasis = visibleWidth / options.aspectRatio / 6;
|
|
851
|
+
// don't give minHeight when single-month non-auto-height
|
|
852
|
+
// TODO: better way to detect this with DateProfile?
|
|
853
|
+
return (rowCnt > 6 || isHeightAuto) ? rowBasis : 0;
|
|
861
854
|
}
|
|
862
|
-
return
|
|
855
|
+
return 0;
|
|
856
|
+
}
|
|
857
|
+
/*
|
|
858
|
+
Infers cell height based on overall width
|
|
859
|
+
*/
|
|
860
|
+
function computeRowIsCompact(visibleWidth, // should INCLUDE any scrollbar width to avoid oscillation
|
|
861
|
+
options) {
|
|
862
|
+
if (visibleWidth != null) {
|
|
863
|
+
// ensure a consistent row min-height modelled after a month with 6 rows respecting aspectRatio
|
|
864
|
+
// will result in same minHeight regardless of weekends, dayMinWidth, height:auto
|
|
865
|
+
const rowBasis = visibleWidth / options.aspectRatio / 6;
|
|
866
|
+
return rowBasis < 70;
|
|
867
|
+
}
|
|
868
|
+
return false;
|
|
863
869
|
}
|
|
864
870
|
|
|
865
871
|
class DayGridHeaderCell extends BaseComponent {
|
|
@@ -919,6 +925,9 @@ class DayGridHeaderRow extends BaseComponent {
|
|
|
919
925
|
const { props } = this;
|
|
920
926
|
return (createElement("div", { role: props.role /* !!! */, "aria-rowindex": props.rowIndex != null ? 1 + props.rowIndex : undefined, className: joinClassNames('fc-flex-row fc-content-box', props.className), style: { height: props.height } }, props.dataConfigs.map((dataConfig, cellI) => (createElement(DayGridHeaderCell, { key: dataConfig.key, renderConfig: props.renderConfig, dataConfig: dataConfig, isSticky: props.isSticky, borderStart: Boolean(cellI), colWidth: props.colWidth, innerHeightRef: props.innerHeightRef })))));
|
|
921
927
|
}
|
|
928
|
+
componentWillUnmount() {
|
|
929
|
+
setRef(this.props.innerHeightRef, null);
|
|
930
|
+
}
|
|
922
931
|
}
|
|
923
932
|
|
|
924
933
|
/*
|
|
@@ -939,37 +948,39 @@ class DayGridLayoutNormal extends BaseComponent {
|
|
|
939
948
|
this.handleScroller = (scroller) => {
|
|
940
949
|
setRef(this.props.scrollerRef, scroller);
|
|
941
950
|
};
|
|
951
|
+
this.handleTotalWidth = (totalWidth) => {
|
|
952
|
+
this.setState({ totalWidth });
|
|
953
|
+
};
|
|
942
954
|
this.handleClientWidth = (clientWidth) => {
|
|
943
955
|
this.setState({ clientWidth });
|
|
944
956
|
};
|
|
945
|
-
this.handleEndScrollbarWidth = (endScrollbarWidth) => {
|
|
946
|
-
this.setState({ endScrollbarWidth });
|
|
947
|
-
};
|
|
948
957
|
}
|
|
949
958
|
render() {
|
|
950
959
|
const { props, state, context } = this;
|
|
951
960
|
const { options } = context;
|
|
961
|
+
const { totalWidth, clientWidth } = state;
|
|
962
|
+
const endScrollbarWidth = (totalWidth != null && clientWidth != null)
|
|
963
|
+
? totalWidth - clientWidth
|
|
964
|
+
: undefined;
|
|
952
965
|
const verticalScrollbars = !props.forPrint && !getIsHeightAuto(options);
|
|
953
966
|
const stickyHeaderDates = !props.forPrint && getStickyHeaderDates(options);
|
|
954
967
|
return (createElement(Fragment, null,
|
|
955
968
|
options.dayHeaders && (createElement("div", { className: joinClassNames(props.forPrint ? 'fc-print-header' : 'fc-flex-row', // col for print, row for screen
|
|
956
|
-
'fc-border-b') },
|
|
957
|
-
createElement(DayGridHeader, { headerTiers: props.headerTiers, className:
|
|
958
|
-
Boolean(
|
|
959
|
-
createElement(Scroller, { vertical: verticalScrollbars,
|
|
969
|
+
stickyHeaderDates && 'fc-table-header-sticky', 'fc-border-b') },
|
|
970
|
+
createElement(DayGridHeader, { headerTiers: props.headerTiers, className: 'fc-daygrid-header' }),
|
|
971
|
+
Boolean(endScrollbarWidth) && (createElement("div", { className: 'fc-border-s fc-filler', style: { minWidth: endScrollbarWidth } })))),
|
|
972
|
+
createElement(Scroller, { vertical: verticalScrollbars, className: joinClassNames('fc-daygrid-body',
|
|
960
973
|
// HACK for Safari. Can't do break-inside:avoid with flexbox items, likely b/c it's not standard:
|
|
961
974
|
// https://stackoverflow.com/a/60256345
|
|
962
|
-
!props.forPrint && 'fc-flex-col', verticalScrollbars && 'fc-liquid'), ref: this.handleScroller },
|
|
975
|
+
!props.forPrint && 'fc-flex-col', verticalScrollbars && 'fc-liquid'), ref: this.handleScroller, clientWidthRef: this.handleClientWidth },
|
|
963
976
|
createElement(DayGridRows, { dateProfile: props.dateProfile, todayRange: props.todayRange, cellRows: props.cellRows, forPrint: props.forPrint, isHitComboAllowed: props.isHitComboAllowed, className: 'fc-grow', dayMaxEvents: props.forPrint ? undefined : options.dayMaxEvents, dayMaxEventRows: options.dayMaxEventRows,
|
|
964
977
|
// content
|
|
965
978
|
fgEventSegs: props.fgEventSegs, bgEventSegs: props.bgEventSegs, businessHourSegs: props.businessHourSegs, dateSelectionSegs: props.dateSelectionSegs, eventDrag: props.eventDrag, eventResize: props.eventResize, eventSelection: props.eventSelection,
|
|
966
979
|
// dimensions
|
|
967
|
-
visibleWidth:
|
|
968
|
-
state.clientWidth != null && state.endScrollbarWidth != null
|
|
969
|
-
? state.clientWidth + state.endScrollbarWidth
|
|
970
|
-
: undefined,
|
|
980
|
+
visibleWidth: totalWidth,
|
|
971
981
|
// refs
|
|
972
|
-
rowHeightRefMap: props.rowHeightRefMap }))
|
|
982
|
+
rowHeightRefMap: props.rowHeightRefMap })),
|
|
983
|
+
createElement(Ruler, { widthRef: this.handleTotalWidth })));
|
|
973
984
|
}
|
|
974
985
|
}
|
|
975
986
|
|
|
@@ -981,43 +992,45 @@ class DayGridLayoutPannable extends BaseComponent {
|
|
|
981
992
|
this.footerScrollerRef = createRef();
|
|
982
993
|
// Sizing
|
|
983
994
|
// -----------------------------------------------------------------------------------------------
|
|
995
|
+
this.handleTotalWidth = (totalWidth) => {
|
|
996
|
+
this.setState({ totalWidth });
|
|
997
|
+
};
|
|
984
998
|
this.handleClientWidth = (clientWidth) => {
|
|
985
999
|
this.setState({ clientWidth });
|
|
986
1000
|
};
|
|
987
|
-
this.handleEndScrollbarWidth = (endScrollbarWidth) => {
|
|
988
|
-
this.setState({ endScrollbarWidth });
|
|
989
|
-
};
|
|
990
1001
|
}
|
|
991
1002
|
render() {
|
|
992
1003
|
const { props, state, context } = this;
|
|
993
1004
|
const { options } = context;
|
|
1005
|
+
const { totalWidth, clientWidth } = state;
|
|
1006
|
+
const endScrollbarWidth = (totalWidth != null && clientWidth != null)
|
|
1007
|
+
? totalWidth - clientWidth
|
|
1008
|
+
: undefined;
|
|
994
1009
|
const verticalScrollbars = !props.forPrint && !getIsHeightAuto(options);
|
|
995
1010
|
const stickyHeaderDates = !props.forPrint && getStickyHeaderDates(options);
|
|
996
1011
|
const stickyFooterScrollbar = !props.forPrint && getStickyFooterScrollbar(options);
|
|
997
1012
|
const colCnt = props.cellRows[0].length;
|
|
998
|
-
const [canvasWidth, colWidth] = computeColWidth(colCnt, props.dayMinWidth,
|
|
1013
|
+
const [canvasWidth, colWidth] = computeColWidth(colCnt, props.dayMinWidth, clientWidth);
|
|
999
1014
|
return (createElement(Fragment, null,
|
|
1000
|
-
options.dayHeaders && (createElement("div", { className: 'fc-print-header' },
|
|
1001
|
-
createElement(Scroller, { horizontal: true, hideScrollbars: true, className:
|
|
1015
|
+
options.dayHeaders && (createElement("div", { className: joinClassNames('fc-print-header', stickyHeaderDates && 'fc-table-header-sticky') },
|
|
1016
|
+
createElement(Scroller, { horizontal: true, hideScrollbars: true, className: 'fc-daygrid-header fc-flex-row fc-border-b', ref: this.headerScrollerRef },
|
|
1002
1017
|
createElement(DayGridHeader, { headerTiers: props.headerTiers, colWidth: colWidth, width: canvasWidth }),
|
|
1003
|
-
Boolean(
|
|
1018
|
+
Boolean(endScrollbarWidth) && (createElement("div", { className: 'fc-border-s fc-filler', style: { minWidth: endScrollbarWidth } }))))),
|
|
1004
1019
|
createElement(Scroller, { vertical: verticalScrollbars, horizontal: true, hideScrollbars: stickyFooterScrollbar ||
|
|
1005
1020
|
props.forPrint // prevents blank space in print-view on Safari
|
|
1006
1021
|
, className: joinClassNames('fc-daygrid-body',
|
|
1007
1022
|
// HACK for Safari. Can't do break-inside:avoid with flexbox items, likely b/c it's not standard:
|
|
1008
1023
|
// https://stackoverflow.com/a/60256345
|
|
1009
|
-
!props.forPrint && 'fc-flex-col', verticalScrollbars && 'fc-liquid'), ref: this.bodyScrollerRef, clientWidthRef: this.handleClientWidth
|
|
1024
|
+
!props.forPrint && 'fc-flex-col', verticalScrollbars && 'fc-liquid'), ref: this.bodyScrollerRef, clientWidthRef: this.handleClientWidth },
|
|
1010
1025
|
createElement(DayGridRows, { dateProfile: props.dateProfile, todayRange: props.todayRange, cellRows: props.cellRows, forPrint: props.forPrint, isHitComboAllowed: props.isHitComboAllowed, className: 'fc-grow', dayMaxEvents: props.forPrint ? undefined : options.dayMaxEvents, dayMaxEventRows: options.dayMaxEventRows,
|
|
1011
1026
|
// content
|
|
1012
1027
|
fgEventSegs: props.fgEventSegs, bgEventSegs: props.bgEventSegs, businessHourSegs: props.businessHourSegs, dateSelectionSegs: props.dateSelectionSegs, eventDrag: props.eventDrag, eventResize: props.eventResize, eventSelection: props.eventSelection,
|
|
1013
1028
|
// dimensions
|
|
1014
|
-
colWidth: colWidth, width: canvasWidth, visibleWidth:
|
|
1015
|
-
state.clientWidth != null && state.endScrollbarWidth != null
|
|
1016
|
-
? state.clientWidth + state.endScrollbarWidth
|
|
1017
|
-
: undefined,
|
|
1029
|
+
colWidth: colWidth, width: canvasWidth, visibleWidth: totalWidth,
|
|
1018
1030
|
// refs
|
|
1019
1031
|
rowHeightRefMap: props.rowHeightRefMap })),
|
|
1020
|
-
Boolean(stickyFooterScrollbar) && (createElement(
|
|
1032
|
+
Boolean(stickyFooterScrollbar) && (createElement(FooterScrollbar, { isSticky: true, canvasWidth: canvasWidth, scrollerRef: this.footerScrollerRef })),
|
|
1033
|
+
createElement(Ruler, { widthRef: this.handleTotalWidth })));
|
|
1021
1034
|
}
|
|
1022
1035
|
// Lifecycle
|
|
1023
1036
|
// -----------------------------------------------------------------------------------------------
|
|
@@ -1072,7 +1085,7 @@ class DayGridLayout extends BaseComponent {
|
|
|
1072
1085
|
}
|
|
1073
1086
|
}
|
|
1074
1087
|
};
|
|
1075
|
-
this.handleScrollEnd = (
|
|
1088
|
+
this.handleScrollEnd = (isUser) => {
|
|
1076
1089
|
if (isUser) {
|
|
1077
1090
|
this.scrollDate = null;
|
|
1078
1091
|
}
|
|
@@ -1180,7 +1193,7 @@ function buildDayTableRenderRange(props) {
|
|
|
1180
1193
|
return { start, end };
|
|
1181
1194
|
}
|
|
1182
1195
|
|
|
1183
|
-
var css_248z = ":root{--fc-daygrid-event-dot-width:8px}.fc-daygrid-day.fc-day-today{background-color:var(--fc-today-bg-color)}.fc-daygrid-day-header{display:flex;flex-direction:row-reverse}.fc-day-other .fc-daygrid-day-header{opacity:.3}.fc-daygrid-day-number{padding:4px;position:relative}.fc-daygrid-month-start{font-size:1.1em;font-weight:700}.fc-daygrid-day-body{display:flex;flex-direction:column;margin-bottom:1px}.fc-daygrid-day-body-tall{margin-bottom:1em;min-height:2em}.fc-daygrid-day-body:only-child{margin-top:2px}.fc-daygrid-more-link{border-radius:3px;cursor:pointer;font-size:var(--fc-small-font-size);margin:0 2px 1px;max-width:100%;overflow:hidden;padding:2px;position:relative;white-space:nowrap}.fc-daygrid-more-link:hover{background-color:rgba(0,0,0,.1)}.fc-daygrid-more-link-button{align-self:flex-start}.fc-daygrid-more-link-block{border:1px solid var(--fc-event-border-color);padding:1px}.fc-daygrid-week-number{background-color:var(--fc-neutral-bg-color);color:var(--fc-neutral-text-color);min-width:1.5em;padding:2px;position:absolute;text-align:center;top:0}.fc-more-popover .fc-popover-body{min-width:220px;padding:10px}.fc-daygrid-event{border-radius:3px;font-size:var(--fc-small-font-size);margin-bottom:1px}.fc-
|
|
1196
|
+
var css_248z = ":root{--fc-daygrid-event-dot-width:8px}.fc-daygrid-row-print{min-height:6em}.fc-daygrid-day.fc-day-today{background-color:var(--fc-today-bg-color)}.fc-daygrid-day-header{display:flex;flex-direction:row-reverse}.fc-day-other .fc-daygrid-day-header{opacity:.3}.fc-daygrid-day-number{padding:4px;position:relative}.fc-daygrid-month-start{font-size:1.1em;font-weight:700}.fc-daygrid-day-body{display:flex;flex-direction:column;margin-bottom:1px}.fc-daygrid-day-body-tall{margin-bottom:1em;min-height:2em}.fc-daygrid-day-body:only-child{margin-top:2px}.fc-daygrid-more-link{border-radius:3px;cursor:pointer;font-size:var(--fc-small-font-size);margin:0 2px 1px;max-width:100%;overflow:hidden;padding:2px;position:relative;white-space:nowrap}.fc-daygrid-more-link:hover{background-color:rgba(0,0,0,.1)}.fc-daygrid-more-link-button{align-self:flex-start}.fc-daygrid-more-link-block{border:1px solid var(--fc-event-border-color);padding:1px}.fc-daygrid-week-number{background-color:var(--fc-neutral-bg-color);color:var(--fc-neutral-text-color);min-width:1.5em;padding:2px;position:absolute;text-align:center;top:0;z-index:1}.fc-direction-ltr .fc-daygrid-week-number{border-radius:0 0 3px}.fc-direction-rtl .fc-daygrid-week-number{border-radius:0 0 0 3px}.fc-more-popover .fc-popover-body{min-width:220px;padding:10px}.fc-daygrid-event{border-radius:3px;font-size:var(--fc-small-font-size);margin-bottom:1px}.fc-direction-ltr .fc-daygrid-event.fc-event-start,.fc-direction-rtl .fc-daygrid-event.fc-event-end{margin-left:2px}.fc-direction-ltr .fc-daygrid-event.fc-event-end,.fc-direction-rtl .fc-daygrid-event.fc-event-start{margin-right:2px}.fc-direction-ltr .fc-daygrid-event .fc-event-time{margin-right:3px}.fc-direction-rtl .fc-daygrid-event .fc-event-time{margin-left:3px}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-start),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-end){border-bottom-left-radius:0;border-left-width:0;border-top-left-radius:0}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-end),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-start){border-bottom-right-radius:0;border-right-width:0;border-top-right-radius:0}.fc-daygrid-block-event .fc-event-time{font-weight:700}.fc-daygrid-block-event .fc-event-time,.fc-daygrid-block-event .fc-event-title{padding:1px}.fc-daygrid-dot-event{align-items:center;direction:row;display:flex;padding:2px 0;position:relative}.fc-daygrid-dot-event.fc-event-mirror,.fc-daygrid-dot-event:hover{background:rgba(0,0,0,.1)}.fc-daygrid-dot-event.fc-event-selected:before{bottom:-10px;top:-10px}.fc-daygrid-event-dot{border:calc(var(--fc-daygrid-event-dot-width)/2) solid var(--fc-event-border-color);border-radius:calc(var(--fc-daygrid-event-dot-width)/2);box-sizing:content-box;height:0;margin:0 4px;width:0}.fc-daygrid-dot-event .fc-event-time,.fc-daygrid-dot-event .fc-event-title{overflow:hidden;white-space:nowrap}.fc-media-print .fc-daygrid-dot-event .fc-event-time,.fc-media-print .fc-daygrid-dot-event .fc-event-title{overflow:hidden!important;white-space:nowrap!important}.fc-daygrid-dot-event .fc-event-title{flex-basis:0;flex-grow:1;font-weight:700;min-height:0;min-width:0}";
|
|
1184
1197
|
injectStyles(css_248z);
|
|
1185
1198
|
|
|
1186
|
-
export { DayGridHeaderRow, DayGridLayout, DayGridRow, DayGridRows, DayGridView, DayTableSlicer, TableDateProfileGenerator, buildDateDataConfigs, buildDateRenderConfig, buildDateRowConfig, buildDateRowConfigs, buildDayTableModel, buildDayTableRenderRange, computeColFromPosition, computeColWidth,
|
|
1199
|
+
export { DayGridHeaderRow, DayGridLayout, DayGridRow, DayGridRows, DayGridView, DayTableSlicer, TableDateProfileGenerator, buildDateDataConfigs, buildDateRenderConfig, buildDateRowConfig, buildDateRowConfigs, buildDayTableModel, buildDayTableRenderRange, computeColFromPosition, computeColWidth, computeRowBasis, computeRowIsCompact, createDayHeaderFormatter, getCellEl, getRowEl };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullcalendar/daygrid",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-rc.0",
|
|
4
4
|
"title": "FullCalendar Day Grid Plugin",
|
|
5
5
|
"description": "Display events on a month view or \"day grid\" view",
|
|
6
6
|
"homepage": "https://fullcalendar.io/docs/month-view",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"month-view"
|
|
14
14
|
],
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@fullcalendar/core": "7.0.0-
|
|
16
|
+
"@fullcalendar/core": "7.0.0-rc.0"
|
|
17
17
|
},
|
|
18
18
|
"type": "module",
|
|
19
19
|
"bugs": "https://fullcalendar.io/reporting-bugs",
|