Fix fullcalendar js bug.(stuck at loading and more button out of column)

This commit is contained in:
BoHung Chiu 2022-06-25 19:40:16 +08:00
parent 5ed7a08a1a
commit 6e63cf4777
3 changed files with 15340 additions and 2 deletions

View File

@ -12337,7 +12337,7 @@ var FullCalendar = (function (exports) {
function computeFgSegPlacement(segs, // assumed already sorted
dayMaxEvents, dayMaxEventRows, strictOrder, eventInstanceHeights, maxContentHeight, cells) {
var hierarchy = new DayGridSegHierarchy();
hierarchy.allowReslicing = true;
hierarchy.allowReslicing = false;
hierarchy.strictOrder = strictOrder;
if (dayMaxEvents === true || dayMaxEventRows === true) {
hierarchy.maxCoord = maxContentHeight;
@ -12379,12 +12379,15 @@ var FullCalendar = (function (exports) {
// add segs with unknown heights
for (var _i = 0, unknownHeightSegs_1 = unknownHeightSegs; _i < unknownHeightSegs_1.length; _i++) {
var seg = unknownHeightSegs_1[_i];
var relation_idx = multiColPlacements[seg.firstCol].length;
multiColPlacements[seg.firstCol].push({
seg: seg,
isVisible: false,
isAbsolute: true,
absoluteTop: 0,
marginTop: 0,
relation_idx: relation_idx,
thickness: null
});
for (var col = seg.firstCol; col <= seg.lastCol; col += 1) {
singleColPlacements[col].push({
@ -12404,6 +12407,7 @@ var FullCalendar = (function (exports) {
var hiddenEntry = hiddenEntries_1[_b];
var seg = segs[hiddenEntry.index];
var hiddenSpan = hiddenEntry.span;
var relation_idx = multiColPlacements[hiddenSpan.start].length;
multiColPlacements[hiddenSpan.start].push({
seg: resliceSeg(seg, hiddenSpan.start, hiddenSpan.end, cells),
isVisible: false,
@ -12419,6 +12423,8 @@ var FullCalendar = (function (exports) {
isAbsolute: false,
absoluteTop: 0,
marginTop: 0,
relation_idx: relation_idx,
thickness: hiddenEntry.thickness
});
}
}
@ -12426,6 +12432,33 @@ var FullCalendar = (function (exports) {
for (var col = 0; col < cells.length; col += 1) {
moreMarginTops.push(leftoverMargins[col]);
}
var need_fix_height = maxContentHeight != null;
if(need_fix_height){
for(var i=0, n = singleColPlacements.length; i < n; i++){
var placement = singleColPlacements[i];
if(placement.length > 1){
var first_col = placement[0];
if(first_col.isVisible){
var lastCol = placement[placement.length - 1];
if(!lastCol.isVisible){
var last_visible_idx = placement.map(function(v){return v.isVisible}).lastIndexOf(true);
var height = 0;
for(var j=0;j<=last_visible_idx;j++){
height += placement[j].thickness;
}
if(height >= need_fix_height){
var last_placement = placement[last_visible_idx];
last_placement.isVisible = false;
moreCnts[i] += 1;
last_placement = multiColPlacements[i][last_placement.relation_idx];
last_placement.isVisible = false;
last_placement.isAbsolute = true;
}
}
}
}
}
}
return { singleColPlacements: singleColPlacements, multiColPlacements: multiColPlacements, moreCnts: moreCnts, moreMarginTops: moreMarginTops };
}
// rects ordered by top coord, then left
@ -12449,6 +12482,8 @@ var FullCalendar = (function (exports) {
isAbsolute: false,
absoluteTop: rect.levelCoord,
marginTop: rect.levelCoord - currentHeight,
relation_idx: _i,
thickness: rect.thickness
});
currentHeight = rect.levelCoord + rect.thickness;
}

File diff suppressed because one or more lines are too long

15303
app/assets/javascripts/tmp.js Normal file

File diff suppressed because one or more lines are too long