funda-ui 4.7.730 → 4.7.735
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/EventCalendarTimeline/index.js +270 -196
- package/lib/cjs/EventCalendarTimeline/index.js +270 -196
- package/lib/esm/EventCalendarTimeline/index.tsx +290 -198
- package/package.json +1 -1
|
@@ -4058,6 +4058,7 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
|
|
|
4058
4058
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
4059
4059
|
date = _useState4[0],
|
|
4060
4060
|
setDate = _useState4[1];
|
|
4061
|
+
var prevDateRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
4061
4062
|
var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(date.getDate()),
|
|
4062
4063
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
4063
4064
|
day = _useState6[0],
|
|
@@ -4136,6 +4137,9 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
|
|
|
4136
4137
|
tempDate = _useState28[0],
|
|
4137
4138
|
setTempDate = _useState28[1];
|
|
4138
4139
|
|
|
4140
|
+
// Track all pending requestAnimationFrame IDs for cleanup on unmount
|
|
4141
|
+
var rafIdsRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(new Set());
|
|
4142
|
+
|
|
4139
4143
|
// Open temporary storage for pop-ups
|
|
4140
4144
|
var _useState29 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(-1),
|
|
4141
4145
|
_useState30 = _slicedToArray(_useState29, 2),
|
|
@@ -4787,6 +4791,7 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
|
|
|
4787
4791
|
var mouseDown = false;
|
|
4788
4792
|
var startX = 0;
|
|
4789
4793
|
var scrollLeft = 0;
|
|
4794
|
+
var tableDragRafIdRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
4790
4795
|
var handleTableDragStart = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (e) {
|
|
4791
4796
|
draggedObj = e.currentTarget;
|
|
4792
4797
|
mouseDown = true;
|
|
@@ -4800,15 +4805,28 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
|
|
|
4800
4805
|
if (draggedObj === null) return;
|
|
4801
4806
|
mouseDown = false;
|
|
4802
4807
|
draggedObj.classList.remove('dragging');
|
|
4808
|
+
|
|
4809
|
+
// Cancel any pending animation frame
|
|
4810
|
+
if (tableDragRafIdRef.current !== null) {
|
|
4811
|
+
cancelAnimationFrame(tableDragRafIdRef.current);
|
|
4812
|
+
tableDragRafIdRef.current = null;
|
|
4813
|
+
}
|
|
4803
4814
|
}, []);
|
|
4804
4815
|
var handleTableMove = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (e) {
|
|
4805
4816
|
e.preventDefault();
|
|
4806
4817
|
if (!mouseDown) {
|
|
4807
4818
|
return;
|
|
4808
4819
|
}
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4820
|
+
|
|
4821
|
+
// Use requestAnimationFrame to throttle scroll updates for better performance
|
|
4822
|
+
if (tableDragRafIdRef.current === null) {
|
|
4823
|
+
tableDragRafIdRef.current = requestAnimationFrame(function () {
|
|
4824
|
+
var x = e.pageX - draggedObj.offsetLeft;
|
|
4825
|
+
var scroll = x - startX;
|
|
4826
|
+
draggedObj.scrollLeft = scrollLeft - scroll;
|
|
4827
|
+
tableDragRafIdRef.current = null;
|
|
4828
|
+
});
|
|
4829
|
+
}
|
|
4812
4830
|
}, []);
|
|
4813
4831
|
|
|
4814
4832
|
// ================================================================
|
|
@@ -4879,22 +4897,31 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
|
|
|
4879
4897
|
// ================================================================
|
|
4880
4898
|
// Calendar
|
|
4881
4899
|
// ================================================================
|
|
4882
|
-
function updateTodayDate(inputDate) {
|
|
4900
|
+
function updateTodayDate(inputDate, prevDate) {
|
|
4901
|
+
var previous = prevDate !== null && prevDate !== void 0 ? prevDate : prevDateRef.current;
|
|
4902
|
+
var hasMonthOrYearChanged = !previous || previous.getMonth() !== inputDate.getMonth() || previous.getFullYear() !== inputDate.getFullYear();
|
|
4903
|
+
|
|
4904
|
+
// Always sync the active day value
|
|
4883
4905
|
setDay(inputDate.getDate());
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4906
|
+
if (hasMonthOrYearChanged) {
|
|
4907
|
+
// Only update month/year related state when it actually changes;
|
|
4908
|
+
// this prevents expensive table re-inits for simple day clicks.
|
|
4909
|
+
setMonth(inputDate.getMonth());
|
|
4910
|
+
setYear(inputDate.getFullYear());
|
|
4911
|
+
setStartDay(getStartDayOfMonth(inputDate));
|
|
4912
|
+
|
|
4913
|
+
// update selector
|
|
4914
|
+
setSelectedMonth(inputDate.getMonth());
|
|
4915
|
+
setSelectedYear(inputDate.getFullYear());
|
|
4916
|
+
setTimeout(function () {
|
|
4917
|
+
// initialize table grid
|
|
4918
|
+
tableGridInit();
|
|
4894
4919
|
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4920
|
+
// The scrollbar position is horizontal
|
|
4921
|
+
_bodyScrollbarInit();
|
|
4922
|
+
}, 500);
|
|
4923
|
+
}
|
|
4924
|
+
prevDateRef.current = inputDate;
|
|
4898
4925
|
}
|
|
4899
4926
|
function getStartDayOfMonth(date) {
|
|
4900
4927
|
var startDate = new Date(date.getFullYear(), date.getMonth(), 1).getDay();
|
|
@@ -4971,6 +4998,23 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
|
|
|
4971
4998
|
}
|
|
4972
4999
|
|
|
4973
5000
|
function handleDayChange(e, currentDay) {
|
|
5001
|
+
// Avoid triggering a full table re-render when the clicked cell is already
|
|
5002
|
+
// the active day; this becomes expensive with large datasets.
|
|
5003
|
+
if (date.getDate() === currentDay && date.getMonth() === month && date.getFullYear() === year) {
|
|
5004
|
+
return;
|
|
5005
|
+
}
|
|
5006
|
+
|
|
5007
|
+
// !!! Important, performance optimization for large data renderings
|
|
5008
|
+
/*
|
|
5009
|
+
- Previously, every time I clicked on the date, 'setDate' would be called in 'useEffect([date])',
|
|
5010
|
+
and 'tableGridInit + bodyScrollbarInit' would be run regardless of whether it was across months/years,
|
|
5011
|
+
and these recalculations and DOM operations were very time-consuming when 1000+ pieces of data, causing lag.
|
|
5012
|
+
- Now remember the last date with 'prevDateRef', reset the month/year related state only when the month or year
|
|
5013
|
+
changes and execute 'tableGridInit/scrollbarInit'. Only 'day' is updated when the date is changed, avoiding
|
|
5014
|
+
the relayout of the entire table and the initialization of the scrollbar.
|
|
5015
|
+
-'handleDayChange' still updates 'date', but since the month/year has not changed, it no longer triggers heavy
|
|
5016
|
+
initialization, significantly reducing stuttering when clicking, while the month/year switch triggers a full recount as usual.
|
|
5017
|
+
*/
|
|
4974
5018
|
setDate(new Date(year, month, currentDay));
|
|
4975
5019
|
}
|
|
4976
5020
|
function handleYearChange(currentValue) {
|
|
@@ -5553,23 +5597,32 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
|
|
|
5553
5597
|
if (tableGridRef.current === null) return;
|
|
5554
5598
|
var tableGridEl = tableGridRef.current;
|
|
5555
5599
|
|
|
5556
|
-
//
|
|
5557
|
-
var
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5600
|
+
// Use requestAnimationFrame to batch DOM operations
|
|
5601
|
+
var rafId = requestAnimationFrame(function () {
|
|
5602
|
+
// initialize cell height
|
|
5603
|
+
var headerTitleTbody = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__title tbody');
|
|
5604
|
+
var contentTbody = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody');
|
|
5605
|
+
if (!headerTitleTbody || !contentTbody) return;
|
|
5606
|
+
var headerTitleTrElements = headerTitleTbody.getElementsByTagName('tr');
|
|
5607
|
+
var trElements = contentTbody.getElementsByTagName('tr');
|
|
5608
|
+
|
|
5609
|
+
// Reset any previously set inline heights so we measure natural heights.
|
|
5610
|
+
for (var i = 0; i < headerTitleTrElements.length; i++) {
|
|
5611
|
+
// set to 'auto' (or remove inline style) to allow shrink
|
|
5612
|
+
headerTitleTrElements[i].style.height = 'auto';
|
|
5613
|
+
if (trElements[i]) trElements[i].style.height = 'auto';
|
|
5614
|
+
var targetElement = headerTitleTrElements[i].offsetHeight > trElements[i].offsetHeight ? headerTitleTrElements[i] : trElements[i];
|
|
5615
|
+
var tdOHeight = window.getComputedStyle(targetElement).height;
|
|
5616
|
+
headerTitleTrElements[i].style.height = tdOHeight;
|
|
5617
|
+
trElements[i].style.height = tdOHeight;
|
|
5618
|
+
}
|
|
5562
5619
|
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
var tdOHeight = window.getComputedStyle(targetElement).height;
|
|
5570
|
-
headerTitleTrElements[i].style.height = tdOHeight;
|
|
5571
|
-
trElements[i].style.height = tdOHeight;
|
|
5572
|
-
}
|
|
5620
|
+
// Remove from tracking set after execution
|
|
5621
|
+
rafIdsRef.current["delete"](rafId);
|
|
5622
|
+
});
|
|
5623
|
+
|
|
5624
|
+
// Track this requestAnimationFrame ID for cleanup
|
|
5625
|
+
rafIdsRef.current.add(rafId);
|
|
5573
5626
|
}
|
|
5574
5627
|
function tableGridInit() {
|
|
5575
5628
|
//
|
|
@@ -5584,187 +5637,196 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
|
|
|
5584
5637
|
_curColCount = 7;
|
|
5585
5638
|
}
|
|
5586
5639
|
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
var tableHeaderTitleWidth = tableGridEl.querySelector('.custom-event-tl-table__cell-cushion-headertitle').clientWidth;
|
|
5595
|
-
var tableDividerWidth = tableGridEl.querySelector('.custom-event-tl-table__timeline-divider').clientWidth;
|
|
5596
|
-
var tableBorderWidth = 4;
|
|
5597
|
-
var scrollMaxWidth = tableMaxWidth - tableHeaderTitleWidth - tableDividerWidth - tableBorderWidth;
|
|
5598
|
-
_curCellMinWidth = scrollMaxWidth / 7;
|
|
5599
|
-
_curColCount = 7;
|
|
5600
|
-
|
|
5601
|
-
// header
|
|
5602
|
-
tableGridEl.querySelectorAll('.custom-event-tl-table__cell-cushion-headercontent__container, .custom-event-tl-table__cell-cushion-content').forEach(function (node) {
|
|
5603
|
-
node.style.width = _curCellMinWidth + 'px';
|
|
5604
|
-
});
|
|
5605
|
-
}
|
|
5606
|
-
|
|
5607
|
-
//****************
|
|
5608
|
-
// STEP 1-2:
|
|
5609
|
-
//****************
|
|
5610
|
-
// calculate min width (MODE: MONTH)
|
|
5611
|
-
//--------------
|
|
5612
|
-
var cellMinWidth = _curCellMinWidth;
|
|
5613
|
-
var colCount = _curColCount;
|
|
5614
|
-
var scrollableMinWidth = cellMinWidth * colCount;
|
|
5615
|
-
|
|
5616
|
-
//****************
|
|
5617
|
-
// STEP 1-3:
|
|
5618
|
-
//****************
|
|
5619
|
-
// initialize "header & main" cells
|
|
5620
|
-
//--------------
|
|
5621
|
-
var headerThContentContainers = tableGridEl.querySelector('.custom-event-tl-table__datagrid-header__content tbody').getElementsByTagName('th');
|
|
5622
|
-
for (var i = 0; i < headerThContentContainers.length; i++) {
|
|
5623
|
-
var curHeaderThContent = headerThContentContainers[i].querySelector('.custom-event-tl-table__cell-cushion-headercontent');
|
|
5624
|
-
if (curHeaderThContent !== null) curHeaderThContent.style.width = _curCellMinWidth + 'px';
|
|
5625
|
-
}
|
|
5626
|
-
var mainTdContentContainers = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody').getElementsByTagName('td');
|
|
5627
|
-
for (var _i2 = 0; _i2 < mainTdContentContainers.length; _i2++) {
|
|
5628
|
-
var _curHeaderThContent = mainTdContentContainers[_i2].querySelector('.custom-event-tl-table__cell-cushion-content');
|
|
5629
|
-
if (_curHeaderThContent !== null) _curHeaderThContent.style.width = _curCellMinWidth + 'px';
|
|
5630
|
-
}
|
|
5631
|
-
var mainTdContentCols = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content colgroup').getElementsByTagName('col');
|
|
5632
|
-
for (var _i3 = 0; _i3 < mainTdContentCols.length; _i3++) {
|
|
5633
|
-
mainTdContentCols[_i3].style.minWidth = _curCellMinWidth + 'px';
|
|
5634
|
-
}
|
|
5635
|
-
|
|
5636
|
-
//****************
|
|
5637
|
-
// STEP 2:
|
|
5638
|
-
//****************
|
|
5639
|
-
// initialize scrollable wrapper (width)
|
|
5640
|
-
//--------------
|
|
5641
|
-
var _scrollableWrapper = tableGridEl.querySelectorAll('.custom-event-tl-table__scroller-harness');
|
|
5642
|
-
[].slice.call(_scrollableWrapper).forEach(function (el) {
|
|
5643
|
-
var scrollType = el.dataset.scroll;
|
|
5640
|
+
// Use requestAnimationFrame to batch DOM operations
|
|
5641
|
+
var rafId = requestAnimationFrame(function () {
|
|
5642
|
+
//****************
|
|
5643
|
+
// STEP 1-1:
|
|
5644
|
+
//****************
|
|
5645
|
+
// calculate min width (MODE: WEEK)
|
|
5646
|
+
//--------------
|
|
5644
5647
|
if (appearanceMode === 'week') {
|
|
5645
|
-
|
|
5648
|
+
var tableMaxWidth = tableGridEl.clientWidth;
|
|
5649
|
+
var tableHeaderTitleWidth = tableGridEl.querySelector('.custom-event-tl-table__cell-cushion-headertitle').clientWidth;
|
|
5650
|
+
var tableDividerWidth = tableGridEl.querySelector('.custom-event-tl-table__timeline-divider').clientWidth;
|
|
5651
|
+
var tableBorderWidth = 4;
|
|
5652
|
+
var scrollMaxWidth = tableMaxWidth - tableHeaderTitleWidth - tableDividerWidth - tableBorderWidth;
|
|
5653
|
+
_curCellMinWidth = scrollMaxWidth / 7;
|
|
5654
|
+
_curColCount = 7;
|
|
5655
|
+
|
|
5656
|
+
// header
|
|
5657
|
+
tableGridEl.querySelectorAll('.custom-event-tl-table__cell-cushion-headercontent__container, .custom-event-tl-table__cell-cushion-content').forEach(function (node) {
|
|
5658
|
+
node.style.width = _curCellMinWidth + 'px';
|
|
5659
|
+
});
|
|
5646
5660
|
}
|
|
5647
|
-
|
|
5648
|
-
|
|
5661
|
+
|
|
5662
|
+
//****************
|
|
5663
|
+
// STEP 1-2:
|
|
5664
|
+
//****************
|
|
5665
|
+
// calculate min width (MODE: MONTH)
|
|
5666
|
+
//--------------
|
|
5667
|
+
var cellMinWidth = _curCellMinWidth;
|
|
5668
|
+
var colCount = _curColCount;
|
|
5669
|
+
var scrollableMinWidth = cellMinWidth * colCount;
|
|
5670
|
+
|
|
5671
|
+
//****************
|
|
5672
|
+
// STEP 1-3:
|
|
5673
|
+
//****************
|
|
5674
|
+
// initialize "header & main" cells
|
|
5675
|
+
//--------------
|
|
5676
|
+
var headerThContentContainers = tableGridEl.querySelector('.custom-event-tl-table__datagrid-header__content tbody').getElementsByTagName('th');
|
|
5677
|
+
for (var i = 0; i < headerThContentContainers.length; i++) {
|
|
5678
|
+
var curHeaderThContent = headerThContentContainers[i].querySelector('.custom-event-tl-table__cell-cushion-headercontent');
|
|
5679
|
+
if (curHeaderThContent !== null) curHeaderThContent.style.width = _curCellMinWidth + 'px';
|
|
5649
5680
|
}
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
var
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
el.style.maxWidth = el.dataset.width + 'px';
|
|
5659
|
-
_content.style.minWidth = scrollableMinWidth + 'px';
|
|
5681
|
+
var mainTdContentContainers = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody').getElementsByTagName('td');
|
|
5682
|
+
for (var _i2 = 0; _i2 < mainTdContentContainers.length; _i2++) {
|
|
5683
|
+
var _curHeaderThContent = mainTdContentContainers[_i2].querySelector('.custom-event-tl-table__cell-cushion-content');
|
|
5684
|
+
if (_curHeaderThContent !== null) _curHeaderThContent.style.width = _curCellMinWidth + 'px';
|
|
5685
|
+
}
|
|
5686
|
+
var mainTdContentCols = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content colgroup').getElementsByTagName('col');
|
|
5687
|
+
for (var _i3 = 0; _i3 < mainTdContentCols.length; _i3++) {
|
|
5688
|
+
mainTdContentCols[_i3].style.minWidth = _curCellMinWidth + 'px';
|
|
5660
5689
|
}
|
|
5661
|
-
});
|
|
5662
5690
|
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
var targetElement = headerThContentContainers[_i4].offsetWidth > mainTdContentContainers[_i4].offsetWidth ? headerThContentContainers[_i4] : mainTdContentContainers[_i4];
|
|
5674
|
-
var tdOwidth = parseFloat(window.getComputedStyle(targetElement).width);
|
|
5675
|
-
|
|
5676
|
-
// check td max width
|
|
5677
|
-
if (tdElementMaxWidth > 0 && tdOwidth > tdElementMaxWidth) {
|
|
5678
|
-
tdOwidth = tdElementMaxWidth;
|
|
5691
|
+
//****************
|
|
5692
|
+
// STEP 2:
|
|
5693
|
+
//****************
|
|
5694
|
+
// initialize scrollable wrapper (width)
|
|
5695
|
+
//--------------
|
|
5696
|
+
var _scrollableWrapper = tableGridEl.querySelectorAll('.custom-event-tl-table__scroller-harness');
|
|
5697
|
+
[].slice.call(_scrollableWrapper).forEach(function (el) {
|
|
5698
|
+
var scrollType = el.dataset.scroll;
|
|
5699
|
+
if (appearanceMode === 'week') {
|
|
5700
|
+
el.classList.add('custom-event-tl-table__scroller-harness--hideX');
|
|
5679
5701
|
}
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5702
|
+
if (appearanceMode === 'month') {
|
|
5703
|
+
el.classList.remove('custom-event-tl-table__scroller-harness--hideX');
|
|
5704
|
+
}
|
|
5705
|
+
if (scrollType !== 'list') {
|
|
5706
|
+
var _content = el.querySelector('.custom-event-tl-table__scroller');
|
|
5707
|
+
var _tableMaxWidth = tableGridEl.clientWidth;
|
|
5708
|
+
var _tableHeaderTitleWidth = tableGridEl.querySelector('.custom-event-tl-table__cell-cushion-headertitle').clientWidth;
|
|
5709
|
+
var _tableDividerWidth = tableGridEl.querySelector('.custom-event-tl-table__timeline-divider').clientWidth;
|
|
5710
|
+
var _tableBorderWidth = 4;
|
|
5711
|
+
var _scrollMaxWidth = _tableMaxWidth - _tableHeaderTitleWidth - _tableDividerWidth - _tableBorderWidth;
|
|
5712
|
+
el.dataset.width = _scrollMaxWidth;
|
|
5713
|
+
el.style.maxWidth = el.dataset.width + 'px';
|
|
5714
|
+
_content.style.minWidth = scrollableMinWidth + 'px';
|
|
5684
5715
|
}
|
|
5716
|
+
});
|
|
5685
5717
|
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5718
|
+
//****************
|
|
5719
|
+
// STEP 3:
|
|
5720
|
+
//****************
|
|
5721
|
+
// initialize cell width
|
|
5722
|
+
//--------------
|
|
5723
|
+
var tdElementMaxWidth = typeof mainTdContentContainers[0] === 'undefined' ? 0 : parseFloat(window.getComputedStyle(mainTdContentContainers[0].querySelector('.custom-event-tl-table__cell-cushion-content')).maxWidth);
|
|
5724
|
+
if (Array.isArray(eventsValue) && eventsValue.length > 0) {
|
|
5725
|
+
for (var _i4 = 0; _i4 < headerThContentContainers.length; _i4++) {
|
|
5726
|
+
var _curHeaderThContent2 = headerThContentContainers[_i4].querySelector('.custom-event-tl-table__cell-cushion-headercontent');
|
|
5727
|
+
var curHeaderThContentMaxWidth = parseFloat(window.getComputedStyle(_curHeaderThContent2).width);
|
|
5728
|
+
var targetElement = headerThContentContainers[_i4].offsetWidth > mainTdContentContainers[_i4].offsetWidth ? headerThContentContainers[_i4] : mainTdContentContainers[_i4];
|
|
5729
|
+
var tdOwidth = parseFloat(window.getComputedStyle(targetElement).width);
|
|
5730
|
+
|
|
5731
|
+
// check td max width
|
|
5732
|
+
if (tdElementMaxWidth > 0 && tdOwidth > tdElementMaxWidth) {
|
|
5733
|
+
tdOwidth = tdElementMaxWidth;
|
|
5734
|
+
}
|
|
5692
5735
|
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
//--------------
|
|
5698
|
-
if (scrollBodyRef.current !== null && scrollHeaderRef.current !== null) {
|
|
5699
|
-
var tableContentWidth = window.getComputedStyle(tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content')).width;
|
|
5700
|
-
var scrollBodyEl = scrollBodyRef.current;
|
|
5701
|
-
var scrollHeaderEl = scrollHeaderRef.current;
|
|
5702
|
-
scrollBodyEl.style.width = tableContentWidth;
|
|
5703
|
-
scrollHeaderEl.style.width = tableContentWidth;
|
|
5704
|
-
scrollBodyEl.dataset.width = parseFloat(tableContentWidth);
|
|
5705
|
-
scrollHeaderEl.dataset.width = parseFloat(tableContentWidth);
|
|
5736
|
+
// check header th max width
|
|
5737
|
+
if (tdElementMaxWidth > 0 && tdElementMaxWidth < curHeaderThContentMaxWidth) {
|
|
5738
|
+
tdOwidth = curHeaderThContentMaxWidth;
|
|
5739
|
+
}
|
|
5706
5740
|
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5741
|
+
// Prevent the width from being +1 each time it is initialized
|
|
5742
|
+
tdOwidth = tdOwidth - 1;
|
|
5743
|
+
headerThContentContainers[_i4].querySelector('.custom-event-tl-table__cell-cushion-headercontent').style.width = tdOwidth + 'px';
|
|
5744
|
+
mainTdContentCols[_i4].style.minWidth = tdOwidth + 'px';
|
|
5745
|
+
}
|
|
5711
5746
|
}
|
|
5712
|
-
}
|
|
5713
5747
|
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5748
|
+
//****************
|
|
5749
|
+
// STEP 4:
|
|
5750
|
+
//****************
|
|
5751
|
+
// initialize max width of table content
|
|
5752
|
+
//--------------
|
|
5753
|
+
if (scrollBodyRef.current !== null && scrollHeaderRef.current !== null) {
|
|
5754
|
+
var tableContentWidth = window.getComputedStyle(tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content')).width;
|
|
5755
|
+
var scrollBodyEl = scrollBodyRef.current;
|
|
5756
|
+
var scrollHeaderEl = scrollHeaderRef.current;
|
|
5757
|
+
scrollBodyEl.style.width = tableContentWidth;
|
|
5758
|
+
scrollHeaderEl.style.width = tableContentWidth;
|
|
5759
|
+
scrollBodyEl.dataset.width = parseFloat(tableContentWidth);
|
|
5760
|
+
scrollHeaderEl.dataset.width = parseFloat(tableContentWidth);
|
|
5720
5761
|
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
//--------------
|
|
5726
|
-
[].slice.call(_scrollableWrapper).forEach(function (el) {
|
|
5727
|
-
var scrollType = el.dataset.scroll;
|
|
5728
|
-
var oldHeight = el.clientHeight;
|
|
5729
|
-
if (scrollType !== 'header') {
|
|
5730
|
-
var tableWrapperMaxHeight = window.getComputedStyle(tableGridEl).height;
|
|
5731
|
-
if (oldHeight > parseFloat(tableWrapperMaxHeight)) {
|
|
5732
|
-
el.style.height = tableWrapperMaxHeight;
|
|
5762
|
+
//
|
|
5763
|
+
var tableWrapperMaxWidthLatest = tableGridEl.clientWidth;
|
|
5764
|
+
if (tableWrapperMaxWidthLatest > parseFloat(tableContentWidth)) {
|
|
5765
|
+
tableGridEl.querySelector('.custom-event-tl-table__timeline-table').style.width = tableContentWidth;
|
|
5733
5766
|
}
|
|
5734
5767
|
}
|
|
5735
|
-
});
|
|
5736
5768
|
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5769
|
+
//****************
|
|
5770
|
+
// STEP 5:
|
|
5771
|
+
//****************
|
|
5772
|
+
// initialize cell height
|
|
5773
|
+
//--------------
|
|
5774
|
+
tableGridInitHeadertitle();
|
|
5775
|
+
|
|
5776
|
+
//****************
|
|
5777
|
+
// STEP 6:
|
|
5778
|
+
//****************
|
|
5779
|
+
//initialize scrollable wrapper (height)
|
|
5780
|
+
//--------------
|
|
5781
|
+
[].slice.call(_scrollableWrapper).forEach(function (el) {
|
|
5782
|
+
var scrollType = el.dataset.scroll;
|
|
5783
|
+
var oldHeight = el.clientHeight;
|
|
5784
|
+
if (scrollType !== 'header') {
|
|
5785
|
+
var tableWrapperMaxHeight = window.getComputedStyle(tableGridEl).height;
|
|
5786
|
+
if (oldHeight > parseFloat(tableWrapperMaxHeight)) {
|
|
5787
|
+
el.style.height = tableWrapperMaxHeight;
|
|
5788
|
+
}
|
|
5789
|
+
}
|
|
5790
|
+
});
|
|
5743
5791
|
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5792
|
+
//****************
|
|
5793
|
+
// STEP 7:
|
|
5794
|
+
//****************
|
|
5795
|
+
// display wrapper
|
|
5796
|
+
//--------------
|
|
5797
|
+
tableGridEl.classList.remove('invisible');
|
|
5798
|
+
|
|
5799
|
+
//****************
|
|
5800
|
+
// STEP 1-1:
|
|
5801
|
+
//****************
|
|
5802
|
+
// calculate min width (MODE: WEEK)
|
|
5803
|
+
//--------------
|
|
5804
|
+
if (appearanceMode === 'week') {
|
|
5805
|
+
var _tableMaxWidth2 = tableGridEl.clientWidth;
|
|
5806
|
+
var _tableHeaderTitleWidth2 = tableGridEl.querySelector('.custom-event-tl-table__cell-cushion-headertitle').clientWidth;
|
|
5807
|
+
var _tableDividerWidth2 = tableGridEl.querySelector('.custom-event-tl-table__timeline-divider').clientWidth;
|
|
5808
|
+
var _tableBorderWidth2 = 4;
|
|
5809
|
+
var _scrollMaxWidth2 = _tableMaxWidth2 - _tableHeaderTitleWidth2 - _tableDividerWidth2 - _tableBorderWidth2;
|
|
5810
|
+
_curCellMinWidth = _scrollMaxWidth2 / 7;
|
|
5811
|
+
_curColCount = 7;
|
|
5812
|
+
|
|
5813
|
+
// header content
|
|
5814
|
+
tableGridEl.querySelectorAll('.custom-event-tl-table__cell-cushion-headercontent__container, .custom-event-tl-table__cell-cushion-headercontent').forEach(function (node) {
|
|
5815
|
+
node.style.width = _curCellMinWidth + 'px';
|
|
5816
|
+
});
|
|
5757
5817
|
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5818
|
+
// main content
|
|
5819
|
+
tableGridEl.querySelectorAll('.custom-event-tl-table__cell-cushion-content').forEach(function (node) {
|
|
5820
|
+
node.style.width = _curCellMinWidth + 'px';
|
|
5821
|
+
});
|
|
5822
|
+
}
|
|
5762
5823
|
|
|
5763
|
-
//
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5824
|
+
// Remove from tracking set after execution
|
|
5825
|
+
rafIdsRef.current["delete"](rafId);
|
|
5826
|
+
});
|
|
5827
|
+
|
|
5828
|
+
// Track this requestAnimationFrame ID for cleanup
|
|
5829
|
+
rafIdsRef.current.add(rafId);
|
|
5768
5830
|
}
|
|
5769
5831
|
function tableGridReset() {
|
|
5770
5832
|
if (tableGridRef.current === null) return;
|
|
@@ -5799,7 +5861,7 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
|
|
|
5799
5861
|
setYearsCollection(years);
|
|
5800
5862
|
}, [selectedYear]);
|
|
5801
5863
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
5802
|
-
updateTodayDate(date);
|
|
5864
|
+
updateTodayDate(date, prevDateRef.current);
|
|
5803
5865
|
}, [date]);
|
|
5804
5866
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
5805
5867
|
// Guaranteed year change triggered by the front and rear buttons
|
|
@@ -5836,6 +5898,18 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
|
|
|
5836
5898
|
// !!!Please do not use dependencies
|
|
5837
5899
|
//--------------
|
|
5838
5900
|
return function () {
|
|
5901
|
+
// Cancel all pending requestAnimationFrame callbacks to prevent memory leaks
|
|
5902
|
+
rafIdsRef.current.forEach(function (rafId) {
|
|
5903
|
+
cancelAnimationFrame(rafId);
|
|
5904
|
+
});
|
|
5905
|
+
rafIdsRef.current.clear();
|
|
5906
|
+
|
|
5907
|
+
// Cancel table drag animation frame if pending
|
|
5908
|
+
if (tableDragRafIdRef.current !== null) {
|
|
5909
|
+
cancelAnimationFrame(tableDragRafIdRef.current);
|
|
5910
|
+
tableDragRafIdRef.current = null;
|
|
5911
|
+
}
|
|
5912
|
+
|
|
5839
5913
|
// reset table grid
|
|
5840
5914
|
tableGridReset();
|
|
5841
5915
|
|