funda-ui 4.5.522 → 4.5.575

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.
@@ -3025,6 +3025,15 @@ var EventCalendar = function EventCalendar(props) {
3025
3025
  // exposes the following methods
3026
3026
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(contentRef, function () {
3027
3027
  return {
3028
+ today: function today() {
3029
+ handleTodayChange();
3030
+ },
3031
+ next: function next() {
3032
+ handleNextChange();
3033
+ },
3034
+ prev: function prev() {
3035
+ handlePrevChange();
3036
+ },
3028
3037
  closeModal: function closeModal() {
3029
3038
  if (modalEditHandleRef.current) modalEditHandleRef.current.close();
3030
3039
  if (modalDeleteHandleRef.current) modalDeleteHandleRef.current.close();
@@ -3990,10 +3990,6 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
3990
3990
  //
3991
3991
  var FILL_BLANK_DATE_DISABLD = typeof forwardAndBackFillDisabled === 'undefined' ? true : forwardAndBackFillDisabled;
3992
3992
 
3993
- // root
3994
- var rootRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
3995
- var rootWidth = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);
3996
-
3997
3993
  //
3998
3994
  var now = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () {
3999
3995
  return new Date();
@@ -4121,6 +4117,15 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
4121
4117
  // exposes the following methods
4122
4118
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(contentRef, function () {
4123
4119
  return {
4120
+ today: function today() {
4121
+ handleTodayChange();
4122
+ },
4123
+ next: function next() {
4124
+ handleNextChange();
4125
+ },
4126
+ prev: function prev() {
4127
+ handlePrevChange();
4128
+ },
4124
4129
  gridInit: function gridInit() {
4125
4130
  tableGridInit();
4126
4131
  },
@@ -4936,6 +4941,16 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
4936
4941
 
4937
4942
  // restore table grid init status
4938
4943
  restoreTableGridInitStatus();
4944
+
4945
+ // The scrollbar position is horizontal
4946
+ setTimeout(function () {
4947
+ if (scrollBodyRef.current && tableGridRef.current) {
4948
+ var targetPos = tableGridRef.current.querySelector('.custom-event-tl-table__datagrid-header__content tbody .today.selected');
4949
+ if (targetPos !== null) {
4950
+ scrollBodyRef.current.scrollLeft = targetPos.offsetLeft;
4951
+ }
4952
+ }
4953
+ }, 0);
4939
4954
  }
4940
4955
  function handleAppearanceChange(e) {
4941
4956
  var _mode = e.target.dataset.mode;
@@ -5021,7 +5036,7 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5021
5036
  className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_7__.combinedCls)('custom-event-tl-table__cell-cushion-headercontent__container', {
5022
5037
  'empty': !isInteractive,
5023
5038
  'today': d === now.getDate(),
5024
- 'selected': d === day,
5039
+ 'selected': "".concat(year, "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(month + 1), "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(day)) === "".concat(year, "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(month + 1), "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(d)),
5025
5040
  'last-cell': isLastCol
5026
5041
  }),
5027
5042
  key: "col" + i,
@@ -5444,28 +5459,6 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5444
5459
  trElements[i].style.height = tdOHeight;
5445
5460
  }
5446
5461
  }
5447
- function outerWrapperInit() {
5448
- var _rootRef$current$pare;
5449
- if (rootRef.current === null) return;
5450
- var hasInlineHeightOrMaxHeight = function hasInlineHeightOrMaxHeight(element) {
5451
- if (!element) return false;
5452
- return element.style.height !== '' || element.style.maxHeight !== '';
5453
- };
5454
-
5455
- // calculate wrapper width & height
5456
- var wrapperWidth = ((_rootRef$current$pare = rootRef.current.parentElement) === null || _rootRef$current$pare === void 0 ? void 0 : _rootRef$current$pare.offsetWidth) || 0;
5457
- if (rootRef.current && wrapperWidth > 0 && rootWidth.current === 0) {
5458
- var _rootRef$current$pare2;
5459
- rootWidth.current = wrapperWidth;
5460
- rootRef.current.style.width = wrapperWidth + 'px';
5461
-
5462
- // height
5463
- var wrapperHeight = ((_rootRef$current$pare2 = rootRef.current.parentElement) === null || _rootRef$current$pare2 === void 0 ? void 0 : _rootRef$current$pare2.offsetHeight) || 0;
5464
- if (hasInlineHeightOrMaxHeight(rootRef.current.parentElement) && wrapperHeight > 0) {
5465
- rootRef.current.style.height = wrapperHeight + 'px';
5466
- }
5467
- }
5468
- }
5469
5462
  function tableGridInit() {
5470
5463
  //
5471
5464
  if (tableGridRef.current === null) return;
@@ -5731,10 +5724,6 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5731
5724
  onListRenderComplete === null || onListRenderComplete === void 0 ? void 0 : onListRenderComplete();
5732
5725
  }, [eventsValue, customTodayDate, appearanceMode]);
5733
5726
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
5734
- // calculate wrapper width (!!!FIRST!!!)
5735
- //--------------
5736
- outerWrapperInit();
5737
-
5738
5727
  // !!!Please do not use dependencies
5739
5728
  //--------------
5740
5729
  return function () {
@@ -5747,9 +5736,6 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5747
5736
  };
5748
5737
  }, []);
5749
5738
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
5750
- ref: rootRef,
5751
- className: "custom-event-tl__outerwrapper"
5752
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
5753
5739
  className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_7__.combinedCls)("custom-event-tl__wrapper custom-event-tl__wrapper--".concat(appearanceMode), calendarWrapperClassName)
5754
5740
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
5755
5741
  className: "custom-event-tl__header bg-body-tertiary"
@@ -5961,7 +5947,7 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5961
5947
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("tr", {
5962
5948
  key: i
5963
5949
  }, generateDaysUi(item.eventSources, item.listSection, i, true));
5964
- }))))))))))))), EVENTS_ENABLED ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((funda_modaldialog__WEBPACK_IMPORTED_MODULE_2___default()), {
5950
+ })))))))))))), EVENTS_ENABLED ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((funda_modaldialog__WEBPACK_IMPORTED_MODULE_2___default()), {
5965
5951
  ref: modalDeleteHandleRef,
5966
5952
  show: showDelete,
5967
5953
  maskOpacity: modalMaskOpacity,
@@ -476,6 +476,17 @@ var MasonryLayout = function MasonryLayout(props) {
476
476
 
477
477
  // STEP 3:
478
478
  //=================
479
+ // Calculate the wrapper width based on the gap
480
+ var wrapperTotalGap = 0;
481
+ for (var _i2 = 0; _i2 < colCount; _i2++) {
482
+ if (_i2 > 0) {
483
+ wrapperTotalGap += GAP;
484
+ }
485
+ }
486
+ if (rootRef.current) rootRef.current.style.width = "calc(100% - ".concat(wrapperTotalGap, "px)");
487
+
488
+ // STEP 4:
489
+ //=================
479
490
  // Divide the children into columns
480
491
  var items = [];
481
492
  if (children && !Array.isArray(children)) {
@@ -493,32 +504,31 @@ var MasonryLayout = function MasonryLayout(props) {
493
504
  var columnIndex = i % colCount;
494
505
  columnWrapper["".concat(itemWrapperKey).concat(columnIndex)].push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
495
506
  key: i,
496
- className: "masonry-item",
497
507
  style: {
498
508
  marginBottom: "".concat(GAP, "px")
499
509
  }
500
510
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
501
511
  style: perBrickWidth > 0 ? {
502
- maxWidth: perBrickWidth + 'px'
512
+ width: perBrickWidth + 'px'
503
513
  } : undefined
504
514
  }, el)));
505
515
  });
