funda-ui 4.4.35 → 4.5.12

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.
Files changed (40) hide show
  1. package/Date/index.js +1078 -77
  2. package/EventCalendar/index.js +8 -2
  3. package/EventCalendarTimeline/index.js +32 -1
  4. package/Input/index.d.ts +7 -0
  5. package/Input/index.js +699 -57
  6. package/MasonryLayout/index.js +11 -1
  7. package/MultipleSelect/index.d.ts +1 -0
  8. package/MultipleSelect/index.js +7 -5
  9. package/RangeSlider/index.js +1078 -77
  10. package/Select/index.js +34 -2
  11. package/Textarea/index.d.ts +7 -0
  12. package/Textarea/index.js +707 -10
  13. package/Tree/index.js +2 -0
  14. package/Utils/inputsCalculation.d.ts +18 -1
  15. package/Utils/inputsCalculation.js +26 -0
  16. package/lib/cjs/Date/index.js +1078 -77
  17. package/lib/cjs/EventCalendar/index.js +8 -2
  18. package/lib/cjs/EventCalendarTimeline/index.js +32 -1
  19. package/lib/cjs/Input/index.d.ts +7 -0
  20. package/lib/cjs/Input/index.js +699 -57
  21. package/lib/cjs/MasonryLayout/index.js +11 -1
  22. package/lib/cjs/MultipleSelect/index.d.ts +1 -0
  23. package/lib/cjs/MultipleSelect/index.js +7 -5
  24. package/lib/cjs/RangeSlider/index.js +1078 -77
  25. package/lib/cjs/Select/index.js +34 -2
  26. package/lib/cjs/Textarea/index.d.ts +7 -0
  27. package/lib/cjs/Textarea/index.js +707 -10
  28. package/lib/cjs/Tree/index.js +2 -0
  29. package/lib/cjs/Utils/inputsCalculation.d.ts +18 -1
  30. package/lib/cjs/Utils/inputsCalculation.js +26 -0
  31. package/lib/esm/EventCalendar/index.tsx +8 -6
  32. package/lib/esm/EventCalendarTimeline/index.tsx +439 -403
  33. package/lib/esm/Input/index.tsx +299 -77
  34. package/lib/esm/MasonryLayout/index.tsx +9 -2
  35. package/lib/esm/MultipleSelect/index.tsx +6 -4
  36. package/lib/esm/Textarea/index.tsx +332 -39
  37. package/lib/esm/Tree/TreeList.tsx +4 -1
  38. package/lib/esm/Tree/index.tsx +1 -0
  39. package/lib/esm/Utils/libs/inputsCalculation.ts +60 -31
  40. package/package.json +1 -1
@@ -14,6 +14,7 @@ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
14
14
  import getOs from 'funda-utils//dist/cjs/os';
15
15
 
16
16
 
17
+
17
18
  export interface EventsValueConfig {
18
19
  id: string | number;
19
20
  date: string,
@@ -241,6 +242,10 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
241
242
  //
242
243
  const FILL_BLANK_DATE_DISABLD = typeof forwardAndBackFillDisabled === 'undefined' ? true : forwardAndBackFillDisabled;
243
244
 
245
+ // root
246
+ const rootRef = useRef<any>(null);
247
+ const rootWidth = useRef<number>(0);
248
+
244
249
  //
245
250
  const now = useMemo(() => new Date(), []);
246
251
  const [date, setDate] = useState<Date>(now);
@@ -261,6 +266,8 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
261
266
  const [winMonth, setWinMonth] = useState<boolean>(false);
262
267
 
263
268
  // modal dialog
269
+ const modalEditHandleRef = useRef<any>();
270
+ const modalDeleteHandleRef = useRef<any>();
264
271
  const EVENTS_ENABLED = typeof modalContent !== 'undefined';
265
272
  const EVENTS_DELETE_ENABLED = typeof modalDeleteContent !== 'undefined';
266
273
  const [showEdit, setShowEdit] = useState<boolean>(false);
@@ -303,7 +310,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
303
310
  // Find the first Monday in the sequence
304
311
  for (let i = 0; i < _res.length; i++) {
305
312
  const date = _res[i];
306
- if (date.getDay() === START_WEEK_ON) {
313
+ if (date.getDay() === START_WEEK_ON) {
307
314
  // Return dates starting from Monday onwards
308
315
  return dates.slice(i);
309
316
  }
@@ -331,12 +338,16 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
331
338
  // reset selection area
332
339
  setSelectedCells([]);
333
340
  setCopiedCells(null);
341
+ },
342
+ closeModal: () => {
343
+ if (modalEditHandleRef.current) modalEditHandleRef.current.close();
344
+ if (modalDeleteHandleRef.current) modalDeleteHandleRef.current.close();
334
345
  }
335
346
  }),
336
347
  [contentRef],
337
348
  );
338
349
 
339
-
350
+
340
351
 
341
352
  //================================================================
342
353
  // Monthly calendar
@@ -379,7 +390,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
379
390
  // Start selecting
