@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.cjs
CHANGED
|
@@ -32,6 +32,7 @@ Or ResourceApi object itself?
|
|
|
32
32
|
function buildDateRowConfig(dates, datesRepDistinctDays, dateProfile, todayRange, dayHeaderFormat, // TODO: rename to dateHeaderFormat?
|
|
33
33
|
context, colSpan) {
|
|
34
34
|
return {
|
|
35
|
+
isDateRow: true,
|
|
35
36
|
renderConfig: buildDateRenderConfig(context),
|
|
36
37
|
dataConfigs: buildDateDataConfigs(dates, datesRepDistinctDays, dateProfile, todayRange, dayHeaderFormat, context, colSpan)
|
|
37
38
|
};
|
|
@@ -50,31 +51,38 @@ function buildDateRenderConfig(context) {
|
|
|
50
51
|
willUnmount: options.dayHeaderWillUnmount,
|
|
51
52
|
};
|
|
52
53
|
}
|
|
54
|
+
const dowDates = [];
|
|
55
|
+
for (let dow = 0; dow < 7; dow++) {
|
|
56
|
+
dowDates.push(internal_cjs.addDays(new Date(259200000), dow)); // start with Sun, 04 Jan 1970 00:00:00 GMT)
|
|
57
|
+
}
|
|
53
58
|
/*
|
|
54
59
|
For header cells: data
|
|
55
60
|
*/
|
|
56
61
|
function buildDateDataConfigs(dates, datesRepDistinctDays, dateProfile, todayRange, dayHeaderFormat, // TODO: rename to dateHeaderFormat?
|
|
57
|
-
context, colSpan = 1, keyPrefix = ''
|
|
62
|
+
context, colSpan = 1, keyPrefix = '', extraRenderProps = {}, // TODO
|
|
63
|
+
extraAttrs = {}, // TODO
|
|
64
|
+
className = '') {
|
|
58
65
|
const { dateEnv, viewApi, options } = context;
|
|
59
66
|
return datesRepDistinctDays
|
|
60
67
|
? dates.map((date) => {
|
|
61
68
|
const dateMeta = internal_cjs.getDateMeta(date, todayRange, null, dateProfile);
|
|
62
69
|
const text = dateEnv.format(date, dayHeaderFormat);
|
|
63
|
-
const renderProps = Object.assign(Object.assign({}, dateMeta), { date: dateEnv.toDate(date), view: viewApi, text });
|
|
64
|
-
const isNavLink = options.navLinks && !dateMeta.isDisabled
|
|
70
|
+
const renderProps = Object.assign(Object.assign(Object.assign({}, dateMeta), { date: dateEnv.toDate(date), view: viewApi, text }), extraRenderProps);
|
|
71
|
+
const isNavLink = options.navLinks && !dateMeta.isDisabled &&
|
|
72
|
+
dates.length > 1; // don't show navlink to day if only one day
|
|
65
73
|
const fullDateStr = internal_cjs.buildDateStr(context, date);
|
|
66
74
|
// for DayGridHeaderCell
|
|
67
75
|
return {
|
|
68
76
|
key: keyPrefix + date.toUTCString(),
|
|
69
77
|
renderProps,
|
|
70
|
-
attrs: Object.assign(Object.assign({ 'aria-label': fullDateStr }, (dateMeta.isToday ? { 'aria-current': 'date' } : {})), { 'data-date': internal_cjs.formatDayString(date) }),
|
|
78
|
+
attrs: Object.assign(Object.assign(Object.assign({ 'aria-label': fullDateStr }, (dateMeta.isToday ? { 'aria-current': 'date' } : {})), { 'data-date': internal_cjs.formatDayString(date) }), extraAttrs),
|
|
71
79
|
// for navlink
|
|
72
80
|
innerAttrs: isNavLink
|
|
73
81
|
? internal_cjs.buildNavLinkAttrs(context, date, undefined, fullDateStr)
|
|
74
82
|
: { 'aria-hidden': true },
|
|
75
83
|
colSpan,
|
|
76
84
|
isNavLink,
|
|
77
|
-
className: internal_cjs.getDayClassName(dateMeta),
|
|
85
|
+
className: internal_cjs.joinClassNames(className, internal_cjs.getDayClassName(dateMeta)),
|
|
78
86
|
};
|
|
79
87
|
})
|
|
80
88
|
: dates.map((date) => {
|
|
@@ -89,21 +97,19 @@ context, colSpan = 1, keyPrefix = '') {
|
|
|
89
97
|
isOther: false,
|
|
90
98
|
};
|
|
91
99
|
const text = dateEnv.format(normDate, dayHeaderFormat);
|
|
92
|
-
const renderProps = Object.assign(Object.assign({}, dayMeta), { date, view: viewApi, text });
|
|
100
|
+
const renderProps = Object.assign(Object.assign(Object.assign({}, dayMeta), { date: dowDates[dow], view: viewApi, text }), extraRenderProps);
|
|
93
101
|
const fullWeekDayStr = dateEnv.format(normDate, WEEKDAY_FORMAT);
|
|
94
102
|
// for DayGridHeaderCell
|
|
95
103
|
return {
|
|
96
104
|
key: keyPrefix + String(dow),
|
|
97
105
|
renderProps,
|
|
98
|
-
attrs: {
|
|
99
|
-
|
|
100
|
-
},
|
|
101
|
-
// for navlink
|
|
106
|
+
attrs: Object.assign({ 'aria-label': fullWeekDayStr }, extraAttrs),
|
|
107
|
+
// NOT a navlink
|
|
102
108
|
innerAttrs: {
|
|
103
109
|
'aria-hidden': true, // label already on cell
|
|
104
110
|
},
|
|
105
111
|
colSpan,
|
|
106
|
-
className: internal_cjs.getDayClassName(dayMeta),
|
|
112
|
+
className: internal_cjs.joinClassNames(className, internal_cjs.getDayClassName(dayMeta)),
|
|
107
113
|
};
|
|
108
114
|
});
|
|
109
115
|
}
|
|
@@ -222,6 +228,8 @@ class DayGridMoreLink extends internal_cjs.BaseComponent {
|
|
|
222
228
|
class DayGridCell extends internal_cjs.DateComponent {
|
|
223
229
|
constructor() {
|
|
224
230
|
super(...arguments);
|
|
231
|
+
// memo
|
|
232
|
+
this.getDateMeta = internal_cjs.memoize(internal_cjs.getDateMeta);
|
|
225
233
|
// ref
|
|
226
234
|
this.rootElRef = preact_cjs.createRef();
|
|
227
235
|
this.handleBodyEl = (bodyEl) => {
|
|
@@ -255,8 +263,7 @@ class DayGridCell extends internal_cjs.DateComponent {
|
|
|
255
263
|
// TODO: memoize this
|
|
256
264
|
const isMonthStart = props.showDayNumber &&
|
|
257
265
|
shouldDisplayMonthStart(props.date, props.dateProfile.currentRange, dateEnv);
|
|
258
|
-
|
|
259
|
-
const dateMeta = internal_cjs.getDateMeta(props.date, props.todayRange, null, props.dateProfile);
|
|
266
|
+
const dateMeta = this.getDateMeta(props.date, props.todayRange, null, props.dateProfile);
|
|
260
267
|
const baseClassName = internal_cjs.joinClassNames('fc-daygrid-day', props.borderStart && 'fc-border-s', props.width != null ? '' : 'fc-liquid', 'fc-flex-col');
|
|
261
268
|
if (dateMeta.isDisabled) {
|
|
262
269
|
return (preact_cjs.createElement("div", { role: 'gridcell', "aria-disabled": true, className: internal_cjs.joinClassNames(baseClassName, 'fc-day-disabled'), style: {
|
|
@@ -505,10 +512,10 @@ function computeRowFromPosition(positionTop, cellRows, rowHeightMap) {
|
|
|
505
512
|
// Hit Element
|
|
506
513
|
// -------------------------------------------------------------------------------------------------
|
|
507
514
|
function getRowEl(rootEl, row) {
|
|
508
|
-
return rootEl.querySelectorAll('
|
|
515
|
+
return rootEl.querySelectorAll('[role=row]')[row];
|
|
509
516
|
}
|
|
510
517
|
function getCellEl(rowEl, col) {
|
|
511
|
-
return rowEl.querySelectorAll('
|
|
518
|
+
return rowEl.querySelectorAll('[role=gridcell]')[col];
|
|
512
519
|
}
|
|
513
520
|
// Header Formatting
|
|
514
521
|
// -------------------------------------------------------------------------------------------------
|
|
@@ -606,13 +613,16 @@ class DayGridRow extends internal_cjs.BaseComponent {
|
|
|
606
613
|
return (preact_cjs.createElement("div", { role: props.role /* !!! */, "aria-label": props.role === 'row' // HACK
|
|
607
614
|
? fullWeekStr
|
|
608
615
|
: undefined // can't have label on non-role div
|
|
609
|
-
, className: internal_cjs.joinClassNames('fc-flex-row fc-rel', props.className), style: {
|
|
610
|
-
|
|
616
|
+
, className: internal_cjs.joinClassNames('fc-daygrid-row', props.forPrint && 'fc-daygrid-row-print', 'fc-flex-row fc-rel', props.className), style: {
|
|
617
|
+
'flex-basis': props.basis,
|
|
611
618
|
}, ref: this.handleRootEl },
|
|
619
|
+
props.showWeekNumbers && (preact_cjs.createElement(internal_cjs.WeekNumberContainer, { tag: 'div', attrs: Object.assign(Object.assign({}, (isNavLink
|
|
620
|
+
? internal_cjs.buildNavLinkAttrs(context, weekDate, 'week', fullWeekStr, /* isTabbable = */ false)
|
|
621
|
+
: {})), { 'role': undefined, 'aria-hidden': true }), className: 'fc-daygrid-week-number', date: weekDate, defaultFormat: DEFAULT_WEEK_NUM_FORMAT })),
|
|
612
622
|
this.renderFillSegs(props.businessHourSegs, 'non-business'),
|
|
613
623
|
this.renderFillSegs(props.bgEventSegs, 'bg-event'),
|
|
614
624
|
this.renderFillSegs(highlightSegs, 'highlight'),
|
|
615
|
-
|
|
625
|
+
props.cells.map((cell, col) => {
|
|
616
626
|
const normalFgNodes = this.renderFgSegs(maxMainTop, renderableSegsByCol[col], segTops, props.todayRange, forcedInvisibleMap);
|
|
617
627
|
return (preact_cjs.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),
|
|
618
628
|
// content
|
|
@@ -623,10 +633,7 @@ class DayGridRow extends internal_cjs.BaseComponent {
|
|
|
623
633
|
fgHeight: heightsByCol[col], width: props.colWidth,
|
|
624
634
|
// refs
|
|
625
635
|
headerHeightRef: headerHeightRefMap.createRef(cell.key), mainHeightRef: mainHeightRefMap.createRef(cell.key) }));
|
|
626
|
-
})
|
|
627
|
-
props.showWeekNumbers && (preact_cjs.createElement(internal_cjs.WeekNumberContainer, { tag: 'div', attrs: Object.assign(Object.assign({}, (isNavLink
|
|
628
|
-
? internal_cjs.buildNavLinkAttrs(context, weekDate, 'week', fullWeekStr, /* isTabbable = */ false)
|
|
629
|
-
: {})), { 'role': undefined, 'aria-hidden': true }), className: 'fc-daygrid-week-number', date: weekDate, defaultFormat: DEFAULT_WEEK_NUM_FORMAT })),
|
|
636
|
+
}),
|
|
630
637
|
this.renderFgSegs(maxMainTop, mirrorSegs, segTops, props.todayRange, {}, // forcedInvisibleMap
|
|
631
638
|
Boolean(props.eventDrag), Boolean(props.eventResize), false)));
|
|
632
639
|
}
|
|
@@ -786,30 +793,22 @@ class DayGridRows extends internal_cjs.DateComponent {
|
|
|
786
793
|
let eventResizeByRow = this.splitEventResize(props.eventResize, rowCnt);
|
|
787
794
|
let isHeightAuto = internal_cjs.getIsHeightAuto(options);
|
|
788
795
|
let rowHeightsRedistribute = !props.forPrint && !isHeightAuto;
|
|
789
|
-
let
|
|
796
|
+
let rowBasis = computeRowBasis(props.visibleWidth, rowCnt, isHeightAuto, options);
|
|
797
|
+
let isCompact = computeRowIsCompact(props.visibleWidth, options);
|
|
790
798
|
return (preact_cjs.createElement("div", { role: 'rowgroup', className: internal_cjs.joinClassNames(
|
|
791
799
|
// HACK for Safari. Can't do break-inside:avoid with flexbox items, likely b/c it's not standard:
|
|
792
800
|
// https://stackoverflow.com/a/60256345
|
|
793
801
|
!props.forPrint && 'fc-flex-col', props.className), style: { width: props.width }, ref: this.handleRootEl }, props.cellRows.map((cells, row) => (preact_cjs.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,
|
|
794
802
|
// if not auto-height, distribute height of container somewhat evently to rows
|
|
795
|
-
|
|
796
|
-
className: internal_cjs.joinClassNames(rowHeightsRedistribute && 'fc-grow fc-basis0', rowCnt > 1 && 'fc-break-inside-avoid', // don't avoid breaks for single tall row
|
|
803
|
+
className: internal_cjs.joinClassNames(rowHeightsRedistribute && 'fc-grow', rowCnt > 1 && 'fc-break-inside-avoid', // don't avoid breaks for single tall row
|
|
797
804
|
row < rowCnt - 1 && 'fc-border-b'),
|
|
798
805
|
// content
|
|
799
806
|
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,
|
|
800
807
|
// dimensions
|
|
801
|
-
colWidth: props.colWidth,
|
|
808
|
+
colWidth: props.colWidth, basis: rowBasis,
|
|
802
809
|
// refs
|
|
803
810
|
heightRef: rowHeightRefMap.createRef(cells[0].key) })))));
|
|
804
811
|
}
|
|
805
|
-
componentDidMount() {
|
|
806
|
-
this.disconnectWidth = internal_cjs.watchWidth(this.rootEl, (width) => {
|
|
807
|
-
this.setState({ width });
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
componentWillUnmount() {
|
|
811
|
-
this.disconnectWidth();
|
|
812
|
-
}
|
|
813
812
|
// Hit System
|
|
814
813
|
// -----------------------------------------------------------------------------------------------
|
|
815
814
|
queryHit(positionLeft, positionTop, elWidth) {
|
|
@@ -826,8 +825,7 @@ class DayGridRows extends internal_cjs.DateComponent {
|
|
|
826
825
|
start: cellStartDate,
|
|
827
826
|
end: cellEndDate,
|
|
828
827
|
}, allDay: true }, cell.dateSpanProps),
|
|
829
|
-
|
|
830
|
-
dayEl: getCellEl(getRowEl(this.rootEl, row), col),
|
|
828
|
+
getDayEl: () => getCellEl(getRowEl(this.rootEl, row), col),
|
|
831
829
|
rect: {
|
|
832
830
|
left,
|
|
833
831
|
right,
|
|
@@ -843,27 +841,35 @@ class DayGridRows extends internal_cjs.DateComponent {
|
|
|
843
841
|
function isSegAllDay(seg) {
|
|
844
842
|
return seg.eventRange.def.allDay;
|
|
845
843
|
}
|
|
846
|
-
|
|
847
|
-
|
|
844
|
+
/*
|
|
845
|
+
Amount of height a row should consume prior to expanding
|
|
846
|
+
We don't want to use min-height with flexbox because we leverage min-height:auto,
|
|
847
|
+
which yields value based on natural height of events
|
|
848
|
+
*/
|
|
849
|
+
function computeRowBasis(visibleWidth, // should INCLUDE any scrollbar width to avoid oscillation
|
|
850
|
+
rowCnt, isHeightAuto, options) {
|
|
848
851
|
if (visibleWidth != null) {
|
|
849
852
|
// ensure a consistent row min-height modelled after a month with 6 rows respecting aspectRatio
|
|
850
853
|
// will result in same minHeight regardless of weekends, dayMinWidth, height:auto
|
|
851
|
-
const
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
// this is value that looks natural on paper for portrait/landscape
|
|
856
|
-
? '6em'
|
|
857
|
-
// don't give minHeight when single-month non-auto-height
|
|
858
|
-
// TODO: better way to detect this with DateProfile?
|
|
859
|
-
: (rowCnt > 6 || isHeightAuto)
|
|
860
|
-
? rowMinHeight
|
|
861
|
-
: undefined,
|
|
862
|
-
// isCompact?: just before most lone +more links hit bottom of cell
|
|
863
|
-
rowMinHeight < 70,
|
|
864
|
-
];
|
|
854
|
+
const rowBasis = visibleWidth / options.aspectRatio / 6;
|
|
855
|
+
// don't give minHeight when single-month non-auto-height
|
|
856
|
+
// TODO: better way to detect this with DateProfile?
|
|
857
|
+
return (rowCnt > 6 || isHeightAuto) ? rowBasis : 0;
|
|
865
858
|
}
|
|
866
|
-
return
|
|
859
|
+
return 0;
|
|
860
|
+
}
|
|
861
|
+
/*
|
|
862
|
+
Infers cell height based on overall width
|
|
863
|
+
*/
|
|
864
|
+
function computeRowIsCompact(visibleWidth, // should INCLUDE any scrollbar width to avoid oscillation
|
|
865
|
+
options) {
|
|
866
|
+
if (visibleWidth != null) {
|
|
867
|
+
// ensure a consistent row min-height modelled after a month with 6 rows respecting aspectRatio
|
|
868
|
+
// will result in same minHeight regardless of weekends, dayMinWidth, height:auto
|
|
869
|
+
const rowBasis = visibleWidth / options.aspectRatio / 6;
|
|
870
|
+
return rowBasis < 70;
|
|
871
|
+
}
|
|
872
|
+
return false;
|
|
867
873
|
}
|
|
868
874
|
|
|
869
875
|
class DayGridHeaderCell extends internal_cjs.BaseComponent {
|
|
@@ -923,6 +929,9 @@ class DayGridHeaderRow extends internal_cjs.BaseComponent {
|
|
|
923
929
|
const { props } = this;
|
|
924
930
|
return (preact_cjs.createElement("div", { role: props.role /* !!! */, "aria-rowindex": props.rowIndex != null ? 1 + props.rowIndex : undefined, className: internal_cjs.joinClassNames('fc-flex-row fc-content-box', props.className), style: { height: props.height } }, props.dataConfigs.map((dataConfig, cellI) => (preact_cjs.createElement(DayGridHeaderCell, { key: dataConfig.key, renderConfig: props.renderConfig, dataConfig: dataConfig, isSticky: props.isSticky, borderStart: Boolean(cellI), colWidth: props.colWidth, innerHeightRef: props.innerHeightRef })))));
|
|
925
931
|
}
|
|
932
|
+
componentWillUnmount() {
|
|
933
|
+
internal_cjs.setRef(this.props.innerHeightRef, null);
|
|
934
|
+
}
|
|
926
935
|
}
|
|
927
936
|
|
|
928
937
|
/*
|
|
@@ -943,37 +952,39 @@ class DayGridLayoutNormal extends internal_cjs.BaseComponent {
|
|
|
943
952
|
this.handleScroller = (scroller) => {
|
|
944
953
|
internal_cjs.setRef(this.props.scrollerRef, scroller);
|
|
945
954
|
};
|
|
955
|
+
this.handleTotalWidth = (totalWidth) => {
|
|
956
|
+
this.setState({ totalWidth });
|
|
957
|
+
};
|
|
946
958
|
this.handleClientWidth = (clientWidth) => {
|
|
947
959
|
this.setState({ clientWidth });
|
|
948
960
|
};
|
|
949
|
-
this.handleEndScrollbarWidth = (endScrollbarWidth) => {
|
|
950
|
-
this.setState({ endScrollbarWidth });
|
|
951
|
-
};
|
|
952
961
|
}
|
|
953
962
|
render() {
|
|
954
963
|
const { props, state, context } = this;
|
|
955
964
|
const { options } = context;
|
|
965
|
+
const { totalWidth, clientWidth } = state;
|
|
966
|
+
const endScrollbarWidth = (totalWidth != null && clientWidth != null)
|
|
967
|
+
? totalWidth - clientWidth
|
|
968
|
+
: undefined;
|
|
956
969
|
const verticalScrollbars = !props.forPrint && !internal_cjs.getIsHeightAuto(options);
|
|
957
970
|
const stickyHeaderDates = !props.forPrint && internal_cjs.getStickyHeaderDates(options);
|
|
958
971
|
return (preact_cjs.createElement(preact_cjs.Fragment, null,
|
|
959
972
|
options.dayHeaders && (preact_cjs.createElement("div", { className: internal_cjs.joinClassNames(props.forPrint ? 'fc-print-header' : 'fc-flex-row', // col for print, row for screen
|
|
960
|
-
'fc-border-b') },
|
|
961
|
-
preact_cjs.createElement(DayGridHeader, { headerTiers: props.headerTiers, className:
|
|
962
|
-
Boolean(
|
|
963
|
-
preact_cjs.createElement(internal_cjs.Scroller, { vertical: verticalScrollbars,
|
|
973
|
+
stickyHeaderDates && 'fc-table-header-sticky', 'fc-border-b') },
|
|
974
|
+
preact_cjs.createElement(DayGridHeader, { headerTiers: props.headerTiers, className: 'fc-daygrid-header' }),
|
|
975
|
+
Boolean(endScrollbarWidth) && (preact_cjs.createElement("div", { className: 'fc-border-s fc-filler', style: { minWidth: endScrollbarWidth } })))),
|
|
976
|
+
preact_cjs.createElement(internal_cjs.Scroller, { vertical: verticalScrollbars, className: internal_cjs.joinClassNames('fc-daygrid-body',
|
|
964
977
|
// HACK for Safari. Can't do break-inside:avoid with flexbox items, likely b/c it's not standard:
|
|
965
978
|
// https://stackoverflow.com/a/60256345
|
|
966
|
-
!props.forPrint && 'fc-flex-col', verticalScrollbars && 'fc-liquid'), ref: this.handleScroller },
|
|
979
|
+
!props.forPrint && 'fc-flex-col', verticalScrollbars && 'fc-liquid'), ref: this.handleScroller, clientWidthRef: this.handleClientWidth },
|
|
967
980
|
preact_cjs.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,
|
|
968
981
|
// content
|
|
969
982
|
fgEventSegs: props.fgEventSegs, bgEventSegs: props.bgEventSegs, businessHourSegs: props.businessHourSegs, dateSelectionSegs: props.dateSelectionSegs, eventDrag: props.eventDrag, eventResize: props.eventResize, eventSelection: props.eventSelection,
|
|
970
983
|
// dimensions
|
|
971
|
-
visibleWidth:
|
|
972
|
-
state.clientWidth != null && state.endScrollbarWidth != null
|
|
973
|
-
? state.clientWidth + state.endScrollbarWidth
|
|
974
|
-
: undefined,
|
|
984
|
+
visibleWidth: totalWidth,
|
|
975
985
|
// refs
|
|
976
|
-
rowHeightRefMap: props.rowHeightRefMap }))
|
|
986
|
+
rowHeightRefMap: props.rowHeightRefMap })),
|
|
987
|
+
preact_cjs.createElement(internal_cjs.Ruler, { widthRef: this.handleTotalWidth })));
|
|
977
988
|
}
|
|
978
989
|
}
|
|
979
990
|
|
|
@@ -985,43 +996,45 @@ class DayGridLayoutPannable extends internal_cjs.BaseComponent {
|
|
|
985
996
|
this.footerScrollerRef = preact_cjs.createRef();
|
|
986
997
|
// Sizing
|
|
987
998
|
// -----------------------------------------------------------------------------------------------
|
|
999
|
+
this.handleTotalWidth = (totalWidth) => {
|
|
1000
|
+
this.setState({ totalWidth });
|
|
1001
|
+
};
|
|
988
1002
|
this.handleClientWidth = (clientWidth) => {
|
|
989
1003
|
this.setState({ clientWidth });
|
|
990
1004
|
};
|
|
991
|
-
this.handleEndScrollbarWidth = (endScrollbarWidth) => {
|
|
992
|
-
this.setState({ endScrollbarWidth });
|
|
993
|
-
};
|
|
994
1005
|
}
|
|
995
1006
|
render() {
|
|
996
1007
|
const { props, state, context } = this;
|
|
997
1008
|
const { options } = context;
|
|
1009
|
+
const { totalWidth, clientWidth } = state;
|
|
1010
|
+
const endScrollbarWidth = (totalWidth != null && clientWidth != null)
|
|
1011
|
+
? totalWidth - clientWidth
|
|
1012
|
+
: undefined;
|
|
998
1013
|
const verticalScrollbars = !props.forPrint && !internal_cjs.getIsHeightAuto(options);
|
|
999
1014
|
const stickyHeaderDates = !props.forPrint && internal_cjs.getStickyHeaderDates(options);
|
|
1000
1015
|
const stickyFooterScrollbar = !props.forPrint && internal_cjs.getStickyFooterScrollbar(options);
|
|
1001
1016
|
const colCnt = props.cellRows[0].length;
|
|
1002
|
-
const [canvasWidth, colWidth] = computeColWidth(colCnt, props.dayMinWidth,
|
|
1017
|
+
const [canvasWidth, colWidth] = computeColWidth(colCnt, props.dayMinWidth, clientWidth);
|
|
1003
1018
|
return (preact_cjs.createElement(preact_cjs.Fragment, null,
|
|
1004
|
-
options.dayHeaders && (preact_cjs.createElement("div", { className: 'fc-print-header' },
|
|
1005
|
-
preact_cjs.createElement(internal_cjs.Scroller, { horizontal: true, hideScrollbars: true, className:
|
|
1019
|
+
options.dayHeaders && (preact_cjs.createElement("div", { className: internal_cjs.joinClassNames('fc-print-header', stickyHeaderDates && 'fc-table-header-sticky') },
|
|
1020
|
+
preact_cjs.createElement(internal_cjs.Scroller, { horizontal: true, hideScrollbars: true, className: 'fc-daygrid-header fc-flex-row fc-border-b', ref: this.headerScrollerRef },
|
|
1006
1021
|
preact_cjs.createElement(DayGridHeader, { headerTiers: props.headerTiers, colWidth: colWidth, width: canvasWidth }),
|
|
1007
|
-
Boolean(
|
|
1022
|
+
Boolean(endScrollbarWidth) && (preact_cjs.createElement("div", { className: 'fc-border-s fc-filler', style: { minWidth: endScrollbarWidth } }))))),
|
|
1008
1023
|
preact_cjs.createElement(internal_cjs.Scroller, { vertical: verticalScrollbars, horizontal: true, hideScrollbars: stickyFooterScrollbar ||
|
|
1009
1024
|
props.forPrint // prevents blank space in print-view on Safari
|
|
1010
1025
|
, className: internal_cjs.joinClassNames('fc-daygrid-body',
|
|
1011
1026
|
// HACK for Safari. Can't do break-inside:avoid with flexbox items, likely b/c it's not standard:
|
|
1012
1027
|
// https://stackoverflow.com/a/60256345
|
|
1013
|
-
!props.forPrint && 'fc-flex-col', verticalScrollbars && 'fc-liquid'), ref: this.bodyScrollerRef, clientWidthRef: this.handleClientWidth
|
|
1028
|
+
!props.forPrint && 'fc-flex-col', verticalScrollbars && 'fc-liquid'), ref: this.bodyScrollerRef, clientWidthRef: this.handleClientWidth },
|
|
1014
1029
|
preact_cjs.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,
|
|
1015
1030
|
// content
|
|
1016
1031
|
fgEventSegs: props.fgEventSegs, bgEventSegs: props.bgEventSegs, businessHourSegs: props.businessHourSegs, dateSelectionSegs: props.dateSelectionSegs, eventDrag: props.eventDrag, eventResize: props.eventResize, eventSelection: props.eventSelection,
|
|
1017
1032
|
// dimensions
|
|
1018
|
-
colWidth: colWidth, width: canvasWidth, visibleWidth:
|
|
1019
|
-
state.clientWidth != null && state.endScrollbarWidth != null
|
|
1020
|
-
? state.clientWidth + state.endScrollbarWidth
|
|
1021
|
-
: undefined,
|
|
1033
|
+
colWidth: colWidth, width: canvasWidth, visibleWidth: totalWidth,
|
|
1022
1034
|
// refs
|
|
1023
1035
|
rowHeightRefMap: props.rowHeightRefMap })),
|
|
1024
|
-
Boolean(stickyFooterScrollbar) && (preact_cjs.createElement(internal_cjs.
|
|
1036
|
+
Boolean(stickyFooterScrollbar) && (preact_cjs.createElement(internal_cjs.FooterScrollbar, { isSticky: true, canvasWidth: canvasWidth, scrollerRef: this.footerScrollerRef })),
|
|
1037
|
+
preact_cjs.createElement(internal_cjs.Ruler, { widthRef: this.handleTotalWidth })));
|
|
1025
1038
|
}
|
|
1026
1039
|
// Lifecycle
|
|
1027
1040
|
// -----------------------------------------------------------------------------------------------
|
|
@@ -1076,7 +1089,7 @@ class DayGridLayout extends internal_cjs.BaseComponent {
|
|
|
1076
1089
|
}
|
|
1077
1090
|
}
|
|
1078
1091
|
};
|
|
1079
|
-
this.handleScrollEnd = (
|
|
1092
|
+
this.handleScrollEnd = (isUser) => {
|
|
1080
1093
|
if (isUser) {
|
|
1081
1094
|
this.scrollDate = null;
|
|
1082
1095
|
}
|
|
@@ -1184,7 +1197,7 @@ function buildDayTableRenderRange(props) {
|
|
|
1184
1197
|
return { start, end };
|
|
1185
1198
|
}
|
|
1186
1199
|
|
|
1187
|
-
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-
|
|
1200
|
+
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}";
|
|
1188
1201
|
internal_cjs.injectStyles(css_248z);
|
|
1189
1202
|
|
|
1190
1203
|
exports.DayGridHeaderRow = DayGridHeaderRow;
|
|
@@ -1202,7 +1215,8 @@ exports.buildDayTableModel = buildDayTableModel;
|
|
|
1202
1215
|
exports.buildDayTableRenderRange = buildDayTableRenderRange;
|
|
1203
1216
|
exports.computeColFromPosition = computeColFromPosition;
|
|
1204
1217
|
exports.computeColWidth = computeColWidth;
|
|
1205
|
-
exports.
|
|
1218
|
+
exports.computeRowBasis = computeRowBasis;
|
|
1219
|
+
exports.computeRowIsCompact = computeRowIsCompact;
|
|
1206
1220
|
exports.createDayHeaderFormatter = createDayHeaderFormatter;
|
|
1207
1221
|
exports.getCellEl = getCellEl;
|
|
1208
1222
|
exports.getRowEl = getRowEl;
|
package/internal.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Slicer, DayGridRange, DayTableModel, DateRange, DateProfileGenerator, DateEnv, BaseComponent, ViewProps, DateMarker, DateProfile, DateFormatter, ViewContext, DayTableCell, Hit, EventRangeProps, EventSegUiInteractionState, DateComponent, ViewOptionsRefined, RefMap, SlicedCoordRange } from '@fullcalendar/core/internal';
|
|
2
2
|
import { createElement, Ref, VNode } from '@fullcalendar/core/preact';
|
|
3
|
-
import { CustomContentGenerator, ClassNamesGenerator, DidMountHandler, WillUnmountHandler, DayHeaderContentArg
|
|
3
|
+
import { CustomContentGenerator, ClassNamesGenerator, DidMountHandler, WillUnmountHandler, DayHeaderContentArg } from '@fullcalendar/core';
|
|
4
4
|
|
|
5
5
|
declare class DayTableSlicer extends Slicer<DayGridRange, [DayTableModel]> {
|
|
6
6
|
forceDayIfListItem: boolean;
|
|
@@ -46,6 +46,7 @@ interface CellDataConfig<RenderProps> {
|
|
|
46
46
|
isNavLink?: boolean;
|
|
47
47
|
}
|
|
48
48
|
interface RowConfig<RenderProps> {
|
|
49
|
+
isDateRow: boolean;
|
|
49
50
|
renderConfig: CellRenderConfig<RenderProps>;
|
|
50
51
|
dataConfigs: CellDataConfig<RenderProps>[];
|
|
51
52
|
}
|
|
@@ -54,7 +55,9 @@ declare function buildDateRowConfig(dates: DateMarker[], datesRepDistinctDays: b
|
|
|
54
55
|
context: ViewContext, colSpan?: number): RowConfig<DayHeaderContentArg>;
|
|
55
56
|
declare function buildDateRenderConfig(context: ViewContext): CellRenderConfig<DayHeaderContentArg>;
|
|
56
57
|
declare function buildDateDataConfigs(dates: DateMarker[], datesRepDistinctDays: boolean, dateProfile: DateProfile, todayRange: DateRange, dayHeaderFormat: DateFormatter, // TODO: rename to dateHeaderFormat?
|
|
57
|
-
context: ViewContext, colSpan?: number, keyPrefix?: string
|
|
58
|
+
context: ViewContext, colSpan?: number, keyPrefix?: string, extraRenderProps?: any, // TODO
|
|
59
|
+
extraAttrs?: any, // TODO
|
|
60
|
+
className?: string): CellDataConfig<DayHeaderContentArg>[];
|
|
58
61
|
|
|
59
62
|
interface DayGridHeaderRowProps<RenderProps> extends RowConfig<RenderProps> {
|
|
60
63
|
isSticky?: boolean;
|
|
@@ -73,6 +76,7 @@ declare class DayGridHeaderRow<RenderProps extends {
|
|
|
73
76
|
private currentInnerHeight?;
|
|
74
77
|
render(): createElement.JSX.Element;
|
|
75
78
|
private handleInnerHeights;
|
|
79
|
+
componentWillUnmount(): void;
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
declare function buildDayTableModel(dateProfile: DateProfile, dateProfileGenerator: DateProfileGenerator): DayTableModel;
|
|
@@ -120,9 +124,7 @@ declare class DayGridLayout extends BaseComponent<DayGridLayoutProps> {
|
|
|
120
124
|
componentWillUnmount(): void;
|
|
121
125
|
resetScroll(): void;
|
|
122
126
|
updateScrollY: () => void;
|
|
123
|
-
handleScrollEnd: (
|
|
124
|
-
isUser: boolean;
|
|
125
|
-
}) => void;
|
|
127
|
+
handleScrollEnd: (isUser: boolean) => void;
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
interface DayGridRowsProps {
|
|
@@ -155,15 +157,14 @@ declare class DayGridRows extends DateComponent<DayGridRowsProps> {
|
|
|
155
157
|
private splitEventDrag;
|
|
156
158
|
private splitEventResize;
|
|
157
159
|
private rowHeightRefMap;
|
|
158
|
-
private disconnectWidth?;
|
|
159
160
|
render(): createElement.JSX.Element;
|
|
160
161
|
handleRootEl: (rootEl: HTMLDivElement) => void;
|
|
161
|
-
componentDidMount(): void;
|
|
162
|
-
componentWillUnmount(): void;
|
|
163
162
|
queryHit(positionLeft: number, positionTop: number, elWidth: number): Hit;
|
|
164
163
|
}
|
|
165
|
-
declare function
|
|
166
|
-
rowCnt: number, isHeightAuto: boolean,
|
|
164
|
+
declare function computeRowBasis(visibleWidth: number | undefined, // should INCLUDE any scrollbar width to avoid oscillation
|
|
165
|
+
rowCnt: number, isHeightAuto: boolean, options: ViewOptionsRefined): number;
|
|
166
|
+
declare function computeRowIsCompact(visibleWidth: number | undefined, // should INCLUDE any scrollbar width to avoid oscillation
|
|
167
|
+
options: ViewOptionsRefined): boolean;
|
|
167
168
|
|
|
168
169
|
type DayRowRange = SlicedCoordRange;
|
|
169
170
|
type DayRowEventRange = DayRowRange & EventRangeProps;
|
|
@@ -193,7 +194,7 @@ interface DayGridRowProps {
|
|
|
193
194
|
dayMaxEvents: boolean | number;
|
|
194
195
|
dayMaxEventRows: boolean | number;
|
|
195
196
|
colWidth?: number;
|
|
196
|
-
|
|
197
|
+
basis?: number;
|
|
197
198
|
rootElRef?: Ref<HTMLElement>;
|
|
198
199
|
heightRef?: Ref<number>;
|
|
199
200
|
}
|
|
@@ -217,4 +218,4 @@ declare class DayGridRow extends BaseComponent<DayGridRowProps> {
|
|
|
217
218
|
private getHighlightSegs;
|
|
218
219
|
}
|
|
219
220
|
|
|
220
|
-
export { CellDataConfig, CellRenderConfig, DayGridHeaderRow, DayGridHeaderRowProps, DayGridLayout, DayGridLayoutProps, DayGridRow, DayGridRowProps, DayGridRows, DayGridView, DayTableSlicer, RowConfig, TableDateProfileGenerator, buildDateDataConfigs, buildDateRenderConfig, buildDateRowConfig, buildDateRowConfigs, buildDayTableModel, buildDayTableRenderRange, computeColFromPosition, computeColWidth,
|
|
221
|
+
export { CellDataConfig, CellRenderConfig, DayGridHeaderRow, DayGridHeaderRowProps, DayGridLayout, DayGridLayoutProps, DayGridRow, DayGridRowProps, DayGridRows, DayGridView, DayTableSlicer, RowConfig, TableDateProfileGenerator, buildDateDataConfigs, buildDateRenderConfig, buildDateRowConfig, buildDateRowConfigs, buildDayTableModel, buildDayTableRenderRange, computeColFromPosition, computeColWidth, computeRowBasis, computeRowIsCompact, createDayHeaderFormatter, getCellEl, getRowEl };
|