506
516
 
507
- // STEP 4:
517
+ // STEP 5:
508
518
  //=================
509
519
  // Wrapping the items in each column with a div and pushing it into the result array
510
- for (var _i2 = 0; _i2 < colCount; _i2++) {
520
+ for (var _i3 = 0; _i3 < colCount; _i3++) {
511
521
  result.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
512
- key: _i2,
522
+ key: _i3,
513
523
  className: "masonry-item",
514
524
  style: {
515
- marginLeft: "".concat(_i2 > 0 ? GAP : 0, "px"),
516
- flex: 1
525
+ marginLeft: "".concat(_i3 > 0 ? GAP : 0, "px"),
526
+ flex: '0 1 auto'
517
527
  }
518
- }, columnWrapper["".concat(itemWrapperKey).concat(_i2)]));
528
+ }, columnWrapper["".concat(itemWrapperKey).concat(_i3)]));
519
529
  }
520
530
 
521
- // STEP 5:
531
+ // STEP 6:
522
532
  //=================
523
533
  setItems(result);
524
534
  }, [children]);
@@ -3025,6 +3025,15 @@ var EventCalendar = function EventCalendar(props) {
3025
3025
  // exposes the following methods
3026
3026
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(contentRef, function () {
3027
3027
  return {
3028
+ today: function today() {
3029
+ handleTodayChange();
3030
+ },
3031
+ next: function next() {
3032
+ handleNextChange();
3033
+ },
3034
+ prev: function prev() {
3035
+ handlePrevChange();
3036
+ },
3028
3037
  closeModal: function closeModal() {
3029
3038
  if (modalEditHandleRef.current) modalEditHandleRef.current.close();
3030
3039
  if (modalDeleteHandleRef.current) modalDeleteHandleRef.current.close();
@@ -3990,10 +3990,6 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
3990
3990
  //
3991
3991
  var FILL_BLANK_DATE_DISABLD = typeof forwardAndBackFillDisabled === 'undefined' ? true : forwardAndBackFillDisabled;
3992
3992
 
3993
- // root
3994
- var rootRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
3995
- var rootWidth = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);
3996
-
3997
3993
  //
3998
3994
  var now = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () {
3999
3995
  return new Date();
@@ -4121,6 +4117,15 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
4121
4117
  // exposes the following methods
4122
4118
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(contentRef, function () {
4123
4119
  return {
4120
+ today: function today() {
4121
+ handleTodayChange();
4122
+ },
4123
+ next: function next() {
4124
+ handleNextChange();
4125
+ },
4126
+ prev: function prev() {
4127
+ handlePrevChange();
4128
+ },
4124
4129
  gridInit: function gridInit() {
4125
4130
  tableGridInit();
4126
4131
  },
@@ -4936,6 +4941,16 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
4936
4941
 
4937
4942
  // restore table grid init status
4938
4943
  restoreTableGridInitStatus();
4944
+
4945
+ // The scrollbar position is horizontal
4946
+ setTimeout(function () {
4947
+ if (scrollBodyRef.current && tableGridRef.current) {
4948
+ var targetPos = tableGridRef.current.querySelector('.custom-event-tl-table__datagrid-header__content tbody .today.selected');
4949
+ if (targetPos !== null) {
4950
+ scrollBodyRef.current.scrollLeft = targetPos.offsetLeft;
4951
+ }
4952
+ }
4953
+ }, 0);
4939
4954
  }
4940
4955
  function handleAppearanceChange(e) {
4941
4956
  var _mode = e.target.dataset.mode;
@@ -5021,7 +5036,7 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5021
5036
  className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_7__.combinedCls)('custom-event-tl-table__cell-cushion-headercontent__container', {
5022
5037
  'empty': !isInteractive,
5023
5038
  'today': d === now.getDate(),
5024
- 'selected': d === day,
5039
+ 'selected': "".concat(year, "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(month + 1), "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(day)) === "".concat(year, "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(month + 1), "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(d)),
5025
5040
  'last-cell': isLastCol
5026
5041
  }),
5027
5042
  key: "col" + i,
@@ -5444,28 +5459,6 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5444
5459
  trElements[i].style.height = tdOHeight;
5445
5460
  }
5446
5461
  }
5447
- function outerWrapperInit() {
5448
- var _rootRef$current$pare;
5449
- if (rootRef.current === null) return;
5450
- var hasInlineHeightOrMaxHeight = function hasInlineHeightOrMaxHeight(element) {
5451
- if (!element) return false;
5452
- return element.style.height !== '' || element.style.maxHeight !== '';
5453
- };
5454
-
5455
- // calculate wrapper width & height
5456
- var wrapperWidth = ((_rootRef$current$pare = rootRef.current.parentElement) === null || _rootRef$current$pare === void 0 ? void 0 : _rootRef$current$pare.offsetWidth) || 0;
5457
- if (rootRef.current && wrapperWidth > 0 && rootWidth.current === 0) {
5458
- var _rootRef$current$pare2;
5459
- rootWidth.current = wrapperWidth;
5460
- rootRef.current.style.width = wrapperWidth + 'px';
5461
-
5462
- // height
5463
- var wrapperHeight = ((_rootRef$current$pare2 = rootRef.current.parentElement) === null || _rootRef$current$pare2 === void 0 ? void 0 : _rootRef$current$pare2.offsetHeight) || 0;
5464
- if (hasInlineHeightOrMaxHeight(rootRef.current.parentElement) && wrapperHeight > 0) {
5465
- rootRef.current.style.height = wrapperHeight + 'px';
5466
- }
5467
- }
5468
- }
5469
5462
  function tableGridInit() {
5470
5463
  //
5471
5464
  if (tableGridRef.current === null) return;
@@ -5731,10 +5724,6 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5731
5724
  onListRenderComplete === null || onListRenderComplete === void 0 ? void 0 : onListRenderComplete();
5732
5725
  }, [eventsValue, customTodayDate, appearanceMode]);
5733
5726
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
5734
- // calculate wrapper width (!!!FIRST!!!)
5735
- //--------------
5736
- outerWrapperInit();
5737
-
5738
5727
  // !!!Please do not use dependencies
5739
5728
  //--------------
5740
5729
  return function () {
@@ -5747,9 +5736,6 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5747
5736
  };
5748
5737
  }, []);
5749
5738
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
5750
- ref: rootRef,
5751
- className: "custom-event-tl__outerwrapper"
5752
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
5753
5739
  className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_7__.combinedCls)("custom-event-tl__wrapper custom-event-tl__wrapper--".concat(appearanceMode), calendarWrapperClassName)
5754
5740
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
5755
5741
  className: "custom-event-tl__header bg-body-tertiary"
@@ -5961,7 +5947,7 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5961
5947
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("tr", {
5962
5948
  key: i
5963
5949
  }, generateDaysUi(item.eventSources, item.listSection, i, true));
5964
- }))))))))))))), EVENTS_ENABLED ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((funda_modaldialog__WEBPACK_IMPORTED_MODULE_2___default()), {
5950
+ })))))))))))), EVENTS_ENABLED ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((funda_modaldialog__WEBPACK_IMPORTED_MODULE_2___default()), {
5965
5951
  ref: modalDeleteHandleRef,
5966
5952
  show: showDelete,
5967
5953
  maskOpacity: modalMaskOpacity,
@@ -476,6 +476,17 @@ var MasonryLayout = function MasonryLayout(props) {
476
476
 
477
477
  // STEP 3:
478
478
  //=================
479
+ // Calculate the wrapper width based on the gap
480
+ var wrapperTotalGap = 0;
481
+ for (var _i2 = 0; _i2 < colCount; _i2++) {
482
+ if (_i2 > 0) {
483
+ wrapperTotalGap += GAP;
484
+ }
485
+ }
486
+ if (rootRef.current) rootRef.current.style.width = "calc(100% - ".concat(wrapperTotalGap, "px)");
487
+
488
+ // STEP 4:
489
+ //=================
479
490
  // Divide the children into columns
480
491
  var items = [];
481
492
  if (children && !Array.isArray(children)) {
@@ -493,32 +504,31 @@ var MasonryLayout = function MasonryLayout(props) {
493
504
  var columnIndex = i % colCount;
494
505
  columnWrapper["".concat(itemWrapperKey).concat(columnIndex)].push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
495
506
  key: i,
496
- className: "masonry-item",
497
507
  style: {
498
508
  marginBottom: "".concat(GAP, "px")
499
509
  }
500
510
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
501
511
  style: perBrickWidth > 0 ? {
502
- maxWidth: perBrickWidth + 'px'
512
+ width: perBrickWidth + 'px'
503
513
  } : undefined
504
514
  }, el)));
505
515
  });