380
391
  const handleTableMainCellMouseDown = (e: React.MouseEvent, row: number, col: number, colsOffset: number) => {
381
392
  const isMultiSelect = e.ctrlKey || e.metaKey; // Check whether the Ctrl or Command key is pressed
382
-
393
+
383
394
  setIsSelecting(true);
384
395
  setStartCell({ row, col });
385
396
 
@@ -392,9 +403,9 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
392
403
  if (isMultiSelect) {
393
404
  // Multi-select mode: Add or remove cells
394
405
  //++++++++++
395
- const cellExists = prevSelectedCells.some(({row: r, col: c}) => r === row && c === col);
406
+ const cellExists = prevSelectedCells.some(({ row: r, col: c }) => r === row && c === col);
396
407
  if (cellExists) {
397
- return prevSelectedCells.filter(({row: r, col: c}) => !(r === row && c === col));
408
+ return prevSelectedCells.filter(({ row: r, col: c }) => !(r === row && c === col));
398
409
  } else {
399
410
  return [...prevSelectedCells, {
400
411
  rowData: JSON.parse(_el.dataset.rowinfo),
@@ -440,7 +451,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
440
451
  const [minRow, maxRow] = [startCell.row, row].sort((a, b) => a - b);
441
452
  const [minCol, maxCol] = [startCell.col, col].sort((a, b) => a - b);
442
453
 
443
-
454
+
444
455
  for (let r = minRow; r <= maxRow; r++) {
445
456
  for (let c = minCol; c <= maxCol; c++) {
446
457
 
@@ -494,10 +505,10 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
494
505
 
495
506
  // Listen for copy
496
507
  if ((isMac && e.metaKey && e.key === 'c') || (!isMac && e.ctrlKey && e.key === 'c')) {
497
-
508
+
498
509
  if (selectedCells.length > 0) {
499
510
  // Gets the structure of the selected area
500
- const _selectedCellsCoordinates = selectedCells.map(({row: r, col: c}) => {
511
+ const _selectedCellsCoordinates = selectedCells.map(({ row: r, col: c }) => {
501
512
  return [r, c];
502
513
  });
503
514
 
@@ -526,7 +537,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
526
537
  if (col > maxCol) maxCol = col;
527
538
  }
528
539
  */
529
-
540
+
530
541
  // Calculate the offset and adjust the cell coordinates
531
542
  const adjustedCells = _selectedCellsCoordinates.map(([r, c]) => [r - minRow, c - minCol]);
532
543
 
@@ -550,16 +561,16 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
550
561
 
551
562
  // Listen for paste
552
563
  if ((isMac && e.metaKey && e.key === 'v') || (!isMac && e.ctrlKey && e.key === 'v')) {
553
-
564
+
554
565
 
555
566
  if (copiedCells && selectedCells.length > 0) {
556
- const {rowsTotal, colsTotal, forwardFillTotal} = getCells();
557
- const {row: targetRow, col: targetCol} = selectedCells[0]; // the first position
567
+ const { rowsTotal, colsTotal, forwardFillTotal } = getCells();
568
+ const { row: targetRow, col: targetCol } = selectedCells[0]; // the first position
558
569
  const newSelectedCellsCoordinates = copiedCells.cells.map(([r, c]) => [
559
570
  targetRow + r,
560
571
  targetCol + c
561
572
  ]).filter(([r, c]) => r < rowsTotal && c < colsTotal); // Make sure you don't go beyond the scope of the table
562
-
573
+
563
574
  // query date and row data
564
575
  const newSelectedCells: any[] = [];
565
576
  newSelectedCellsCoordinates.forEach((item: any[]) => {
@@ -570,7 +581,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
570
581
  date: curDateList[c - forwardFillTotal],
571
582
  row: r,
572
583
  col: c
573
- });
584
+ });
574
585
  });
575
586
 
576
587
 
@@ -618,7 +629,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
618
629
 
619
630
  // cell
620
631
  const getCells = (type: 'none' | 'forward' | 'back' = 'none') => {
621
-
632
+
622
633
 
623
634
  //########## MODE: WEEK #############
624
635
  if (appearanceMode === 'week') {
@@ -626,14 +637,14 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
626
637
  weekDates.forEach((date: Date, dayIndex: number) => {
627
638
  const _dayOfWeek = new Date(date).getDay();
628
639
  // ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
629
- const _daysIndicator = [7, 1, 2, 3, 4, 5, 6];
640
+ const _daysIndicator = [7, 1, 2, 3, 4, 5, 6];
630
641
  const _detail = getDateDetails(date);
631
642
  const {
632
643
  year: _temp_year,
633
644
  month: _temp_month,
634
645
  day: _temp_day
635
646
  } = _detail;
636
-
647
+
637
648
  curWeek.push({
638
649
  month: Number(_temp_month) - 1,
639
650
  startDay: _daysIndicator[_dayOfWeek],
@@ -650,13 +661,13 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
650
661
  }
651
662
  ],
652
663
  weekDisplay: [
653
- WEEK[_daysIndicator[_dayOfWeek]-1]
664
+ WEEK[_daysIndicator[_dayOfWeek] - 1]
654
665
  ],
655
666
  week: [
656
- _daysIndicator[_dayOfWeek]-1
667
+ _daysIndicator[_dayOfWeek] - 1
657
668
  ]
658
669
  });
659
-
670
+
660
671
  });
661
672
 
662
673
  return {
@@ -665,44 +676,44 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
665
676
  forwardFillTotal: 0,
666
677
  list: curWeek
667
678
  };
668
-
679
+
669
680
  }
670
681
  //########## /MODE: WEEK #############
671
682
 
672
-
683
+
673
684
 
674
685
  //########## MODE: MONTH #############
675
686
  if (appearanceMode === 'month') {
676
687
  let currentMonth: any = month;
677
688
  let currentStartDay: any = startDay;
678
-
689
+
679
690
  // previous month
680
691
  if (type === 'forward') {
681
692
  const _date = new Date(year, currentMonth - 1, day);
682
693
  currentMonth = _date.getMonth();
683
694
  currentStartDay = getStartDayOfMonth(_date);
684
695
  }
685
-
696
+
686
697
  // next month
687
698
  if (type === 'back') {
688
699
  const _date = new Date(year, currentMonth + 1, day);
689
700
  currentMonth = _date.getMonth();
690
701
  currentStartDay = getStartDayOfMonth(_date);
691
702
  }
692
-
693
-
703
+
704
+
694
705
  //
695
706
  const allDays = Array(days[currentMonth] + (currentStartDay - 1)).fill(null).map((_: any, i: number) => i); // [0,1,..,30,31]
696
707
  const rows = Math.ceil(allDays.length / 7); // 5
697
-
708
+
698
709
  //
699
710
  const _tempCells: any[] = Array.from({ length: rows }).fill(null);
700
-
711
+
701
712
  const _getForwardFill = (_year: number, _month: number) => {
702
713
  // Get the last day of the previous month
703
714
  const lastDayOfLastMonth = new Date(_year, _month - 1, 0);
704
715
  const last7Days: Date[] = [];
705
-
716
+
706
717
  // Rewind 7 days forward from the last day
707
718
  for (let i = 0; i < 7; i++) {
708
719
  last7Days.unshift(new Date(lastDayOfLastMonth));
@@ -710,81 +721,81 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
710
721
  }
711
722
  return last7Days.map((v: Date) => getCalendarDate(v));
712
723
  };
713
-
724
+
714
725
  const _getBackFill = (_year: number, _month: number) => {
715
726
  // Get the first day of the next month
716
727
  const firstDayOfNextMonth = new Date(_year, _month, 1);
717
728
  const first7Days: Date[] = [];
718
-
729
+
719
730
  // Rewind 7 days forward from the first day of the next month
720
731
  for (let i = 0; i < 7; i++) {
721
732
  first7Days.push(new Date(firstDayOfNextMonth));
722
733
  firstDayOfNextMonth.setDate(firstDayOfNextMonth.getDate() + 1);
723
734
  }
724
-
735
+
725
736
  return first7Days.map((v: Date) => getCalendarDate(v));
726
737
  };
727
-
728
-
738
+
739
+
729
740
 
730
741
  // The remaining date of the previous month
731
742
  // If the number is 7, the calendar does not include the date of the previous month
732
- const remainPrevDate = findMondayAndTruncate(_getForwardFill(year, month+1));
743
+ const remainPrevDate = findMondayAndTruncate(_getForwardFill(year, month + 1));
733
744
  const remainPrevDateTotal = remainPrevDate.length === 7 ? 0 : remainPrevDate.length;
734
745
 
735
-
746
+
736
747
  return {
737
748
  rowsTotal: orginalData.length,
738
749
  colsTotal: allDays.length,
739
750
  forwardFillTotal: remainPrevDateTotal,
740
751
  list: _tempCells.map((_: any, j: number) => {
741
752
  const _col = allDays.slice(j * 7, (j + 1) * 7);
742
-
753
+
743
754
  // back fill
744
755
  const backFillArr: null[] = [];
745
756
  for (let k = 0; k < 7 - _col.length; k++) {
746
757
  backFillArr.push(null);
747
758
  }
748
759
  _col.splice(_col.length, 0, ...backFillArr as any);
749
-
750
-
760
+
761
+
751
762
  //
752
763
  const isFirstGroup = j === 0;
753
764
  const isLastGroup = j === _tempCells.length - 1;
754
-
755
-
765
+
766
+
756
767
  // forward fill
757
- const __forwardFillDate: string[] = _getForwardFill(year, month+1);
758
-
768
+ const __forwardFillDate: string[] = _getForwardFill(year, month + 1);
769
+
759
770
  // back fill
760
- const __backFillDate: string[] = _getBackFill(year, month+1);
761
-
762
-
771
+ const __backFillDate: string[] = _getBackFill(year, month + 1);
772
+
773
+
763
774
  const _getDateShow = (_dayIndex: number, _m: number, _startDay: number, _month: number) => {
764
775
  const currentDay = typeof _dayIndex === 'number' ? _dayIndex - (_startDay - 2) : 0; // ..., -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, ...
765
-
776
+
766
777
  // date
767
778
  let _dateShow: any = currentDay > 0 ? `${year}-${_month + 1}-${currentDay}` : '';
768
-
779
+
769
780
  // forward & back
770
- if (isFirstGroup && _dateShow === '') {
771
- _dateShow = __forwardFillDate.at(currentDay-1);
781
+ if (isFirstGroup && _dateShow === '') {
782
+ _dateShow = __forwardFillDate.at(currentDay - 1);
772
783
  }
773
-
784
+
774
785
  if (isLastGroup && _dateShow === '') {
775
786
  _dateShow = __backFillDate.at(_m);
776
787
  }
777
-
778
-
788
+
789
+
779
790
  return {
780
791
  date: getCalendarDate(_dateShow),
781
792
  firstGroup: isFirstGroup,
782
793
  lastGroup: isLastGroup,
783
794
  validDisplayDate: currentDay > 0 && currentDay <= days[month]
784
795
  };
785
-
796
+
786
797
  }
787
-
798
+
788
799
  //
789
800
  return {
790
801
  month: currentMonth,
@@ -801,12 +812,12 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
801
812
  week: _col.map((k: number, m: number) => {
802
813
  return m
803
814
  }),
804
-
815
+
805
816
  }
806
817
  })
807
818
  };
808
-
809
-
819
+
820
+
810
821
  }
811
822
  //########## /MODE: MONTH #############
812
823
 
@@ -834,7 +845,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
834
845
  if (_rowData[0]) {
835
846
  const _items = _rowData[0].list;
836
847
 
837
-
848
+
838
849
  if (tableCellId === -1) {
839
850
  // add new
840
851
  _currentData = {
@@ -849,7 +860,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
849
860
 
850
861
  }
851
862
 
852
- return _rowData[0] ? _currentData: {
863
+ return _rowData[0] ? _currentData : {
853
864
  rowData: curRowData.listSection,
854
865
  id: 0,
855
866
  date: getCalendarDate(curDate)
@@ -1052,7 +1063,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1052
1063
 
1053
1064
  }
1054
1065
  //########## /MODE: MONTH #############
1055
-
1066
+
1056
1067
 
1057
1068
  }
1058
1069
 
@@ -1093,8 +1104,8 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1093
1104
  });
1094
1105
  }
1095
1106
  //########## /MODE: MONTH #############
1096
-
1097
-
1107
+
1108
+
1098
1109
  }
1099
1110
  function handleDayChange(e: React.MouseEvent, currentDay: number) {
1100
1111
  setDate(new Date(year, month, currentDay));
@@ -1169,7 +1180,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1169
1180
  onChangeAppearanceMode?.(_mode);
1170
1181
  }
1171
1182
 
1172
-
1183
+
1173
1184
 
1174
1185
 
1175
1186
  function handleShowWinYear() {
@@ -1207,11 +1218,11 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1207
1218
  // colIndex
1208
1219
  let colIndex = 0;
1209
1220
 
1210
- const {forwardFillTotal, list: cellsList} = getCells();
1221
+ const { forwardFillTotal, list: cellsList } = getCells();
1211
1222
  return cellsList.map((item: any, j: number) => {
1212
1223
 
1213
1224
 
1214
-
1225
+
1215
1226
  return item.col.map((dayIndex: number, i: number) => {
1216
1227
 
1217
1228
  colIndex++;
@@ -1234,8 +1245,8 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1234
1245
  const isInteractive = item.dateInfo[i].validDisplayDate; // The date on which the user interaction can occur, e.g. click, modify
1235
1246
  const isForward = item.dateInfo[i].firstGroup && !isInteractive;
1236
1247
  const isBack = item.dateInfo[i].lastGroup && !isInteractive;
1237
-
1238
-
1248
+
1249
+
1239
1250
  // days
1240
1251
  //------
1241
1252
  if (!showEvents) {
@@ -1310,9 +1321,9 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1310
1321
  }}
1311
1322
  >
1312
1323
 
1313
-
1324
+
1314
1325
  {/* forward fill & day & back fill */}
1315
- <div
1326
+ <div
1316
1327
  className={combinedCls(
1317
1328
  'custom-event-tl-table__cell-cushion custom-event-tl-table__cell-cushion-headercontent',
1318
1329
  {
@@ -1374,7 +1385,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1374
1385
  `custom-event-tl-table__cell-cushion-content__item custom-event-tl-table__cell-cushion-content__item-${cellItemIndex}`,
1375
1386
  {
1376
1387
  'first': cellItemIndex === 0,
1377
- 'last': cellItemIndex === _items.length-1
1388
+ 'last': cellItemIndex === _items.length - 1
1378
1389
  }
1379
1390
  )}
1380
1391
  key={`cell-item-${rowIndex}-${cellItemIndex}}`}
@@ -1455,10 +1466,10 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1455
1466
  <div
1456
1467
  className={`custom-event-tl__day__eventdel ${cellCloseBtnClassName || ''}`}
1457
1468
  >
1458
- <a
1459
- href="#"
1460
- tabIndex={-1}
1461
- className="align-middle"
1469
+ <a
1470
+ href="#"
1471
+ tabIndex={-1}
1472
+ className="align-middle"
1462
1473
  data-date={_dateShow}
1463
1474
  data-day={_dateDayShow}
1464
1475
  data-week={weekDay}
@@ -1498,7 +1509,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1498
1509
  }
1499
1510
 
1500
1511
 
1501
-
1512
+
1502
1513
  }}
1503
1514
  >
1504
1515
  {_delBtn()}
@@ -1510,7 +1521,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1510
1521
  });
1511
1522
  };
1512
1523
 
1513
-
1524
+
1514
1525
 
1515
1526
  const _tdContent = () => {
1516
1527
 
@@ -1553,10 +1564,10 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1553
1564
  onChangeDate?.(e, null);
1554
1565
  }
1555
1566
 
1556
-
1567
+
1557
1568
  if (multipleCells) handleTableMainCellMouseDown(e, rowIndex, dayIndex, forwardFillTotal);
1558
1569
  }}
1559
-
1570
+
1560
1571
  onDoubleClick={(e: React.MouseEvent) => {
1561
1572
  //
1562
1573
  onCellDoubleClick?.(e, {
@@ -1576,7 +1587,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1576
1587
 
1577
1588
 
1578
1589
  {/* forward fill & day & back fill */}
1579
- <div
1590
+ <div
1580
1591
  className={combinedCls(
1581
1592
  'custom-event-tl-table__cell-cushion custom-event-tl-table__cell-cushion-content',
1582
1593
  {
@@ -1585,9 +1596,9 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1585
1596
  )}
1586
1597
  style={{ width: (CELL_MIN_W - 1) + 'px' }}
1587
1598
  >
1588
-
1599
+
1589
1600
  {/*++++++++++++++++ EVENT ++++++++++++++++*/}
1590
- {_eventContent() || <><i style={{userSelect: 'none'}}>&nbsp;</i></>}
1601
+ {_eventContent() || <><i style={{ userSelect: 'none' }}>&nbsp;</i></>}
1591
1602
  {/*++++++++++++++++ /EVENT ++++++++++++++++*/}
1592
1603
 
1593
1604
  {/* ADD BUTTON */}
@@ -1595,10 +1606,10 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1595
1606
  <div
1596
1607
  className={`custom-event-tl__day__eventadd ${cellAddBtnClassName || ''}`}
1597
1608
  >
1598
- <a
1599
- href="#"
1600
- tabIndex={-1}
1601
- className="align-middle"
1609
+ <a
1610
+ href="#"
1611
+ tabIndex={-1}
1612
+ className="align-middle"
1602
1613
  data-date={_dateShow}
1603
1614
  data-day={_dateDayShow}
1604
1615
  data-week={weekDay}
@@ -1644,7 +1655,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1644
1655
  </>}
1645
1656
  {/* /ADD BUTTON */}
1646
1657
  </div>
1647
-
1658
+
1648
1659
 
1649
1660
  </td>;
1650
1661
  };
@@ -1668,7 +1679,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1668
1679
 
1669
1680
  function generateColUi() {
1670
1681
 
1671
- {/* //########## MODE: WEEK ############# */}
1682
+ {/* //########## MODE: WEEK ############# */ }
1672
1683
  if (appearanceMode === 'week') {
1673
1684
  return Array.from({ length: 7 }).fill(0).map((item: any, i: number) => {
1674
1685
  return (
@@ -1683,10 +1694,10 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1683
1694
  })
1684
1695
  }
1685
1696
 
1686
- {/* //########## /MODE: WEEK ############# */}
1697
+ {/* //########## /MODE: WEEK ############# */ }
1687
1698
 
1688
1699
 
1689
- {/* //########## MODE: MONTH ############# */}
1700
+ {/* //########## MODE: MONTH ############# */ }
1690
1701
  if (appearanceMode === 'month') {
1691
1702
  if (FILL_BLANK_DATE_DISABLD) {
1692
1703
  return Array.from({ length: days[month] }).fill(0).map((item: any, i: number) => {
@@ -1705,7 +1716,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1705
1716
  // colIndex
1706
1717
  let colIndex = 0;
1707
1718
 
1708
- const {forwardFillTotal, list: cellsList} = getCells();
1719
+ const { forwardFillTotal, list: cellsList } = getCells();
1709
1720
  return cellsList.map((item: any, j: number) => {
1710
1721
  return item.col.map((dayIndex: number | null, i: number) => {
1711
1722
 
@@ -1713,7 +1724,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1713
1724
 
1714
1725
  // helper
1715
1726
  const isInteractive = item.dateInfo[i].validDisplayDate; // The date on which the user interaction can occur, e.g. click, modify
1716
-
1727
+
1717
1728
  return (
1718
1729
  <col
1719
1730
  className={combinedCls(
@@ -1733,9 +1744,9 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1733
1744
 
1734
1745
 
1735
1746
  })
1736
- }
1747
+ }
1737
1748
  }
1738
- {/* //########## /MODE: MONTH ############# */}
1749
+ {/* //########## /MODE: MONTH ############# */ }
1739
1750
 
1740
1751
 
1741
1752
 
@@ -1795,7 +1806,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1795
1806
  if (tableGridRef.current === null) return;
1796
1807
 
1797
1808
  const tableGridEl: any = tableGridRef.current;
1798
-
1809
+
1799
1810
  // initialize cell height
1800
1811
  const headerTitleTrElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__title tbody').getElementsByTagName('tr');
1801
1812
  const trElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody').getElementsByTagName('tr');
@@ -1810,14 +1821,26 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1810
1821
  }
1811
1822
 
1812
1823
  }
1824
+
1825
+
1826
+ function outerWrapperInit() {
1827
+ if (rootRef.current === null) return;
1828
+
1829
+ // calculate wrapper width
1830
+ const wrapperWidth = rootRef.current.parentElement?.offsetWidth || 0;
1831
+ if (rootRef.current && wrapperWidth > 0 && rootWidth.current === 0) {
1832
+ rootWidth.current = wrapperWidth;
1833
+ rootRef.current.style.width = wrapperWidth + 'px';
1834
+ }
1835
+ }
1836
+
1813
1837
 
1814
-
1815
1838
  function tableGridInit() {
1816
1839
 
1817
1840
  //
1818
1841
  if (tableGridRef.current === null) return;
1819
1842
 
1820
- const {forwardFillTotal, list: cellsList} = getCells();
1843
+ const { forwardFillTotal, list: cellsList } = getCells();
1821
1844
  const tableGridEl: any = tableGridRef.current;
1822
1845
  let _curCellMinWidth: number = CELL_MIN_W;
1823
1846
  let _curColCount: number = FILL_BLANK_DATE_DISABLD ? days[month] : 7 * cellsList.length;
@@ -1826,7 +1849,6 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1826
1849
  if (appearanceMode === 'week') {
1827
1850
  _curColCount = 7;
1828
1851
  }
1829
-
1830
1852
 
1831
1853
  //****************
1832
1854
  // STEP 1-1:
@@ -1840,7 +1862,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1840
1862
  const tableBorderWidth = 4;
1841
1863
  const scrollMaxWidth = tableMaxWidth - tableHeaderTitleWidth - tableDividerWidth - tableBorderWidth;
1842
1864
 
1843
- _curCellMinWidth = scrollMaxWidth/7;
1865
+ _curCellMinWidth = scrollMaxWidth / 7;
1844
1866
  _curColCount = 7;
1845
1867
 
1846
1868
  // header
@@ -1848,10 +1870,10 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1848
1870
  node.style.width = _curCellMinWidth + 'px';
1849
1871
  });
1850
1872
 
1851
-
1873
+
1852
1874
  }
1853
-
1854
-
1875
+
1876
+
1855
1877
 
1856
1878
  //****************
1857
1879
  // STEP 1-2:
@@ -1874,18 +1896,18 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1874
1896
  if (curHeaderThContent !== null) curHeaderThContent.style.width = _curCellMinWidth + 'px';
1875
1897
  }
1876
1898
 
1877
-
1899
+
1878
1900
  const mainTdContentContainers: any = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody').getElementsByTagName('td');
1879
1901
  for (let i = 0; i < mainTdContentContainers.length; i++) {
1880
1902
  const curHeaderThContent = mainTdContentContainers[i].querySelector('.custom-event-tl-table__cell-cushion-content');
1881
1903
  if (curHeaderThContent !== null) curHeaderThContent.style.width = _curCellMinWidth + 'px';
1882
1904
  }
1883
-
1905
+
1884
1906
  const mainTdContentCols: any = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content colgroup').getElementsByTagName('col')
1885
1907
  for (let i = 0; i < mainTdContentCols.length; i++) {
1886
1908
  mainTdContentCols[i].style.minWidth = _curCellMinWidth + 'px';
1887
1909
  }
1888
-
1910
+
1889
1911
 
1890
1912
  //****************
1891
1913
  // STEP 2:
@@ -1917,7 +1939,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1917
1939
 
1918
1940
  }
1919
1941
  });
1920
-
1942
+
1921
1943
 
1922
1944
  //****************
1923
1945
  // STEP 3:
@@ -2009,7 +2031,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
2009
2031
  }
2010
2032
 
2011
2033
  });
2012
-
2034
+
2013
2035
 
2014
2036
 
2015
2037
  //****************
@@ -2031,7 +2053,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
2031
2053
  const tableBorderWidth = 4;
2032
2054
  const scrollMaxWidth = tableMaxWidth - tableHeaderTitleWidth - tableDividerWidth - tableBorderWidth;
2033
2055
 
2034
- _curCellMinWidth = scrollMaxWidth/7;
2056
+ _curCellMinWidth = scrollMaxWidth / 7;
2035
2057
  _curColCount = 7;
2036
2058
 
2037
2059
  // header content
@@ -2059,13 +2081,13 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
2059
2081
  //--------------
2060
2082
  const _scrollableWrapper = tableGridEl.querySelectorAll('.custom-event-tl-table__scroller-harness');
2061
2083
  [].slice.call(_scrollableWrapper).forEach((el: any) => {
2062
-
2084
+
2063
2085
  const _content = el.querySelector('.custom-event-tl-table__scroller');
2064
2086
  el.removeAttribute('data-width');
2065
2087
  el.removeAttribute('style');
2066
2088
  _content.removeAttribute('style');
2067
2089
  });
2068
-
2090
+
2069
2091
 
2070
2092
  // initialize cell height
2071
2093
  //--------------
@@ -2114,7 +2136,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
2114
2136
 
2115
2137
  useEffect(() => {
2116
2138
 
2117
- const {forwardFillTotal, list: cellsList} = getCells();
2139
+ const { forwardFillTotal, list: cellsList } = getCells();
2118
2140
  if (typeof appearanceWeekTmpl === 'function') {
2119
2141
  setDisplayWeekForHeader([cellsList.at(0).dateInfo[0].date, cellsList.at(-1).dateInfo[0].date]);
2120
2142
  } else {
@@ -2140,11 +2162,16 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
2140
2162
  }, [eventsValue, customTodayDate, appearanceMode]);
2141
2163
 
2142
2164
 
2143
-
2165
+
2144
2166
  useEffect(() => {
2145
2167
 
2146
2168
 
2169
+ // calculate wrapper width (!!!FIRST!!!)
2170
+ //--------------
2171
+ outerWrapperInit();
2172
+
2147
2173
  // !!!Please do not use dependencies
2174
+ //--------------
2148
2175
  return () => {
2149
2176
 
2150
2177
  // reset table grid
@@ -2159,357 +2186,364 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
2159
2186
  return (
2160
2187
  <>
2161
2188
 
2162
- {/*/////////////////////////////////////////////////// */}
2163
- {/*//////////////////// Calendar //////////////////// */}
2164
- {/*////////////////////////////////////////////////// */}
2189
+ <div
2190
+ ref={rootRef}
2191
+ className="custom-event-tl__outerwrapper"
2192
+ >
2193
+
2194
+ {/*/////////////////////////////////////////////////// */}
2195
+ {/*//////////////////// Calendar //////////////////// */}
2196
+ {/*////////////////////////////////////////////////// */}
2197
+
2198
+ <div className={combinedCls(
2199
+ `custom-event-tl__wrapper custom-event-tl__wrapper--${appearanceMode}`,
2200
+ calendarWrapperClassName
2201
+ )}>
2202
+
2203
+ {/*++++++++++++++++ MAIN ++++++++++++++++*/}
2204
+ <div className="custom-event-tl__header bg-body-tertiary">
2205
+ <button tabIndex={-1} type="button" className="custom-event-tl__btn custom-event-tl__btn--prev" onClick={handlePrevChange}>
2206
+ <svg width="20px" height="20px" viewBox="0 0 24 24" fill="none">
2207
+ <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" />
2208
+ </svg>
2209
+ </button>
2165
2210
 
2166
- <div className={combinedCls(
2167
- `custom-event-tl__wrapper custom-event-tl__wrapper--${appearanceMode}`,
2168
- calendarWrapperClassName
2169
- )}>
2170
-
2171
- {/*++++++++++++++++ MAIN ++++++++++++++++*/}
2172
- <div className="custom-event-tl__header bg-body-tertiary">
2173
- <button tabIndex={-1} type="button" className="custom-event-tl__btn custom-event-tl__btn--prev" onClick={handlePrevChange}>
2174
- <svg width="20px" height="20px" viewBox="0 0 24 24" fill="none">
2175
- <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" />
2176
- </svg>
2177
- </button>
2178
-
2179
- {/* //########## MODE: WEEK ############# */}
2180
- {appearanceMode === 'week' ? <>
2181
- <div className="custom-event-tl__header__info">
2182
- {typeof appearanceWeekTmpl === 'function' ? <>{appearanceWeekTmpl(displayWeekForHeader[0], displayWeekForHeader[1])}</> : <>{displayWeekForHeader[0]} - {displayWeekForHeader[1]}</>}
2183
- </div>
2184
- </> : null}
2185
- {/* //########## /MODE: WEEK ############# */}
2211
+ {/* //########## MODE: WEEK ############# */}
2212
+ {appearanceMode === 'week' ? <>
2213
+ <div className="custom-event-tl__header__info">
2214
+ {typeof appearanceWeekTmpl === 'function' ? <>{appearanceWeekTmpl(displayWeekForHeader[0], displayWeekForHeader[1])}</> : <>{displayWeekForHeader[0]} - {displayWeekForHeader[1]}</>}
2215
+ </div>
2216
+ </> : null}
2217
+ {/* //########## /MODE: WEEK ############# */}
2218
+
2219
+
2220
+ {/* //########## MODE: MONTH ############# */}
2221
+ {appearanceMode === 'month' ? <>
2222
+ <div className="custom-event-tl__header__btns">
2223
+ <button tabIndex={-1} type="button" className={`custom-event-tl__btn ${winMonth ? 'active' : ''}`} onClick={handleShowWinMonth}>
2224
+ {MONTHS[month]}
2225
+ <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>
2226
+ </button>
2227
+ <button tabIndex={-1} type="button" className={`custom-event-tl__btn ${winYear ? 'active' : ''}`} onClick={handleShowWinYear}>
2228
+ {year}
2229
+ <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>
2230
+ </button>
2231
+ </div>
2232
+ </> : null}
2233
+ {/* //########## /MODE: MONTH ############# */}
2186
2234
 
2187
2235
 
2188
- {/* //########## MODE: MONTH ############# */}
2189
- {appearanceMode === 'month' ? <>
2190
- <div className="custom-event-tl__header__btns">
2191
- <button tabIndex={-1} type="button" className={`custom-event-tl__btn ${winMonth ? 'active' : ''}`} onClick={handleShowWinMonth}>
2192
- {MONTHS[month]}
2193
- <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>
2194
- </button>
2195
- <button tabIndex={-1} type="button" className={`custom-event-tl__btn ${winYear ? 'active' : ''}`} onClick={handleShowWinYear}>
2196
- {year}
2197
- <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>
2198
- </button>
2199
- </div>
2200
- </> : null}
2201
- {/* //########## /MODE: MONTH ############# */}
2202
2236
 
2237
+ <button tabIndex={-1} type="button" className="custom-event-tl__btn custom-event-tl__btn--next" onClick={handleNextChange}>
2238
+ <svg width="20px" height="20px" viewBox="0 0 24 24" fill="none">
2239
+ <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" />
2240
+ </svg>
2241
+ </button>
2242
+ </div>
2203
2243
 
2204
-
2205
- <button tabIndex={-1} type="button" className="custom-event-tl__btn custom-event-tl__btn--next" onClick={handleNextChange}>
2206
- <svg width="20px" height="20px" viewBox="0 0 24 24" fill="none">
2207
- <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" />
2208
- </svg>
2209
- </button>
2210
- </div>
2211
2244
 
2212
2245
 
2246
+ <div className="custom-event-tl__body">
2213
2247
 
2214
- <div className="custom-event-tl__body">
2215
2248
 
2249
+ <div className="custom-event-tl__row">
2250
+ {/* day */}
2216
2251
 
2217
- <div className="custom-event-tl__row">
2218
- {/* day */}
2252
+ {/* /day */}
2253
+ </div>
2219
2254
 
2220
- {/* /day */}
2221
2255
  </div>
2222
-
2223
- </div>
2224
- {/*++++++++++++++++ /MAIN ++++++++++++++++*/}
2225
-
2226
-
2227
- {/*++++++++++++++++ MONTH SELECTION TAB ++++++++++++++++*/}
2228
- <div className={`custom-event-tl__month-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winMonth ? 'active' : ''}`}>
2229
- <div className="custom-event-tl__month-container">
2230
- {MONTHS_FULL.map((month, index) => {
2231
- return <div
2232
- data-month={padZero(index + 1)}
2233
- className={`custom-event-tl__month ${selectedMonth === index ? ' selected' : ''}`}
2234
- key={month + index}
2235
- onClick={() => { handleMonthChange(index) }}
2236
- >{month}</div>
2237
- })}
2256
+ {/*++++++++++++++++ /MAIN ++++++++++++++++*/}
2257
+
2258
+
2259
+ {/*++++++++++++++++ MONTH SELECTION TAB ++++++++++++++++*/}
2260
+ <div className={`custom-event-tl__month-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winMonth ? 'active' : ''}`}>
2261
+ <div className="custom-event-tl__month-container">
2262
+ {MONTHS_FULL.map((month, index) => {
2263
+ return <div
2264
+ data-month={padZero(index + 1)}
2265
+ className={`custom-event-tl__month ${selectedMonth === index ? ' selected' : ''}`}
2266
+ key={month + index}
2267
+ onClick={() => { handleMonthChange(index) }}
2268
+ >{month}</div>
2269
+ })}
2270
+ </div>
2238
2271
  </div>
2239
- </div>
2240
- {/*++++++++++++++++ /MONTH SELECTION TAB ++++++++++++++++*/}
2272
+ {/*++++++++++++++++ /MONTH SELECTION TAB ++++++++++++++++*/}
2273
+
2274
+ {/*++++++++++++++++ YEAR SELECTION TAB ++++++++++++++++*/}
2275
+ <div className={`custom-event-tl__year-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winYear ? 'active' : ''}`}>
2276
+ <div className="custom-event-tl__year-container bg-body-tertiary">
2277
+ {yearsArray.map((year, index) => {
2278
+ return <div
2279
+ data-year={year}
2280
+ className={`custom-event-tl__year ${selectedYear === year ? ' selected' : ''}`}
2281
+ key={year + index}
2282
+ onClick={() => { handleYearChange(year) }}
2283
+ >{year}</div>
2284
+ })}
2285
+ </div>
2241
2286
 
2242
- {/*++++++++++++++++ YEAR SELECTION TAB ++++++++++++++++*/}
2243
- <div className={`custom-event-tl__year-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winYear ? 'active' : ''}`}>
2244
- <div className="custom-event-tl__year-container bg-body-tertiary">
2245
- {yearsArray.map((year, index) => {
2246
- return <div
2247
- data-year={year}
2248
- className={`custom-event-tl__year ${selectedYear === year ? ' selected' : ''}`}
2249
- key={year + index}
2250
- onClick={() => { handleYearChange(year) }}
2251
- >{year}</div>
2252
- })}
2253
2287
  </div>
2288
+ {/*++++++++++++++++ /YEAR SELECTION TAB ++++++++++++++++*/}
2254
2289
 
2255
- </div>
2256
- {/*++++++++++++++++ /YEAR SELECTION TAB ++++++++++++++++*/}
2257
2290
 
2258
2291
 
2259
-
2260
- {/*++++++++++++++++ TODAY SELECTION TAB ++++++++++++++++*/}
2261
- <div className="custom-event-tl__today-wrapper p-2">
2262
- <button
2263
- tabIndex={-1}
2264
- type="button"
2265
- className="custom-event-tl__btn custom-event-tl__btn--today"
2266
- onClick={handleTodayChange}
2267
- >
2268
- {langToday || 'Today'}
2269
- </button>
2270
-
2271
- {appearanceToggle ? <>
2272
- <button
2273
- tabIndex={-1}
2274
- type="button"
2275
- className={`custom-event-tl__btn custom-event-tl__btn--appearance ${appearanceMode === 'month' ? 'active' : ''}`}
2276
- data-mode="month"
2277
- onClick={handleAppearanceChange}
2292
+ {/*++++++++++++++++ TODAY SELECTION TAB ++++++++++++++++*/}
2293
+ <div className="custom-event-tl__today-wrapper p-2">
2294
+ <button
2295
+ tabIndex={-1}
2296
+ type="button"
2297
+ className="custom-event-tl__btn custom-event-tl__btn--today"
2298
+ onClick={handleTodayChange}
2278
2299
  >
2279
- {langAppearanceLabelMonth || 'Month'}
2300
+ {langToday || 'Today'}
2280
2301
  </button>
2281
- <button
2282
- tabIndex={-1}
2283
- type="button"
2284
- className={`custom-event-tl__btn custom-event-tl__btn--appearance ${appearanceMode === 'week' ? 'active' : ''}`}
2285
- data-mode="week"
2286
- onClick={handleAppearanceChange}
2287
- >
2288
- {langAppearanceLabelWeek || 'Week'}
2289
- </button>
2290
- </> : null}
2291
-
2292
- </div>
2293
- {/*++++++++++++++++ /TODAY SELECTION TAB ++++++++++++++++*/}
2294
2302
 
2303
+ {appearanceToggle ? <>
2304
+ <button
2305
+ tabIndex={-1}
2306
+ type="button"
2307
+ className={`custom-event-tl__btn custom-event-tl__btn--appearance ${appearanceMode === 'month' ? 'active' : ''}`}
2308
+ data-mode="month"
2309
+ onClick={handleAppearanceChange}
2310
+ >
2311
+ {langAppearanceLabelMonth || 'Month'}
2312
+ </button>
2313
+ <button
2314
+ tabIndex={-1}
2315
+ type="button"
2316
+ className={`custom-event-tl__btn custom-event-tl__btn--appearance ${appearanceMode === 'week' ? 'active' : ''}`}
2317
+ data-mode="week"
2318
+ onClick={handleAppearanceChange}
2319
+ >
2320
+ {langAppearanceLabelWeek || 'Week'}
2321
+ </button>
2322
+ </> : null}
2295
2323
 
2296
- </div>{/* /.custom-event-tl__wrapper */}
2324
+ </div>
2325
+ {/*++++++++++++++++ /TODAY SELECTION TAB ++++++++++++++++*/}
2297
2326
 
2298
2327
 
2328
+ </div>{/* /.custom-event-tl__wrapper */}
2299
2329
 
2300
- {/*/////////////////////////////////////////////////// */}
2301
- {/*//////////////////// Table Grid //////////////////// */}
2302
- {/*////////////////////////////////////////////////// */}
2303
- {orginalData.length === 0 ? null : <>
2304
- <div
2305
- ref={tableGridRef}
2306
- className={combinedCls(
2307
- `custom-event-tl-table__timeline-table__wrapper custom-event-tl-table__timeline-table__wrapper--${appearanceMode} invisible`,
2308
- tableWrapperClassName
2309
- )}
2310
- onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {
2311
- onKeyPressed?.(e, selectedCells);
2312
-
2313
- // Copy & Paste
2314
- handleWrapperKeyDown(e);
2315
- }}
2316
- tabIndex={-1} // require "tabIndex" attribute
2317
- >
2318
- <table role="grid" className={combinedCls(
2319
- "custom-event-tl-table__timeline-table",
2320
- tableClassName
2321
- )}>
2322
- <colgroup>
2323
- <col className="custom-event-tl-table__datagrid-header" />
2324
- <col />
2325
- <col />
2326
- </colgroup>
2327
-
2328
- <thead className={combinedCls(
2329
- tableHeadClassName
2330
+
2331
+
2332
+ {/*/////////////////////////////////////////////////// */}
2333
+ {/*//////////////////// Table Grid //////////////////// */}
2334
+ {/*////////////////////////////////////////////////// */}
2335
+ {orginalData.length === 0 ? null : <>
2336
+ <div
2337
+ ref={tableGridRef}
2338
+ className={combinedCls(
2339
+ `custom-event-tl-table__timeline-table__wrapper custom-event-tl-table__timeline-table__wrapper--${appearanceMode} invisible`,
2340
+ tableWrapperClassName
2330
2341
  )}
2331
- ref={tableGridHeaderRef}
2332
- role="rowgroup"
2333
- >
2334
- <tr role="presentation">
2335
- <th role="presentation">
2336
- {/*<!--///// HEADER LEFT //////-->*/}
2337
- <div className="custom-event-tl-table__timeline-header custom-event-tl-table__timeline-headertitle">
2338
-
2339
- <table role="presentation" className="custom-event-tl-table__datagrid-header__title">
2340
- <colgroup>
2341
- <col />
2342
- </colgroup>
2343
- <thead role="presentation">
2344
- <tr role="row">
2345
- <th role="columnheader">
2346
- <div className="custom-event-tl-table__cell-cushion custom-event-tl-table__cell-cushion-headertitle">
2347
- {tableListSectionTitle || ''}
2348
- </div>
2349
- </th>
2350
- </tr>
2351
- </thead>
2352
- </table>
2342
+ onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {
2343
+ onKeyPressed?.(e, selectedCells);
2353
2344
 
2354
- </div>
2355
- {/*<!--///// /HEADER LEFT //////-->*/}
2345
+ // Copy & Paste
2346
+ handleWrapperKeyDown(e);
2347
+ }}
2348
+ tabIndex={-1} // require "tabIndex" attribute
2349
+ >
2350
+ <table role="grid" className={combinedCls(
2351
+ "custom-event-tl-table__timeline-table",
2352
+ tableClassName
2353
+ )}>
2354
+ <colgroup>
2355
+ <col className="custom-event-tl-table__datagrid-header" />
2356
+ <col />
2357
+ <col />
2358
+ </colgroup>
2359
+
2360
+ <thead className={combinedCls(
2361
+ tableHeadClassName
2362
+ )}
2363
+ ref={tableGridHeaderRef}
2364
+ role="rowgroup"
2365
+ >
2366
+ <tr role="presentation">
2367
+ <th role="presentation">
2368
+ {/*<!--///// HEADER LEFT //////-->*/}
2369
+ <div className="custom-event-tl-table__timeline-header custom-event-tl-table__timeline-headertitle">
2356
2370
 
2371
+ <table role="presentation" className="custom-event-tl-table__datagrid-header__title">
2372
+ <colgroup>
2373
+ <col />
2374
+ </colgroup>
2375
+ <thead role="presentation">
2376
+ <tr role="row">
2377
+ <th role="columnheader">
2378
+ <div className="custom-event-tl-table__cell-cushion custom-event-tl-table__cell-cushion-headertitle">
2379
+ {tableListSectionTitle || ''}
2380
+ </div>
2381
+ </th>
2382
+ </tr>
2383
+ </thead>
2384
+ </table>
2357
2385
 
2386
+ </div>
2387
+ {/*<!--///// /HEADER LEFT //////-->*/}
2358
2388
 
2359
- </th>
2360
- <th role="presentation" className="custom-event-tl-table__timeline-divider"><div></div></th>
2361
- <th role="presentation">
2362
- <div
2363
- ref={scrollHeaderRef}
2364
- className="custom-event-tl-table__scroller-harness custom-event-tl-table__scroller-harness--hide"
2365
- data-scroll="header"
2366
- onScroll={syncTableScrollHeader}
2367
- >
2368
- <div className="custom-event-tl-table__scroller">
2369
2389
 
2370
- {/*<!--///// HEADER RIGHT //////-->*/}
2371
- <div className="custom-event-tl-table__timeline-header">
2372
2390
 
2373
- <table className="custom-event-tl-table__datagrid-header__content custom-event-tl-table__scrollgrid-sync-table" >
2374
- <tbody>
2375
- <tr>
2376
- {generateDaysUi()}
2377
- </tr>
2378
- </tbody>
2379
- </table>
2391
+ </th>
2392
+ <th role="presentation" className="custom-event-tl-table__timeline-divider"><div></div></th>
2393
+ <th role="presentation">
2394
+ <div
2395
+ ref={scrollHeaderRef}
2396
+ className="custom-event-tl-table__scroller-harness custom-event-tl-table__scroller-harness--hide"
2397
+ data-scroll="header"
2398
+ onScroll={syncTableScrollHeader}
2399
+ >
2400
+ <div className="custom-event-tl-table__scroller">
2401
+
2402
+ {/*<!--///// HEADER RIGHT //////-->*/}
2403
+ <div className="custom-event-tl-table__timeline-header">
2404
+
2405
+ <table className="custom-event-tl-table__datagrid-header__content custom-event-tl-table__scrollgrid-sync-table" >
2406
+ <tbody>
2407
+ <tr>
2408
+ {generateDaysUi()}
2409
+ </tr>
2410
+ </tbody>
2411
+ </table>
2412
+ </div>
2413
+ {/*<!--///// /HEADER RIGHT //////-->*/}
2380
2414
  </div>
2381
- {/*<!--///// /HEADER RIGHT //////-->*/}
2382
2415
  </div>
2383
- </div>
2384
- </th>
2385
- </tr>
2386
- </thead>
2416
+ </th>
2417
+ </tr>
2418
+ </thead>
2387
2419
 
2388
2420
 
2389
2421
 
2390
- <tbody className={combinedCls(
2391
- tableBodyClassName
2392
- )}
2393
- role="rowgroup"
2394
- >
2395
- <tr role="presentation" className="custom-event-tl-table__list-section">
2396
- <td
2397
- role="presentation"
2398
- className={combinedCls(
2399
- tableListStartClassName
2400
- )}
2401
-
2402
- >
2403
-
2404
- <div
2405
- ref={scrollListRef}
2422
+ <tbody className={combinedCls(
2423
+ tableBodyClassName
2424
+ )}
2425
+ role="rowgroup"
2426
+ >
2427
+ <tr role="presentation" className="custom-event-tl-table__list-section">
2428
+ <td
2429
+ role="presentation"
2406
2430
  className={combinedCls(
2407
- 'custom-event-tl-table__scroller-harness',
2408
- {
2409
- 'autoscroll': AUTO_SCROLL
2410
- }
2431
+ tableListStartClassName
2411
2432
  )}
2412
- data-scroll="list"
2413
- onScroll={syncTableScrollList}
2414
- >
2415
- <div className="custom-event-tl-table__scroller">
2416
2433
 
2417
- {/*<!--///// RESOURCE LEFT //////-->*/}
2418
- <table role="presentation" className="custom-event-tl-table__datagrid-body__title custom-event-tl-table__scrollgrid-sync-table">
2419
- <colgroup>
2420
- <col />
2421
- </colgroup>
2422
- <tbody role="presentation">
2434
+ >
2423
2435
 
2424
- {/*<!-- per row -->*/}
2425
- {generateListSectionUi()}
2426
- {/*<!-- /per row -->*/}
2436
+ <div
2437
+ ref={scrollListRef}
2438
+ className={combinedCls(
2439
+ 'custom-event-tl-table__scroller-harness',
2440
+ {
2441
+ 'autoscroll': AUTO_SCROLL
2442
+ }
2443
+ )}
2444
+ data-scroll="list"
2445
+ onScroll={syncTableScrollList}
2446
+ >
2447
+ <div className="custom-event-tl-table__scroller">
2427
2448
 
2428
- </tbody>
2429
- </table>
2430
- {/*<!--///// /RESOURCE LEFT //////-->*/}
2431
- </div>
2432
- </div>
2449
+ {/*<!--///// RESOURCE LEFT //////-->*/}
2450
+ <table role="presentation" className="custom-event-tl-table__datagrid-body__title custom-event-tl-table__scrollgrid-sync-table">
2451
+ <colgroup>
2452
+ <col />
2453
+ </colgroup>
2454
+ <tbody role="presentation">
2433
2455
 
2456
+ {/*<!-- per row -->*/}
2457
+ {generateListSectionUi()}
2458
+ {/*<!-- /per row -->*/}
2434
2459
 
2435
- </td>
2436
- <td
2437
- role="presentation"
2438
- className={combinedCls(
2439
- 'custom-event-tl-table__timeline-divider',
2440
- tableListDividerClassName
2441
- )}
2442
- >
2443
- <div></div>
2444
- </td>
2445
- <td
2446
- role="presentation"
2447
- className={combinedCls(
2448
- tableListEndClassName
2449
- )}
2450
- >
2460
+ </tbody>
2461
+ </table>
2462
+ {/*<!--///// /RESOURCE LEFT //////-->*/}
2463
+ </div>
2464
+ </div>
2451
2465
 
2452
2466
 
2453
- <div
2454
- ref={scrollBodyRef}
2467
+ </td>
2468
+ <td
2469
+ role="presentation"
2455
2470
  className={combinedCls(
2456
- 'custom-event-tl-table__scroller-harness',
2457
- {
2458
- 'autoscroll': AUTO_SCROLL
2459
- }
2471
+ 'custom-event-tl-table__timeline-divider',
2472
+ tableListDividerClassName
2473
+ )}
2474
+ >
2475
+ <div></div>
2476
+ </td>
2477
+ <td
2478
+ role="presentation"
2479
+ className={combinedCls(
2480
+ tableListEndClassName
2460
2481
  )}
2461
- data-scroll="body"
2462
- onScroll={syncTableScrollBody}
2463
- onMouseMove={BODY_DRAG ? handleTableMove : () => { }}
2464
- onMouseDown={BODY_DRAG ? handleTableDragStart : () => { }}
2465
- onMouseUp={BODY_DRAG ? handleTableDragEnd : () => { }}
2466
- onMouseLeave={BODY_DRAG ? handleTableDragEnd : () => { }}
2467
2482
  >
2468
- <div className="custom-event-tl-table__scroller">
2469
- {/*<!--///// RESOURCE RIGHT //////-->*/}
2470
- <div className="custom-event-tl-table__timeline-body">
2471
- <table
2472
- className="custom-event-tl-table__datagrid-body__content custom-event-tl-table__scrollgrid-sync-table"
2473
- /* Drag to activate the selection area */
2474
- onMouseLeave={multipleCells ? handleTableMainMouseUp : undefined}
2475
- onMouseUp={multipleCells ? handleTableMainMouseUp : undefined}
2476
-
2477
- >
2478
- <colgroup>
2479
- {generateColUi()}
2480
- </colgroup>
2481
- <tbody>
2482
- {/*<!-- per row -->*/}
2483
- {orginalData.map((item: any, i: number) => {
2484
2483
 
2485
- return (
2486
- <tr key={i}>
2487
- {generateDaysUi(item.eventSources, item.listSection, i, true)}
2488
- </tr>
2489
- )
2490
2484
 
2491
- })}
2485
+ <div
2486
+ ref={scrollBodyRef}
2487
+ className={combinedCls(
2488
+ 'custom-event-tl-table__scroller-harness',
2489
+ {
2490
+ 'autoscroll': AUTO_SCROLL
2491
+ }
2492
+ )}
2493
+ data-scroll="body"
2494
+ onScroll={syncTableScrollBody}
2495
+ onMouseMove={BODY_DRAG ? handleTableMove : () => { }}
2496
+ onMouseDown={BODY_DRAG ? handleTableDragStart : () => { }}
2497
+ onMouseUp={BODY_DRAG ? handleTableDragEnd : () => { }}
2498
+ onMouseLeave={BODY_DRAG ? handleTableDragEnd : () => { }}
2499
+ >
2500
+ <div className="custom-event-tl-table__scroller">
2501
+ {/*<!--///// RESOURCE RIGHT //////-->*/}
2502
+ <div className="custom-event-tl-table__timeline-body">
2503
+ <table
2504
+ className="custom-event-tl-table__datagrid-body__content custom-event-tl-table__scrollgrid-sync-table"
2505
+ /* Drag to activate the selection area */
2506
+ onMouseLeave={multipleCells ? handleTableMainMouseUp : undefined}
2507
+ onMouseUp={multipleCells ? handleTableMainMouseUp : undefined}
2508
+
2509
+ >
2510
+ <colgroup>
2511
+ {generateColUi()}
2512
+ </colgroup>
2513
+ <tbody>
2514
+ {/*<!-- per row -->*/}
2515
+ {orginalData.map((item: any, i: number) => {
2516
+
2517
+ return (
2518
+ <tr key={i}>
2519
+ {generateDaysUi(item.eventSources, item.listSection, i, true)}
2520
+ </tr>
2521
+ )
2522
+
2523
+ })}
2524
+
2525
+ </tbody>
2526
+ </table>
2527
+
2528
+ </div>
2529
+ {/*<!--///// /RESOURCE RIGHT //////-->*/}
2492
2530
 
2493
- </tbody>
2494
- </table>
2495
2531
 
2496
2532
  </div>
2497
- {/*<!--///// /RESOURCE RIGHT //////-->*/}
2498
-
2499
-
2500
2533
  </div>
2501
- </div>
2502
2534
 
2503
2535
 
2504
- </td>
2505
- </tr>
2506
- </tbody>
2507
- </table>
2536
+ </td>
2537
+ </tr>
2538
+ </tbody>
2539
+ </table>
2540
+
2541
+ </div>{/* /.custom-event-tl-table__timeline-table__wrapper */}
2508
2542
 
2509
- </div>{/* /.custom-event-tl-table__timeline-table__wrapper */}
2510
2543
 
2544
+ </>}
2545
+ </div>
2511
2546
 
2512
- </>}
2513
2547
 
2514
2548
 
2515
2549
  {/*/////////////////////////////////////////////////// */}
@@ -2521,6 +2555,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
2521
2555
 
2522
2556
  {/*<!-- DELETE -->*/}
2523
2557
  <ModalDialog
2558
+ ref={modalDeleteHandleRef}
2524
2559
  show={showDelete}
2525
2560
  maskOpacity={modalMaskOpacity}
2526
2561
  triggerClassName=""
@@ -2556,6 +2591,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
2556
2591
 
2557
2592
  {/*<!-- EDIT -->*/}
2558
2593
  <ModalDialog
2594
+ ref={modalEditHandleRef}
2559
2595
  show={showEdit}
2560
2596
  maskOpacity={modalMaskOpacity}
2561
2597
  heading={modalHeading}