funda-ui 4.4.15 → 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.
- package/Date/index.js +1078 -77
- package/EventCalendar/index.css +114 -114
- package/EventCalendar/index.d.ts +1 -0
- package/EventCalendar/index.js +124 -86
- package/EventCalendarTimeline/index.css +274 -270
- package/EventCalendarTimeline/index.d.ts +3 -0
- package/EventCalendarTimeline/index.js +673 -225
- package/Input/index.d.ts +7 -0
- package/Input/index.js +699 -57
- package/MasonryLayout/index.js +11 -1
- package/MultipleCheckboxes/index.js +11 -11
- package/MultipleSelect/index.d.ts +1 -0
- package/MultipleSelect/index.js +18 -16
- package/NativeSelect/index.js +11 -11
- package/Radio/index.js +11 -11
- package/RangeSlider/index.js +1078 -77
- package/Select/index.js +45 -13
- package/Table/index.css +1 -0
- package/Table/index.js +36 -7
- package/TagInput/index.d.ts +1 -0
- package/TagInput/index.js +20 -2
- package/Textarea/index.d.ts +7 -0
- package/Textarea/index.js +707 -10
- package/Tree/index.js +13 -11
- package/Utils/inputsCalculation.d.ts +18 -1
- package/Utils/inputsCalculation.js +26 -0
- package/Utils/object.js +11 -11
- package/Utils/os.d.ts +2 -0
- package/Utils/os.js +104 -0
- package/lib/cjs/Date/index.js +1078 -77
- package/lib/cjs/EventCalendar/index.d.ts +1 -0
- package/lib/cjs/EventCalendar/index.js +124 -86
- package/lib/cjs/EventCalendarTimeline/index.d.ts +3 -0
- package/lib/cjs/EventCalendarTimeline/index.js +673 -225
- package/lib/cjs/Input/index.d.ts +7 -0
- package/lib/cjs/Input/index.js +699 -57
- package/lib/cjs/MasonryLayout/index.js +11 -1
- package/lib/cjs/MultipleCheckboxes/index.js +11 -11
- package/lib/cjs/MultipleSelect/index.d.ts +1 -0
- package/lib/cjs/MultipleSelect/index.js +18 -16
- package/lib/cjs/NativeSelect/index.js +11 -11
- package/lib/cjs/Radio/index.js +11 -11
- package/lib/cjs/RangeSlider/index.js +1078 -77
- package/lib/cjs/Select/index.js +45 -13
- package/lib/cjs/Table/index.js +36 -7
- package/lib/cjs/TagInput/index.d.ts +1 -0
- package/lib/cjs/TagInput/index.js +20 -2
- package/lib/cjs/Textarea/index.d.ts +7 -0
- package/lib/cjs/Textarea/index.js +707 -10
- package/lib/cjs/Tree/index.js +13 -11
- package/lib/cjs/Utils/inputsCalculation.d.ts +18 -1
- package/lib/cjs/Utils/inputsCalculation.js +26 -0
- package/lib/cjs/Utils/object.js +11 -11
- package/lib/cjs/Utils/os.d.ts +2 -0
- package/lib/cjs/Utils/os.js +104 -0
- package/lib/css/EventCalendar/index.css +114 -114
- package/lib/css/EventCalendarTimeline/index.css +274 -270
- package/lib/css/Table/index.css +1 -0
- package/lib/esm/EventCalendar/index.scss +81 -81
- package/lib/esm/EventCalendar/index.tsx +144 -104
- package/lib/esm/EventCalendarTimeline/index.scss +226 -221
- package/lib/esm/EventCalendarTimeline/index.tsx +791 -517
- package/lib/esm/Input/index.tsx +299 -77
- package/lib/esm/MasonryLayout/index.tsx +9 -2
- package/lib/esm/ModalDialog/index.tsx +0 -1
- package/lib/esm/MultipleSelect/index.tsx +6 -4
- package/lib/esm/Table/Table.tsx +0 -1
- package/lib/esm/Table/index.scss +2 -0
- package/lib/esm/Table/utils/hooks/useTableDraggable.tsx +47 -6
- package/lib/esm/TagInput/index.tsx +23 -1
- package/lib/esm/Textarea/index.tsx +332 -39
- package/lib/esm/Tree/TreeList.tsx +4 -1
- package/lib/esm/Tree/index.tsx +1 -0
- package/lib/esm/Utils/libs/inputsCalculation.ts +60 -31
- package/lib/esm/Utils/libs/object.ts +67 -67
- package/lib/esm/Utils/libs/os.ts +63 -0
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from 'funda-utils/dist/cjs/getElementProperty';
|
|
12
12
|
import { getTodayDate, getCalendarDate, isValidDate, padZero, getDateDetails, getMonthDates, getWeekDatesFromMon } from 'funda-utils/dist/cjs/date';
|
|
13
13
|
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
|
|
|
@@ -108,8 +108,10 @@ export type EventCalendarTimelineProps = {
|
|
|
108
108
|
onCellMouseLeave?: (el: any) => void;
|
|
109
109
|
onCellMouseUp?: (el: any, selectedCellsData: any[]) => void;
|
|
110
110
|
onCellClick?: (el: any, cellData: any) => void;
|
|
111
|
+
onCellDoubleClick?: (el: any, cellData: any) => void;
|
|
111
112
|
onKeyPressed?: (el: any, selectedCellsData: any[]) => void;
|
|
112
|
-
|
|
113
|
+
onKeyCopy?: (el: any, selectedCellsData: any[]) => void;
|
|
114
|
+
onKeyPaste?: (el: any, selectedCellsData: any[]) => void;
|
|
113
115
|
|
|
114
116
|
// table
|
|
115
117
|
tableListSectionTitle?: string | React.ReactNode;
|
|
@@ -194,7 +196,10 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
194
196
|
onCellMouseLeave,
|
|
195
197
|
onCellMouseUp,
|
|
196
198
|
onCellClick,
|
|
199
|
+
onCellDoubleClick,
|
|
197
200
|
onKeyPressed,
|
|
201
|
+
onKeyCopy,
|
|
202
|
+
onKeyPaste,
|
|
198
203
|
|
|
199
204
|
//
|
|
200
205
|
tableListSectionTitle,
|
|
@@ -229,13 +234,18 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
229
234
|
const day = date.getDate();
|
|
230
235
|
return month + ' ' + day;
|
|
231
236
|
};
|
|
237
|
+
const START_WEEK_ON = 1; // represents "Monday/1" in JavaScript
|
|
232
238
|
|
|
233
239
|
// orginal data
|
|
234
|
-
const [
|
|
240
|
+
const [orginalData, setOrginalData] = useState<TimelineRowListConfig[]>([]);
|
|
235
241
|
|
|
236
242
|
//
|
|
237
243
|
const FILL_BLANK_DATE_DISABLD = typeof forwardAndBackFillDisabled === 'undefined' ? true : forwardAndBackFillDisabled;
|
|
238
244
|
|
|
245
|
+
// root
|
|
246
|
+
const rootRef = useRef<any>(null);
|
|
247
|
+
const rootWidth = useRef<number>(0);
|
|
248
|
+
|
|
239
249
|
//
|
|
240
250
|
const now = useMemo(() => new Date(), []);
|
|
241
251
|
const [date, setDate] = useState<Date>(now);
|
|
@@ -256,6 +266,8 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
256
266
|
const [winMonth, setWinMonth] = useState<boolean>(false);
|
|
257
267
|
|
|
258
268
|
// modal dialog
|
|
269
|
+
const modalEditHandleRef = useRef<any>();
|
|
270
|
+
const modalDeleteHandleRef = useRef<any>();
|
|
259
271
|
const EVENTS_ENABLED = typeof modalContent !== 'undefined';
|
|
260
272
|
const EVENTS_DELETE_ENABLED = typeof modalDeleteContent !== 'undefined';
|
|
261
273
|
const [showEdit, setShowEdit] = useState<boolean>(false);
|
|
@@ -272,6 +284,11 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
272
284
|
const scrollBodyRef = useRef(null);
|
|
273
285
|
const scrollListRef = useRef(null);
|
|
274
286
|
|
|
287
|
+
// Temporary date
|
|
288
|
+
const [tempDate, setTempDate] = useState<string>('');
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
275
292
|
// Open temporary storage for pop-ups
|
|
276
293
|
const [tableRowNum, setTableRowNum] = useState<number>(-1);
|
|
277
294
|
const [tableCellId, setTableCellId] = useState<number>(-1);
|
|
@@ -288,6 +305,22 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
288
305
|
const [appearanceMode, setAppearanceMode] = useState<string>(appearance);
|
|
289
306
|
|
|
290
307
|
|
|
308
|
+
const findMondayAndTruncate = (dates: string[]) => {
|
|
309
|
+
const _res = dates.map((s: string) => new Date(s));
|
|
310
|
+
// Find the first Monday in the sequence
|
|
311
|
+
for (let i = 0; i < _res.length; i++) {
|
|
312
|
+
const date = _res[i];
|
|
313
|
+
if (date.getDay() === START_WEEK_ON) {
|
|
314
|
+
// Return dates starting from Monday onwards
|
|
315
|
+
return dates.slice(i);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return []; // Return empty array if no Monday found
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
291
324
|
// exposes the following methods
|
|
292
325
|
useImperativeHandle(
|
|
293
326
|
contentRef,
|
|
@@ -304,12 +337,17 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
304
337
|
resetSelectedCells: () => {
|
|
305
338
|
// reset selection area
|
|
306
339
|
setSelectedCells([]);
|
|
340
|
+
setCopiedCells(null);
|
|
341
|
+
},
|
|
342
|
+
closeModal: () => {
|
|
343
|
+
if (modalEditHandleRef.current) modalEditHandleRef.current.close();
|
|
344
|
+
if (modalDeleteHandleRef.current) modalDeleteHandleRef.current.close();
|
|
307
345
|
}
|
|
308
346
|
}),
|
|
309
347
|
[contentRef],
|
|
310
348
|
);
|
|
311
349
|
|
|
312
|
-
|
|
350
|
+
|
|
313
351
|
|
|
314
352
|
//================================================================
|
|
315
353
|
// Monthly calendar
|
|
@@ -342,10 +380,6 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
342
380
|
const [isSelecting, setIsSelecting] = useState<boolean>(false);
|
|
343
381
|
const [selectedCells, setSelectedCells] = useState<any[]>([]);
|
|
344
382
|
const [startCell, setStartCell] = useState<any>(null);
|
|
345
|
-
function handleTableMainMouseUp(e: React.MouseEvent) {
|
|
346
|
-
setIsSelecting(false);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
383
|
|
|
350
384
|
// Determine whether it is a selected cell
|
|
351
385
|
const isCellSelected = (row: number, col: number) => {
|
|
@@ -353,10 +387,50 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
353
387
|
};
|
|
354
388
|
|
|
355
389
|
|
|
356
|
-
//
|
|
357
|
-
|
|
390
|
+
// Start selecting
|
|
391
|
+
const handleTableMainCellMouseDown = (e: React.MouseEvent, row: number, col: number, colsOffset: number) => {
|
|
392
|
+
const isMultiSelect = e.ctrlKey || e.metaKey; // Check whether the Ctrl or Command key is pressed
|
|
393
|
+
|
|
394
|
+
setIsSelecting(true);
|
|
395
|
+
setStartCell({ row, col });
|
|
396
|
+
|
|
358
397
|
const _el: any = e.currentTarget;
|
|
359
398
|
|
|
399
|
+
setIsSelecting(true);
|
|
400
|
+
setStartCell({ row, col });
|
|
401
|
+
|
|
402
|
+
setSelectedCells((prevSelectedCells: any[]) => {
|
|
403
|
+
if (isMultiSelect) {
|
|
404
|
+
// Multi-select mode: Add or remove cells
|
|
405
|
+
//++++++++++
|
|
406
|
+
const cellExists = prevSelectedCells.some(({ row: r, col: c }) => r === row && c === col);
|
|
407
|
+
if (cellExists) {
|
|
408
|
+
return prevSelectedCells.filter(({ row: r, col: c }) => !(r === row && c === col));
|
|
409
|
+
} else {
|
|
410
|
+
return [...prevSelectedCells, {
|
|
411
|
+
rowData: JSON.parse(_el.dataset.rowinfo),
|
|
412
|
+
date: _el.dataset.date,
|
|
413
|
+
row: row,
|
|
414
|
+
col: col
|
|
415
|
+
}];
|
|
416
|
+
}
|
|
417
|
+
} else {
|
|
418
|
+
// Radio Mode: Clear the previous selection, select only the current cell
|
|
419
|
+
//++++++++++
|
|
420
|
+
return [{
|
|
421
|
+
rowData: JSON.parse(_el.dataset.rowinfo),
|
|
422
|
+
date: _el.dataset.date,
|
|
423
|
+
row: row,
|
|
424
|
+
col: col
|
|
425
|
+
}];
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
// Selecting now
|
|
432
|
+
const handleTableMainCellMouseEnter = (e: React.MouseEvent, row: number, col: number, colsOffset: number) => {
|
|
433
|
+
|
|
360
434
|
if (isSelecting && startCell) {
|
|
361
435
|
|
|
362
436
|
//########## MODE: WEEK #############
|
|
@@ -377,14 +451,15 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
377
451
|
const [minRow, maxRow] = [startCell.row, row].sort((a, b) => a - b);
|
|
378
452
|
const [minCol, maxCol] = [startCell.col, col].sort((a, b) => a - b);
|
|
379
453
|
|
|
454
|
+
|
|
380
455
|
for (let r = minRow; r <= maxRow; r++) {
|
|
381
456
|
for (let c = minCol; c <= maxCol; c++) {
|
|
382
457
|
|
|
383
458
|
// query date and row data
|
|
384
|
-
const curRowData: any =
|
|
459
|
+
const curRowData: any = orginalData[r];
|
|
385
460
|
newSelectedCells.push({
|
|
386
461
|
rowData: curRowData?.listSection,
|
|
387
|
-
date: curDateList[c],
|
|
462
|
+
date: curDateList[c - colsOffset],
|
|
388
463
|
row: r,
|
|
389
464
|
col: c
|
|
390
465
|
});
|
|
@@ -392,24 +467,133 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
392
467
|
}
|
|
393
468
|
setSelectedCells(newSelectedCells);
|
|
394
469
|
}
|
|
395
|
-
}
|
|
470
|
+
};
|
|
396
471
|
|
|
397
472
|
// Stop selecting
|
|
398
|
-
|
|
399
|
-
|
|
473
|
+
const handleTableMainMouseUp = (e: React.MouseEvent) => {
|
|
474
|
+
setIsSelecting(false);
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
//================================================================
|
|
478
|
+
// Copy & Paste
|
|
479
|
+
//================================================================
|
|
480
|
+
const [copiedCells, setCopiedCells] = useState<{
|
|
481
|
+
structure: {
|
|
482
|
+
rows: number,
|
|
483
|
+
cols: number
|
|
484
|
+
},
|
|
485
|
+
offset: { row: number, col: number },
|
|
486
|
+
cells: any[]
|
|
487
|
+
} | null>(null);
|
|
488
|
+
|
|
489
|
+
const handleWrapperKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
490
|
+
const isMac = getOs().isOSX;
|
|
491
|
+
|
|
492
|
+
//########## MODE: WEEK #############
|
|
493
|
+
let curDateList: any[] = [];
|
|
494
|
+
if (appearanceMode === 'week') {
|
|
495
|
+
curDateList = weekDates.map((v: Date) => getCalendarDate(v));
|
|
496
|
+
}
|
|
497
|
+
//########## /MODE: WEEK #############
|
|
498
|
+
|
|
499
|
+
//########## MODE: MONTH #############
|
|
500
|
+
if (appearanceMode === 'month') {
|
|
501
|
+
curDateList = getMonthDates(year, month + 1);
|
|
502
|
+
}
|
|
503
|
+
//########## /MODE: MONTH #############
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
// Listen for copy
|
|
507
|
+
if ((isMac && e.metaKey && e.key === 'c') || (!isMac && e.ctrlKey && e.key === 'c')) {
|
|
508
|
+
|
|
509
|
+
if (selectedCells.length > 0) {
|
|
510
|
+
// Gets the structure of the selected area
|
|
511
|
+
const _selectedCellsCoordinates = selectedCells.map(({ row: r, col: c }) => {
|
|
512
|
+
return [r, c];
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
const [minRow, maxRow] = _selectedCellsCoordinates.reduce(
|
|
516
|
+
([min, max], [r]) => [Math.min(min, r), Math.max(max, r)],
|
|
517
|
+
[Infinity, -Infinity]
|
|
518
|
+
);
|
|
519
|
+
const [minCol, maxCol] = _selectedCellsCoordinates.reduce(
|
|
520
|
+
([min, max], [_, c]) => [Math.min(min, c), Math.max(max, c)],
|
|
521
|
+
[Infinity, -Infinity]
|
|
522
|
+
);
|
|
523
|
+
|
|
524
|
+
/*
|
|
525
|
+
[Be equal to:]
|
|
526
|
+
|
|
527
|
+
// Suppose _selectedCellsCoordinates is an array of selected cells, each of which is in the form of [row, col].
|
|
528
|
+
let minRow = Infinity;
|
|
529
|
+
let maxRow = -Infinity;
|
|
530
|
+
let minCol = Infinity;
|
|
531
|
+
let maxCol = -Infinity;
|
|
532
|
+
|
|
533
|
+
for (const [row, col] of _selectedCellsCoordinates) {
|
|
534
|
+
if (row < minRow) minRow = row;
|
|
535
|
+
if (row > maxRow) maxRow = row;
|
|
536
|
+
if (col < minCol) minCol = col;
|
|
537
|
+
if (col > maxCol) maxCol = col;
|
|
538
|
+
}
|
|
539
|
+
*/
|
|
540
|
+
|
|
541
|
+
// Calculate the offset and adjust the cell coordinates
|
|
542
|
+
const adjustedCells = _selectedCellsCoordinates.map(([r, c]) => [r - minRow, c - minCol]);
|
|
543
|
+
|
|
544
|
+
// The copy result is independent of the data
|
|
545
|
+
setCopiedCells({
|
|
546
|
+
structure: {
|
|
547
|
+
rows: maxRow - minRow + 1,
|
|
548
|
+
cols: maxCol - minCol + 1
|
|
549
|
+
},
|
|
550
|
+
offset: { row: minRow, col: minCol },
|
|
551
|
+
cells: adjustedCells
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
//
|
|
556
|
+
onKeyCopy?.(e, selectedCells);
|
|
557
|
+
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// Listen for paste
|
|
563
|
+
if ((isMac && e.metaKey && e.key === 'v') || (!isMac && e.ctrlKey && e.key === 'v')) {
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
if (copiedCells && selectedCells.length > 0) {
|
|
567
|
+
const { rowsTotal, colsTotal, forwardFillTotal } = getCells();
|
|
568
|
+
const { row: targetRow, col: targetCol } = selectedCells[0]; // the first position
|
|
569
|
+
const newSelectedCellsCoordinates = copiedCells.cells.map(([r, c]) => [
|
|
570
|
+
targetRow + r,
|
|
571
|
+
targetCol + c
|
|
572
|
+
]).filter(([r, c]) => r < rowsTotal && c < colsTotal); // Make sure you don't go beyond the scope of the table
|
|
573
|
+
|
|
574
|
+
// query date and row data
|
|
575
|
+
const newSelectedCells: any[] = [];
|
|
576
|
+
newSelectedCellsCoordinates.forEach((item: any[]) => {
|
|
577
|
+
const [r, c] = item;
|
|
578
|
+
const curRowData: any = orginalData[r];
|
|
579
|
+
newSelectedCells.push({
|
|
580
|
+
rowData: curRowData?.listSection,
|
|
581
|
+
date: curDateList[c - forwardFillTotal],
|
|
582
|
+
row: r,
|
|
583
|
+
col: c
|
|
584
|
+
});
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
setSelectedCells(newSelectedCells);
|
|
589
|
+
|
|
590
|
+
//
|
|
591
|
+
onKeyPaste?.(e, newSelectedCells);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
};
|
|
400
595
|
|
|
401
|
-
setIsSelecting(true);
|
|
402
|
-
setStartCell({ row, col });
|
|
403
|
-
setSelectedCells([{
|
|
404
|
-
rowData: JSON.parse(_el.dataset.rowinfo),
|
|
405
|
-
date: _el.dataset.date,
|
|
406
|
-
row: row,
|
|
407
|
-
col: col
|
|
408
|
-
}]);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
596
|
|
|
412
|
-
|
|
413
597
|
|
|
414
598
|
//================================================================
|
|
415
599
|
// Other
|
|
@@ -426,9 +610,6 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
426
610
|
{cellAddBtnLabel || ''}
|
|
427
611
|
</>;
|
|
428
612
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
613
|
// click outside
|
|
433
614
|
useClickOutside({
|
|
434
615
|
enabled: isShowTableTooltip && tableGridRef.current,
|
|
@@ -448,7 +629,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
448
629
|
|
|
449
630
|
// cell
|
|
450
631
|
const getCells = (type: 'none' | 'forward' | 'back' = 'none') => {
|
|
451
|
-
|
|
632
|
+
|
|
452
633
|
|
|
453
634
|
//########## MODE: WEEK #############
|
|
454
635
|
if (appearanceMode === 'week') {
|
|
@@ -456,14 +637,14 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
456
637
|
weekDates.forEach((date: Date, dayIndex: number) => {
|
|
457
638
|
const _dayOfWeek = new Date(date).getDay();
|
|
458
639
|
// ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
|
459
|
-
const _daysIndicator = [7, 1, 2, 3, 4, 5, 6];
|
|
640
|
+
const _daysIndicator = [7, 1, 2, 3, 4, 5, 6];
|
|
460
641
|
const _detail = getDateDetails(date);
|
|
461
642
|
const {
|
|
462
643
|
year: _temp_year,
|
|
463
644
|
month: _temp_month,
|
|
464
645
|
day: _temp_day
|
|
465
646
|
} = _detail;
|
|
466
|
-
|
|
647
|
+
|
|
467
648
|
curWeek.push({
|
|
468
649
|
month: Number(_temp_month) - 1,
|
|
469
650
|
startDay: _daysIndicator[_dayOfWeek],
|
|
@@ -480,54 +661,59 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
480
661
|
}
|
|
481
662
|
],
|
|
482
663
|
weekDisplay: [
|
|
483
|
-
WEEK[_daysIndicator[_dayOfWeek]-1]
|
|
664
|
+
WEEK[_daysIndicator[_dayOfWeek] - 1]
|
|
484
665
|
],
|
|
485
666
|
week: [
|
|
486
|
-
_daysIndicator[_dayOfWeek]-1
|
|
667
|
+
_daysIndicator[_dayOfWeek] - 1
|
|
487
668
|
]
|
|
488
669
|
});
|
|
489
|
-
|
|
670
|
+
|
|
490
671
|
});
|
|
491
672
|
|
|
492
|
-
return
|
|
493
|
-
|
|
673
|
+
return {
|
|
674
|
+
rowsTotal: orginalData.length,
|
|
675
|
+
colsTotal: curWeek.length,
|
|
676
|
+
forwardFillTotal: 0,
|
|
677
|
+
list: curWeek
|
|
678
|
+
};
|
|
679
|
+
|
|
494
680
|
}
|
|
495
681
|
//########## /MODE: WEEK #############
|
|
496
682
|
|
|
497
|
-
|
|
683
|
+
|
|
498
684
|
|
|
499
685
|
//########## MODE: MONTH #############
|
|
500
686
|
if (appearanceMode === 'month') {
|
|
501
687
|
let currentMonth: any = month;
|
|
502
688
|
let currentStartDay: any = startDay;
|
|
503
|
-
|
|
689
|
+
|
|
504
690
|
// previous month
|
|
505
691
|
if (type === 'forward') {
|
|
506
692
|
const _date = new Date(year, currentMonth - 1, day);
|
|
507
693
|
currentMonth = _date.getMonth();
|
|
508
694
|
currentStartDay = getStartDayOfMonth(_date);
|
|
509
695
|
}
|
|
510
|
-
|
|
696
|
+
|
|
511
697
|
// next month
|
|
512
698
|
if (type === 'back') {
|
|
513
699
|
const _date = new Date(year, currentMonth + 1, day);
|
|
514
700
|
currentMonth = _date.getMonth();
|
|
515
701
|
currentStartDay = getStartDayOfMonth(_date);
|
|
516
702
|
}
|
|
517
|
-
|
|
518
|
-
|
|
703
|
+
|
|
704
|
+
|
|
519
705
|
//
|
|
520
706
|
const allDays = Array(days[currentMonth] + (currentStartDay - 1)).fill(null).map((_: any, i: number) => i); // [0,1,..,30,31]
|
|
521
707
|
const rows = Math.ceil(allDays.length / 7); // 5
|
|
522
|
-
|
|
708
|
+
|
|
523
709
|
//
|
|
524
710
|
const _tempCells: any[] = Array.from({ length: rows }).fill(null);
|
|
525
|
-
|
|
711
|
+
|
|
526
712
|
const _getForwardFill = (_year: number, _month: number) => {
|
|
527
713
|
// Get the last day of the previous month
|
|
528
714
|
const lastDayOfLastMonth = new Date(_year, _month - 1, 0);
|
|
529
715
|
const last7Days: Date[] = [];
|
|
530
|
-
|
|
716
|
+
|
|
531
717
|
// Rewind 7 days forward from the last day
|
|
532
718
|
for (let i = 0; i < 7; i++) {
|
|
533
719
|
last7Days.unshift(new Date(lastDayOfLastMonth));
|
|
@@ -535,118 +721,137 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
535
721
|
}
|
|
536
722
|
return last7Days.map((v: Date) => getCalendarDate(v));
|
|
537
723
|
};
|
|
538
|
-
|
|
724
|
+
|
|
539
725
|
const _getBackFill = (_year: number, _month: number) => {
|
|
540
726
|
// Get the first day of the next month
|
|
541
727
|
const firstDayOfNextMonth = new Date(_year, _month, 1);
|
|
542
728
|
const first7Days: Date[] = [];
|
|
543
|
-
|
|
729
|
+
|
|
544
730
|
// Rewind 7 days forward from the first day of the next month
|
|
545
731
|
for (let i = 0; i < 7; i++) {
|
|
546
732
|
first7Days.push(new Date(firstDayOfNextMonth));
|
|
547
733
|
firstDayOfNextMonth.setDate(firstDayOfNextMonth.getDate() + 1);
|
|
548
734
|
}
|
|
549
|
-
|
|
735
|
+
|
|
550
736
|
return first7Days.map((v: Date) => getCalendarDate(v));
|
|
551
737
|
};
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
// back fill
|
|
574
|
-
const __backFillDate: string[] = _getBackFill(year, month+1);
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
const _getDateShow = (_dayIndex: number, _m: number, _startDay: number, _month: number) => {
|
|
578
|
-
const currentDay = typeof _dayIndex === 'number' ? _dayIndex - (_startDay - 2) : 0; // ..., -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, ...
|
|
579
|
-
|
|
580
|
-
// date
|
|
581
|
-
let _dateShow: any = currentDay > 0 ? `${year}-${_month + 1}-${currentDay}` : '';
|
|
582
|
-
|
|
583
|
-
// forward & back
|
|
584
|
-
if (isFirstGroup && _dateShow === '') {
|
|
585
|
-
_dateShow = __forwardFillDate.at(currentDay-1);
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
// The remaining date of the previous month
|
|
742
|
+
// If the number is 7, the calendar does not include the date of the previous month
|
|
743
|
+
const remainPrevDate = findMondayAndTruncate(_getForwardFill(year, month + 1));
|
|
744
|
+
const remainPrevDateTotal = remainPrevDate.length === 7 ? 0 : remainPrevDate.length;
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
return {
|
|
748
|
+
rowsTotal: orginalData.length,
|
|
749
|
+
colsTotal: allDays.length,
|
|
750
|
+
forwardFillTotal: remainPrevDateTotal,
|
|
751
|
+
list: _tempCells.map((_: any, j: number) => {
|
|
752
|
+
const _col = allDays.slice(j * 7, (j + 1) * 7);
|
|
753
|
+
|
|
754
|
+
// back fill
|
|
755
|
+
const backFillArr: null[] = [];
|
|
756
|
+
for (let k = 0; k < 7 - _col.length; k++) {
|
|
757
|
+
backFillArr.push(null);
|
|
586
758
|
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
759
|
+
_col.splice(_col.length, 0, ...backFillArr as any);
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
//
|
|
763
|
+
const isFirstGroup = j === 0;
|
|
764
|
+
const isLastGroup = j === _tempCells.length - 1;
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
// forward fill
|
|
768
|
+
const __forwardFillDate: string[] = _getForwardFill(year, month + 1);
|
|
769
|
+
|
|
770
|
+
// back fill
|
|
771
|
+
const __backFillDate: string[] = _getBackFill(year, month + 1);
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
const _getDateShow = (_dayIndex: number, _m: number, _startDay: number, _month: number) => {
|
|
775
|
+
const currentDay = typeof _dayIndex === 'number' ? _dayIndex - (_startDay - 2) : 0; // ..., -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, ...
|
|
776
|
+
|
|
777
|
+
// date
|
|
778
|
+
let _dateShow: any = currentDay > 0 ? `${year}-${_month + 1}-${currentDay}` : '';
|
|
779
|
+
|
|
780
|
+
// forward & back
|
|
781
|
+
if (isFirstGroup && _dateShow === '') {
|
|
782
|
+
_dateShow = __forwardFillDate.at(currentDay - 1);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
if (isLastGroup && _dateShow === '') {
|
|
786
|
+
_dateShow = __backFillDate.at(_m);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
return {
|
|
791
|
+
date: getCalendarDate(_dateShow),
|
|
792
|
+
firstGroup: isFirstGroup,
|
|
793
|
+
lastGroup: isLastGroup,
|
|
794
|
+
validDisplayDate: currentDay > 0 && currentDay <= days[month]
|
|
795
|
+
};
|
|
796
|
+
|
|
590
797
|
}
|
|
591
|
-
|
|
592
|
-
|
|
798
|
+
|
|
799
|
+
//
|
|
593
800
|
return {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
}),
|
|
615
|
-
week: _col.map((k: number, m: number) => {
|
|
616
|
-
return m
|
|
617
|
-
}),
|
|
618
|
-
|
|
619
|
-
}
|
|
620
|
-
});
|
|
801
|
+
month: currentMonth,
|
|
802
|
+
startDay: currentStartDay,
|
|
803
|
+
row: j,
|
|
804
|
+
col: _col,
|
|
805
|
+
dateInfo: _col.map((k: number, m: number) => {
|
|
806
|
+
const _lastWeekDays: number = _col.filter(Boolean).length;
|
|
807
|
+
return _getDateShow(k, m - _lastWeekDays, currentStartDay, currentMonth);
|
|
808
|
+
}),
|
|
809
|
+
weekDisplay: _col.map((k: number, m: number) => {
|
|
810
|
+
return WEEK[m]
|
|
811
|
+
}),
|
|
812
|
+
week: _col.map((k: number, m: number) => {
|
|
813
|
+
return m
|
|
814
|
+
}),
|
|
815
|
+
|
|
816
|
+
}
|
|
817
|
+
})
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
|
|
621
821
|
}
|
|
622
822
|
//########## /MODE: MONTH #############
|
|
623
823
|
|
|
624
824
|
|
|
625
|
-
return
|
|
825
|
+
return {
|
|
826
|
+
rowsTotal: 0,
|
|
827
|
+
colsTotal: 0,
|
|
828
|
+
forwardFillTotal: 0,
|
|
829
|
+
list: []
|
|
830
|
+
};
|
|
626
831
|
|
|
627
832
|
|
|
628
833
|
};
|
|
629
834
|
|
|
630
835
|
const queryItemObj = () => {
|
|
631
|
-
const curRowData: any =
|
|
836
|
+
const curRowData: any = orginalData[tableRowNum];
|
|
837
|
+
const curDate: string = tempDate !== '' ? tempDate : `${year}-${month + 1}-${day}`;
|
|
632
838
|
|
|
633
|
-
|
|
634
839
|
if (curRowData) {
|
|
635
840
|
const eventSourcesData = curRowData.eventSources;
|
|
636
841
|
|
|
637
|
-
const _rowData = eventSourcesData.filter((item: any) => getCalendarDate(item.date as string) === getCalendarDate(
|
|
842
|
+
const _rowData = eventSourcesData.filter((item: any) => getCalendarDate(item.date as string) === getCalendarDate(curDate));
|
|
638
843
|
|
|
639
844
|
let _currentData: any = undefined;
|
|
640
845
|
if (_rowData[0]) {
|
|
641
846
|
const _items = _rowData[0].list;
|
|
642
847
|
|
|
643
|
-
|
|
848
|
+
|
|
644
849
|
if (tableCellId === -1) {
|
|
645
850
|
// add new
|
|
646
851
|
_currentData = {
|
|
647
852
|
rowData: curRowData.listSection,
|
|
648
853
|
id: 0,
|
|
649
|
-
date: getCalendarDate(
|
|
854
|
+
date: getCalendarDate(curDate)
|
|
650
855
|
};
|
|
651
856
|
} else {
|
|
652
857
|
// edit or delete
|
|
@@ -655,10 +860,10 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
655
860
|
|
|
656
861
|
}
|
|
657
862
|
|
|
658
|
-
return _rowData[0] ? _currentData: {
|
|
863
|
+
return _rowData[0] ? _currentData : {
|
|
659
864
|
rowData: curRowData.listSection,
|
|
660
865
|
id: 0,
|
|
661
|
-
date: getCalendarDate(
|
|
866
|
+
date: getCalendarDate(curDate)
|
|
662
867
|
};
|
|
663
868
|
}
|
|
664
869
|
};
|
|
@@ -743,7 +948,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
743
948
|
|
|
744
949
|
|
|
745
950
|
// Determine whether it exceeds the far right or left side of the screen
|
|
746
|
-
const _modalContent = _tableTooltipModalRef.querySelector('.
|
|
951
|
+
const _modalContent = _tableTooltipModalRef.querySelector('.custom-event-tl-table__cell-tooltipcontent');
|
|
747
952
|
const _modalBox = _modalContent.getBoundingClientRect();
|
|
748
953
|
if (typeof _modalContent.dataset.offset === 'undefined' && _modalBox.left > 0) {
|
|
749
954
|
|
|
@@ -858,7 +1063,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
858
1063
|
|
|
859
1064
|
}
|
|
860
1065
|
//########## /MODE: MONTH #############
|
|
861
|
-
|
|
1066
|
+
|
|
862
1067
|
|
|
863
1068
|
}
|
|
864
1069
|
|
|
@@ -899,8 +1104,8 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
899
1104
|
});
|
|
900
1105
|
}
|
|
901
1106
|
//########## /MODE: MONTH #############
|
|
902
|
-
|
|
903
|
-
|
|
1107
|
+
|
|
1108
|
+
|
|
904
1109
|
}
|
|
905
1110
|
function handleDayChange(e: React.MouseEvent, currentDay: number) {
|
|
906
1111
|
setDate(new Date(year, month, currentDay));
|
|
@@ -975,7 +1180,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
975
1180
|
onChangeAppearanceMode?.(_mode);
|
|
976
1181
|
}
|
|
977
1182
|
|
|
978
|
-
|
|
1183
|
+
|
|
979
1184
|
|
|
980
1185
|
|
|
981
1186
|
function handleShowWinYear() {
|
|
@@ -992,12 +1197,12 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
992
1197
|
// ================================================================
|
|
993
1198
|
|
|
994
1199
|
function generateListSectionUi() {
|
|
995
|
-
return
|
|
1200
|
+
return orginalData.map((item: any, i: number) => {
|
|
996
1201
|
|
|
997
1202
|
return (
|
|
998
1203
|
<tr key={i} role="row" data-index={i}>
|
|
999
|
-
<td role="gridcell" data-resource-index={i} className="
|
|
1000
|
-
<div className="
|
|
1204
|
+
<td role="gridcell" data-resource-index={i} className="custom-event-tl-table__datagrid-cell">
|
|
1205
|
+
<div className="custom-event-tl-table__cell-cushion custom-event-tl-table__cell-cushion-title" dangerouslySetInnerHTML={{
|
|
1001
1206
|
__html: item.listSection.title
|
|
1002
1207
|
}} />
|
|
1003
1208
|
</td>
|
|
@@ -1013,10 +1218,11 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1013
1218
|
// colIndex
|
|
1014
1219
|
let colIndex = 0;
|
|
1015
1220
|
|
|
1016
|
-
|
|
1221
|
+
const { forwardFillTotal, list: cellsList } = getCells();
|
|
1222
|
+
return cellsList.map((item: any, j: number) => {
|
|
1223
|
+
|
|
1017
1224
|
|
|
1018
1225
|
|
|
1019
|
-
|
|
1020
1226
|
return item.col.map((dayIndex: number, i: number) => {
|
|
1021
1227
|
|
|
1022
1228
|
colIndex++;
|
|
@@ -1035,12 +1241,12 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1035
1241
|
// helper
|
|
1036
1242
|
const d = parseFloat(_dateDayShow);
|
|
1037
1243
|
const _currentData = eventSourcesData.filter((item: any) => getCalendarDate(item.date as string) === _dateShow);
|
|
1038
|
-
const isLastCol = colIndex === 7 *
|
|
1244
|
+
const isLastCol = colIndex === 7 * cellsList.length;
|
|
1039
1245
|
const isInteractive = item.dateInfo[i].validDisplayDate; // The date on which the user interaction can occur, e.g. click, modify
|
|
1040
1246
|
const isForward = item.dateInfo[i].firstGroup && !isInteractive;
|
|
1041
1247
|
const isBack = item.dateInfo[i].lastGroup && !isInteractive;
|
|
1042
|
-
|
|
1043
|
-
|
|
1248
|
+
|
|
1249
|
+
|
|
1044
1250
|
// days
|
|
1045
1251
|
//------
|
|
1046
1252
|
if (!showEvents) {
|
|
@@ -1049,7 +1255,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1049
1255
|
|
|
1050
1256
|
return <th
|
|
1051
1257
|
className={combinedCls(
|
|
1052
|
-
'
|
|
1258
|
+
'custom-event-tl-table__cell-cushion-headercontent__container',
|
|
1053
1259
|
{
|
|
1054
1260
|
'empty': !isInteractive,
|
|
1055
1261
|
'today': d === now.getDate(),
|
|
@@ -1081,6 +1287,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1081
1287
|
|
|
1082
1288
|
// reset selection area
|
|
1083
1289
|
setSelectedCells([]);
|
|
1290
|
+
setCopiedCells(null);
|
|
1084
1291
|
|
|
1085
1292
|
|
|
1086
1293
|
//
|
|
@@ -1099,6 +1306,9 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1099
1306
|
id: 0,
|
|
1100
1307
|
date: _dateShow
|
|
1101
1308
|
} : _currentData[0], () => setShowEdit(true), 'normal');
|
|
1309
|
+
|
|
1310
|
+
// set temporary date
|
|
1311
|
+
setTempDate(_dateShow);
|
|
1102
1312
|
}
|
|
1103
1313
|
}
|
|
1104
1314
|
|
|
@@ -1111,11 +1321,11 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1111
1321
|
}}
|
|
1112
1322
|
>
|
|
1113
1323
|
|
|
1114
|
-
|
|
1324
|
+
|
|
1115
1325
|
{/* forward fill & day & back fill */}
|
|
1116
|
-
<div
|
|
1326
|
+
<div
|
|
1117
1327
|
className={combinedCls(
|
|
1118
|
-
'
|
|
1328
|
+
'custom-event-tl-table__cell-cushion custom-event-tl-table__cell-cushion-headercontent',
|
|
1119
1329
|
{
|
|
1120
1330
|
'disabled': !isInteractive
|
|
1121
1331
|
}
|
|
@@ -1163,7 +1373,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1163
1373
|
|
|
1164
1374
|
const _eventContentTooltip = typeof cellItem.dataTooltip === 'undefined' ? '' : <>
|
|
1165
1375
|
<div
|
|
1166
|
-
className="
|
|
1376
|
+
className="custom-event-tl__day__event-tooltipcontent"
|
|
1167
1377
|
dangerouslySetInnerHTML={{
|
|
1168
1378
|
__html: cellItem.dataTooltip
|
|
1169
1379
|
}}
|
|
@@ -1172,14 +1382,14 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1172
1382
|
|
|
1173
1383
|
return <div
|
|
1174
1384
|
className={combinedCls(
|
|
1175
|
-
`
|
|
1385
|
+
`custom-event-tl-table__cell-cushion-content__item custom-event-tl-table__cell-cushion-content__item-${cellItemIndex}`,
|
|
1176
1386
|
{
|
|
1177
1387
|
'first': cellItemIndex === 0,
|
|
1178
|
-
'last': cellItemIndex === _items.length-1
|
|
1388
|
+
'last': cellItemIndex === _items.length - 1
|
|
1179
1389
|
}
|
|
1180
1390
|
)}
|
|
1181
1391
|
key={`cell-item-${rowIndex}-${cellItemIndex}}`}
|
|
1182
|
-
data-overlay-id={`
|
|
1392
|
+
data-overlay-id={`custom-event-tl-table__cell-tooltipwrapper-${idRes}`}
|
|
1183
1393
|
data-cell-item-index={cellItemIndex}
|
|
1184
1394
|
data-date={_dateShow}
|
|
1185
1395
|
data-day={_dateDayShow}
|
|
@@ -1230,6 +1440,9 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1230
1440
|
|
|
1231
1441
|
if (EVENTS_ENABLED) {
|
|
1232
1442
|
onModalEditOpen?.(cellItem, () => setShowEdit(true), 'normal');
|
|
1443
|
+
|
|
1444
|
+
// set temporary date
|
|
1445
|
+
setTempDate(_dateShow);
|
|
1233
1446
|
}
|
|
1234
1447
|
}
|
|
1235
1448
|
}}
|
|
@@ -1239,7 +1452,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1239
1452
|
|
|
1240
1453
|
{/* ITEM */}
|
|
1241
1454
|
<div
|
|
1242
|
-
className="
|
|
1455
|
+
className="custom-event-tl__day__event"
|
|
1243
1456
|
style={typeof cellItem !== 'undefined' && (cellItem as any).eventStyles !== 'undefined' ? cellItem.eventStyles : {}}
|
|
1244
1457
|
dangerouslySetInnerHTML={typeof cellItem.data === 'string' ? {
|
|
1245
1458
|
__html: cellItem.data
|
|
@@ -1251,12 +1464,12 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1251
1464
|
|
|
1252
1465
|
{/* DELETE BUTTON */}
|
|
1253
1466
|
<div
|
|
1254
|
-
className={`
|
|
1467
|
+
className={`custom-event-tl__day__eventdel ${cellCloseBtnClassName || ''}`}
|
|
1255
1468
|
>
|
|
1256
|
-
<a
|
|
1257
|
-
href="#"
|
|
1258
|
-
tabIndex={-1}
|
|
1259
|
-
className="align-middle"
|
|
1469
|
+
<a
|
|
1470
|
+
href="#"
|
|
1471
|
+
tabIndex={-1}
|
|
1472
|
+
className="align-middle"
|
|
1260
1473
|
data-date={_dateShow}
|
|
1261
1474
|
data-day={_dateDayShow}
|
|
1262
1475
|
data-week={weekDay}
|
|
@@ -1289,11 +1502,14 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1289
1502
|
|
|
1290
1503
|
if (EVENTS_DELETE_ENABLED) {
|
|
1291
1504
|
onModalDeleteOpen?.(_existsContent, () => setShowDelete(true));
|
|
1505
|
+
|
|
1506
|
+
// set temporary date
|
|
1507
|
+
setTempDate(_dateShow);
|
|
1292
1508
|
}
|
|
1293
1509
|
}
|
|
1294
1510
|
|
|
1295
1511
|
|
|
1296
|
-
|
|
1512
|
+
|
|
1297
1513
|
}}
|
|
1298
1514
|
>
|
|
1299
1515
|
{_delBtn()}
|
|
@@ -1305,13 +1521,13 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1305
1521
|
});
|
|
1306
1522
|
};
|
|
1307
1523
|
|
|
1308
|
-
|
|
1524
|
+
|
|
1309
1525
|
|
|
1310
1526
|
const _tdContent = () => {
|
|
1311
1527
|
|
|
1312
1528
|
return <td
|
|
1313
1529
|
className={combinedCls(
|
|
1314
|
-
'
|
|
1530
|
+
'custom-event-tl-table__cell-cushion-content__container custom-event-tl-table__cell-tooltiptrigger',
|
|
1315
1531
|
{
|
|
1316
1532
|
'has-event': eventSourcesData && _currentData.length > 0,
|
|
1317
1533
|
'empty': !isInteractive,
|
|
@@ -1323,7 +1539,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1323
1539
|
key={"col" + i}
|
|
1324
1540
|
data-index={colIndex - 1}
|
|
1325
1541
|
colSpan={1}
|
|
1326
|
-
data-rowinfo={JSON.stringify(
|
|
1542
|
+
data-rowinfo={JSON.stringify(orginalData[rowIndex]?.listSection)}
|
|
1327
1543
|
data-date={_dateShow}
|
|
1328
1544
|
data-day={_dateDayShow}
|
|
1329
1545
|
data-week={weekDay}
|
|
@@ -1332,12 +1548,12 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1332
1548
|
onCellMouseEnter?.(e);
|
|
1333
1549
|
|
|
1334
1550
|
//
|
|
1335
|
-
if (multipleCells) handleTableMainCellMouseEnter(e, rowIndex, dayIndex);
|
|
1551
|
+
if (multipleCells) handleTableMainCellMouseEnter(e, rowIndex, dayIndex, forwardFillTotal);
|
|
1336
1552
|
}}
|
|
1337
1553
|
onMouseDown={(e: React.MouseEvent) => {
|
|
1338
1554
|
//
|
|
1339
1555
|
onCellClick?.(e, {
|
|
1340
|
-
rowData:
|
|
1556
|
+
rowData: orginalData[rowIndex]?.listSection,
|
|
1341
1557
|
date: _dateShow,
|
|
1342
1558
|
row: rowIndex,
|
|
1343
1559
|
col: dayIndex
|
|
@@ -1348,7 +1564,18 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1348
1564
|
onChangeDate?.(e, null);
|
|
1349
1565
|
}
|
|
1350
1566
|
|
|
1351
|
-
|
|
1567
|
+
|
|
1568
|
+
if (multipleCells) handleTableMainCellMouseDown(e, rowIndex, dayIndex, forwardFillTotal);
|
|
1569
|
+
}}
|
|
1570
|
+
|
|
1571
|
+
onDoubleClick={(e: React.MouseEvent) => {
|
|
1572
|
+
//
|
|
1573
|
+
onCellDoubleClick?.(e, {
|
|
1574
|
+
rowData: orginalData[rowIndex]?.listSection,
|
|
1575
|
+
date: _dateShow,
|
|
1576
|
+
row: rowIndex,
|
|
1577
|
+
col: dayIndex
|
|
1578
|
+
});
|
|
1352
1579
|
}}
|
|
1353
1580
|
onMouseLeave={(e: React.MouseEvent) => {
|
|
1354
1581
|
onCellMouseLeave?.(e);
|
|
@@ -1360,29 +1587,29 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1360
1587
|
|
|
1361
1588
|
|
|
1362
1589
|
{/* forward fill & day & back fill */}
|
|
1363
|
-
<div
|
|
1590
|
+
<div
|
|
1364
1591
|
className={combinedCls(
|
|
1365
|
-
'
|
|
1592
|
+
'custom-event-tl-table__cell-cushion custom-event-tl-table__cell-cushion-content',
|
|
1366
1593
|
{
|
|
1367
1594
|
'disabled': !isInteractive
|
|
1368
1595
|
}
|
|
1369
1596
|
)}
|
|
1370
1597
|
style={{ width: (CELL_MIN_W - 1) + 'px' }}
|
|
1371
1598
|
>
|
|
1372
|
-
|
|
1599
|
+
|
|
1373
1600
|
{/*++++++++++++++++ EVENT ++++++++++++++++*/}
|
|
1374
|
-
{_eventContent() || <><i style={{userSelect: 'none'}}> </i></>}
|
|
1601
|
+
{_eventContent() || <><i style={{ userSelect: 'none' }}> </i></>}
|
|
1375
1602
|
{/*++++++++++++++++ /EVENT ++++++++++++++++*/}
|
|
1376
1603
|
|
|
1377
1604
|
{/* ADD BUTTON */}
|
|
1378
1605
|
{isForward || isBack ? null : <>
|
|
1379
1606
|
<div
|
|
1380
|
-
className={`
|
|
1607
|
+
className={`custom-event-tl__day__eventadd ${cellAddBtnClassName || ''}`}
|
|
1381
1608
|
>
|
|
1382
|
-
<a
|
|
1383
|
-
href="#"
|
|
1384
|
-
tabIndex={-1}
|
|
1385
|
-
className="align-middle"
|
|
1609
|
+
<a
|
|
1610
|
+
href="#"
|
|
1611
|
+
tabIndex={-1}
|
|
1612
|
+
className="align-middle"
|
|
1386
1613
|
data-date={_dateShow}
|
|
1387
1614
|
data-day={_dateDayShow}
|
|
1388
1615
|
data-week={weekDay}
|
|
@@ -1413,6 +1640,10 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1413
1640
|
id: 0,
|
|
1414
1641
|
date: _dateShow
|
|
1415
1642
|
}, () => setShowEdit(true), 'new');
|
|
1643
|
+
|
|
1644
|
+
// set temporary date
|
|
1645
|
+
setTempDate(_dateShow);
|
|
1646
|
+
|
|
1416
1647
|
}
|
|
1417
1648
|
}
|
|
1418
1649
|
}}
|
|
@@ -1424,7 +1655,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1424
1655
|
</>}
|
|
1425
1656
|
{/* /ADD BUTTON */}
|
|
1426
1657
|
</div>
|
|
1427
|
-
|
|
1658
|
+
|
|
1428
1659
|
|
|
1429
1660
|
</td>;
|
|
1430
1661
|
};
|
|
@@ -1448,7 +1679,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1448
1679
|
|
|
1449
1680
|
function generateColUi() {
|
|
1450
1681
|
|
|
1451
|
-
{/* //########## MODE: WEEK ############# */}
|
|
1682
|
+
{/* //########## MODE: WEEK ############# */ }
|
|
1452
1683
|
if (appearanceMode === 'week') {
|
|
1453
1684
|
return Array.from({ length: 7 }).fill(0).map((item: any, i: number) => {
|
|
1454
1685
|
return (
|
|
@@ -1463,10 +1694,10 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1463
1694
|
})
|
|
1464
1695
|
}
|
|
1465
1696
|
|
|
1466
|
-
{/* //########## /MODE: WEEK ############# */}
|
|
1697
|
+
{/* //########## /MODE: WEEK ############# */ }
|
|
1467
1698
|
|
|
1468
1699
|
|
|
1469
|
-
{/* //########## MODE: MONTH ############# */}
|
|
1700
|
+
{/* //########## MODE: MONTH ############# */ }
|
|
1470
1701
|
if (appearanceMode === 'month') {
|
|
1471
1702
|
if (FILL_BLANK_DATE_DISABLD) {
|
|
1472
1703
|
return Array.from({ length: days[month] }).fill(0).map((item: any, i: number) => {
|
|
@@ -1485,14 +1716,15 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1485
1716
|
// colIndex
|
|
1486
1717
|
let colIndex = 0;
|
|
1487
1718
|
|
|
1488
|
-
|
|
1719
|
+
const { forwardFillTotal, list: cellsList } = getCells();
|
|
1720
|
+
return cellsList.map((item: any, j: number) => {
|
|
1489
1721
|
return item.col.map((dayIndex: number | null, i: number) => {
|
|
1490
1722
|
|
|
1491
1723
|
colIndex++;
|
|
1492
1724
|
|
|
1493
1725
|
// helper
|
|
1494
1726
|
const isInteractive = item.dateInfo[i].validDisplayDate; // The date on which the user interaction can occur, e.g. click, modify
|
|
1495
|
-
|
|
1727
|
+
|
|
1496
1728
|
return (
|
|
1497
1729
|
<col
|
|
1498
1730
|
className={combinedCls(
|
|
@@ -1512,9 +1744,9 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1512
1744
|
|
|
1513
1745
|
|
|
1514
1746
|
})
|
|
1515
|
-
}
|
|
1747
|
+
}
|
|
1516
1748
|
}
|
|
1517
|
-
{/* //########## /MODE: MONTH ############# */}
|
|
1749
|
+
{/* //########## /MODE: MONTH ############# */ }
|
|
1518
1750
|
|
|
1519
1751
|
|
|
1520
1752
|
|
|
@@ -1574,10 +1806,10 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1574
1806
|
if (tableGridRef.current === null) return;
|
|
1575
1807
|
|
|
1576
1808
|
const tableGridEl: any = tableGridRef.current;
|
|
1577
|
-
|
|
1809
|
+
|
|
1578
1810
|
// initialize cell height
|
|
1579
|
-
const headerTitleTrElements = tableGridEl.querySelector('.
|
|
1580
|
-
const trElements = tableGridEl.querySelector('.
|
|
1811
|
+
const headerTitleTrElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__title tbody').getElementsByTagName('tr');
|
|
1812
|
+
const trElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody').getElementsByTagName('tr');
|
|
1581
1813
|
|
|
1582
1814
|
for (let i = 0; i < headerTitleTrElements.length; i++) {
|
|
1583
1815
|
|
|
@@ -1589,22 +1821,34 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1589
1821
|
}
|
|
1590
1822
|
|
|
1591
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
|
+
|
|
1592
1837
|
|
|
1593
|
-
|
|
1594
1838
|
function tableGridInit() {
|
|
1595
1839
|
|
|
1596
1840
|
//
|
|
1597
1841
|
if (tableGridRef.current === null) return;
|
|
1598
1842
|
|
|
1843
|
+
const { forwardFillTotal, list: cellsList } = getCells();
|
|
1599
1844
|
const tableGridEl: any = tableGridRef.current;
|
|
1600
1845
|
let _curCellMinWidth: number = CELL_MIN_W;
|
|
1601
|
-
let _curColCount: number = FILL_BLANK_DATE_DISABLD ? days[month] : 7 *
|
|
1846
|
+
let _curColCount: number = FILL_BLANK_DATE_DISABLD ? days[month] : 7 * cellsList.length;
|
|
1602
1847
|
|
|
1603
1848
|
|
|
1604
1849
|
if (appearanceMode === 'week') {
|
|
1605
1850
|
_curColCount = 7;
|
|
1606
1851
|
}
|
|
1607
|
-
|
|
1608
1852
|
|
|
1609
1853
|
//****************
|
|
1610
1854
|
// STEP 1-1:
|
|
@@ -1613,23 +1857,23 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1613
1857
|
//--------------
|
|
1614
1858
|
if (appearanceMode === 'week') {
|
|
1615
1859
|
const tableMaxWidth = tableGridEl.clientWidth;
|
|
1616
|
-
const tableHeaderTitleWidth = tableGridEl.querySelector('.
|
|
1617
|
-
const tableDividerWidth = tableGridEl.querySelector('.
|
|
1860
|
+
const tableHeaderTitleWidth = tableGridEl.querySelector('.custom-event-tl-table__cell-cushion-headertitle').clientWidth;
|
|
1861
|
+
const tableDividerWidth = tableGridEl.querySelector('.custom-event-tl-table__timeline-divider').clientWidth;
|
|
1618
1862
|
const tableBorderWidth = 4;
|
|
1619
1863
|
const scrollMaxWidth = tableMaxWidth - tableHeaderTitleWidth - tableDividerWidth - tableBorderWidth;
|
|
1620
1864
|
|
|
1621
|
-
_curCellMinWidth = scrollMaxWidth/7;
|
|
1865
|
+
_curCellMinWidth = scrollMaxWidth / 7;
|
|
1622
1866
|
_curColCount = 7;
|
|
1623
1867
|
|
|
1624
1868
|
// header
|
|
1625
|
-
tableGridEl.querySelectorAll('.
|
|
1869
|
+
tableGridEl.querySelectorAll('.custom-event-tl-table__cell-cushion-headercontent__container, .custom-event-tl-table__cell-cushion-content').forEach((node: HTMLDivElement) => {
|
|
1626
1870
|
node.style.width = _curCellMinWidth + 'px';
|
|
1627
1871
|
});
|
|
1628
1872
|
|
|
1629
|
-
|
|
1873
|
+
|
|
1630
1874
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1875
|
+
|
|
1876
|
+
|
|
1633
1877
|
|
|
1634
1878
|
//****************
|
|
1635
1879
|
// STEP 1-2:
|
|
@@ -1646,46 +1890,46 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1646
1890
|
//****************
|
|
1647
1891
|
// initialize "header & main" cells
|
|
1648
1892
|
//--------------
|
|
1649
|
-
const headerThContentContainers: any = tableGridEl.querySelector('.
|
|
1893
|
+
const headerThContentContainers: any = tableGridEl.querySelector('.custom-event-tl-table__datagrid-header__content tbody').getElementsByTagName('th');
|
|
1650
1894
|
for (let i = 0; i < headerThContentContainers.length; i++) {
|
|
1651
|
-
const curHeaderThContent = headerThContentContainers[i].querySelector('.
|
|
1895
|
+
const curHeaderThContent = headerThContentContainers[i].querySelector('.custom-event-tl-table__cell-cushion-headercontent');
|
|
1652
1896
|
if (curHeaderThContent !== null) curHeaderThContent.style.width = _curCellMinWidth + 'px';
|
|
1653
1897
|
}
|
|
1654
1898
|
|
|
1655
|
-
|
|
1656
|
-
const mainTdContentContainers: any = tableGridEl.querySelector('.
|
|
1899
|
+
|
|
1900
|
+
const mainTdContentContainers: any = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody').getElementsByTagName('td');
|
|
1657
1901
|
for (let i = 0; i < mainTdContentContainers.length; i++) {
|
|
1658
|
-
const curHeaderThContent = mainTdContentContainers[i].querySelector('.
|
|
1902
|
+
const curHeaderThContent = mainTdContentContainers[i].querySelector('.custom-event-tl-table__cell-cushion-content');
|
|
1659
1903
|
if (curHeaderThContent !== null) curHeaderThContent.style.width = _curCellMinWidth + 'px';
|
|
1660
1904
|
}
|
|
1661
|
-
|
|
1662
|
-
const mainTdContentCols: any = tableGridEl.querySelector('.
|
|
1905
|
+
|
|
1906
|
+
const mainTdContentCols: any = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content colgroup').getElementsByTagName('col')
|
|
1663
1907
|
for (let i = 0; i < mainTdContentCols.length; i++) {
|
|
1664
1908
|
mainTdContentCols[i].style.minWidth = _curCellMinWidth + 'px';
|
|
1665
1909
|
}
|
|
1666
|
-
|
|
1910
|
+
|
|
1667
1911
|
|
|
1668
1912
|
//****************
|
|
1669
1913
|
// STEP 2:
|
|
1670
1914
|
//****************
|
|
1671
1915
|
// initialize scrollable wrapper (width)
|
|
1672
1916
|
//--------------
|
|
1673
|
-
const _scrollableWrapper: HTMLElement[] = tableGridEl.querySelectorAll('.
|
|
1917
|
+
const _scrollableWrapper: HTMLElement[] = tableGridEl.querySelectorAll('.custom-event-tl-table__scroller-harness');
|
|
1674
1918
|
[].slice.call(_scrollableWrapper).forEach((el: any) => {
|
|
1675
1919
|
const scrollType = el.dataset.scroll;
|
|
1676
1920
|
|
|
1677
1921
|
if (appearanceMode === 'week') {
|
|
1678
|
-
el.classList.add('
|
|
1922
|
+
el.classList.add('custom-event-tl-table__scroller-harness--hideX');
|
|
1679
1923
|
}
|
|
1680
1924
|
if (appearanceMode === 'month') {
|
|
1681
|
-
el.classList.remove('
|
|
1925
|
+
el.classList.remove('custom-event-tl-table__scroller-harness--hideX');
|
|
1682
1926
|
}
|
|
1683
1927
|
|
|
1684
1928
|
if (scrollType !== 'list') {
|
|
1685
|
-
const _content = el.querySelector('.
|
|
1929
|
+
const _content = el.querySelector('.custom-event-tl-table__scroller');
|
|
1686
1930
|
const tableMaxWidth = tableGridEl.clientWidth;
|
|
1687
|
-
const tableHeaderTitleWidth = tableGridEl.querySelector('.
|
|
1688
|
-
const tableDividerWidth = tableGridEl.querySelector('.
|
|
1931
|
+
const tableHeaderTitleWidth = tableGridEl.querySelector('.custom-event-tl-table__cell-cushion-headertitle').clientWidth;
|
|
1932
|
+
const tableDividerWidth = tableGridEl.querySelector('.custom-event-tl-table__timeline-divider').clientWidth;
|
|
1689
1933
|
const tableBorderWidth = 4;
|
|
1690
1934
|
const scrollMaxWidth = tableMaxWidth - tableHeaderTitleWidth - tableDividerWidth - tableBorderWidth;
|
|
1691
1935
|
|
|
@@ -1695,21 +1939,21 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1695
1939
|
|
|
1696
1940
|
}
|
|
1697
1941
|
});
|
|
1698
|
-
|
|
1942
|
+
|
|
1699
1943
|
|
|
1700
1944
|
//****************
|
|
1701
1945
|
// STEP 3:
|
|
1702
1946
|
//****************
|
|
1703
1947
|
// initialize cell width
|
|
1704
1948
|
//--------------
|
|
1705
|
-
const tdElementMaxWidth: number = typeof mainTdContentContainers[0] === 'undefined' ? 0 : parseFloat(window.getComputedStyle(mainTdContentContainers[0].querySelector('.
|
|
1949
|
+
const tdElementMaxWidth: number = typeof mainTdContentContainers[0] === 'undefined' ? 0 : parseFloat(window.getComputedStyle(mainTdContentContainers[0].querySelector('.custom-event-tl-table__cell-cushion-content')).maxWidth);
|
|
1706
1950
|
|
|
1707
1951
|
|
|
1708
1952
|
if (Array.isArray(eventsValue) && eventsValue.length > 0) {
|
|
1709
1953
|
|
|
1710
1954
|
for (let i = 0; i < headerThContentContainers.length; i++) {
|
|
1711
1955
|
|
|
1712
|
-
const curHeaderThContent = headerThContentContainers[i].querySelector('.
|
|
1956
|
+
const curHeaderThContent = headerThContentContainers[i].querySelector('.custom-event-tl-table__cell-cushion-headercontent');
|
|
1713
1957
|
const curHeaderThContentMaxWidth = parseFloat(window.getComputedStyle(curHeaderThContent).width);
|
|
1714
1958
|
const targetElement = headerThContentContainers[i].offsetWidth > mainTdContentContainers[i].offsetWidth ? headerThContentContainers[i] : mainTdContentContainers[i];
|
|
1715
1959
|
let tdOwidth = parseFloat(window.getComputedStyle(targetElement).width);
|
|
@@ -1729,7 +1973,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1729
1973
|
tdOwidth = tdOwidth - 1;
|
|
1730
1974
|
|
|
1731
1975
|
|
|
1732
|
-
headerThContentContainers[i].querySelector('.
|
|
1976
|
+
headerThContentContainers[i].querySelector('.custom-event-tl-table__cell-cushion-headercontent').style.width = tdOwidth + 'px';
|
|
1733
1977
|
mainTdContentCols[i].style.minWidth = tdOwidth + 'px';
|
|
1734
1978
|
|
|
1735
1979
|
|
|
@@ -1743,7 +1987,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1743
1987
|
// initialize max width of table content
|
|
1744
1988
|
//--------------
|
|
1745
1989
|
if (scrollBodyRef.current !== null && scrollHeaderRef.current !== null) {
|
|
1746
|
-
const tableContentWidth = window.getComputedStyle(tableGridEl.querySelector('.
|
|
1990
|
+
const tableContentWidth = window.getComputedStyle(tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content')).width;
|
|
1747
1991
|
const scrollBodyEl: any = scrollBodyRef.current;
|
|
1748
1992
|
const scrollHeaderEl: any = scrollHeaderRef.current;
|
|
1749
1993
|
|
|
@@ -1755,7 +1999,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1755
1999
|
//
|
|
1756
2000
|
const tableWrapperMaxWidthLatest = tableGridEl.clientWidth;
|
|
1757
2001
|
if (tableWrapperMaxWidthLatest > parseFloat(tableContentWidth)) {
|
|
1758
|
-
tableGridEl.querySelector('.
|
|
2002
|
+
tableGridEl.querySelector('.custom-event-tl-table__timeline-table').style.width = tableContentWidth;
|
|
1759
2003
|
}
|
|
1760
2004
|
|
|
1761
2005
|
|
|
@@ -1787,7 +2031,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1787
2031
|
}
|
|
1788
2032
|
|
|
1789
2033
|
});
|
|
1790
|
-
|
|
2034
|
+
|
|
1791
2035
|
|
|
1792
2036
|
|
|
1793
2037
|
//****************
|
|
@@ -1804,21 +2048,21 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1804
2048
|
//--------------
|
|
1805
2049
|
if (appearanceMode === 'week') {
|
|
1806
2050
|
const tableMaxWidth = tableGridEl.clientWidth;
|
|
1807
|
-
const tableHeaderTitleWidth = tableGridEl.querySelector('.
|
|
1808
|
-
const tableDividerWidth = tableGridEl.querySelector('.
|
|
2051
|
+
const tableHeaderTitleWidth = tableGridEl.querySelector('.custom-event-tl-table__cell-cushion-headertitle').clientWidth;
|
|
2052
|
+
const tableDividerWidth = tableGridEl.querySelector('.custom-event-tl-table__timeline-divider').clientWidth;
|
|
1809
2053
|
const tableBorderWidth = 4;
|
|
1810
2054
|
const scrollMaxWidth = tableMaxWidth - tableHeaderTitleWidth - tableDividerWidth - tableBorderWidth;
|
|
1811
2055
|
|
|
1812
|
-
_curCellMinWidth = scrollMaxWidth/7;
|
|
2056
|
+
_curCellMinWidth = scrollMaxWidth / 7;
|
|
1813
2057
|
_curColCount = 7;
|
|
1814
2058
|
|
|
1815
2059
|
// header content
|
|
1816
|
-
tableGridEl.querySelectorAll('.
|
|
2060
|
+
tableGridEl.querySelectorAll('.custom-event-tl-table__cell-cushion-headercontent__container, .custom-event-tl-table__cell-cushion-headercontent').forEach((node: HTMLDivElement) => {
|
|
1817
2061
|
node.style.width = _curCellMinWidth + 'px';
|
|
1818
2062
|
});
|
|
1819
2063
|
|
|
1820
2064
|
// main content
|
|
1821
|
-
tableGridEl.querySelectorAll('.
|
|
2065
|
+
tableGridEl.querySelectorAll('.custom-event-tl-table__cell-cushion-content').forEach((node: HTMLDivElement) => {
|
|
1822
2066
|
node.style.width = _curCellMinWidth + 'px';
|
|
1823
2067
|
});
|
|
1824
2068
|
|
|
@@ -1835,20 +2079,20 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1835
2079
|
|
|
1836
2080
|
// initialize scrollable wrapper (width & height)
|
|
1837
2081
|
//--------------
|
|
1838
|
-
const _scrollableWrapper = tableGridEl.querySelectorAll('.
|
|
2082
|
+
const _scrollableWrapper = tableGridEl.querySelectorAll('.custom-event-tl-table__scroller-harness');
|
|
1839
2083
|
[].slice.call(_scrollableWrapper).forEach((el: any) => {
|
|
1840
|
-
|
|
1841
|
-
const _content = el.querySelector('.
|
|
2084
|
+
|
|
2085
|
+
const _content = el.querySelector('.custom-event-tl-table__scroller');
|
|
1842
2086
|
el.removeAttribute('data-width');
|
|
1843
2087
|
el.removeAttribute('style');
|
|
1844
2088
|
_content.removeAttribute('style');
|
|
1845
2089
|
});
|
|
1846
|
-
|
|
2090
|
+
|
|
1847
2091
|
|
|
1848
2092
|
// initialize cell height
|
|
1849
2093
|
//--------------
|
|
1850
|
-
const headerTitleTrElements = tableGridEl.querySelector('.
|
|
1851
|
-
const trElements = tableGridEl.querySelector('.
|
|
2094
|
+
const headerTitleTrElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__title tbody').getElementsByTagName('tr');
|
|
2095
|
+
const trElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody').getElementsByTagName('tr');
|
|
1852
2096
|
|
|
1853
2097
|
for (let i = 0; i < headerTitleTrElements.length; i++) {
|
|
1854
2098
|
headerTitleTrElements[i].removeAttribute('style');
|
|
@@ -1891,10 +2135,12 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1891
2135
|
|
|
1892
2136
|
|
|
1893
2137
|
useEffect(() => {
|
|
2138
|
+
|
|
2139
|
+
const { forwardFillTotal, list: cellsList } = getCells();
|
|
1894
2140
|
if (typeof appearanceWeekTmpl === 'function') {
|
|
1895
|
-
setDisplayWeekForHeader([
|
|
2141
|
+
setDisplayWeekForHeader([cellsList.at(0).dateInfo[0].date, cellsList.at(-1).dateInfo[0].date]);
|
|
1896
2142
|
} else {
|
|
1897
|
-
setDisplayWeekForHeader([formatToEnglishMonthDay(
|
|
2143
|
+
setDisplayWeekForHeader([formatToEnglishMonthDay(cellsList.at(0).dateInfo[0].date), formatToEnglishMonthDay(cellsList.at(-1).dateInfo[0].date)]);
|
|
1898
2144
|
}
|
|
1899
2145
|
|
|
1900
2146
|
}, [weekOffset]);
|
|
@@ -1902,7 +2148,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1902
2148
|
useEffect(() => {
|
|
1903
2149
|
|
|
1904
2150
|
// update events value
|
|
1905
|
-
if (Array.isArray(eventsValue) && eventsValue.length > 0)
|
|
2151
|
+
if (Array.isArray(eventsValue) && eventsValue.length > 0) setOrginalData(eventsValue);
|
|
1906
2152
|
|
|
1907
2153
|
// update current today
|
|
1908
2154
|
if (typeof customTodayDate !== 'undefined' && isValidDate(customTodayDate)) {
|
|
@@ -1913,369 +2159,391 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1913
2159
|
// Call a function when the list has been rendered completely
|
|
1914
2160
|
onListRenderComplete?.();
|
|
1915
2161
|
|
|
2162
|
+
}, [eventsValue, customTodayDate, appearanceMode]);
|
|
2163
|
+
|
|
2164
|
+
|
|
2165
|
+
|
|
2166
|
+
useEffect(() => {
|
|
2167
|
+
|
|
1916
2168
|
|
|
2169
|
+
// calculate wrapper width (!!!FIRST!!!)
|
|
2170
|
+
//--------------
|
|
2171
|
+
outerWrapperInit();
|
|
2172
|
+
|
|
2173
|
+
// !!!Please do not use dependencies
|
|
2174
|
+
//--------------
|
|
1917
2175
|
return () => {
|
|
1918
2176
|
|
|
1919
2177
|
// reset table grid
|
|
1920
2178
|
tableGridReset();
|
|
1921
|
-
}
|
|
1922
|
-
|
|
1923
|
-
}, [eventsValue, customTodayDate, appearanceMode]);
|
|
1924
|
-
|
|
1925
2179
|
|
|
2180
|
+
// reset selection area
|
|
2181
|
+
setSelectedCells([]);
|
|
2182
|
+
setCopiedCells(null);
|
|
2183
|
+
}
|
|
1926
2184
|
|
|
2185
|
+
}, []);
|
|
1927
2186
|
return (
|
|
1928
2187
|
<>
|
|
1929
2188
|
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
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>
|
|
1933
2210
|
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
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 ############# */}
|
|
1954
2234
|
|
|
1955
2235
|
|
|
1956
|
-
{/* //########## MODE: MONTH ############# */}
|
|
1957
|
-
{appearanceMode === 'month' ? <>
|
|
1958
|
-
<div className="e-cal-timeline__header__btns">
|
|
1959
|
-
<button tabIndex={-1} type="button" className={`e-cal-timeline__btn ${winMonth ? 'active' : ''}`} onClick={handleShowWinMonth}>
|
|
1960
|
-
{MONTHS[month]}
|
|
1961
|
-
<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>
|
|
1962
|
-
</button>
|
|
1963
|
-
<button tabIndex={-1} type="button" className={`e-cal-timeline__btn ${winYear ? 'active' : ''}`} onClick={handleShowWinYear}>
|
|
1964
|
-
{year}
|
|
1965
|
-
<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>
|
|
1966
|
-
</button>
|
|
1967
|
-
</div>
|
|
1968
|
-
</> : null}
|
|
1969
|
-
{/* //########## /MODE: MONTH ############# */}
|
|
1970
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>
|
|
1971
2243
|
|
|
1972
|
-
|
|
1973
|
-
<button tabIndex={-1} type="button" className="e-cal-timeline__btn e-cal-timeline__btn--next" onClick={handleNextChange}>
|
|
1974
|
-
<svg width="20px" height="20px" viewBox="0 0 24 24" fill="none">
|
|
1975
|
-
<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" />
|
|
1976
|
-
</svg>
|
|
1977
|
-
</button>
|
|
1978
|
-
</div>
|
|
1979
2244
|
|
|
1980
2245
|
|
|
2246
|
+
<div className="custom-event-tl__body">
|
|
1981
2247
|
|
|
1982
|
-
<div className="e-cal-timeline__body">
|
|
1983
2248
|
|
|
2249
|
+
<div className="custom-event-tl__row">
|
|
2250
|
+
{/* day */}
|
|
1984
2251
|
|
|
1985
|
-
|
|
1986
|
-
|
|
2252
|
+
{/* /day */}
|
|
2253
|
+
</div>
|
|
1987
2254
|
|
|
1988
|
-
{/* /day */}
|
|
1989
2255
|
</div>
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
})}
|
|
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>
|
|
2006
2271
|
</div>
|
|
2007
|
-
|
|
2008
|
-
|
|
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>
|
|
2009
2286
|
|
|
2010
|
-
{/*++++++++++++++++ YEAR SELECTION TAB ++++++++++++++++*/}
|
|
2011
|
-
<div className={`e-cal-timeline__year-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winYear ? 'active' : ''}`}>
|
|
2012
|
-
<div className="e-cal-timeline__year-container bg-body-tertiary">
|
|
2013
|
-
{yearsArray.map((year, index) => {
|
|
2014
|
-
return <div
|
|
2015
|
-
data-year={year}
|
|
2016
|
-
className={`e-cal-timeline__year ${selectedYear === year ? ' selected' : ''}`}
|
|
2017
|
-
key={year + index}
|
|
2018
|
-
onClick={() => { handleYearChange(year) }}
|
|
2019
|
-
>{year}</div>
|
|
2020
|
-
})}
|
|
2021
2287
|
</div>
|
|
2022
|
-
|
|
2023
|
-
</div>
|
|
2024
|
-
{/*++++++++++++++++ /YEAR SELECTION TAB ++++++++++++++++*/}
|
|
2288
|
+
{/*++++++++++++++++ /YEAR SELECTION TAB ++++++++++++++++*/}
|
|
2025
2289
|
|
|
2026
2290
|
|
|
2027
2291
|
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
>
|
|
2036
|
-
{langToday || 'Today'}
|
|
2037
|
-
</button>
|
|
2038
|
-
|
|
2039
|
-
{appearanceToggle ? <>
|
|
2040
|
-
<button
|
|
2041
|
-
tabIndex={-1}
|
|
2042
|
-
type="button"
|
|
2043
|
-
className={`e-cal-timeline__btn e-cal-timeline__btn--appearance ${appearanceMode === 'month' ? 'active' : ''}`}
|
|
2044
|
-
data-mode="month"
|
|
2045
|
-
onClick={handleAppearanceChange}
|
|
2046
|
-
>
|
|
2047
|
-
{langAppearanceLabelMonth || 'Month'}
|
|
2048
|
-
</button>
|
|
2049
|
-
<button
|
|
2050
|
-
tabIndex={-1}
|
|
2051
|
-
type="button"
|
|
2052
|
-
className={`e-cal-timeline__btn e-cal-timeline__btn--appearance ${appearanceMode === 'week' ? 'active' : ''}`}
|
|
2053
|
-
data-mode="week"
|
|
2054
|
-
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}
|
|
2055
2299
|
>
|
|
2056
|
-
{
|
|
2300
|
+
{langToday || 'Today'}
|
|
2057
2301
|
</button>
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
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}
|
|
2323
|
+
|
|
2324
|
+
</div>
|
|
2325
|
+
{/*++++++++++++++++ /TODAY SELECTION TAB ++++++++++++++++*/}
|
|
2062
2326
|
|
|
2063
2327
|
|
|
2064
|
-
|
|
2328
|
+
</div>{/* /.custom-event-tl__wrapper */}
|
|
2065
2329
|
|
|
2066
2330
|
|
|
2067
2331
|
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
)}
|
|
2078
|
-
onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
2079
|
-
onKeyPressed?.(e, selectedCells);
|
|
2080
|
-
}}
|
|
2081
|
-
tabIndex={-1} // require "tabIndex" attribute
|
|
2082
|
-
>
|
|
2083
|
-
<table role="grid" className={combinedCls(
|
|
2084
|
-
"e-cal-timeline-table__timeline-table",
|
|
2085
|
-
tableClassName
|
|
2086
|
-
)}>
|
|
2087
|
-
<colgroup>
|
|
2088
|
-
<col className="e-cal-timeline-table__datagrid-header" />
|
|
2089
|
-
<col />
|
|
2090
|
-
<col />
|
|
2091
|
-
</colgroup>
|
|
2092
|
-
|
|
2093
|
-
<thead className={combinedCls(
|
|
2094
|
-
tableHeadClassName
|
|
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
|
|
2095
2341
|
)}
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
>
|
|
2099
|
-
<tr role="presentation">
|
|
2100
|
-
<th role="presentation">
|
|
2101
|
-
{/*<!--///// HEADER LEFT //////-->*/}
|
|
2102
|
-
<div className="e-cal-timeline-table__timeline-header e-cal-timeline-table__timeline-headertitle">
|
|
2103
|
-
|
|
2104
|
-
<table role="presentation" className="e-cal-timeline-table__datagrid-header__title">
|
|
2105
|
-
<colgroup>
|
|
2106
|
-
<col />
|
|
2107
|
-
</colgroup>
|
|
2108
|
-
<thead role="presentation">
|
|
2109
|
-
<tr role="row">
|
|
2110
|
-
<th role="columnheader">
|
|
2111
|
-
<div className="e-cal-timeline-table__cell-cushion e-cal-timeline-table__cell-cushion-headertitle">
|
|
2112
|
-
{tableListSectionTitle || ''}
|
|
2113
|
-
</div>
|
|
2114
|
-
</th>
|
|
2115
|
-
</tr>
|
|
2116
|
-
</thead>
|
|
2117
|
-
</table>
|
|
2342
|
+
onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
2343
|
+
onKeyPressed?.(e, selectedCells);
|
|
2118
2344
|
|
|
2119
|
-
|
|
2120
|
-
|
|
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">
|
|
2121
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>
|
|
2122
2385
|
|
|
2386
|
+
</div>
|
|
2387
|
+
{/*<!--///// /HEADER LEFT //////-->*/}
|
|
2123
2388
|
|
|
2124
|
-
</th>
|
|
2125
|
-
<th role="presentation" className="e-cal-timeline-table__timeline-divider"><div></div></th>
|
|
2126
|
-
<th role="presentation">
|
|
2127
|
-
<div
|
|
2128
|
-
ref={scrollHeaderRef}
|
|
2129
|
-
className="e-cal-timeline-table__scroller-harness e-cal-timeline-table__scroller-harness--hide"
|
|
2130
|
-
data-scroll="header"
|
|
2131
|
-
onScroll={syncTableScrollHeader}
|
|
2132
|
-
>
|
|
2133
|
-
<div className="e-cal-timeline-table__scroller">
|
|
2134
2389
|
|
|
2135
|
-
{/*<!--///// HEADER RIGHT //////-->*/}
|
|
2136
|
-
<div className="e-cal-timeline-table__timeline-header">
|
|
2137
2390
|
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
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 //////-->*/}
|
|
2145
2414
|
</div>
|
|
2146
|
-
{/*<!--///// /HEADER RIGHT //////-->*/}
|
|
2147
2415
|
</div>
|
|
2148
|
-
</
|
|
2149
|
-
</
|
|
2150
|
-
</
|
|
2151
|
-
</thead>
|
|
2416
|
+
</th>
|
|
2417
|
+
</tr>
|
|
2418
|
+
</thead>
|
|
2152
2419
|
|
|
2153
2420
|
|
|
2154
2421
|
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
className={combinedCls(
|
|
2164
|
-
tableListStartClassName
|
|
2165
|
-
)}
|
|
2166
|
-
|
|
2167
|
-
>
|
|
2168
|
-
|
|
2169
|
-
<div
|
|
2170
|
-
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"
|
|
2171
2430
|
className={combinedCls(
|
|
2172
|
-
|
|
2173
|
-
{
|
|
2174
|
-
'autoscroll': AUTO_SCROLL
|
|
2175
|
-
}
|
|
2431
|
+
tableListStartClassName
|
|
2176
2432
|
)}
|
|
2177
|
-
data-scroll="list"
|
|
2178
|
-
onScroll={syncTableScrollList}
|
|
2179
|
-
>
|
|
2180
|
-
<div className="e-cal-timeline-table__scroller">
|
|
2181
2433
|
|
|
2182
|
-
|
|
2183
|
-
<table role="presentation" className="e-cal-timeline-table__datagrid-body__title e-cal-timeline-table__scrollgrid-sync-table">
|
|
2184
|
-
<colgroup>
|
|
2185
|
-
<col />
|
|
2186
|
-
</colgroup>
|
|
2187
|
-
<tbody role="presentation">
|
|
2434
|
+
>
|
|
2188
2435
|
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
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">
|
|
2192
2448
|
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
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">
|
|
2198
2455
|
|
|
2456
|
+
{/*<!-- per row -->*/}
|
|
2457
|
+
{generateListSectionUi()}
|
|
2458
|
+
{/*<!-- /per row -->*/}
|
|
2199
2459
|
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
tableListDividerClassName
|
|
2206
|
-
)}
|
|
2207
|
-
>
|
|
2208
|
-
<div></div>
|
|
2209
|
-
</td>
|
|
2210
|
-
<td
|
|
2211
|
-
role="presentation"
|
|
2212
|
-
className={combinedCls(
|
|
2213
|
-
tableListEndClassName
|
|
2214
|
-
)}
|
|
2215
|
-
>
|
|
2460
|
+
</tbody>
|
|
2461
|
+
</table>
|
|
2462
|
+
{/*<!--///// /RESOURCE LEFT //////-->*/}
|
|
2463
|
+
</div>
|
|
2464
|
+
</div>
|
|
2216
2465
|
|
|
2217
2466
|
|
|
2218
|
-
|
|
2219
|
-
|
|
2467
|
+
</td>
|
|
2468
|
+
<td
|
|
2469
|
+
role="presentation"
|
|
2220
2470
|
className={combinedCls(
|
|
2221
|
-
'
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
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
|
|
2225
2481
|
)}
|
|
2226
|
-
data-scroll="body"
|
|
2227
|
-
onScroll={syncTableScrollBody}
|
|
2228
|
-
onMouseMove={BODY_DRAG ? handleTableMove : () => { }}
|
|
2229
|
-
onMouseDown={BODY_DRAG ? handleTableDragStart : () => { }}
|
|
2230
|
-
onMouseUp={BODY_DRAG ? handleTableDragEnd : () => { }}
|
|
2231
|
-
onMouseLeave={BODY_DRAG ? handleTableDragEnd : () => { }}
|
|
2232
2482
|
>
|
|
2233
|
-
<div className="e-cal-timeline-table__scroller">
|
|
2234
|
-
{/*<!--///// RESOURCE RIGHT //////-->*/}
|
|
2235
|
-
<div className="e-cal-timeline-table__timeline-body">
|
|
2236
|
-
<table
|
|
2237
|
-
className="e-cal-timeline-table__datagrid-body__content e-cal-timeline-table__scrollgrid-sync-table"
|
|
2238
|
-
/* Drag to activate the selection area */
|
|
2239
|
-
onMouseLeave={multipleCells ? handleTableMainMouseUp : undefined}
|
|
2240
|
-
onMouseUp={multipleCells ? handleTableMainMouseUp : undefined}
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
>
|
|
2244
|
-
<colgroup>
|
|
2245
|
-
{generateColUi()}
|
|
2246
|
-
</colgroup>
|
|
2247
|
-
<tbody>
|
|
2248
|
-
{/*<!-- per row -->*/}
|
|
2249
|
-
{val.map((item: any, i: number) => {
|
|
2250
2483
|
|
|
2251
|
-
return (
|
|
2252
|
-
<tr key={i}>
|
|
2253
|
-
{generateDaysUi(item.eventSources, item.listSection, i, true)}
|
|
2254
|
-
</tr>
|
|
2255
|
-
)
|
|
2256
2484
|
|
|
2257
|
-
|
|
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 //////-->*/}
|
|
2258
2530
|
|
|
2259
|
-
</tbody>
|
|
2260
|
-
</table>
|
|
2261
2531
|
|
|
2262
2532
|
</div>
|
|
2263
|
-
{/*<!--///// /RESOURCE RIGHT //////-->*/}
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
2533
|
</div>
|
|
2267
|
-
</div>
|
|
2268
2534
|
|
|
2269
2535
|
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2536
|
+
</td>
|
|
2537
|
+
</tr>
|
|
2538
|
+
</tbody>
|
|
2539
|
+
</table>
|
|
2540
|
+
|
|
2541
|
+
</div>{/* /.custom-event-tl-table__timeline-table__wrapper */}
|
|
2274
2542
|
|
|
2275
|
-
</div>{/* /.e-cal-timeline-table__timeline-table__wrapper */}
|
|
2276
2543
|
|
|
2544
|
+
</>}
|
|
2545
|
+
</div>
|
|
2277
2546
|
|
|
2278
|
-
</>}
|
|
2279
2547
|
|
|
2280
2548
|
|
|
2281
2549
|
{/*/////////////////////////////////////////////////// */}
|
|
@@ -2287,6 +2555,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
2287
2555
|
|
|
2288
2556
|
{/*<!-- DELETE -->*/}
|
|
2289
2557
|
<ModalDialog
|
|
2558
|
+
ref={modalDeleteHandleRef}
|
|
2290
2559
|
show={showDelete}
|
|
2291
2560
|
maskOpacity={modalMaskOpacity}
|
|
2292
2561
|
triggerClassName=""
|
|
@@ -2300,6 +2569,8 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
2300
2569
|
setTimeout(() => {
|
|
2301
2570
|
setShowDelete(false);
|
|
2302
2571
|
onModalDeleteClose?.(queryItemObj());
|
|
2572
|
+
// set temporary date
|
|
2573
|
+
setTempDate('');
|
|
2303
2574
|
}, 350);
|
|
2304
2575
|
}}
|
|
2305
2576
|
onSubmit={async (e: any, closewin: Function, data: any) => {
|
|
@@ -2320,6 +2591,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
2320
2591
|
|
|
2321
2592
|
{/*<!-- EDIT -->*/}
|
|
2322
2593
|
<ModalDialog
|
|
2594
|
+
ref={modalEditHandleRef}
|
|
2323
2595
|
show={showEdit}
|
|
2324
2596
|
maskOpacity={modalMaskOpacity}
|
|
2325
2597
|
heading={modalHeading}
|
|
@@ -2336,6 +2608,8 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
2336
2608
|
setTimeout(() => {
|
|
2337
2609
|
setShowEdit(false);
|
|
2338
2610
|
onModalEditClose?.(queryItemObj());
|
|
2611
|
+
// set temporary date
|
|
2612
|
+
setTempDate('');
|
|
2339
2613
|
}, 350);
|
|
2340
2614
|
}}
|
|
2341
2615
|
onSubmit={async (e: any, closewin: Function, data: any) => {
|
|
@@ -2367,14 +2641,14 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
2367
2641
|
<RootPortal show={true} containerClassName="EventCalendarTimeline-TooltipModal">
|
|
2368
2642
|
<div
|
|
2369
2643
|
ref={tableTooltipModalRef}
|
|
2370
|
-
id={`
|
|
2371
|
-
className={`
|
|
2644
|
+
id={`custom-event-tl-table__cell-tooltipwrapper-${idRes}`}
|
|
2645
|
+
className={`custom-event-tl-table__cell-tooltipwrapper d-inline-block ${isShowTableTooltip ? 'active' : ''}`}
|
|
2372
2646
|
role="tooltip"
|
|
2373
2647
|
data-microtip-position={tableTooltipDirection || 'bottom'}
|
|
2374
2648
|
data-microtip-size={tableTooltipSize || 'auto'}
|
|
2375
2649
|
style={{ display: 'none' }}
|
|
2376
2650
|
>
|
|
2377
|
-
<div className="
|
|
2651
|
+
<div className="custom-event-tl-table__cell-tooltipcontent">
|
|
2378
2652
|
{tableTooltipContent}
|
|
2379
2653
|
</div>
|
|
2380
2654
|
</div>
|