506
516
 
507
- // STEP 4:
517
+ // STEP 5:
508
518
  //=================
509
519
  // Wrapping the items in each column with a div and pushing it into the result array
510
- for (var _i2 = 0; _i2 < colCount; _i2++) {
520
+ for (var _i3 = 0; _i3 < colCount; _i3++) {
511
521
  result.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
512
- key: _i2,
522
+ key: _i3,
513
523
  className: "masonry-item",
514
524
  style: {
515
- marginLeft: "".concat(_i2 > 0 ? GAP : 0, "px"),
516
- flex: 1
525
+ marginLeft: "".concat(_i3 > 0 ? GAP : 0, "px"),
526
+ flex: '0 1 auto'
517
527
  }
518
- }, columnWrapper["".concat(itemWrapperKey).concat(_i2)]));
528
+ }, columnWrapper["".concat(itemWrapperKey).concat(_i3)]));
519
529
  }
520
530
 
521
- // STEP 5:
531
+ // STEP 6:
522
532
  //=================
523
533
  setItems(result);
524
534
  }, [children]);
@@ -187,6 +187,15 @@ const EventCalendar = (props: EventCalendarProps) => {
187
187
  useImperativeHandle(
188
188
  contentRef,
189
189
  () => ({
190
+ today: () => {
191
+ handleTodayChange();
192
+ },
193
+ next: () => {
194
+ handleNextChange();
195
+ },
196
+ prev: () => {
197
+ handlePrevChange();
198
+ },
190
199
  closeModal: () => {
191
200
  if (modalEditHandleRef.current) modalEditHandleRef.current.close();
192
201
  if (modalDeleteHandleRef.current) modalDeleteHandleRef.current.close();
@@ -242,9 +242,6 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
242
242
  //
243
243
  const FILL_BLANK_DATE_DISABLD = typeof forwardAndBackFillDisabled === 'undefined' ? true : forwardAndBackFillDisabled;
244
244
 
245
- // root
246
- const rootRef = useRef<any>(null);
247
- const rootWidth = useRef<number>(0);
248
245
 
249
246
  //
250
247
  const now = useMemo(() => new Date(), []);
@@ -325,6 +322,15 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
325
322
  useImperativeHandle(
326
323
  contentRef,
327
324
  () => ({
325
+ today: () => {
326
+ handleTodayChange();
327
+ },
328
+ next: () => {
329
+ handleNextChange();
330
+ },
331
+ prev: () => {
332
+ handlePrevChange();
333
+ },
328
334
  gridInit: () => {
329
335
  tableGridInit();
330
336
  },
@@ -1170,6 +1176,18 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1170
1176
  // restore table grid init status
1171
1177
  restoreTableGridInitStatus();
1172
1178
 
1179
+ // The scrollbar position is horizontal
1180
+ setTimeout(() => {
1181
+ if (scrollBodyRef.current && tableGridRef.current) {
1182
+ const targetPos = tableGridRef.current.querySelector('.custom-event-tl-table__datagrid-header__content tbody .today.selected');
1183
+ if (targetPos !== null) {
1184
+ (scrollBodyRef.current as any).scrollLeft = targetPos.offsetLeft;
1185
+ }
1186
+ }
1187
+ }, 0);
1188
+
1189
+
1190
+
1173
1191
  }
1174
1192
 
1175
1193
  function handleAppearanceChange(e: React.MouseEvent) {
@@ -1259,7 +1277,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1259
1277
  {
1260
1278
  'empty': !isInteractive,
1261
1279
  'today': d === now.getDate(),
1262
- 'selected': d === day,
1280
+ 'selected': `${year}-${padZero(month + 1)}-${padZero(day)}` === `${year}-${padZero(month + 1)}-${padZero(d)}`,
1263
1281
  'last-cell': isLastCol
1264
1282
  }
1265
1283
  )}
@@ -1320,8 +1338,6 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1320
1338
  onCellMouseUp?.(e, selectedCells);
1321
1339
  }}
1322
1340
  >
1323
-
1324
-
1325
1341
  {/* forward fill & day & back fill */}
1326
1342
  <div
1327
1343
  className={combinedCls(
@@ -1332,6 +1348,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1332
1348
  )}
1333
1349
  style={{ width: (CELL_MIN_W - 1) + 'px' }}
1334
1350
  >
1351
+
1335
1352
  {d}
1336
1353
  {_weekDayStr}
1337
1354
  </div>
@@ -1822,31 +1839,6 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1822
1839
 
1823
1840
  }
1824
1841
 
1825
-
1826
- function outerWrapperInit() {
1827
- if (rootRef.current === null) return;
1828
-
1829
- const hasInlineHeightOrMaxHeight = (element: HTMLElement) => {
1830
- if (!element) return false;
1831
- return element.style.height !== '' || element.style.maxHeight !== '';
1832
- };
1833
-
1834
- // calculate wrapper width & height
1835
- const wrapperWidth = rootRef.current.parentElement?.offsetWidth || 0;
1836
- if (rootRef.current && wrapperWidth > 0 && rootWidth.current === 0) {
1837
- rootWidth.current = wrapperWidth;
1838
- rootRef.current.style.width = wrapperWidth + 'px';
1839
-
1840
- // height
1841
- const wrapperHeight = rootRef.current.parentElement?.offsetHeight || 0;
1842
- if (hasInlineHeightOrMaxHeight(rootRef.current.parentElement) && wrapperHeight > 0) {
1843
- rootRef.current.style.height = wrapperHeight + 'px';
1844
- }
1845
-
1846
- }
1847
- }
1848
-
1849
-
1850
1842
  function tableGridInit() {
1851
1843
 
1852
1844
  //
@@ -2177,11 +2169,6 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
2177
2169
 
2178
2170
  useEffect(() => {
2179
2171
 
2180
-
2181
- // calculate wrapper width (!!!FIRST!!!)
2182
- //--------------
2183
- outerWrapperInit();
2184
-
2185
2172
  // !!!Please do not use dependencies
2186
2173
  //--------------
2187
2174
  return () => {
@@ -2198,364 +2185,357 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
2198
2185
  return (
2199
2186
  <>
2200
2187
 
2201
- <div
2202
- ref={rootRef}
2203
- className="custom-event-tl__outerwrapper"
2204
- >
2205
-
2206
- {/*/////////////////////////////////////////////////// */}
2207
- {/*//////////////////// Calendar //////////////////// */}
2208
- {/*////////////////////////////////////////////////// */}
2209
-
2210
- <div className={combinedCls(
2211
- `custom-event-tl__wrapper custom-event-tl__wrapper--${appearanceMode}`,
2212
- calendarWrapperClassName
2213
- )}>
2214
-
2215
- {/*++++++++++++++++ MAIN ++++++++++++++++*/}
2216
- <div className="custom-event-tl__header bg-body-tertiary">
2217
- <button tabIndex={-1} type="button" className="custom-event-tl__btn custom-event-tl__btn--prev" onClick={handlePrevChange}>
2218
- <svg width="20px" height="20px" viewBox="0 0 24 24" fill="none">
2219
- <path d="M14.2893 5.70708C13.8988 5.31655 13.2657 5.31655 12.8751 5.70708L7.98768 10.5993C7.20729 11.3805 7.2076 12.6463 7.98837 13.427L12.8787 18.3174C13.2693 18.7079 13.9024 18.7079 14.293 18.3174C14.6835 17.9269 14.6835 17.2937 14.293 16.9032L10.1073 12.7175C9.71678 12.327 9.71678 11.6939 10.1073 11.3033L14.2893 7.12129C14.6799 6.73077 14.6799 6.0976 14.2893 5.70708Z" fill="#000" />
2220
- </svg>
2221
- </button>
2188
+ {/*/////////////////////////////////////////////////// */}
2189
+ {/*//////////////////// Calendar //////////////////// */}
2190
+ {/*////////////////////////////////////////////////// */}
2191
+
2192
+ <div className={combinedCls(
2193
+ `custom-event-tl__wrapper custom-event-tl__wrapper--${appearanceMode}`,
2194
+ calendarWrapperClassName
2195
+ )}>
2196
+
2197
+ {/*++++++++++++++++ MAIN ++++++++++++++++*/}
2198
+ <div className="custom-event-tl__header bg-body-tertiary">
2199
+ <button tabIndex={-1} type="button" className="custom-event-tl__btn custom-event-tl__btn--prev" onClick={handlePrevChange}>
2200
+ <svg width="20px" height="20px" viewBox="0 0 24 24" fill="none">
2201
+ <path d="M14.2893 5.70708C13.8988 5.31655 13.2657 5.31655 12.8751 5.70708L7.98768 10.5993C7.20729 11.3805 7.2076 12.6463 7.98837 13.427L12.8787 18.3174C13.2693 18.7079 13.9024 18.7079 14.293 18.3174C14.6835 17.9269 14.6835 17.2937 14.293 16.9032L10.1073 12.7175C9.71678 12.327 9.71678 11.6939 10.1073 11.3033L14.2893 7.12129C14.6799 6.73077 14.6799 6.0976 14.2893 5.70708Z" fill="#000" />
2202
+ </svg>
2203
+ </button>
2204
+
2205
+ {/* //########## MODE: WEEK ############# */}
2206
+ {appearanceMode === 'week' ? <>
2207
+ <div className="custom-event-tl__header__info">
2208
+ {typeof appearanceWeekTmpl === 'function' ? <>{appearanceWeekTmpl(displayWeekForHeader[0], displayWeekForHeader[1])}</> : <>{displayWeekForHeader[0]} - {displayWeekForHeader[1]}</>}
2209
+ </div>
2210
+ </> : null}
2211
+ {/* //########## /MODE: WEEK ############# */}
2222
2212
 
2223
- {/* //########## MODE: WEEK ############# */}
2224
- {appearanceMode === 'week' ? <>
2225
- <div className="custom-event-tl__header__info">
2226
- {typeof appearanceWeekTmpl === 'function' ? <>{appearanceWeekTmpl(displayWeekForHeader[0], displayWeekForHeader[1])}</> : <>{displayWeekForHeader[0]} - {displayWeekForHeader[1]}</>}
2227
- </div>
2228
- </> : null}
2229
- {/* //########## /MODE: WEEK ############# */}
2230
-
2231
-
2232
- {/* //########## MODE: MONTH ############# */}
2233
- {appearanceMode === 'month' ? <>
2234
- <div className="custom-event-tl__header__btns">
2235
- <button tabIndex={-1} type="button" className={`custom-event-tl__btn ${winMonth ? 'active' : ''}`} onClick={handleShowWinMonth}>
2236
- {MONTHS[month]}
2237
- <svg width="12px" height="12px" viewBox="0 0 24 24"><path d="M11.178 19.569a.998.998 0 0 0 1.644 0l9-13A.999.999 0 0 0 21 5H3a1.002 1.002 0 0 0-.822 1.569l9 13z" fill="#000000" /></svg>
2238
- </button>
2239
- <button tabIndex={-1} type="button" className={`custom-event-tl__btn ${winYear ? 'active' : ''}`} onClick={handleShowWinYear}>
2240
- {year}
2241
- <svg width="12px" height="12px" viewBox="0 0 24 24"><path d="M11.178 19.569a.998.998 0 0 0 1.644 0l9-13A.999.999 0 0 0 21 5H3a1.002 1.002 0 0 0-.822 1.569l9 13z" fill="#000000" /></svg>
2242
- </button>
2243
- </div>
2244
- </> : null}
2245
- {/* //########## /MODE: MONTH ############# */}
2246
2213
 
2214
+ {/* //########## MODE: MONTH ############# */}
2215
+ {appearanceMode === 'month' ? <>
2216
+ <div className="custom-event-tl__header__btns">
2217
+ <button tabIndex={-1} type="button" className={`custom-event-tl__btn ${winMonth ? 'active' : ''}`} onClick={handleShowWinMonth}>
2218
+ {MONTHS[month]}
2219
+ <svg width="12px" height="12px" viewBox="0 0 24 24"><path d="M11.178 19.569a.998.998 0 0 0 1.644 0l9-13A.999.999 0 0 0 21 5H3a1.002 1.002 0 0 0-.822 1.569l9 13z" fill="#000000" /></svg>
2220
+ </button>
2221
+ <button tabIndex={-1} type="button" className={`custom-event-tl__btn ${winYear ? 'active' : ''}`} onClick={handleShowWinYear}>
2222
+ {year}
2223
+ <svg width="12px" height="12px" viewBox="0 0 24 24"><path d="M11.178 19.569a.998.998 0 0 0 1.644 0l9-13A.999.999 0 0 0 21 5H3a1.002 1.002 0 0 0-.822 1.569l9 13z" fill="#000000" /></svg>
2224
+ </button>
2225
+ </div>
2226
+ </> : null}
2227
+ {/* //########## /MODE: MONTH ############# */}
2247
2228
 
2248
2229
 
2249
- <button tabIndex={-1} type="button" className="custom-event-tl__btn custom-event-tl__btn--next" onClick={handleNextChange}>
2250
- <svg width="20px" height="20px" viewBox="0 0 24 24" fill="none">
2251
- <path d="M9.71069 18.2929C10.1012 18.6834 10.7344 18.6834 11.1249 18.2929L16.0123 13.4006C16.7927 12.6195 16.7924 11.3537 16.0117 10.5729L11.1213 5.68254C10.7308 5.29202 10.0976 5.29202 9.70708 5.68254C9.31655 6.07307 9.31655 6.70623 9.70708 7.09676L13.8927 11.2824C14.2833 11.6729 14.2833 12.3061 13.8927 12.6966L9.71069 16.8787C9.32016 17.2692 9.32016 17.9023 9.71069 18.2929Z" fill="#000" />
2252
- </svg>
2253
- </button>
2254
- </div>
2255
2230
 
2231
+ <button tabIndex={-1} type="button" className="custom-event-tl__btn custom-event-tl__btn--next" onClick={handleNextChange}>
2232
+ <svg width="20px" height="20px" viewBox="0 0 24 24" fill="none">
2233
+ <path d="M9.71069 18.2929C10.1012 18.6834 10.7344 18.6834 11.1249 18.2929L16.0123 13.4006C16.7927 12.6195 16.7924 11.3537 16.0117 10.5729L11.1213 5.68254C10.7308 5.29202 10.0976 5.29202 9.70708 5.68254C9.31655 6.07307 9.31655 6.70623 9.70708 7.09676L13.8927 11.2824C14.2833 11.6729 14.2833 12.3061 13.8927 12.6966L9.71069 16.8787C9.32016 17.2692 9.32016 17.9023 9.71069 18.2929Z" fill="#000" />
2234
+ </svg>
2235
+ </button>
2236
+ </div>
2256
2237
 
2257
2238
 
2258
- <div className="custom-event-tl__body">
2259
2239
 
2240
+ <div className="custom-event-tl__body">
2260
2241
 
2261
- <div className="custom-event-tl__row">
2262
- {/* day */}
2263
2242
 
2264
- {/* /day */}
2265
- </div>
2243
+ <div className="custom-event-tl__row">
2244
+ {/* day */}
2266
2245
 
2246
+ {/* /day */}
2267
2247
  </div>
2268
- {/*++++++++++++++++ /MAIN ++++++++++++++++*/}
2269
-
2270
-
2271
- {/*++++++++++++++++ MONTH SELECTION TAB ++++++++++++++++*/}
2272
- <div className={`custom-event-tl__month-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winMonth ? 'active' : ''}`}>
2273
- <div className="custom-event-tl__month-container">
2274
- {MONTHS_FULL.map((month, index) => {
2275
- return <div
2276
- data-month={padZero(index + 1)}
2277
- className={`custom-event-tl__month ${selectedMonth === index ? ' selected' : ''}`}
2278
- key={month + index}
2279
- onClick={() => { handleMonthChange(index) }}
2280
- >{month}</div>
2281
- })}
2282
- </div>
2248
+
2249
+ </div>
2250
+ {/*++++++++++++++++ /MAIN ++++++++++++++++*/}
2251
+
2252
+
2253
+ {/*++++++++++++++++ MONTH SELECTION TAB ++++++++++++++++*/}
2254
+ <div className={`custom-event-tl__month-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winMonth ? 'active' : ''}`}>
2255
+ <div className="custom-event-tl__month-container">
2256
+ {MONTHS_FULL.map((month, index) => {
2257
+ return <div
2258
+ data-month={padZero(index + 1)}
2259
+ className={`custom-event-tl__month ${selectedMonth === index ? ' selected' : ''}`}
2260
+ key={month + index}
2261
+ onClick={() => { handleMonthChange(index) }}
2262
+ >{month}</div>
2263
+ })}
2283
2264
  </div>
2284
- {/*++++++++++++++++ /MONTH SELECTION TAB ++++++++++++++++*/}
2285
-
2286
- {/*++++++++++++++++ YEAR SELECTION TAB ++++++++++++++++*/}
2287
- <div className={`custom-event-tl__year-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winYear ? 'active' : ''}`}>
2288
- <div className="custom-event-tl__year-container bg-body-tertiary">
2289
- {yearsArray.map((year, index) => {
2290
- return <div
2291
- data-year={year}
2292
- className={`custom-event-tl__year ${selectedYear === year ? ' selected' : ''}`}
2293
- key={year + index}
2294
- onClick={() => { handleYearChange(year) }}
2295
- >{year}</div>
2296
- })}
2297
- </div>
2265
+ </div>
2266
+ {/*++++++++++++++++ /MONTH SELECTION TAB ++++++++++++++++*/}
2298
2267
 
2268
+ {/*++++++++++++++++ YEAR SELECTION TAB ++++++++++++++++*/}
2269
+ <div className={`custom-event-tl__year-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winYear ? 'active' : ''}`}>
2270
+ <div className="custom-event-tl__year-container bg-body-tertiary">
2271
+ {yearsArray.map((year, index) => {
2272
+ return <div
2273
+ data-year={year}
2274
+ className={`custom-event-tl__year ${selectedYear === year ? ' selected' : ''}`}
2275
+ key={year + index}
2276
+ onClick={() => { handleYearChange(year) }}
2277
+ >{year}</div>
2278
+ })}
2299
2279
  </div>
2300
- {/*++++++++++++++++ /YEAR SELECTION TAB ++++++++++++++++*/}
2280
+
2281
+ </div>
2282
+ {/*++++++++++++++++ /YEAR SELECTION TAB ++++++++++++++++*/}
2301
2283
 
2302
2284
 
2303
2285
 
2304
- {/*++++++++++++++++ TODAY SELECTION TAB ++++++++++++++++*/}
2305
- <div className="custom-event-tl__today-wrapper p-2">
2286
+ {/*++++++++++++++++ TODAY SELECTION TAB ++++++++++++++++*/}
2287
+ <div className="custom-event-tl__today-wrapper p-2">
2288
+ <button
2289
+ tabIndex={-1}
2290
+ type="button"
2291
+ className="custom-event-tl__btn custom-event-tl__btn--today"
2292
+ onClick={handleTodayChange}
2293
+ >
2294
+ {langToday || 'Today'}
2295
+ </button>
2296
+
2297
+ {appearanceToggle ? <>
2306
2298
  <button
2307
2299
  tabIndex={-1}
2308
2300
  type="button"
2309
- className="custom-event-tl__btn custom-event-tl__btn--today"
2310
- onClick={handleTodayChange}
2301
+ className={`custom-event-tl__btn custom-event-tl__btn--appearance ${appearanceMode === 'month' ? 'active' : ''}`}
2302
+ data-mode="month"
2303
+ onClick={handleAppearanceChange}
2311
2304
  >
2312
- {langToday || 'Today'}
2305
+ {langAppearanceLabelMonth || 'Month'}
2313
2306
  </button>
2307
+ <button
2308
+ tabIndex={-1}
2309
+ type="button"
2310
+ className={`custom-event-tl__btn custom-event-tl__btn--appearance ${appearanceMode === 'week' ? 'active' : ''}`}
2311
+ data-mode="week"
2312
+ onClick={handleAppearanceChange}
2313
+ >
2314
+ {langAppearanceLabelWeek || 'Week'}
2315
+ </button>
2316
+ </> : null}
2314
2317
 
2315
- {appearanceToggle ? <>
2316
- <button
2317
- tabIndex={-1}
2318
- type="button"
2319
- className={`custom-event-tl__btn custom-event-tl__btn--appearance ${appearanceMode === 'month' ? 'active' : ''}`}
2320
- data-mode="month"
2321
- onClick={handleAppearanceChange}
2322
- >
2323
- {langAppearanceLabelMonth || 'Month'}
2324
- </button>
2325
- <button
2326
- tabIndex={-1}
2327
- type="button"
2328
- className={`custom-event-tl__btn custom-event-tl__btn--appearance ${appearanceMode === 'week' ? 'active' : ''}`}
2329
- data-mode="week"
2330
- onClick={handleAppearanceChange}
2331
- >
2332
- {langAppearanceLabelWeek || 'Week'}
2333
- </button>
2334
- </> : null}
2335
-
2336
- </div>
2337
- {/*++++++++++++++++ /TODAY SELECTION TAB ++++++++++++++++*/}
2318
+ </div>
2319
+ {/*++++++++++++++++ /TODAY SELECTION TAB ++++++++++++++++*/}
2338
2320
 
2339
2321
 
2340
- </div>{/* /.custom-event-tl__wrapper */}
2322
+ </div>{/* /.custom-event-tl__wrapper */}
2341
2323
 
2342
2324
 
2343
2325
 
2344
- {/*/////////////////////////////////////////////////// */}
2345
- {/*//////////////////// Table Grid //////////////////// */}
2346
- {/*////////////////////////////////////////////////// */}
2347
- {orginalData.length === 0 ? null : <>
2348
- <div
2349
- ref={tableGridRef}
2350
- className={combinedCls(
2351
- `custom-event-tl-table__timeline-table__wrapper custom-event-tl-table__timeline-table__wrapper--${appearanceMode} invisible`,
2352
- tableWrapperClassName
2326
+ {/*/////////////////////////////////////////////////// */}
2327
+ {/*//////////////////// Table Grid //////////////////// */}
2328
+ {/*////////////////////////////////////////////////// */}
2329
+ {orginalData.length === 0 ? null : <>
2330
+ <div
2331
+ ref={tableGridRef}
2332
+ className={combinedCls(
2333
+ `custom-event-tl-table__timeline-table__wrapper custom-event-tl-table__timeline-table__wrapper--${appearanceMode} invisible`,
2334
+ tableWrapperClassName
2335
+ )}
2336
+ onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {
2337
+ onKeyPressed?.(e, selectedCells);
2338
+
2339
+ // Copy & Paste
2340
+ handleWrapperKeyDown(e);
2341
+ }}
2342
+ tabIndex={-1} // require "tabIndex" attribute
2343
+ >
2344
+ <table role="grid" className={combinedCls(
2345
+ "custom-event-tl-table__timeline-table",
2346
+ tableClassName
2347
+ )}>
2348
+ <colgroup>
2349
+ <col className="custom-event-tl-table__datagrid-header" />
2350
+ <col />
2351
+ <col />
2352
+ </colgroup>
2353
+
2354
+ <thead className={combinedCls(
2355
+ tableHeadClassName
2353
2356
  )}
2354
- onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {
2355
- onKeyPressed?.(e, selectedCells);
2357
+ ref={tableGridHeaderRef}
2358
+ role="rowgroup"
2359
+ >
2360
+ <tr role="presentation">
2361
+ <th role="presentation">
2362
+ {/*<!--///// HEADER LEFT //////-->*/}
2363
+ <div className="custom-event-tl-table__timeline-header custom-event-tl-table__timeline-headertitle">
2364
+
2365
+ <table role="presentation" className="custom-event-tl-table__datagrid-header__title">
2366
+ <colgroup>
2367
+ <col />
2368
+ </colgroup>
2369
+ <thead role="presentation">
2370
+ <tr role="row">
2371
+ <th role="columnheader">
2372
+ <div className="custom-event-tl-table__cell-cushion custom-event-tl-table__cell-cushion-headertitle">
2373
+ {tableListSectionTitle || ''}
2374
+ </div>
2375
+ </th>
2376
+ </tr>
2377
+ </thead>
2378
+ </table>
2356
2379
 
2357
- // Copy & Paste
2358
- handleWrapperKeyDown(e);
2359
- }}
2360
- tabIndex={-1} // require "tabIndex" attribute
2361
- >
2362
- <table role="grid" className={combinedCls(
2363
- "custom-event-tl-table__timeline-table",
2364
- tableClassName
2365
- )}>
2366
- <colgroup>
2367
- <col className="custom-event-tl-table__datagrid-header" />
2368
- <col />
2369
- <col />
2370
- </colgroup>
2371
-
2372
- <thead className={combinedCls(
2373
- tableHeadClassName
2374
- )}
2375
- ref={tableGridHeaderRef}
2376
- role="rowgroup"
2377
- >
2378
- <tr role="presentation">
2379
- <th role="presentation">
2380
- {/*<!--///// HEADER LEFT //////-->*/}
2381
- <div className="custom-event-tl-table__timeline-header custom-event-tl-table__timeline-headertitle">
2380
+ </div>
2381
+ {/*<!--///// /HEADER LEFT //////-->*/}
2382
2382
 
2383
- <table role="presentation" className="custom-event-tl-table__datagrid-header__title">
2384
- <colgroup>
2385
- <col />
2386
- </colgroup>
2387
- <thead role="presentation">
2388
- <tr role="row">
2389
- <th role="columnheader">
2390
- <div className="custom-event-tl-table__cell-cushion custom-event-tl-table__cell-cushion-headertitle">
2391
- {tableListSectionTitle || ''}
2392
- </div>
2393
- </th>
2394
- </tr>
2395
- </thead>
2396
- </table>
2397
2383
 
2398
- </div>
2399
- {/*<!--///// /HEADER LEFT //////-->*/}
2400
2384
 
2385
+ </th>
2386
+ <th role="presentation" className="custom-event-tl-table__timeline-divider"><div></div></th>
2387
+ <th role="presentation">
2388
+ <div
2389
+ ref={scrollHeaderRef}
2390
+ className="custom-event-tl-table__scroller-harness custom-event-tl-table__scroller-harness--hide"
2391
+ data-scroll="header"
2392
+ onScroll={syncTableScrollHeader}
2393
+ >
2394
+ <div className="custom-event-tl-table__scroller">
2401
2395
 
2396
+ {/*<!--///// HEADER RIGHT //////-->*/}
2397
+ <div className="custom-event-tl-table__timeline-header">
2402
2398
 
2403
- </th>
2404
- <th role="presentation" className="custom-event-tl-table__timeline-divider"><div></div></th>
2405
- <th role="presentation">
2406
- <div
2407
- ref={scrollHeaderRef}
2408
- className="custom-event-tl-table__scroller-harness custom-event-tl-table__scroller-harness--hide"
2409
- data-scroll="header"
2410
- onScroll={syncTableScrollHeader}
2411
- >
2412
- <div className="custom-event-tl-table__scroller">
2413
-
2414
- {/*<!--///// HEADER RIGHT //////-->*/}
2415
- <div className="custom-event-tl-table__timeline-header">
2416
-
2417
- <table className="custom-event-tl-table__datagrid-header__content custom-event-tl-table__scrollgrid-sync-table" >
2418
- <tbody>
2419
- <tr>
2420
- {generateDaysUi()}
2421
- </tr>
2422
- </tbody>
2423
- </table>
2424
- </div>
2425
- {/*<!--///// /HEADER RIGHT //////-->*/}
2399
+ <table className="custom-event-tl-table__datagrid-header__content custom-event-tl-table__scrollgrid-sync-table" >
2400
+ <tbody>
2401
+ <tr>
2402
+ {generateDaysUi()}
2403
+ </tr>
2404
+ </tbody>
2405
+ </table>
2426
2406
  </div>
2407
+ {/*<!--///// /HEADER RIGHT //////-->*/}
2427
2408
  </div>
2428
- </th>
2429
- </tr>
2430
- </thead>
2409
+ </div>
2410
+ </th>
2411
+ </tr>
2412
+ </thead>
2431
2413
 
2432
2414
 
2433
2415
 
2434
- <tbody className={combinedCls(
2435
- tableBodyClassName
2436
- )}
2437
- role="rowgroup"
2438
- >
2439
- <tr role="presentation" className="custom-event-tl-table__list-section">
2440
- <td
2441
- role="presentation"
2416
+ <tbody className={combinedCls(
2417
+ tableBodyClassName
2418
+ )}
2419
+ role="rowgroup"
2420
+ >
2421
+ <tr role="presentation" className="custom-event-tl-table__list-section">
2422
+ <td
2423
+ role="presentation"
2424
+ className={combinedCls(
2425
+ tableListStartClassName
2426
+ )}
2427
+
2428
+ >
2429
+
2430
+ <div
2431
+ ref={scrollListRef}
2442
2432
  className={combinedCls(
2443
- tableListStartClassName
2433
+ 'custom-event-tl-table__scroller-harness',
2434
+ {
2435
+ 'autoscroll': AUTO_SCROLL
2436
+ }
2444
2437
  )}
2445
-
2438
+ data-scroll="list"
2439
+ onScroll={syncTableScrollList}
2446
2440
  >
2441
+ <div className="custom-event-tl-table__scroller">
2447
2442
 
2448
- <div
2449
- ref={scrollListRef}
2450
- className={combinedCls(
2451
- 'custom-event-tl-table__scroller-harness',
2452
- {
2453
- 'autoscroll': AUTO_SCROLL
2454
- }
2455
- )}
2456
- data-scroll="list"
2457
- onScroll={syncTableScrollList}
2458
- >
2459
- <div className="custom-event-tl-table__scroller">
2460
-
2461
- {/*<!--///// RESOURCE LEFT //////-->*/}
2462
- <table role="presentation" className="custom-event-tl-table__datagrid-body__title custom-event-tl-table__scrollgrid-sync-table">
2463
- <colgroup>
2464
- <col />
2465
- </colgroup>
2466
- <tbody role="presentation">
2443
+ {/*<!--///// RESOURCE LEFT //////-->*/}
2444
+ <table role="presentation" className="custom-event-tl-table__datagrid-body__title custom-event-tl-table__scrollgrid-sync-table">
2445
+ <colgroup>
2446
+ <col />
2447
+ </colgroup>
2448
+ <tbody role="presentation">
2467
2449
 
2468
- {/*<!-- per row -->*/}
2469
- {generateListSectionUi()}
2470
- {/*<!-- /per row -->*/}
2450
+ {/*<!-- per row -->*/}
2451
+ {generateListSectionUi()}
2452
+ {/*<!-- /per row -->*/}
2471
2453
 
2472
- </tbody>
2473
- </table>
2474
- {/*<!--///// /RESOURCE LEFT //////-->*/}
2475
- </div>
2454
+ </tbody>
2455
+ </table>
2456
+ {/*<!--///// /RESOURCE LEFT //////-->*/}
2476
2457
  </div>
2458
+ </div>
2477
2459
 
2478
2460
 
2479
- </td>
2480
- <td
2481
- role="presentation"
2482
- className={combinedCls(
2483
- 'custom-event-tl-table__timeline-divider',
2484
- tableListDividerClassName
2485
- )}
2486
- >
2487
- <div></div>
2488
- </td>
2489
- <td
2490
- role="presentation"
2461
+ </td>
2462
+ <td
2463
+ role="presentation"
2464
+ className={combinedCls(
2465
+ 'custom-event-tl-table__timeline-divider',
2466
+ tableListDividerClassName
2467
+ )}
2468
+ >
2469
+ <div></div>
2470
+ </td>
2471
+ <td
2472
+ role="presentation"
2473
+ className={combinedCls(
2474
+ tableListEndClassName
2475
+ )}
2476
+ >
2477
+
2478
+
2479
+ <div
2480
+ ref={scrollBodyRef}
2491
2481
  className={combinedCls(
2492
- tableListEndClassName
2482
+ 'custom-event-tl-table__scroller-harness',
2483
+ {
2484
+ 'autoscroll': AUTO_SCROLL
2485
+ }
2493
2486
  )}
2487
+ data-scroll="body"
2488
+ onScroll={syncTableScrollBody}
2489
+ onMouseMove={BODY_DRAG ? handleTableMove : () => { }}
2490
+ onMouseDown={BODY_DRAG ? handleTableDragStart : () => { }}
2491
+ onMouseUp={BODY_DRAG ? handleTableDragEnd : () => { }}
2492
+ onMouseLeave={BODY_DRAG ? handleTableDragEnd : () => { }}
2494
2493
  >
2494
+ <div className="custom-event-tl-table__scroller">
2495
+ {/*<!--///// RESOURCE RIGHT //////-->*/}
2496
+ <div className="custom-event-tl-table__timeline-body">
2497
+ <table
2498
+ className="custom-event-tl-table__datagrid-body__content custom-event-tl-table__scrollgrid-sync-table"
2499
+ /* Drag to activate the selection area */
2500
+ onMouseLeave={multipleCells ? handleTableMainMouseUp : undefined}
2501
+ onMouseUp={multipleCells ? handleTableMainMouseUp : undefined}
2502
+
2503
+ >
2504
+ <colgroup>
2505
+ {generateColUi()}
2506
+ </colgroup>
2507
+ <tbody>
2508
+ {/*<!-- per row -->*/}
2509
+ {orginalData.map((item: any, i: number) => {
2495
2510
 
2511
+ return (
2512
+ <tr key={i}>
2513
+ {generateDaysUi(item.eventSources, item.listSection, i, true)}
2514
+ </tr>
2515
+ )
2496
2516
 
2497
- <div
2498
- ref={scrollBodyRef}
2499
- className={combinedCls(
2500
- 'custom-event-tl-table__scroller-harness',
2501
- {
2502
- 'autoscroll': AUTO_SCROLL
2503
- }
2504
- )}
2505
- data-scroll="body"
2506
- onScroll={syncTableScrollBody}
2507
- onMouseMove={BODY_DRAG ? handleTableMove : () => { }}
2508
- onMouseDown={BODY_DRAG ? handleTableDragStart : () => { }}
2509
- onMouseUp={BODY_DRAG ? handleTableDragEnd : () => { }}
2510
- onMouseLeave={BODY_DRAG ? handleTableDragEnd : () => { }}
2511
- >
2512
- <div className="custom-event-tl-table__scroller">
2513
- {/*<!--///// RESOURCE RIGHT //////-->*/}
2514
- <div className="custom-event-tl-table__timeline-body">
2515
- <table
2516
- className="custom-event-tl-table__datagrid-body__content custom-event-tl-table__scrollgrid-sync-table"
2517
- /* Drag to activate the selection area */
2518
- onMouseLeave={multipleCells ? handleTableMainMouseUp : undefined}
2519
- onMouseUp={multipleCells ? handleTableMainMouseUp : undefined}
2520
-
2521
- >
2522
- <colgroup>
2523
- {generateColUi()}
2524
- </colgroup>
2525
- <tbody>
2526
- {/*<!-- per row -->*/}
2527
- {orginalData.map((item: any, i: number) => {
2528
-
2529
- return (
2530
- <tr key={i}>
2531
- {generateDaysUi(item.eventSources, item.listSection, i, true)}
2532
- </tr>
2533
- )
2534
-
2535
- })}
2536
-
2537
- </tbody>
2538
- </table>
2539
-
2540
- </div>
2541
- {/*<!--///// /RESOURCE RIGHT //////-->*/}
2517
+ })}
2542
2518
 
2519
+ </tbody>
2520
+ </table>
2543
2521
 
2544
2522
  </div>
2545
- </div>
2523
+ {/*<!--///// /RESOURCE RIGHT //////-->*/}
2546
2524
 
2547
2525
 
2548
- </td>
2549
- </tr>
2550
- </tbody>
2551
- </table>
2526
+ </div>
2527
+ </div>
2528
+
2552
2529
 
2553
- </div>{/* /.custom-event-tl-table__timeline-table__wrapper */}
2530
+ </td>
2531
+ </tr>
2532
+ </tbody>
2533
+ </table>
2554
2534
 
2535
+ </div>{/* /.custom-event-tl-table__timeline-table__wrapper */}
2555
2536
 
2556
- </>}
2557
- </div>
2558
2537
 
2538
+ </>}
2559
2539
 
2560
2540
 
2561
2541
  {/*/////////////////////////////////////////////////// */}
@@ -8,9 +8,9 @@ import {
8
8
 
9
9
 
10
10
  export type MasonryLayoutProps = {
11
- columns?: number,
12
- gap?: number,
13
- breakPoints?: Record<number, number>
11
+ columns?: number;
12
+ gap?: number;
13
+ breakPoints?: Record<number, number>;
14
14
  /** -- */
15
15
  id?: string;
16
16
  tabIndex?: number;
@@ -75,8 +75,21 @@ const MasonryLayout = (props: MasonryLayoutProps) => {
75
75
  columnWrapper[`${itemWrapperKey}${i}`] = [];
76
76
  }
77
77
 
78
+
78
79
  // STEP 3:
79
80
  //=================
81
+ // Calculate the wrapper width based on the gap
82
+ let wrapperTotalGap: number = 0;
83
+ for (let i = 0; i < colCount; i++) {
84
+ if (i > 0) {
85
+ wrapperTotalGap += GAP;
86
+ }
87
+ }
88
+ if (rootRef.current) rootRef.current.style.width = `calc(100% - ${wrapperTotalGap}px)`;
89
+
90
+
91
+ // STEP 4:
92
+ //=================
80
93
  // Divide the children into columns
81
94
  let items: React.ReactNode[] = [];
82
95
 
@@ -94,21 +107,21 @@ const MasonryLayout = (props: MasonryLayoutProps) => {
94
107
 
95
108
  items.forEach((el: React.ReactNode, i: number) => {
96
109
  const columnIndex = i % colCount;
110
+
97
111
  columnWrapper[`${itemWrapperKey}${columnIndex}`].push(
98
112
  <div
99
113
  key={i}
100
- className="masonry-item"
101
114
  style={{
102
115
  marginBottom: `${GAP}px`
103
116
  }}
104
117
  >
105
- <div style={perBrickWidth > 0 ? {maxWidth: perBrickWidth + 'px'} : undefined}>{el}</div>
118
+ <div style={perBrickWidth > 0 ? {width: perBrickWidth + 'px'} : undefined}>{el}</div>
106
119
  </div>
107
120
  );
108
121
  });
109
122
 
110
123
 
111
- // STEP 4:
124
+ // STEP 5:
112
125
  //=================
113
126
  // Wrapping the items in each column with a div and pushing it into the result array
114
127
  for (let i = 0; i < colCount; i++) {
@@ -118,14 +131,14 @@ const MasonryLayout = (props: MasonryLayoutProps) => {
118
131
  className="masonry-item"
119
132
  style={{
120
133
  marginLeft: `${i > 0 ? GAP : 0}px`,
121
- flex: 1
134
+ flex: '0 1 auto'
122
135
  }}>
123
136
  {columnWrapper[`${itemWrapperKey}${i}`]}
124
137
  </div>
125
138
  );
126
139
  }
127
140
 
128
- // STEP 5:
141
+ // STEP 6:
129
142
  //=================
130
143
  setItems(result);
131
144
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "UIUX Lab",
3
3
  "email": "uiuxlab@gmail.com",
4
4
  "name": "funda-ui",
5
- "version": "4.5.522",
5
+ "version": "4.5.575",
6
6
  "description": "React components using pure Bootstrap 5+ which does not contain any external style and script libraries.",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +0,0 @@
1
- /* ======================================================
2
- <!-- Masonry Layout -->
3
- /* ====================================================== */
4
- .masonry__wrapper .masonry-item > * {
5
- width: 100%;
6
- }
@@ -1,6 +0,0 @@
1
- /* ======================================================
2
- <!-- Masonry Layout -->
3
- /* ====================================================== */
4
- .masonry__wrapper .masonry-item > * {
5
- width: 100%;
6
- }
@@ -1,13 +0,0 @@
1
- /* ======================================================
2
- <!-- Masonry Layout -->
3
- /* ====================================================== */
4
-
5
- .masonry__wrapper {
6
-
7
- .masonry-item {
8
- > * {
9
- width: 100%;
10
- }
11
- }
12
-
13
- }