@fullcalendar/timeline 6.0.1 → 6.0.3
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.cjs → index.esm.js} +12 -20
- package/index.global.js +2 -2
- package/index.global.min.js +2 -2
- package/index.js +20 -12
- package/{internal.cjs → internal.esm.js} +135 -150
- package/internal.js +150 -135
- package/package.json +10 -14
package/internal.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var internal = require('@fullcalendar/core/internal');
|
|
6
|
+
var preact = require('@fullcalendar/core/preact');
|
|
7
|
+
var internal$1 = require('@fullcalendar/scrollgrid/internal');
|
|
4
8
|
|
|
5
9
|
const MIN_AUTO_LABELS = 18; // more than `12` months but less that `24` hours
|
|
6
10
|
const MAX_AUTO_SLOTS_PER_LABEL = 6; // allows 6 10-min slots in an hour
|
|
7
11
|
const MAX_AUTO_CELLS = 200; // allows 4-days to have a :30 slot duration
|
|
8
|
-
config.MAX_TIMELINE_SLOTS = 1000;
|
|
12
|
+
internal.config.MAX_TIMELINE_SLOTS = 1000;
|
|
9
13
|
// potential nice values for slot-duration and interval-duration
|
|
10
14
|
const STOCK_SUB_DURATIONS = [
|
|
11
15
|
{ years: 1 },
|
|
@@ -39,18 +43,18 @@ function buildTimelineDateProfile(dateProfile, dateEnv, allOptions, dateProfileG
|
|
|
39
43
|
let rawFormats = Array.isArray(input) ? input :
|
|
40
44
|
(input != null) ? [input] :
|
|
41
45
|
computeHeaderFormats(tDateProfile, dateProfile, dateEnv, allOptions);
|
|
42
|
-
tDateProfile.headerFormats = rawFormats.map((rawFormat) => createFormatter(rawFormat));
|
|
46
|
+
tDateProfile.headerFormats = rawFormats.map((rawFormat) => internal.createFormatter(rawFormat));
|
|
43
47
|
tDateProfile.isTimeScale = Boolean(tDateProfile.slotDuration.milliseconds);
|
|
44
48
|
let largeUnit = null;
|
|
45
49
|
if (!tDateProfile.isTimeScale) {
|
|
46
|
-
const slotUnit = greatestDurationDenominator(tDateProfile.slotDuration).unit;
|
|
50
|
+
const slotUnit = internal.greatestDurationDenominator(tDateProfile.slotDuration).unit;
|
|
47
51
|
if (/year|month|week/.test(slotUnit)) {
|
|
48
52
|
largeUnit = slotUnit;
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
55
|
tDateProfile.largeUnit = largeUnit;
|
|
52
56
|
tDateProfile.emphasizeWeeks =
|
|
53
|
-
asCleanDays(tDateProfile.slotDuration) === 1 &&
|
|
57
|
+
internal.asCleanDays(tDateProfile.slotDuration) === 1 &&
|
|
54
58
|
currentRangeAs('weeks', dateProfile, dateEnv) >= 2 &&
|
|
55
59
|
!allOptions.businessHours;
|
|
56
60
|
/*
|
|
@@ -64,8 +68,8 @@ function buildTimelineDateProfile(dateProfile, dateEnv, allOptions, dateProfileG
|
|
|
64
68
|
let snapDuration;
|
|
65
69
|
let snapsPerSlot;
|
|
66
70
|
if (rawSnapDuration) {
|
|
67
|
-
snapDuration = createDuration(rawSnapDuration);
|
|
68
|
-
snapsPerSlot = wholeDivideDurations(tDateProfile.slotDuration, snapDuration);
|
|
71
|
+
snapDuration = internal.createDuration(rawSnapDuration);
|
|
72
|
+
snapsPerSlot = internal.wholeDivideDurations(tDateProfile.slotDuration, snapDuration);
|
|
69
73
|
// ^ TODO: warning if not whole?
|
|
70
74
|
}
|
|
71
75
|
if (snapsPerSlot == null) {
|
|
@@ -75,7 +79,7 @@ function buildTimelineDateProfile(dateProfile, dateEnv, allOptions, dateProfileG
|
|
|
75
79
|
tDateProfile.snapDuration = snapDuration;
|
|
76
80
|
tDateProfile.snapsPerSlot = snapsPerSlot;
|
|
77
81
|
// more...
|
|
78
|
-
let timeWindowMs = asRoughMs(dateProfile.slotMaxTime) - asRoughMs(dateProfile.slotMinTime);
|
|
82
|
+
let timeWindowMs = internal.asRoughMs(dateProfile.slotMaxTime) - internal.asRoughMs(dateProfile.slotMinTime);
|
|
79
83
|
// TODO: why not use normalizeRange!?
|
|
80
84
|
let normalizedStart = normalizeDate(dateProfile.renderRange.start, tDateProfile, dateEnv);
|
|
81
85
|
let normalizedEnd = normalizeDate(dateProfile.renderRange.end, tDateProfile, dateEnv);
|
|
@@ -83,7 +87,7 @@ function buildTimelineDateProfile(dateProfile, dateEnv, allOptions, dateProfileG
|
|
|
83
87
|
// TODO: View should be responsible.
|
|
84
88
|
if (tDateProfile.isTimeScale) {
|
|
85
89
|
normalizedStart = dateEnv.add(normalizedStart, dateProfile.slotMinTime);
|
|
86
|
-
normalizedEnd = dateEnv.add(addDays(normalizedEnd, -1), dateProfile.slotMaxTime);
|
|
90
|
+
normalizedEnd = dateEnv.add(internal.addDays(normalizedEnd, -1), dateProfile.slotMaxTime);
|
|
87
91
|
}
|
|
88
92
|
tDateProfile.timeWindowMs = timeWindowMs;
|
|
89
93
|
tDateProfile.normalizedRange = { start: normalizedStart, end: normalizedEnd };
|
|
@@ -121,7 +125,7 @@ function buildTimelineDateProfile(dateProfile, dateEnv, allOptions, dateProfileG
|
|
|
121
125
|
// more...
|
|
122
126
|
tDateProfile.isWeekStarts = buildIsWeekStarts(tDateProfile, dateEnv);
|
|
123
127
|
tDateProfile.cellRows = buildCellRows(tDateProfile, dateEnv);
|
|
124
|
-
tDateProfile.slotsPerLabel = wholeDivideDurations(tDateProfile.labelInterval, tDateProfile.slotDuration);
|
|
128
|
+
tDateProfile.slotsPerLabel = internal.wholeDivideDurations(tDateProfile.labelInterval, tDateProfile.slotDuration);
|
|
125
129
|
return tDateProfile;
|
|
126
130
|
}
|
|
127
131
|
/*
|
|
@@ -130,7 +134,7 @@ snaps to appropriate unit
|
|
|
130
134
|
function normalizeDate(date, tDateProfile, dateEnv) {
|
|
131
135
|
let normalDate = date;
|
|
132
136
|
if (!tDateProfile.isTimeScale) {
|
|
133
|
-
normalDate = startOfDay(normalDate);
|
|
137
|
+
normalDate = internal.startOfDay(normalDate);
|
|
134
138
|
if (tDateProfile.largeUnit) {
|
|
135
139
|
normalDate = dateEnv.startOf(normalDate, tDateProfile.largeUnit);
|
|
136
140
|
}
|
|
@@ -142,7 +146,7 @@ snaps to appropriate unit
|
|
|
142
146
|
*/
|
|
143
147
|
function normalizeRange(range, tDateProfile, dateEnv) {
|
|
144
148
|
if (!tDateProfile.isTimeScale) {
|
|
145
|
-
range = computeVisibleDayRange(range);
|
|
149
|
+
range = internal.computeVisibleDayRange(range);
|
|
146
150
|
if (tDateProfile.largeUnit) {
|
|
147
151
|
let dayRange = range; // preserve original result
|
|
148
152
|
range = {
|
|
@@ -167,9 +171,9 @@ function isValidDate(date, tDateProfile, dateProfile, dateProfileGenerator) {
|
|
|
167
171
|
}
|
|
168
172
|
if (tDateProfile.isTimeScale) {
|
|
169
173
|
// determine if the time is within slotMinTime/slotMaxTime, which may have wacky values
|
|
170
|
-
let day = startOfDay(date);
|
|
174
|
+
let day = internal.startOfDay(date);
|
|
171
175
|
let timeMs = date.valueOf() - day.valueOf();
|
|
172
|
-
let ms = timeMs - asRoughMs(dateProfile.slotMinTime); // milliseconds since slotMinTime
|
|
176
|
+
let ms = timeMs - internal.asRoughMs(dateProfile.slotMinTime); // milliseconds since slotMinTime
|
|
173
177
|
ms = ((ms % 86400000) + 86400000) % 86400000; // make negative values wrap to 24hr clock
|
|
174
178
|
return ms < tDateProfile.timeWindowMs; // before the slotMaxTime?
|
|
175
179
|
}
|
|
@@ -180,7 +184,7 @@ function validateLabelAndSlot(tDateProfile, dateProfile, dateEnv) {
|
|
|
180
184
|
// make sure labelInterval doesn't exceed the max number of cells
|
|
181
185
|
if (tDateProfile.labelInterval) {
|
|
182
186
|
const labelCnt = dateEnv.countDurationsBetween(currentRange.start, currentRange.end, tDateProfile.labelInterval);
|
|
183
|
-
if (labelCnt > config.MAX_TIMELINE_SLOTS) {
|
|
187
|
+
if (labelCnt > internal.config.MAX_TIMELINE_SLOTS) {
|
|
184
188
|
console.warn('slotLabelInterval results in too many cells');
|
|
185
189
|
tDateProfile.labelInterval = null;
|
|
186
190
|
}
|
|
@@ -188,14 +192,14 @@ function validateLabelAndSlot(tDateProfile, dateProfile, dateEnv) {
|
|
|
188
192
|
// make sure slotDuration doesn't exceed the maximum number of cells
|
|
189
193
|
if (tDateProfile.slotDuration) {
|
|
190
194
|
const slotCnt = dateEnv.countDurationsBetween(currentRange.start, currentRange.end, tDateProfile.slotDuration);
|
|
191
|
-
if (slotCnt > config.MAX_TIMELINE_SLOTS) {
|
|
195
|
+
if (slotCnt > internal.config.MAX_TIMELINE_SLOTS) {
|
|
192
196
|
console.warn('slotDuration results in too many cells');
|
|
193
197
|
tDateProfile.slotDuration = null;
|
|
194
198
|
}
|
|
195
199
|
}
|
|
196
200
|
// make sure labelInterval is a multiple of slotDuration
|
|
197
201
|
if (tDateProfile.labelInterval && tDateProfile.slotDuration) {
|
|
198
|
-
const slotsPerLabel = wholeDivideDurations(tDateProfile.labelInterval, tDateProfile.slotDuration);
|
|
202
|
+
const slotsPerLabel = internal.wholeDivideDurations(tDateProfile.labelInterval, tDateProfile.slotDuration);
|
|
199
203
|
if (slotsPerLabel === null || slotsPerLabel < 1) {
|
|
200
204
|
console.warn('slotLabelInterval must be a multiple of slotDuration');
|
|
201
205
|
tDateProfile.slotDuration = null;
|
|
@@ -211,8 +215,8 @@ function ensureLabelInterval(tDateProfile, dateProfile, dateEnv) {
|
|
|
211
215
|
let input;
|
|
212
216
|
if (tDateProfile.slotDuration) {
|
|
213
217
|
for (input of STOCK_SUB_DURATIONS) {
|
|
214
|
-
const tryLabelInterval = createDuration(input);
|
|
215
|
-
const slotsPerLabel = wholeDivideDurations(tryLabelInterval, tDateProfile.slotDuration);
|
|
218
|
+
const tryLabelInterval = internal.createDuration(input);
|
|
219
|
+
const slotsPerLabel = internal.wholeDivideDurations(tryLabelInterval, tDateProfile.slotDuration);
|
|
216
220
|
if (slotsPerLabel !== null && slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL) {
|
|
217
221
|
labelInterval = tryLabelInterval;
|
|
218
222
|
break;
|
|
@@ -227,7 +231,7 @@ function ensureLabelInterval(tDateProfile, dateProfile, dateEnv) {
|
|
|
227
231
|
}
|
|
228
232
|
else {
|
|
229
233
|
for (input of STOCK_SUB_DURATIONS) {
|
|
230
|
-
labelInterval = createDuration(input);
|
|
234
|
+
labelInterval = internal.createDuration(input);
|
|
231
235
|
const labelCnt = dateEnv.countDurationsBetween(currentRange.start, currentRange.end, labelInterval);
|
|
232
236
|
if (labelCnt >= MIN_AUTO_LABELS) {
|
|
233
237
|
break;
|
|
@@ -246,8 +250,8 @@ function ensureSlotDuration(tDateProfile, dateProfile, dateEnv) {
|
|
|
246
250
|
// compute based off the label interval
|
|
247
251
|
// find the largest slot duration that is different from labelInterval, but still acceptable
|
|
248
252
|
for (let input of STOCK_SUB_DURATIONS) {
|
|
249
|
-
const trySlotDuration = createDuration(input);
|
|
250
|
-
const slotsPerLabel = wholeDivideDurations(labelInterval, trySlotDuration);
|
|
253
|
+
const trySlotDuration = internal.createDuration(input);
|
|
254
|
+
const slotsPerLabel = internal.wholeDivideDurations(labelInterval, trySlotDuration);
|
|
251
255
|
if (slotsPerLabel !== null && slotsPerLabel > 1 && slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL) {
|
|
252
256
|
slotDuration = trySlotDuration;
|
|
253
257
|
break;
|
|
@@ -272,7 +276,7 @@ function computeHeaderFormats(tDateProfile, dateProfile, dateEnv, allOptions) {
|
|
|
272
276
|
let format1;
|
|
273
277
|
let format2;
|
|
274
278
|
const { labelInterval } = tDateProfile;
|
|
275
|
-
let unit = greatestDurationDenominator(labelInterval).unit;
|
|
279
|
+
let unit = internal.greatestDurationDenominator(labelInterval).unit;
|
|
276
280
|
const weekNumbersVisible = allOptions.weekNumbers;
|
|
277
281
|
let format0 = (format1 = (format2 = null));
|
|
278
282
|
// NOTE: weekNumber computation function wont work
|
|
@@ -323,12 +327,12 @@ function computeHeaderFormats(tDateProfile, dateProfile, dateEnv, allOptions) {
|
|
|
323
327
|
break;
|
|
324
328
|
case 'minute':
|
|
325
329
|
// sufficiently large number of different minute cells?
|
|
326
|
-
if ((asRoughMinutes(labelInterval) / 60) >= MAX_AUTO_SLOTS_PER_LABEL) {
|
|
330
|
+
if ((internal.asRoughMinutes(labelInterval) / 60) >= MAX_AUTO_SLOTS_PER_LABEL) {
|
|
327
331
|
format0 = {
|
|
328
332
|
hour: 'numeric',
|
|
329
333
|
meridiem: 'short',
|
|
330
334
|
};
|
|
331
|
-
format1 = (params) => (':' + padStart(params.date.minute, 2) // ':30'
|
|
335
|
+
format1 = (params) => (':' + internal.padStart(params.date.minute, 2) // ':30'
|
|
332
336
|
);
|
|
333
337
|
}
|
|
334
338
|
else {
|
|
@@ -341,9 +345,9 @@ function computeHeaderFormats(tDateProfile, dateProfile, dateEnv, allOptions) {
|
|
|
341
345
|
break;
|
|
342
346
|
case 'second':
|
|
343
347
|
// sufficiently large number of different second cells?
|
|
344
|
-
if ((asRoughSeconds(labelInterval) / 60) >= MAX_AUTO_SLOTS_PER_LABEL) {
|
|
348
|
+
if ((internal.asRoughSeconds(labelInterval) / 60) >= MAX_AUTO_SLOTS_PER_LABEL) {
|
|
345
349
|
format0 = { hour: 'numeric', minute: '2-digit', meridiem: 'lowercase' }; // '8:30 PM'
|
|
346
|
-
format1 = (params) => (':' + padStart(params.date.second, 2) // ':30'
|
|
350
|
+
format1 = (params) => (':' + internal.padStart(params.date.second, 2) // ':30'
|
|
347
351
|
);
|
|
348
352
|
}
|
|
349
353
|
else {
|
|
@@ -352,7 +356,7 @@ function computeHeaderFormats(tDateProfile, dateProfile, dateEnv, allOptions) {
|
|
|
352
356
|
break;
|
|
353
357
|
case 'millisecond':
|
|
354
358
|
format0 = { hour: 'numeric', minute: '2-digit', second: '2-digit', meridiem: 'lowercase' }; // '8:30:45 PM'
|
|
355
|
-
format1 = (params) => ('.' + padStart(params.millisecond, 3));
|
|
359
|
+
format1 = (params) => ('.' + internal.padStart(params.millisecond, 3));
|
|
356
360
|
break;
|
|
357
361
|
}
|
|
358
362
|
return [].concat(format0 || [], format1 || [], format2 || []);
|
|
@@ -373,7 +377,7 @@ function currentRangeAs(unit, dateProfile, dateEnv) {
|
|
|
373
377
|
res = dateEnv.diffWholeMonths(range.start, range.end);
|
|
374
378
|
}
|
|
375
379
|
else if (unit === 'days') {
|
|
376
|
-
res = diffWholeDays(range.start, range.end);
|
|
380
|
+
res = internal.diffWholeDays(range.start, range.end);
|
|
377
381
|
}
|
|
378
382
|
return res || 0;
|
|
379
383
|
}
|
|
@@ -393,7 +397,7 @@ function buildCellRows(tDateProfile, dateEnv) {
|
|
|
393
397
|
let slotDates = tDateProfile.slotDates;
|
|
394
398
|
let formats = tDateProfile.headerFormats;
|
|
395
399
|
let cellRows = formats.map(() => []); // indexed by row,col
|
|
396
|
-
let slotAsDays = asCleanDays(tDateProfile.slotDuration);
|
|
400
|
+
let slotAsDays = internal.asCleanDays(tDateProfile.slotDuration);
|
|
397
401
|
let guessedSlotUnit = slotAsDays === 7 ? 'week' :
|
|
398
402
|
slotAsDays === 1 ? 'day' :
|
|
399
403
|
null;
|
|
@@ -421,7 +425,7 @@ function buildCellRows(tDateProfile, dateEnv) {
|
|
|
421
425
|
}
|
|
422
426
|
}
|
|
423
427
|
else if (!leadingCell ||
|
|
424
|
-
isInt(dateEnv.countDurationsBetween(tDateProfile.normalizedRange.start, date, tDateProfile.labelInterval))) {
|
|
428
|
+
internal.isInt(dateEnv.countDurationsBetween(tDateProfile.normalizedRange.start, date, tDateProfile.labelInterval))) {
|
|
425
429
|
let text = dateEnv.format(date, format);
|
|
426
430
|
newCell = buildCellObject(date, text, rowUnit);
|
|
427
431
|
}
|
|
@@ -440,11 +444,11 @@ function buildCellObject(date, text, rowUnit) {
|
|
|
440
444
|
return { date, text, rowUnit, colspan: 1, isWeekStart: false };
|
|
441
445
|
}
|
|
442
446
|
|
|
443
|
-
class TimelineHeaderTh extends BaseComponent {
|
|
447
|
+
class TimelineHeaderTh extends internal.BaseComponent {
|
|
444
448
|
constructor() {
|
|
445
449
|
super(...arguments);
|
|
446
|
-
this.refineRenderProps = memoizeObjArg(refineRenderProps);
|
|
447
|
-
this.buildCellNavLinkAttrs = memoize(buildCellNavLinkAttrs);
|
|
450
|
+
this.refineRenderProps = internal.memoizeObjArg(refineRenderProps);
|
|
451
|
+
this.buildCellNavLinkAttrs = internal.memoize(buildCellNavLinkAttrs);
|
|
448
452
|
}
|
|
449
453
|
render() {
|
|
450
454
|
let { props, context } = this;
|
|
@@ -453,7 +457,7 @@ class TimelineHeaderTh extends BaseComponent {
|
|
|
453
457
|
// the cell.rowUnit is f'd
|
|
454
458
|
// giving 'month' for a 3-day view
|
|
455
459
|
// workaround: to infer day, do NOT time
|
|
456
|
-
let dateMeta = getDateMeta(cell.date, props.todayRange, props.nowDate, dateProfile);
|
|
460
|
+
let dateMeta = internal.getDateMeta(cell.date, props.todayRange, props.nowDate, dateProfile);
|
|
457
461
|
let renderProps = this.refineRenderProps({
|
|
458
462
|
level: props.rowLevel,
|
|
459
463
|
dateMarker: cell.date,
|
|
@@ -461,22 +465,22 @@ class TimelineHeaderTh extends BaseComponent {
|
|
|
461
465
|
dateEnv: context.dateEnv,
|
|
462
466
|
viewApi: context.viewApi,
|
|
463
467
|
});
|
|
464
|
-
return (createElement(ContentContainer, { elTag: "th", elClasses: [
|
|
468
|
+
return (preact.createElement(internal.ContentContainer, { elTag: "th", elClasses: [
|
|
465
469
|
'fc-timeline-slot',
|
|
466
470
|
'fc-timeline-slot-label',
|
|
467
471
|
cell.isWeekStart && 'fc-timeline-slot-em',
|
|
468
472
|
...( // TODO: so slot classnames for week/month/bigger. see note above about rowUnit
|
|
469
473
|
cell.rowUnit === 'time' ?
|
|
470
|
-
getSlotClassNames(dateMeta, context.theme) :
|
|
471
|
-
getDayClassNames(dateMeta, context.theme)),
|
|
474
|
+
internal.getSlotClassNames(dateMeta, context.theme) :
|
|
475
|
+
internal.getDayClassNames(dateMeta, context.theme)),
|
|
472
476
|
], elAttrs: {
|
|
473
477
|
colSpan: cell.colspan,
|
|
474
478
|
'data-date': dateEnv.formatIso(cell.date, {
|
|
475
479
|
omitTime: !tDateProfile.isTimeScale,
|
|
476
480
|
omitTimeZoneOffset: true,
|
|
477
481
|
}),
|
|
478
|
-
}, renderProps: renderProps, generatorName: "slotLabelContent", generator: options.slotLabelContent || renderInnerContent, classNameGenerator: options.slotLabelClassNames, didMount: options.slotLabelDidMount, willUnmount: options.slotLabelWillUnmount }, (InnerContent) => (createElement("div", { className: "fc-timeline-slot-frame", style: { height: props.rowInnerHeight } },
|
|
479
|
-
createElement(InnerContent, { elTag: "a", elClasses: [
|
|
482
|
+
}, renderProps: renderProps, generatorName: "slotLabelContent", generator: options.slotLabelContent || renderInnerContent, classNameGenerator: options.slotLabelClassNames, didMount: options.slotLabelDidMount, willUnmount: options.slotLabelWillUnmount }, (InnerContent) => (preact.createElement("div", { className: "fc-timeline-slot-frame", style: { height: props.rowInnerHeight } },
|
|
483
|
+
preact.createElement(InnerContent, { elTag: "a", elClasses: [
|
|
480
484
|
'fc-timeline-slot-cushion',
|
|
481
485
|
'fc-scrollgrid-sync-inner',
|
|
482
486
|
props.isSticky && 'fc-sticky',
|
|
@@ -485,7 +489,7 @@ class TimelineHeaderTh extends BaseComponent {
|
|
|
485
489
|
}
|
|
486
490
|
function buildCellNavLinkAttrs(context, cellDate, rowUnit) {
|
|
487
491
|
return (rowUnit && rowUnit !== 'time')
|
|
488
|
-
? buildNavLinkAttrs(context, cellDate, rowUnit)
|
|
492
|
+
? internal.buildNavLinkAttrs(context, cellDate, rowUnit)
|
|
489
493
|
: {};
|
|
490
494
|
}
|
|
491
495
|
function renderInnerContent(renderProps) {
|
|
@@ -500,11 +504,11 @@ function refineRenderProps(input) {
|
|
|
500
504
|
};
|
|
501
505
|
}
|
|
502
506
|
|
|
503
|
-
class TimelineHeaderRows extends BaseComponent {
|
|
507
|
+
class TimelineHeaderRows extends internal.BaseComponent {
|
|
504
508
|
render() {
|
|
505
509
|
let { dateProfile, tDateProfile, rowInnerHeights, todayRange, nowDate } = this.props;
|
|
506
510
|
let { cellRows } = tDateProfile;
|
|
507
|
-
return (createElement(Fragment, null, cellRows.map((rowCells, rowLevel) => {
|
|
511
|
+
return (preact.createElement(preact.Fragment, null, cellRows.map((rowCells, rowLevel) => {
|
|
508
512
|
let isLast = rowLevel === cellRows.length - 1;
|
|
509
513
|
let isChrono = tDateProfile.isTimeScale && isLast; // the final row, with times?
|
|
510
514
|
let classNames = [
|
|
@@ -512,7 +516,7 @@ class TimelineHeaderRows extends BaseComponent {
|
|
|
512
516
|
isChrono ? 'fc-timeline-header-row-chrono' : '',
|
|
513
517
|
];
|
|
514
518
|
return ( // eslint-disable-next-line react/no-array-index-key
|
|
515
|
-
createElement("tr", { key: rowLevel, className: classNames.join(' ') }, rowCells.map((cell) => (createElement(TimelineHeaderTh, { key: cell.date.toISOString(), cell: cell, rowLevel: rowLevel, dateProfile: dateProfile, tDateProfile: tDateProfile, todayRange: todayRange, nowDate: nowDate, rowInnerHeight: rowInnerHeights && rowInnerHeights[rowLevel], isSticky: !isLast })))));
|
|
519
|
+
preact.createElement("tr", { key: rowLevel, className: classNames.join(' ') }, rowCells.map((cell) => (preact.createElement(TimelineHeaderTh, { key: cell.date.toISOString(), cell: cell, rowLevel: rowLevel, dateProfile: dateProfile, tDateProfile: tDateProfile, todayRange: todayRange, nowDate: nowDate, rowInnerHeight: rowInnerHeights && rowInnerHeights[rowLevel], isSticky: !isLast })))));
|
|
516
520
|
})));
|
|
517
521
|
}
|
|
518
522
|
}
|
|
@@ -525,15 +529,15 @@ class TimelineCoords {
|
|
|
525
529
|
this.tDateProfile = tDateProfile;
|
|
526
530
|
this.dateEnv = dateEnv;
|
|
527
531
|
this.isRtl = isRtl;
|
|
528
|
-
this.outerCoordCache = new PositionCache(slatRootEl, slatEls, true, // isHorizontal
|
|
532
|
+
this.outerCoordCache = new internal.PositionCache(slatRootEl, slatEls, true, // isHorizontal
|
|
529
533
|
false);
|
|
530
534
|
// for the inner divs within the slats
|
|
531
535
|
// used for event rendering and scrollTime, to disregard slat border
|
|
532
|
-
this.innerCoordCache = new PositionCache(slatRootEl, findDirectChildren(slatEls, 'div'), true, // isHorizontal
|
|
536
|
+
this.innerCoordCache = new internal.PositionCache(slatRootEl, internal.findDirectChildren(slatEls, 'div'), true, // isHorizontal
|
|
533
537
|
false);
|
|
534
538
|
}
|
|
535
539
|
isDateInRange(date) {
|
|
536
|
-
return rangeContainsMarker(this.dateProfile.currentRange, date);
|
|
540
|
+
return internal.rangeContainsMarker(this.dateProfile.currentRange, date);
|
|
537
541
|
}
|
|
538
542
|
// results range from negative width of area to 0
|
|
539
543
|
dateToCoord(date) {
|
|
@@ -563,7 +567,7 @@ class TimelineCoords {
|
|
|
563
567
|
if (dateProfile) {
|
|
564
568
|
let date = dateEnv.add(dateProfile.activeRange.start, duration);
|
|
565
569
|
if (!tDateProfile.isTimeScale) {
|
|
566
|
-
date = startOfDay(date);
|
|
570
|
+
date = internal.startOfDay(date);
|
|
567
571
|
}
|
|
568
572
|
coord = this.dateToCoord(date);
|
|
569
573
|
// hack to overcome the left borders of non-first slat
|
|
@@ -595,7 +599,7 @@ function computeDateSnapCoverage(date, tDateProfile, dateEnv) {
|
|
|
595
599
|
}
|
|
596
600
|
let snapDiffInt = Math.floor(snapDiff);
|
|
597
601
|
let snapCoverage = tDateProfile.snapDiffToIndex[snapDiffInt];
|
|
598
|
-
if (isInt(snapCoverage)) { // not an in-between value
|
|
602
|
+
if (internal.isInt(snapCoverage)) { // not an in-between value
|
|
599
603
|
snapCoverage += snapDiff - snapDiffInt; // add the remainder
|
|
600
604
|
}
|
|
601
605
|
else {
|
|
@@ -624,28 +628,28 @@ function coordsToCss(hcoords, isRtl) {
|
|
|
624
628
|
return { left: hcoords.start, right: -hcoords.end };
|
|
625
629
|
}
|
|
626
630
|
|
|
627
|
-
class TimelineHeader extends BaseComponent {
|
|
631
|
+
class TimelineHeader extends internal.BaseComponent {
|
|
628
632
|
constructor() {
|
|
629
633
|
super(...arguments);
|
|
630
|
-
this.rootElRef = createRef();
|
|
634
|
+
this.rootElRef = preact.createRef();
|
|
631
635
|
}
|
|
632
636
|
render() {
|
|
633
637
|
let { props, context } = this;
|
|
634
638
|
// TODO: very repetitive
|
|
635
639
|
// TODO: make part of tDateProfile?
|
|
636
|
-
let timerUnit = greatestDurationDenominator(props.tDateProfile.slotDuration).unit;
|
|
640
|
+
let timerUnit = internal.greatestDurationDenominator(props.tDateProfile.slotDuration).unit;
|
|
637
641
|
// WORKAROUND: make ignore slatCoords when out of sync with dateProfile
|
|
638
642
|
let slatCoords = props.slatCoords && props.slatCoords.dateProfile === props.dateProfile ? props.slatCoords : null;
|
|
639
|
-
return (createElement(NowTimer, { unit: timerUnit }, (nowDate, todayRange) => (createElement("div", { className: "fc-timeline-header", ref: this.rootElRef },
|
|
640
|
-
createElement("table", { "aria-hidden": true, className: "fc-scrollgrid-sync-table", style: { minWidth: props.tableMinWidth, width: props.clientWidth } },
|
|
643
|
+
return (preact.createElement(internal.NowTimer, { unit: timerUnit }, (nowDate, todayRange) => (preact.createElement("div", { className: "fc-timeline-header", ref: this.rootElRef },
|
|
644
|
+
preact.createElement("table", { "aria-hidden": true, className: "fc-scrollgrid-sync-table", style: { minWidth: props.tableMinWidth, width: props.clientWidth } },
|
|
641
645
|
props.tableColGroupNode,
|
|
642
|
-
createElement("tbody", null,
|
|
643
|
-
createElement(TimelineHeaderRows, { dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: nowDate, todayRange: todayRange, rowInnerHeights: props.rowInnerHeights }))),
|
|
646
|
+
preact.createElement("tbody", null,
|
|
647
|
+
preact.createElement(TimelineHeaderRows, { dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: nowDate, todayRange: todayRange, rowInnerHeights: props.rowInnerHeights }))),
|
|
644
648
|
context.options.nowIndicator && (
|
|
645
649
|
// need to have a container regardless of whether the current view has a visible now indicator
|
|
646
650
|
// because apparently removal of the element resets the scroll for some reasons (issue #5351).
|
|
647
651
|
// this issue doesn't happen for the timeline body however (
|
|
648
|
-
createElement("div", { className: "fc-timeline-now-indicator-container" }, (slatCoords && slatCoords.isDateInRange(nowDate)) && (createElement(NowIndicatorContainer, { elClasses: ['fc-timeline-now-indicator-arrow'], elStyle: coordToCss(slatCoords.dateToCoord(nowDate), context.isRtl), isAxis: true, date: nowDate }))))))));
|
|
652
|
+
preact.createElement("div", { className: "fc-timeline-now-indicator-container" }, (slatCoords && slatCoords.isDateInRange(nowDate)) && (preact.createElement(internal.NowIndicatorContainer, { elClasses: ['fc-timeline-now-indicator-arrow'], elStyle: coordToCss(slatCoords.dateToCoord(nowDate), context.isRtl), isAxis: true, date: nowDate }))))))));
|
|
649
653
|
}
|
|
650
654
|
componentDidMount() {
|
|
651
655
|
this.updateSize();
|
|
@@ -659,55 +663,55 @@ class TimelineHeader extends BaseComponent {
|
|
|
659
663
|
}
|
|
660
664
|
}
|
|
661
665
|
computeMaxCushionWidth() {
|
|
662
|
-
return Math.max(...findElements(this.rootElRef.current, '.fc-timeline-header-row:last-child .fc-timeline-slot-cushion').map((el) => el.getBoundingClientRect().width));
|
|
666
|
+
return Math.max(...internal.findElements(this.rootElRef.current, '.fc-timeline-header-row:last-child .fc-timeline-slot-cushion').map((el) => el.getBoundingClientRect().width));
|
|
663
667
|
}
|
|
664
668
|
}
|
|
665
669
|
|
|
666
|
-
class TimelineSlatCell extends BaseComponent {
|
|
670
|
+
class TimelineSlatCell extends internal.BaseComponent {
|
|
667
671
|
render() {
|
|
668
672
|
let { props, context } = this;
|
|
669
673
|
let { dateEnv, options, theme } = context;
|
|
670
674
|
let { date, tDateProfile, isEm } = props;
|
|
671
|
-
let dateMeta = getDateMeta(props.date, props.todayRange, props.nowDate, props.dateProfile);
|
|
675
|
+
let dateMeta = internal.getDateMeta(props.date, props.todayRange, props.nowDate, props.dateProfile);
|
|
672
676
|
let renderProps = Object.assign(Object.assign({ date: dateEnv.toDate(props.date) }, dateMeta), { view: context.viewApi });
|
|
673
|
-
return (createElement(ContentContainer, { elTag: "td", elRef: props.elRef, elClasses: [
|
|
677
|
+
return (preact.createElement(internal.ContentContainer, { elTag: "td", elRef: props.elRef, elClasses: [
|
|
674
678
|
'fc-timeline-slot',
|
|
675
679
|
'fc-timeline-slot-lane',
|
|
676
680
|
isEm && 'fc-timeline-slot-em',
|
|
677
|
-
tDateProfile.isTimeScale ? (isInt(dateEnv.countDurationsBetween(tDateProfile.normalizedRange.start, props.date, tDateProfile.labelInterval)) ?
|
|
681
|
+
tDateProfile.isTimeScale ? (internal.isInt(dateEnv.countDurationsBetween(tDateProfile.normalizedRange.start, props.date, tDateProfile.labelInterval)) ?
|
|
678
682
|
'fc-timeline-slot-major' :
|
|
679
683
|
'fc-timeline-slot-minor') : '',
|
|
680
684
|
...(props.isDay ?
|
|
681
|
-
getDayClassNames(dateMeta, theme) :
|
|
682
|
-
getSlotClassNames(dateMeta, theme)),
|
|
685
|
+
internal.getDayClassNames(dateMeta, theme) :
|
|
686
|
+
internal.getSlotClassNames(dateMeta, theme)),
|
|
683
687
|
], elAttrs: {
|
|
684
688
|
'data-date': dateEnv.formatIso(date, {
|
|
685
689
|
omitTimeZoneOffset: true,
|
|
686
690
|
omitTime: !tDateProfile.isTimeScale,
|
|
687
691
|
}),
|
|
688
|
-
}, renderProps: renderProps, generatorName: "slotLaneContent", generator: options.slotLaneContent, classNameGenerator: options.slotLaneClassNames, didMount: options.slotLaneDidMount, willUnmount: options.slotLaneWillUnmount }, (InnerContent) => (createElement(InnerContent, { elTag: "div" }))));
|
|
692
|
+
}, renderProps: renderProps, generatorName: "slotLaneContent", generator: options.slotLaneContent, classNameGenerator: options.slotLaneClassNames, didMount: options.slotLaneDidMount, willUnmount: options.slotLaneWillUnmount }, (InnerContent) => (preact.createElement(InnerContent, { elTag: "div" }))));
|
|
689
693
|
}
|
|
690
694
|
}
|
|
691
695
|
|
|
692
|
-
class TimelineSlatsBody extends BaseComponent {
|
|
696
|
+
class TimelineSlatsBody extends internal.BaseComponent {
|
|
693
697
|
render() {
|
|
694
698
|
let { props } = this;
|
|
695
699
|
let { tDateProfile, cellElRefs } = props;
|
|
696
700
|
let { slotDates, isWeekStarts } = tDateProfile;
|
|
697
701
|
let isDay = !tDateProfile.isTimeScale && !tDateProfile.largeUnit;
|
|
698
|
-
return (createElement("tbody", null,
|
|
699
|
-
createElement("tr", null, slotDates.map((slotDate, i) => {
|
|
702
|
+
return (preact.createElement("tbody", null,
|
|
703
|
+
preact.createElement("tr", null, slotDates.map((slotDate, i) => {
|
|
700
704
|
let key = slotDate.toISOString();
|
|
701
|
-
return (createElement(TimelineSlatCell, { key: key, elRef: cellElRefs.createRef(key), date: slotDate, dateProfile: props.dateProfile, tDateProfile: tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange, isEm: isWeekStarts[i], isDay: isDay }));
|
|
705
|
+
return (preact.createElement(TimelineSlatCell, { key: key, elRef: cellElRefs.createRef(key), date: slotDate, dateProfile: props.dateProfile, tDateProfile: tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange, isEm: isWeekStarts[i], isDay: isDay }));
|
|
702
706
|
}))));
|
|
703
707
|
}
|
|
704
708
|
}
|
|
705
709
|
|
|
706
|
-
class TimelineSlats extends BaseComponent {
|
|
710
|
+
class TimelineSlats extends internal.BaseComponent {
|
|
707
711
|
constructor() {
|
|
708
712
|
super(...arguments);
|
|
709
|
-
this.rootElRef = createRef();
|
|
710
|
-
this.cellElRefs = new RefMap();
|
|
713
|
+
this.rootElRef = preact.createRef();
|
|
714
|
+
this.cellElRefs = new internal.RefMap();
|
|
711
715
|
this.handleScrollRequest = (request) => {
|
|
712
716
|
let { onScrollLeftRequest } = this.props;
|
|
713
717
|
let { coords } = this;
|
|
@@ -723,13 +727,13 @@ class TimelineSlats extends BaseComponent {
|
|
|
723
727
|
}
|
|
724
728
|
render() {
|
|
725
729
|
let { props, context } = this;
|
|
726
|
-
return (createElement("div", { className: "fc-timeline-slots", ref: this.rootElRef },
|
|
727
|
-
createElement("table", { "aria-hidden": true, className: context.theme.getClass('table'), style: {
|
|
730
|
+
return (preact.createElement("div", { className: "fc-timeline-slots", ref: this.rootElRef },
|
|
731
|
+
preact.createElement("table", { "aria-hidden": true, className: context.theme.getClass('table'), style: {
|
|
728
732
|
minWidth: props.tableMinWidth,
|
|
729
733
|
width: props.clientWidth,
|
|
730
734
|
} },
|
|
731
735
|
props.tableColGroupNode,
|
|
732
|
-
createElement(TimelineSlatsBody, { cellElRefs: this.cellElRefs, dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange }))));
|
|
736
|
+
preact.createElement(TimelineSlatsBody, { cellElRefs: this.cellElRefs, dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange }))));
|
|
733
737
|
}
|
|
734
738
|
componentDidMount() {
|
|
735
739
|
this.updateSizing();
|
|
@@ -773,7 +777,7 @@ class TimelineSlats extends BaseComponent {
|
|
|
773
777
|
(outerCoordCache.rights[slatIndex] - leftPosition) / slatWidth :
|
|
774
778
|
(leftPosition - outerCoordCache.lefts[slatIndex]) / slatWidth;
|
|
775
779
|
let localSnapIndex = Math.floor(partial * tDateProfile.snapsPerSlot);
|
|
776
|
-
let start = dateEnv.add(tDateProfile.slotDates[slatIndex], multiplyDuration(tDateProfile.snapDuration, localSnapIndex));
|
|
780
|
+
let start = dateEnv.add(tDateProfile.slotDates[slatIndex], internal.multiplyDuration(tDateProfile.snapDuration, localSnapIndex));
|
|
777
781
|
let end = dateEnv.add(start, tDateProfile.snapDuration);
|
|
778
782
|
return {
|
|
779
783
|
dateSpan: {
|
|
@@ -836,7 +840,7 @@ strictOrder, maxStackCnt) {
|
|
|
836
840
|
});
|
|
837
841
|
}
|
|
838
842
|
}
|
|
839
|
-
let hierarchy = new SegHierarchy();
|
|
843
|
+
let hierarchy = new internal.SegHierarchy();
|
|
840
844
|
if (strictOrder != null) {
|
|
841
845
|
hierarchy.strictOrder = strictOrder;
|
|
842
846
|
}
|
|
@@ -849,14 +853,14 @@ strictOrder, maxStackCnt) {
|
|
|
849
853
|
hcoords: entry.span,
|
|
850
854
|
top: null,
|
|
851
855
|
}));
|
|
852
|
-
let hiddenGroups = groupIntersectingEntries(hiddenEntries);
|
|
856
|
+
let hiddenGroups = internal.groupIntersectingEntries(hiddenEntries);
|
|
853
857
|
let moreLinkInputs = [];
|
|
854
858
|
let moreLinkCrudePlacements = [];
|
|
855
859
|
const extractSeg = (entry) => segs[entry.index];
|
|
856
860
|
for (let i = 0; i < hiddenGroups.length; i += 1) {
|
|
857
861
|
let hiddenGroup = hiddenGroups[i];
|
|
858
862
|
let sortedSegs = hiddenGroup.entries.map(extractSeg);
|
|
859
|
-
let height = moreLinkHeights[buildIsoString(computeEarliestSegStart(sortedSegs))]; // not optimal :(
|
|
863
|
+
let height = moreLinkHeights[internal.buildIsoString(internal.computeEarliestSegStart(sortedSegs))]; // not optimal :(
|
|
860
864
|
if (height != null) {
|
|
861
865
|
// NOTE: the hiddenGroup's spanStart/spanEnd are already computed by rangeToCoords. computed during input.
|
|
862
866
|
moreLinkInputs.push({
|
|
@@ -896,11 +900,11 @@ strictOrder, maxStackCnt) {
|
|
|
896
900
|
];
|
|
897
901
|
}
|
|
898
902
|
|
|
899
|
-
class TimelineLaneBg extends BaseComponent {
|
|
903
|
+
class TimelineLaneBg extends internal.BaseComponent {
|
|
900
904
|
render() {
|
|
901
905
|
let { props } = this;
|
|
902
906
|
let highlightSeg = [].concat(props.eventResizeSegs, props.dateSelectionSegs);
|
|
903
|
-
return props.timelineCoords && (createElement("div", { className: "fc-timeline-bg" },
|
|
907
|
+
return props.timelineCoords && (preact.createElement("div", { className: "fc-timeline-bg" },
|
|
904
908
|
this.renderSegs(props.businessHourSegs || [], props.timelineCoords, 'non-business'),
|
|
905
909
|
this.renderSegs(props.bgEventSegs || [], props.timelineCoords, 'bg-event'),
|
|
906
910
|
this.renderSegs(highlightSeg, props.timelineCoords, 'highlight')));
|
|
@@ -912,15 +916,15 @@ class TimelineLaneBg extends BaseComponent {
|
|
|
912
916
|
let children = segs.map((seg, i) => {
|
|
913
917
|
let hcoords = segHCoords[i];
|
|
914
918
|
let hStyle = coordsToCss(hcoords, isRtl);
|
|
915
|
-
return (createElement("div", { key: buildEventRangeKey(seg.eventRange), className: "fc-timeline-bg-harness", style: hStyle }, fillType === 'bg-event' ?
|
|
916
|
-
createElement(BgEvent, Object.assign({ seg: seg }, getSegMeta(seg, todayRange, nowDate))) :
|
|
917
|
-
renderFill(fillType)));
|
|
919
|
+
return (preact.createElement("div", { key: internal.buildEventRangeKey(seg.eventRange), className: "fc-timeline-bg-harness", style: hStyle }, fillType === 'bg-event' ?
|
|
920
|
+
preact.createElement(internal.BgEvent, Object.assign({ seg: seg }, internal.getSegMeta(seg, todayRange, nowDate))) :
|
|
921
|
+
internal.renderFill(fillType)));
|
|
918
922
|
});
|
|
919
|
-
return createElement(Fragment, null, children);
|
|
923
|
+
return preact.createElement(preact.Fragment, null, children);
|
|
920
924
|
}
|
|
921
925
|
}
|
|
922
926
|
|
|
923
|
-
class TimelineLaneSlicer extends Slicer {
|
|
927
|
+
class TimelineLaneSlicer extends internal.Slicer {
|
|
924
928
|
sliceRange(origRange, dateProfile, dateProfileGenerator, tDateProfile, dateEnv) {
|
|
925
929
|
let normalRange = normalizeRange(origRange, tDateProfile, dateEnv);
|
|
926
930
|
let segs = [];
|
|
@@ -928,7 +932,7 @@ class TimelineLaneSlicer extends Slicer {
|
|
|
928
932
|
if (computeDateSnapCoverage(normalRange.start, tDateProfile, dateEnv)
|
|
929
933
|
< computeDateSnapCoverage(normalRange.end, tDateProfile, dateEnv)) {
|
|
930
934
|
// intersect the footprint's range with the grid's range
|
|
931
|
-
let slicedRange = intersectRanges(normalRange, tDateProfile.normalizedRange);
|
|
935
|
+
let slicedRange = internal.intersectRanges(normalRange, tDateProfile.normalizedRange);
|
|
932
936
|
if (slicedRange) {
|
|
933
937
|
segs.push({
|
|
934
938
|
start: slicedRange.start,
|
|
@@ -936,7 +940,7 @@ class TimelineLaneSlicer extends Slicer {
|
|
|
936
940
|
isStart: slicedRange.start.valueOf() === normalRange.start.valueOf()
|
|
937
941
|
&& isValidDate(slicedRange.start, tDateProfile, dateProfile, dateProfileGenerator),
|
|
938
942
|
isEnd: slicedRange.end.valueOf() === normalRange.end.valueOf()
|
|
939
|
-
&& isValidDate(addMs(slicedRange.end, -1), tDateProfile, dateProfile, dateProfileGenerator),
|
|
943
|
+
&& isValidDate(internal.addMs(slicedRange.end, -1), tDateProfile, dateProfile, dateProfileGenerator),
|
|
940
944
|
});
|
|
941
945
|
}
|
|
942
946
|
}
|
|
@@ -944,20 +948,20 @@ class TimelineLaneSlicer extends Slicer {
|
|
|
944
948
|
}
|
|
945
949
|
}
|
|
946
950
|
|
|
947
|
-
const DEFAULT_TIME_FORMAT = createFormatter({
|
|
951
|
+
const DEFAULT_TIME_FORMAT = internal.createFormatter({
|
|
948
952
|
hour: 'numeric',
|
|
949
953
|
minute: '2-digit',
|
|
950
954
|
omitZeroMinute: true,
|
|
951
955
|
meridiem: 'narrow',
|
|
952
956
|
});
|
|
953
|
-
class TimelineEvent extends BaseComponent {
|
|
957
|
+
class TimelineEvent extends internal.BaseComponent {
|
|
954
958
|
render() {
|
|
955
959
|
let { props } = this;
|
|
956
|
-
return (createElement(StandardEvent, Object.assign({}, props, { elClasses: ['fc-timeline-event', 'fc-h-event'], defaultTimeFormat: DEFAULT_TIME_FORMAT, defaultDisplayEventTime: !props.isTimeScale })));
|
|
960
|
+
return (preact.createElement(internal.StandardEvent, Object.assign({}, props, { elClasses: ['fc-timeline-event', 'fc-h-event'], defaultTimeFormat: DEFAULT_TIME_FORMAT, defaultDisplayEventTime: !props.isTimeScale })));
|
|
957
961
|
}
|
|
958
962
|
}
|
|
959
963
|
|
|
960
|
-
class TimelineLaneMoreLink extends BaseComponent {
|
|
964
|
+
class TimelineLaneMoreLink extends internal.BaseComponent {
|
|
961
965
|
render() {
|
|
962
966
|
let { props, context } = this;
|
|
963
967
|
let { hiddenSegs, placement, resourceId } = props;
|
|
@@ -965,22 +969,22 @@ class TimelineLaneMoreLink extends BaseComponent {
|
|
|
965
969
|
let isVisible = hcoords && top !== null;
|
|
966
970
|
let hStyle = coordsToCss(hcoords, context.isRtl);
|
|
967
971
|
let extraDateSpan = resourceId ? { resourceId } : {};
|
|
968
|
-
return (createElement(MoreLinkContainer, { elRef: props.elRef, elClasses: ['fc-timeline-more-link'], elStyle: Object.assign({ visibility: isVisible ? '' : 'hidden', top: top || 0 }, hStyle), allDayDate: null, moreCnt: hiddenSegs.length, allSegs: hiddenSegs, hiddenSegs: hiddenSegs, dateProfile: props.dateProfile, todayRange: props.todayRange, extraDateSpan: extraDateSpan, popoverContent: () => (createElement(Fragment, null, hiddenSegs.map((seg) => {
|
|
972
|
+
return (preact.createElement(internal.MoreLinkContainer, { elRef: props.elRef, elClasses: ['fc-timeline-more-link'], elStyle: Object.assign({ visibility: isVisible ? '' : 'hidden', top: top || 0 }, hStyle), allDayDate: null, moreCnt: hiddenSegs.length, allSegs: hiddenSegs, hiddenSegs: hiddenSegs, dateProfile: props.dateProfile, todayRange: props.todayRange, extraDateSpan: extraDateSpan, popoverContent: () => (preact.createElement(preact.Fragment, null, hiddenSegs.map((seg) => {
|
|
969
973
|
let instanceId = seg.eventRange.instance.instanceId;
|
|
970
|
-
return (createElement("div", { key: instanceId, style: { visibility: props.isForcedInvisible[instanceId] ? 'hidden' : '' } },
|
|
971
|
-
createElement(TimelineEvent, Object.assign({ isTimeScale: props.isTimeScale, seg: seg, isDragging: false, isResizing: false, isDateSelecting: false, isSelected: instanceId === props.eventSelection }, getSegMeta(seg, props.todayRange, props.nowDate)))));
|
|
972
|
-
}))) }, (InnerContent) => (createElement(InnerContent, { elTag: "div", elClasses: ['fc-timeline-more-link-inner', 'fc-sticky'] }))));
|
|
974
|
+
return (preact.createElement("div", { key: instanceId, style: { visibility: props.isForcedInvisible[instanceId] ? 'hidden' : '' } },
|
|
975
|
+
preact.createElement(TimelineEvent, Object.assign({ isTimeScale: props.isTimeScale, seg: seg, isDragging: false, isResizing: false, isDateSelecting: false, isSelected: instanceId === props.eventSelection }, internal.getSegMeta(seg, props.todayRange, props.nowDate)))));
|
|
976
|
+
}))) }, (InnerContent) => (preact.createElement(InnerContent, { elTag: "div", elClasses: ['fc-timeline-more-link-inner', 'fc-sticky'] }))));
|
|
973
977
|
}
|
|
974
978
|
}
|
|
975
979
|
|
|
976
|
-
class TimelineLane extends BaseComponent {
|
|
980
|
+
class TimelineLane extends internal.BaseComponent {
|
|
977
981
|
constructor() {
|
|
978
982
|
super(...arguments);
|
|
979
983
|
this.slicer = new TimelineLaneSlicer();
|
|
980
|
-
this.sortEventSegs = memoize(sortEventSegs);
|
|
981
|
-
this.harnessElRefs = new RefMap();
|
|
982
|
-
this.moreElRefs = new RefMap();
|
|
983
|
-
this.innerElRef = createRef();
|
|
984
|
+
this.sortEventSegs = internal.memoize(internal.sortEventSegs);
|
|
985
|
+
this.harnessElRefs = new internal.RefMap();
|
|
986
|
+
this.moreElRefs = new internal.RefMap();
|
|
987
|
+
this.innerElRef = preact.createRef();
|
|
984
988
|
// TODO: memoize event positioning
|
|
985
989
|
this.state = {
|
|
986
990
|
eventInstanceHeights: {},
|
|
@@ -1008,9 +1012,9 @@ class TimelineLane extends BaseComponent {
|
|
|
1008
1012
|
(slicedProps.eventDrag ? slicedProps.eventDrag.affectedInstances : null) ||
|
|
1009
1013
|
(slicedProps.eventResize ? slicedProps.eventResize.affectedInstances : null) ||
|
|
1010
1014
|
{};
|
|
1011
|
-
return (createElement(Fragment, null,
|
|
1012
|
-
createElement(TimelineLaneBg, { businessHourSegs: slicedProps.businessHourSegs, bgEventSegs: slicedProps.bgEventSegs, timelineCoords: props.timelineCoords, eventResizeSegs: slicedProps.eventResize ? slicedProps.eventResize.segs : [] /* bad new empty array? */, dateSelectionSegs: slicedProps.dateSelectionSegs, nowDate: props.nowDate, todayRange: props.todayRange }),
|
|
1013
|
-
createElement("div", { className: "fc-timeline-events fc-scrollgrid-sync-inner", ref: this.innerElRef, style: { height: fgHeight } },
|
|
1015
|
+
return (preact.createElement(preact.Fragment, null,
|
|
1016
|
+
preact.createElement(TimelineLaneBg, { businessHourSegs: slicedProps.businessHourSegs, bgEventSegs: slicedProps.bgEventSegs, timelineCoords: props.timelineCoords, eventResizeSegs: slicedProps.eventResize ? slicedProps.eventResize.segs : [] /* bad new empty array? */, dateSelectionSegs: slicedProps.dateSelectionSegs, nowDate: props.nowDate, todayRange: props.todayRange }),
|
|
1017
|
+
preact.createElement("div", { className: "fc-timeline-events fc-scrollgrid-sync-inner", ref: this.innerElRef, style: { height: fgHeight } },
|
|
1014
1018
|
this.renderFgSegs(fgPlacements, isForcedInvisible, false, false, false),
|
|
1015
1019
|
this.renderFgSegs(buildMirrorPlacements(mirrorSegs, props.timelineCoords, fgPlacements), {}, Boolean(slicedProps.eventDrag), Boolean(slicedProps.eventResize), false))));
|
|
1016
1020
|
}
|
|
@@ -1038,8 +1042,8 @@ class TimelineLane extends BaseComponent {
|
|
|
1038
1042
|
}
|
|
1039
1043
|
if (timelineCoords) {
|
|
1040
1044
|
this.setState({
|
|
1041
|
-
eventInstanceHeights: mapHash(this.harnessElRefs.currentMap, (harnessEl) => (Math.round(harnessEl.getBoundingClientRect().height))),
|
|
1042
|
-
moreLinkHeights: mapHash(this.moreElRefs.currentMap, (moreEl) => (Math.round(moreEl.getBoundingClientRect().height))),
|
|
1045
|
+
eventInstanceHeights: internal.mapHash(this.harnessElRefs.currentMap, (harnessEl) => (Math.round(harnessEl.getBoundingClientRect().height))),
|
|
1046
|
+
moreLinkHeights: internal.mapHash(this.moreElRefs.currentMap, (moreEl) => (Math.round(moreEl.getBoundingClientRect().height))),
|
|
1043
1047
|
}, () => {
|
|
1044
1048
|
if (props.onHeightChange) {
|
|
1045
1049
|
props.onHeightChange(innerEl, true);
|
|
@@ -1054,23 +1058,23 @@ class TimelineLane extends BaseComponent {
|
|
|
1054
1058
|
renderFgSegs(segPlacements, isForcedInvisible, isDragging, isResizing, isDateSelecting) {
|
|
1055
1059
|
let { harnessElRefs, moreElRefs, props, context } = this;
|
|
1056
1060
|
let isMirror = isDragging || isResizing || isDateSelecting;
|
|
1057
|
-
return (createElement(Fragment, null, segPlacements.map((segPlacement) => {
|
|
1061
|
+
return (preact.createElement(preact.Fragment, null, segPlacements.map((segPlacement) => {
|
|
1058
1062
|
let { seg, hcoords, top } = segPlacement;
|
|
1059
1063
|
if (Array.isArray(seg)) { // a more-link
|
|
1060
|
-
let isoStr = buildIsoString(computeEarliestSegStart(seg));
|
|
1061
|
-
return (createElement(TimelineLaneMoreLink, { key: 'm:' + isoStr /* "m" for "more" */, elRef: moreElRefs.createRef(isoStr), hiddenSegs: seg, placement: segPlacement, dateProfile: props.dateProfile, nowDate: props.nowDate, todayRange: props.todayRange, isTimeScale: props.tDateProfile.isTimeScale, eventSelection: props.eventSelection, resourceId: props.resourceId, isForcedInvisible: isForcedInvisible }));
|
|
1064
|
+
let isoStr = internal.buildIsoString(internal.computeEarliestSegStart(seg));
|
|
1065
|
+
return (preact.createElement(TimelineLaneMoreLink, { key: 'm:' + isoStr /* "m" for "more" */, elRef: moreElRefs.createRef(isoStr), hiddenSegs: seg, placement: segPlacement, dateProfile: props.dateProfile, nowDate: props.nowDate, todayRange: props.todayRange, isTimeScale: props.tDateProfile.isTimeScale, eventSelection: props.eventSelection, resourceId: props.resourceId, isForcedInvisible: isForcedInvisible }));
|
|
1062
1066
|
}
|
|
1063
1067
|
let instanceId = seg.eventRange.instance.instanceId;
|
|
1064
1068
|
let isVisible = isMirror || Boolean(!isForcedInvisible[instanceId] && hcoords && top !== null);
|
|
1065
1069
|
let hStyle = coordsToCss(hcoords, context.isRtl);
|
|
1066
|
-
return (createElement("div", { key: 'e:' + instanceId /* "e" for "event" */, ref: isMirror ? null : harnessElRefs.createRef(instanceId), className: "fc-timeline-event-harness", style: Object.assign({ visibility: isVisible ? '' : 'hidden', top: top || 0 }, hStyle) },
|
|
1067
|
-
createElement(TimelineEvent, Object.assign({ isTimeScale: props.tDateProfile.isTimeScale, seg: seg, isDragging: isDragging, isResizing: isResizing, isDateSelecting: isDateSelecting, isSelected: instanceId === props.eventSelection /* TODO: bad for mirror? */ }, getSegMeta(seg, props.todayRange, props.nowDate)))));
|
|
1070
|
+
return (preact.createElement("div", { key: 'e:' + instanceId /* "e" for "event" */, ref: isMirror ? null : harnessElRefs.createRef(instanceId), className: "fc-timeline-event-harness", style: Object.assign({ visibility: isVisible ? '' : 'hidden', top: top || 0 }, hStyle) },
|
|
1071
|
+
preact.createElement(TimelineEvent, Object.assign({ isTimeScale: props.tDateProfile.isTimeScale, seg: seg, isDragging: isDragging, isResizing: isResizing, isDateSelecting: isDateSelecting, isSelected: instanceId === props.eventSelection /* TODO: bad for mirror? */ }, internal.getSegMeta(seg, props.todayRange, props.nowDate)))));
|
|
1068
1072
|
})));
|
|
1069
1073
|
}
|
|
1070
1074
|
}
|
|
1071
1075
|
TimelineLane.addStateEquality({
|
|
1072
|
-
eventInstanceHeights: isPropsEqual,
|
|
1073
|
-
moreLinkHeights: isPropsEqual,
|
|
1076
|
+
eventInstanceHeights: internal.isPropsEqual,
|
|
1077
|
+
moreLinkHeights: internal.isPropsEqual,
|
|
1074
1078
|
});
|
|
1075
1079
|
function buildMirrorPlacements(mirrorSegs, timelineCoords, fgPlacements) {
|
|
1076
1080
|
if (!mirrorSegs.length || !timelineCoords) {
|
|
@@ -1094,10 +1098,10 @@ function buildAbsoluteTopHash(placements) {
|
|
|
1094
1098
|
return topsByInstanceId;
|
|
1095
1099
|
}
|
|
1096
1100
|
|
|
1097
|
-
class TimelineGrid extends DateComponent {
|
|
1101
|
+
class TimelineGrid extends internal.DateComponent {
|
|
1098
1102
|
constructor() {
|
|
1099
1103
|
super(...arguments);
|
|
1100
|
-
this.slatsRef = createRef();
|
|
1104
|
+
this.slatsRef = preact.createRef();
|
|
1101
1105
|
this.state = {
|
|
1102
1106
|
coords: null,
|
|
1103
1107
|
};
|
|
@@ -1120,17 +1124,17 @@ class TimelineGrid extends DateComponent {
|
|
|
1120
1124
|
let { props, state, context } = this;
|
|
1121
1125
|
let { options } = context;
|
|
1122
1126
|
let { dateProfile, tDateProfile } = props;
|
|
1123
|
-
let timerUnit = greatestDurationDenominator(tDateProfile.slotDuration).unit;
|
|
1124
|
-
return (createElement("div", { className: "fc-timeline-body", ref: this.handeEl, style: {
|
|
1127
|
+
let timerUnit = internal.greatestDurationDenominator(tDateProfile.slotDuration).unit;
|
|
1128
|
+
return (preact.createElement("div", { className: "fc-timeline-body", ref: this.handeEl, style: {
|
|
1125
1129
|
minWidth: props.tableMinWidth,
|
|
1126
1130
|
height: props.clientHeight,
|
|
1127
1131
|
width: props.clientWidth,
|
|
1128
1132
|
} },
|
|
1129
|
-
createElement(NowTimer, { unit: timerUnit }, (nowDate, todayRange) => (createElement(Fragment, null,
|
|
1130
|
-
createElement(TimelineSlats, { ref: this.slatsRef, dateProfile: dateProfile, tDateProfile: tDateProfile, nowDate: nowDate, todayRange: todayRange, clientWidth: props.clientWidth, tableColGroupNode: props.tableColGroupNode, tableMinWidth: props.tableMinWidth, onCoords: this.handleCoords, onScrollLeftRequest: props.onScrollLeftRequest }),
|
|
1131
|
-
createElement(TimelineLane, { dateProfile: dateProfile, tDateProfile: props.tDateProfile, nowDate: nowDate, todayRange: todayRange, nextDayThreshold: options.nextDayThreshold, businessHours: props.businessHours, eventStore: props.eventStore, eventUiBases: props.eventUiBases, dateSelection: props.dateSelection, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, timelineCoords: state.coords, syncParentMinHeight: true }),
|
|
1132
|
-
(options.nowIndicator && state.coords && state.coords.isDateInRange(nowDate)) && (createElement("div", { className: "fc-timeline-now-indicator-container" },
|
|
1133
|
-
createElement(NowIndicatorContainer, { elClasses: ['fc-timeline-now-indicator-line'], elStyle: coordToCss(state.coords.dateToCoord(nowDate), context.isRtl), isAxis: false, date: nowDate }))))))));
|
|
1133
|
+
preact.createElement(internal.NowTimer, { unit: timerUnit }, (nowDate, todayRange) => (preact.createElement(preact.Fragment, null,
|
|
1134
|
+
preact.createElement(TimelineSlats, { ref: this.slatsRef, dateProfile: dateProfile, tDateProfile: tDateProfile, nowDate: nowDate, todayRange: todayRange, clientWidth: props.clientWidth, tableColGroupNode: props.tableColGroupNode, tableMinWidth: props.tableMinWidth, onCoords: this.handleCoords, onScrollLeftRequest: props.onScrollLeftRequest }),
|
|
1135
|
+
preact.createElement(TimelineLane, { dateProfile: dateProfile, tDateProfile: props.tDateProfile, nowDate: nowDate, todayRange: todayRange, nextDayThreshold: options.nextDayThreshold, businessHours: props.businessHours, eventStore: props.eventStore, eventUiBases: props.eventUiBases, dateSelection: props.dateSelection, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, timelineCoords: state.coords, syncParentMinHeight: true }),
|
|
1136
|
+
(options.nowIndicator && state.coords && state.coords.isDateInRange(nowDate)) && (preact.createElement("div", { className: "fc-timeline-now-indicator-container" },
|
|
1137
|
+
preact.createElement(internal.NowIndicatorContainer, { elClasses: ['fc-timeline-now-indicator-line'], elStyle: coordToCss(state.coords.dateToCoord(nowDate), context.isRtl), isAxis: false, date: nowDate }))))))));
|
|
1134
1138
|
}
|
|
1135
1139
|
// Hit System
|
|
1136
1140
|
// ------------------------------------------------------------------------------------------
|
|
@@ -1155,11 +1159,11 @@ class TimelineGrid extends DateComponent {
|
|
|
1155
1159
|
}
|
|
1156
1160
|
}
|
|
1157
1161
|
|
|
1158
|
-
class TimelineView extends DateComponent {
|
|
1162
|
+
class TimelineView extends internal.DateComponent {
|
|
1159
1163
|
constructor() {
|
|
1160
1164
|
super(...arguments);
|
|
1161
|
-
this.buildTimelineDateProfile = memoize(buildTimelineDateProfile);
|
|
1162
|
-
this.scrollGridRef = createRef();
|
|
1165
|
+
this.buildTimelineDateProfile = internal.memoize(buildTimelineDateProfile);
|
|
1166
|
+
this.scrollGridRef = preact.createRef();
|
|
1163
1167
|
this.state = {
|
|
1164
1168
|
slatCoords: null,
|
|
1165
1169
|
slotCushionMaxWidth: null,
|
|
@@ -1180,8 +1184,8 @@ class TimelineView extends DateComponent {
|
|
|
1180
1184
|
render() {
|
|
1181
1185
|
let { props, state, context } = this;
|
|
1182
1186
|
let { options } = context;
|
|
1183
|
-
let stickyHeaderDates = !props.forPrint && getStickyHeaderDates(options);
|
|
1184
|
-
let stickyFooterScrollbar = !props.forPrint && getStickyFooterScrollbar(options);
|
|
1187
|
+
let stickyHeaderDates = !props.forPrint && internal.getStickyHeaderDates(options);
|
|
1188
|
+
let stickyFooterScrollbar = !props.forPrint && internal.getStickyFooterScrollbar(options);
|
|
1185
1189
|
let tDateProfile = this.buildTimelineDateProfile(props.dateProfile, context.dateEnv, options, context.dateProfileGenerator);
|
|
1186
1190
|
let { slotMinWidth } = options;
|
|
1187
1191
|
let slatCols = buildSlatCols(tDateProfile, slotMinWidth || this.computeFallbackSlotMinWidth(tDateProfile));
|
|
@@ -1192,7 +1196,7 @@ class TimelineView extends DateComponent {
|
|
|
1192
1196
|
isSticky: stickyHeaderDates,
|
|
1193
1197
|
chunks: [{
|
|
1194
1198
|
key: 'timeline',
|
|
1195
|
-
content: (contentArg) => (createElement(TimelineHeader, { dateProfile: props.dateProfile, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, tableMinWidth: contentArg.tableMinWidth, tableColGroupNode: contentArg.tableColGroupNode, tDateProfile: tDateProfile, slatCoords: state.slatCoords, onMaxCushionWidth: slotMinWidth ? null : this.handleMaxCushionWidth })),
|
|
1199
|
+
content: (contentArg) => (preact.createElement(TimelineHeader, { dateProfile: props.dateProfile, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, tableMinWidth: contentArg.tableMinWidth, tableColGroupNode: contentArg.tableColGroupNode, tDateProfile: tDateProfile, slatCoords: state.slatCoords, onMaxCushionWidth: slotMinWidth ? null : this.handleMaxCushionWidth })),
|
|
1196
1200
|
}],
|
|
1197
1201
|
},
|
|
1198
1202
|
{
|
|
@@ -1201,7 +1205,7 @@ class TimelineView extends DateComponent {
|
|
|
1201
1205
|
liquid: true,
|
|
1202
1206
|
chunks: [{
|
|
1203
1207
|
key: 'timeline',
|
|
1204
|
-
content: (contentArg) => (createElement(TimelineGrid, Object.assign({}, props, { clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, tableMinWidth: contentArg.tableMinWidth, tableColGroupNode: contentArg.tableColGroupNode, tDateProfile: tDateProfile, onSlatCoords: this.handleSlatCoords, onScrollLeftRequest: this.handleScrollLeftRequest }))),
|
|
1208
|
+
content: (contentArg) => (preact.createElement(TimelineGrid, Object.assign({}, props, { clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, tableMinWidth: contentArg.tableMinWidth, tableColGroupNode: contentArg.tableColGroupNode, tDateProfile: tDateProfile, onSlatCoords: this.handleSlatCoords, onScrollLeftRequest: this.handleScrollLeftRequest }))),
|
|
1205
1209
|
}],
|
|
1206
1210
|
},
|
|
1207
1211
|
];
|
|
@@ -1212,17 +1216,17 @@ class TimelineView extends DateComponent {
|
|
|
1212
1216
|
isSticky: true,
|
|
1213
1217
|
chunks: [{
|
|
1214
1218
|
key: 'timeline',
|
|
1215
|
-
content: renderScrollShim,
|
|
1219
|
+
content: internal.renderScrollShim,
|
|
1216
1220
|
}],
|
|
1217
1221
|
});
|
|
1218
1222
|
}
|
|
1219
|
-
return (createElement(ViewContainer, { elClasses: [
|
|
1223
|
+
return (preact.createElement(internal.ViewContainer, { elClasses: [
|
|
1220
1224
|
'fc-timeline',
|
|
1221
1225
|
options.eventOverlap === false ?
|
|
1222
1226
|
'fc-timeline-overlap-disabled' :
|
|
1223
1227
|
'',
|
|
1224
1228
|
], viewSpec: context.viewSpec },
|
|
1225
|
-
createElement(ScrollGrid, { ref: this.scrollGridRef, liquid: !props.isHeightAuto && !props.forPrint, collapsibleWidth: false, colGroups: [
|
|
1229
|
+
preact.createElement(internal$1.ScrollGrid, { ref: this.scrollGridRef, liquid: !props.isHeightAuto && !props.forPrint, collapsibleWidth: false, colGroups: [
|
|
1226
1230
|
{ cols: slatCols },
|
|
1227
1231
|
], sections: sections })));
|
|
1228
1232
|
}
|
|
@@ -1237,4 +1241,15 @@ function buildSlatCols(tDateProfile, slotMinWidth) {
|
|
|
1237
1241
|
}];
|
|
1238
1242
|
}
|
|
1239
1243
|
|
|
1240
|
-
|
|
1244
|
+
exports.TimelineCoords = TimelineCoords;
|
|
1245
|
+
exports.TimelineHeader = TimelineHeader;
|
|
1246
|
+
exports.TimelineHeaderRows = TimelineHeaderRows;
|
|
1247
|
+
exports.TimelineLane = TimelineLane;
|
|
1248
|
+
exports.TimelineLaneBg = TimelineLaneBg;
|
|
1249
|
+
exports.TimelineLaneSlicer = TimelineLaneSlicer;
|
|
1250
|
+
exports.TimelineSlats = TimelineSlats;
|
|
1251
|
+
exports.TimelineView = TimelineView;
|
|
1252
|
+
exports.buildSlatCols = buildSlatCols;
|
|
1253
|
+
exports.buildTimelineDateProfile = buildTimelineDateProfile;
|
|
1254
|
+
exports.coordToCss = coordToCss;
|
|
1255
|
+
exports.coordsToCss = coordsToCss;
|