funda-ui 4.3.355 → 4.3.721
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/DynamicFields/index.d.ts +1 -0
- package/DynamicFields/index.js +23 -3
- package/EventCalendar/index.css +150 -106
- package/EventCalendar/index.d.ts +11 -2
- package/EventCalendar/index.js +835 -151
- package/EventCalendarTimeline/index.css +293 -251
- package/EventCalendarTimeline/index.d.ts +18 -9
- package/EventCalendarTimeline/index.js +1077 -505
- package/MultipleCheckboxes/index.d.ts +1 -0
- package/MultipleCheckboxes/index.js +17 -7
- package/MultipleSelect/index.d.ts +4 -0
- package/MultipleSelect/index.js +54 -8
- package/NativeSelect/index.js +1 -0
- package/Radio/index.d.ts +2 -1
- package/Radio/index.js +54 -24
- package/Select/index.js +115 -42
- package/Table/index.js +27 -3
- package/lib/cjs/DynamicFields/index.d.ts +1 -0
- package/lib/cjs/DynamicFields/index.js +23 -3
- package/lib/cjs/EventCalendar/index.d.ts +11 -2
- package/lib/cjs/EventCalendar/index.js +835 -151
- package/lib/cjs/EventCalendarTimeline/index.d.ts +18 -9
- package/lib/cjs/EventCalendarTimeline/index.js +1077 -505
- package/lib/cjs/MultipleCheckboxes/index.d.ts +1 -0
- package/lib/cjs/MultipleCheckboxes/index.js +17 -7
- package/lib/cjs/MultipleSelect/index.d.ts +4 -0
- package/lib/cjs/MultipleSelect/index.js +54 -8
- package/lib/cjs/NativeSelect/index.js +1 -0
- package/lib/cjs/Radio/index.d.ts +2 -1
- package/lib/cjs/Radio/index.js +54 -24
- package/lib/cjs/Select/index.js +115 -42
- package/lib/cjs/Table/index.js +27 -3
- package/lib/css/EventCalendar/index.css +150 -106
- package/lib/css/EventCalendarTimeline/index.css +293 -251
- package/lib/esm/DynamicFields/index.tsx +28 -3
- package/lib/esm/EventCalendar/index.scss +172 -104
- package/lib/esm/EventCalendar/index.tsx +272 -139
- package/lib/esm/EventCalendarTimeline/index.scss +275 -213
- package/lib/esm/EventCalendarTimeline/index.tsx +706 -708
- package/lib/esm/MultipleCheckboxes/index.tsx +18 -5
- package/lib/esm/MultipleSelect/ItemList.tsx +1 -0
- package/lib/esm/MultipleSelect/index.tsx +103 -52
- package/lib/esm/NativeSelect/index.tsx +2 -0
- package/lib/esm/Radio/index.tsx +68 -27
- package/lib/esm/Select/index.tsx +236 -65
- package/lib/esm/Table/Table.tsx +1 -0
- package/lib/esm/Table/TableCell.tsx +6 -0
- package/lib/esm/Table/table-utils/ToggleSelection.tsx +17 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect, useMemo, useRef, useCallback } from 'react';
|
|
1
|
+
import React, { useState, useEffect, useMemo, useRef, useCallback, useImperativeHandle } from 'react';
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
import RootPortal from 'funda-root-portal';
|
|
@@ -9,6 +9,7 @@ import useClickOutside from 'funda-utils/dist/cjs/useClickOutside';
|
|
|
9
9
|
import {
|
|
10
10
|
getAbsolutePositionOfStage
|
|
11
11
|
} from 'funda-utils/dist/cjs/getElementProperty';
|
|
12
|
+
import { getTodayDate, getCalendarDate, isValidDate, padZero } from 'funda-utils/dist/cjs/date';
|
|
12
13
|
import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
|
|
13
14
|
|
|
14
15
|
|
|
@@ -20,20 +21,26 @@ export interface EventsValueConfig {
|
|
|
20
21
|
data: string,
|
|
21
22
|
dataTooltip?: string,
|
|
22
23
|
eventStyles?: React.CSSProperties;
|
|
24
|
+
callback?: () => void;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
export interface
|
|
27
|
+
export interface TimelineRowSectionConfig {
|
|
26
28
|
id: string | number;
|
|
27
29
|
title: string;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
export interface
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
export interface TimelineCellListConfig {
|
|
33
|
+
date: string;
|
|
34
|
+
list: EventsValueConfig[];
|
|
33
35
|
}
|
|
34
36
|
|
|
37
|
+
export interface TimelineRowListConfig {
|
|
38
|
+
listSection: TimelineRowSectionConfig;
|
|
39
|
+
eventSources: TimelineCellListConfig[];
|
|
40
|
+
}
|
|
35
41
|
|
|
36
42
|
export type EventCalendarTimelineProps = {
|
|
43
|
+
contentRef?: React.ForwardedRef<any>;
|
|
37
44
|
calendarWrapperClassName?: string;
|
|
38
45
|
tableWrapperClassName?: string;
|
|
39
46
|
tableClassName?: string;
|
|
@@ -43,15 +50,18 @@ export type EventCalendarTimelineProps = {
|
|
|
43
50
|
tableListEndClassName?: string;
|
|
44
51
|
tableListDividerClassName?: string;
|
|
45
52
|
customTodayDate?: string;
|
|
46
|
-
eventsValue?:
|
|
53
|
+
eventsValue?: TimelineRowListConfig[];
|
|
47
54
|
langWeek?: string[];
|
|
48
55
|
langWeekFull?: string[];
|
|
49
56
|
langMonths?: string[];
|
|
50
57
|
langMonthsFull?: string[];
|
|
51
58
|
langToday?: string;
|
|
52
59
|
iconRemove?: React.ReactNode | string;
|
|
60
|
+
iconAdd?: React.ReactNode | string;
|
|
53
61
|
cellCloseBtnClassName?: string;
|
|
54
62
|
cellCloseBtnLabel?: string | React.ReactNode;
|
|
63
|
+
cellAddBtnClassName?: string;
|
|
64
|
+
cellAddBtnLabel?: string | React.ReactNode;
|
|
55
65
|
forwardAndBackFillDisabled?: boolean;
|
|
56
66
|
draggable?: boolean;
|
|
57
67
|
showWeek?: boolean;
|
|
@@ -77,18 +87,18 @@ export type EventCalendarTimelineProps = {
|
|
|
77
87
|
modalSubmitBtnLabel?: string | React.ReactNode;
|
|
78
88
|
modalSubmitDeleteBtnClassName?: string;
|
|
79
89
|
modalSubmitDeleteBtnLabel?: string | React.ReactNode;
|
|
80
|
-
onModalEditOpen?: (currentData: any, openwin: any) => void;
|
|
90
|
+
onModalEditOpen?: (currentData: any, openwin: any, type: 'normal' | 'new') => void;
|
|
81
91
|
onModalEditClose?: (currentData: any) => void;
|
|
82
|
-
onModalDeleteOpen?: (currentData: any) => void;
|
|
92
|
+
onModalDeleteOpen?: (currentData: any, openwin: any) => void;
|
|
83
93
|
onModalDeleteClose?: (currentData: any) => void;
|
|
84
|
-
onModalEditEvent?: (currentData: any, closewin: any) => void;
|
|
85
|
-
onModalDeleteEvent?: (currentData: any, closewin: any) => void;
|
|
86
|
-
|
|
94
|
+
onModalEditEvent?: (currentData: any, closewin: any, gridInit: Function) => void;
|
|
95
|
+
onModalDeleteEvent?: (currentData: any, closewin: any, gridInit: Function) => void;
|
|
96
|
+
|
|
87
97
|
//
|
|
88
98
|
onCellMouseEnter?: (el: any) => void;
|
|
89
99
|
onCellMouseLeave?: (el: any) => void;
|
|
90
100
|
onCellClick?: (el: any) => void;
|
|
91
|
-
|
|
101
|
+
|
|
92
102
|
|
|
93
103
|
// table
|
|
94
104
|
tableListSectionTitle?: string | React.ReactNode;
|
|
@@ -102,12 +112,13 @@ export type EventCalendarTimelineProps = {
|
|
|
102
112
|
tableTooltipDisabled?: boolean;
|
|
103
113
|
|
|
104
114
|
/** -- */
|
|
105
|
-
id?: string;
|
|
115
|
+
id?: string;
|
|
106
116
|
}
|
|
107
117
|
|
|
108
118
|
|
|
109
119
|
const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
110
120
|
const {
|
|
121
|
+
contentRef,
|
|
111
122
|
calendarWrapperClassName,
|
|
112
123
|
tableWrapperClassName,
|
|
113
124
|
tableClassName,
|
|
@@ -124,8 +135,11 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
124
135
|
langMonthsFull,
|
|
125
136
|
langToday,
|
|
126
137
|
iconRemove,
|
|
138
|
+
iconAdd,
|
|
127
139
|
cellCloseBtnClassName,
|
|
128
140
|
cellCloseBtnLabel,
|
|
141
|
+
cellAddBtnClassName,
|
|
142
|
+
cellAddBtnLabel,
|
|
129
143
|
forwardAndBackFillDisabled,
|
|
130
144
|
draggable,
|
|
131
145
|
showWeek,
|
|
@@ -160,7 +174,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
160
174
|
onCellMouseEnter,
|
|
161
175
|
onCellMouseLeave,
|
|
162
176
|
onCellClick,
|
|
163
|
-
|
|
177
|
+
|
|
164
178
|
//
|
|
165
179
|
tableListSectionTitle,
|
|
166
180
|
tableCellMinWidth,
|
|
@@ -185,8 +199,13 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
185
199
|
const MONTHS = langMonths || ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'];
|
|
186
200
|
const MONTHS_FULL = langMonthsFull || ['January', 'Febuary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
187
201
|
|
|
188
|
-
|
|
202
|
+
// orginal data
|
|
203
|
+
const [val, setVal] = useState<TimelineRowListConfig[]>([]);
|
|
204
|
+
|
|
205
|
+
//
|
|
206
|
+
const FILL_BLANK_DATE_DISABLD = typeof forwardAndBackFillDisabled === 'undefined' ? true : forwardAndBackFillDisabled;
|
|
189
207
|
|
|
208
|
+
//
|
|
190
209
|
const now = useMemo(() => new Date(), []);
|
|
191
210
|
const [date, setDate] = useState<Date>(now);
|
|
192
211
|
const [day, setDay] = useState<number>(date.getDate());
|
|
@@ -194,7 +213,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
194
213
|
const [year, setYear] = useState<number>(date.getFullYear());
|
|
195
214
|
const [startDay, setStartDay] = useState<number>(getStartDayOfMonth(date));
|
|
196
215
|
|
|
197
|
-
|
|
216
|
+
|
|
198
217
|
// selection tab
|
|
199
218
|
// gets the today date time object
|
|
200
219
|
const [selectedMonth, setSelectedMonth] = useState<number>(now.getMonth());
|
|
@@ -207,6 +226,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
207
226
|
|
|
208
227
|
// modal dialog
|
|
209
228
|
const EVENTS_ENABLED = typeof modalContent !== 'undefined';
|
|
229
|
+
const EVENTS_DELETE_ENABLED = typeof modalDeleteContent !== 'undefined';
|
|
210
230
|
const [showEdit, setShowEdit] = useState<boolean>(false);
|
|
211
231
|
const [showDelete, setShowDelete] = useState<boolean>(false);
|
|
212
232
|
|
|
@@ -220,7 +240,10 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
220
240
|
const scrollHeaderRef = useRef(null);
|
|
221
241
|
const scrollBodyRef = useRef(null);
|
|
222
242
|
const scrollListRef = useRef(null);
|
|
243
|
+
|
|
244
|
+
// Open temporary storage for pop-ups
|
|
223
245
|
const [tableRowNum, setTableRowNum] = useState<number>(-1);
|
|
246
|
+
const [tableCellId, setTableCellId] = useState<number>(-1);
|
|
224
247
|
|
|
225
248
|
// table grid tooltip
|
|
226
249
|
const CELL_TOOLTIP_EXCEEDED_SIDE_POS_OFFSET = Number(tableTooltipExceededSidePosOffset) || 15;
|
|
@@ -228,7 +251,34 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
228
251
|
const tableTooltipModalRef = useRef<any>(null);
|
|
229
252
|
const [isShowTableTooltip, setIsShowTableTooltip] = useState<boolean>(false);
|
|
230
253
|
const [tableTooltipContent, setTableTooltipContent] = useState<any>(null);
|
|
231
|
-
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
// exposes the following methods
|
|
257
|
+
useImperativeHandle(
|
|
258
|
+
contentRef,
|
|
259
|
+
() => ({
|
|
260
|
+
gridInit: () => {
|
|
261
|
+
tableGridInit();
|
|
262
|
+
},
|
|
263
|
+
gridReset: (cb?: any) => {
|
|
264
|
+
tableGridReset();
|
|
265
|
+
}
|
|
266
|
+
}),
|
|
267
|
+
[contentRef],
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
// helper buttons
|
|
272
|
+
const _delBtn = () => <>
|
|
273
|
+
{iconRemove ? <>{iconRemove}</> : <><svg width="20px" height="20px" viewBox="0 0 24 24" fill="none"><path fillRule="evenodd" clipRule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10ZM8 11a1 1 0 1 0 0 2h8a1 1 0 1 0 0-2H8Z" fill="#000" /></svg></>}
|
|
274
|
+
{cellCloseBtnLabel || ''}
|
|
275
|
+
</>;
|
|
276
|
+
|
|
277
|
+
const _addBtn = () => <>
|
|
278
|
+
{iconAdd ? <>{iconAdd}</> : <><svg width="20px" height="20px" viewBox="0 0 32 32"><g stroke="none" strokeWidth="1" fill="none" fillRule="evenodd"><g transform="translate(-102.000000, -1037.000000)" fill="#000000"><path d="M124,1054 L119,1054 L119,1059 C119,1059.55 118.552,1060 118,1060 C117.448,1060 117,1059.55 117,1059 L117,1054 L112,1054 C111.448,1054 111,1053.55 111,1053 C111,1052.45 111.448,1052 112,1052 L117,1052 L117,1047 C117,1046.45 117.448,1046 118,1046 C118.552,1046 119,1046.45 119,1047 L119,1052 L124,1052 C124.552,1052 125,1052.45 125,1053 C125,1053.55 124.552,1054 124,1054 L124,1054 Z M130,1037 L106,1037 C103.791,1037 102,1038.79 102,1041 L102,1065 C102,1067.21 103.791,1069 106,1069 L130,1069 C132.209,1069 134,1067.21 134,1065 L134,1041 C134,1038.79 132.209,1037 130,1037 L130,1037 Z"></path></g></g></svg></>}
|
|
279
|
+
{cellAddBtnLabel || ''}
|
|
280
|
+
</>;
|
|
281
|
+
|
|
232
282
|
|
|
233
283
|
|
|
234
284
|
|
|
@@ -249,30 +299,6 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
249
299
|
|
|
250
300
|
|
|
251
301
|
|
|
252
|
-
const padZero = (num: number, padZeroEnabled: boolean = true) => {
|
|
253
|
-
if (padZeroEnabled) {
|
|
254
|
-
return num < 10 ? '0' + num : num.toString();
|
|
255
|
-
} else {
|
|
256
|
-
return num.toString();
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
const isValidDate = (v: string) => {
|
|
262
|
-
return !(String(new window.Date(v) as any).toLowerCase() === 'invalid date');
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
const dateFormat = (v: Date | String) => {
|
|
266
|
-
const date = typeof v === 'string' ? new window.Date(v.replace(/-/g, "/")) : v; // fix "Invalid date in safari"
|
|
267
|
-
return date;
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const getTodayDate = () => {
|
|
272
|
-
return getCalendarDate(new Date() as any);
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
|
|
276
302
|
// cell
|
|
277
303
|
const getCells = (type: 'none' | 'forward' | 'back' = 'none') => {
|
|
278
304
|
|
|
@@ -293,21 +319,21 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
293
319
|
currentStartDay = getStartDayOfMonth(_date);
|
|
294
320
|
}
|
|
295
321
|
|
|
296
|
-
|
|
322
|
+
|
|
297
323
|
//
|
|
298
|
-
const allDays = Array(days[currentMonth] + (currentStartDay - 1)).fill(null).map((_: any, i: number) => i
|
|
324
|
+
const allDays = Array(days[currentMonth] + (currentStartDay - 1)).fill(null).map((_: any, i: number) => i); // [0,1,..,30,31]
|
|
299
325
|
const rows = Math.ceil(allDays.length / 7); // 5
|
|
300
|
-
|
|
301
|
-
return Array.from({length: rows}).fill(null).map((_: any, i: number) => {
|
|
302
|
-
const _col = allDays.slice(i * 7, (i+1) * 7);
|
|
303
|
-
|
|
326
|
+
|
|
327
|
+
return Array.from({ length: rows }).fill(null).map((_: any, i: number) => {
|
|
328
|
+
const _col = allDays.slice(i * 7, (i + 1) * 7);
|
|
329
|
+
|
|
304
330
|
// back fill
|
|
305
331
|
const backFillArr: null[] = [];
|
|
306
|
-
for (let k = 0; k < 7-_col.length; k++) {
|
|
332
|
+
for (let k = 0; k < 7 - _col.length; k++) {
|
|
307
333
|
backFillArr.push(null);
|
|
308
334
|
}
|
|
309
335
|
_col.splice(_col.length, 0, ...backFillArr as any);
|
|
310
|
-
|
|
336
|
+
|
|
311
337
|
return {
|
|
312
338
|
month: currentMonth,
|
|
313
339
|
startDay: currentStartDay,
|
|
@@ -350,6 +376,43 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
350
376
|
};
|
|
351
377
|
|
|
352
378
|
|
|
379
|
+
const queryItemObj = () => {
|
|
380
|
+
const curRowData: any = val[tableRowNum];
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
if (curRowData) {
|
|
384
|
+
const eventSourcesData = curRowData.eventSources;
|
|
385
|
+
|
|
386
|
+
const _rowData = eventSourcesData.filter((item: any) => getCalendarDate(item.date as string) === getCalendarDate(`${year}-${month + 1}-${day}`));
|
|
387
|
+
|
|
388
|
+
let _currentData: any = undefined;
|
|
389
|
+
if (_rowData[0]) {
|
|
390
|
+
const _items = _rowData[0].list;
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
if (tableCellId === -1) {
|
|
394
|
+
// add new
|
|
395
|
+
_currentData = {
|
|
396
|
+
rowData: curRowData.listSection,
|
|
397
|
+
id: 0,
|
|
398
|
+
date: getCalendarDate(`${year}-${month + 1}-${day}`)
|
|
399
|
+
};
|
|
400
|
+
} else {
|
|
401
|
+
// edit or delete
|
|
402
|
+
_currentData = _items.filter((item: any) => item.id == tableCellId)[0];
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
return _rowData[0] ? _currentData: {
|
|
408
|
+
rowData: curRowData.listSection,
|
|
409
|
+
id: 0,
|
|
410
|
+
date: getCalendarDate(`${year}-${month + 1}-${day}`)
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
|
|
353
416
|
// ================================================================
|
|
354
417
|
// Table Grid drag & drop
|
|
355
418
|
// ================================================================
|
|
@@ -362,20 +425,20 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
362
425
|
draggedObj = e.currentTarget;
|
|
363
426
|
|
|
364
427
|
mouseDown = true;
|
|
365
|
-
draggedObj.classList.add(
|
|
428
|
+
draggedObj.classList.add('dragging');
|
|
366
429
|
|
|
367
430
|
//
|
|
368
431
|
startX = e.pageX - draggedObj.offsetLeft;
|
|
369
432
|
scrollLeft = draggedObj.scrollLeft;
|
|
370
|
-
|
|
371
|
-
|
|
433
|
+
|
|
434
|
+
|
|
372
435
|
}, []);
|
|
373
436
|
|
|
374
437
|
const handleTableDragEnd = useCallback((e: any) => {
|
|
375
438
|
if (draggedObj === null) return;
|
|
376
439
|
|
|
377
440
|
mouseDown = false;
|
|
378
|
-
draggedObj.classList.remove(
|
|
441
|
+
draggedObj.classList.remove('dragging');
|
|
379
442
|
}, []);
|
|
380
443
|
|
|
381
444
|
const handleTableMove = useCallback((e: any) => {
|
|
@@ -399,42 +462,42 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
399
462
|
// update tooltip content
|
|
400
463
|
setTableTooltipContent(content);
|
|
401
464
|
|
|
402
|
-
|
|
465
|
+
|
|
403
466
|
// update modal positiona
|
|
404
467
|
const _tableTooltipModalRef: any = tableTooltipModalRef.current;
|
|
405
468
|
const _triggerRef: any = e.currentTarget;
|
|
406
469
|
|
|
407
470
|
if (_tableTooltipModalRef !== null && _triggerRef !== null) {
|
|
408
471
|
|
|
409
|
-
const {x, y, width, height} = getAbsolutePositionOfStage(_triggerRef);
|
|
472
|
+
const { x, y, width, height } = getAbsolutePositionOfStage(_triggerRef);
|
|
410
473
|
|
|
411
474
|
let pos = _tableTooltipModalRef.dataset.microtipPosition;
|
|
412
475
|
if (typeof pos === 'undefined') pos = 'top';
|
|
413
|
-
|
|
476
|
+
|
|
414
477
|
// TOP
|
|
415
478
|
//
|
|
416
479
|
if (pos.indexOf('top') >= 0) {
|
|
417
|
-
_tableTooltipModalRef.style.left = x + (width/2) + 'px';
|
|
480
|
+
_tableTooltipModalRef.style.left = x + (width / 2) + 'px';
|
|
418
481
|
_tableTooltipModalRef.style.top = y - height - CELL_TOOLTIP_POS_OFFSET + 'px';
|
|
419
482
|
}
|
|
420
483
|
|
|
421
|
-
|
|
484
|
+
|
|
422
485
|
// BOTTOM
|
|
423
486
|
//
|
|
424
487
|
if (pos.indexOf('bottom') >= 0) {
|
|
425
|
-
_tableTooltipModalRef.style.left = x + (width/2) + 'px';
|
|
488
|
+
_tableTooltipModalRef.style.left = x + (width / 2) + 'px';
|
|
426
489
|
_tableTooltipModalRef.style.top = y + height + CELL_TOOLTIP_POS_OFFSET + 'px';
|
|
427
490
|
}
|
|
428
491
|
|
|
429
492
|
|
|
430
493
|
|
|
431
494
|
// Determine whether it exceeds the far right or left side of the screen
|
|
432
|
-
const _modalContent = _tableTooltipModalRef.querySelector('.e-cal-
|
|
495
|
+
const _modalContent = _tableTooltipModalRef.querySelector('.e-cal-timeline-table__cell-tooltipcontent');
|
|
433
496
|
const _modalBox = _modalContent.getBoundingClientRect();
|
|
434
497
|
if (typeof _modalContent.dataset.offset === 'undefined' && _modalBox.left > 0) {
|
|
435
498
|
|
|
436
|
-
|
|
437
|
-
|
|
499
|
+
// 10 pixels is used to account for some bias in mobile devices
|
|
500
|
+
if ((_modalBox.right + 10) > window.innerWidth) {
|
|
438
501
|
const _modalOffsetPosition = _modalBox.right - window.innerWidth + CELL_TOOLTIP_EXCEEDED_SIDE_POS_OFFSET;
|
|
439
502
|
_modalContent.dataset.offset = _modalOffsetPosition;
|
|
440
503
|
_modalContent.style.marginLeft = `-${_modalOffsetPosition}px`;
|
|
@@ -475,31 +538,6 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
475
538
|
// ================================================================
|
|
476
539
|
// Calendar
|
|
477
540
|
// ================================================================
|
|
478
|
-
|
|
479
|
-
function getCalendarDate(v: string, padZeroEnabled: boolean = true) {
|
|
480
|
-
if (typeof v === 'undefined') return '';
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
// yyyy-MM-dd
|
|
484
|
-
const date = typeof v === 'string' ? new Date(v.replace(/-/g, "/")) : v; // fix "Invalid date in safari"
|
|
485
|
-
const padZero = (num: number): string => {
|
|
486
|
-
if (padZeroEnabled) {
|
|
487
|
-
return num < 10 ? '0' + num : num.toString();
|
|
488
|
-
} else {
|
|
489
|
-
return num.toString();
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
};
|
|
493
|
-
const year = date.getFullYear();
|
|
494
|
-
const month = padZero(date.getMonth() + 1);
|
|
495
|
-
const day = padZero(date.getDate());
|
|
496
|
-
const hours = padZero(date.getHours());
|
|
497
|
-
const minutes = padZero(date.getMinutes());
|
|
498
|
-
const res = `${year}-${month}-${day}`;
|
|
499
|
-
return res;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
|
|
503
541
|
function setTodayDate(inputDate: Date) {
|
|
504
542
|
setDay(inputDate.getDate());
|
|
505
543
|
setMonth(inputDate.getMonth());
|
|
@@ -510,7 +548,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
510
548
|
setSelectedMonth(inputDate.getMonth());
|
|
511
549
|
setSelectedYear(inputDate.getFullYear());
|
|
512
550
|
|
|
513
|
-
// table grid
|
|
551
|
+
// initialize table grid
|
|
514
552
|
setTimeout(() => {
|
|
515
553
|
tableGridInit();
|
|
516
554
|
}, 500);
|
|
@@ -543,7 +581,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
543
581
|
//
|
|
544
582
|
onChangeMonth?.({
|
|
545
583
|
day: padZero(day),
|
|
546
|
-
month: padZero(_date.getMonth()+1),
|
|
584
|
+
month: padZero(_date.getMonth() + 1),
|
|
547
585
|
year: _date.getFullYear().toString()
|
|
548
586
|
});
|
|
549
587
|
|
|
@@ -551,7 +589,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
551
589
|
restoreTableGridInitStatus();
|
|
552
590
|
|
|
553
591
|
|
|
554
|
-
|
|
592
|
+
|
|
555
593
|
return _date;
|
|
556
594
|
});
|
|
557
595
|
|
|
@@ -569,7 +607,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
569
607
|
//
|
|
570
608
|
onChangeMonth?.({
|
|
571
609
|
day: padZero(day),
|
|
572
|
-
month: padZero(_date.getMonth()+1),
|
|
610
|
+
month: padZero(_date.getMonth() + 1),
|
|
573
611
|
year: _date.getFullYear().toString()
|
|
574
612
|
});
|
|
575
613
|
|
|
@@ -612,13 +650,13 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
612
650
|
//
|
|
613
651
|
onChangeMonth?.({
|
|
614
652
|
day: padZero(day),
|
|
615
|
-
month: padZero(currentIndex+1),
|
|
653
|
+
month: padZero(currentIndex + 1),
|
|
616
654
|
year: year.toString()
|
|
617
655
|
});
|
|
618
|
-
|
|
656
|
+
|
|
619
657
|
// restore table grid init status
|
|
620
658
|
restoreTableGridInitStatus();
|
|
621
|
-
|
|
659
|
+
|
|
622
660
|
}
|
|
623
661
|
|
|
624
662
|
|
|
@@ -659,8 +697,8 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
659
697
|
|
|
660
698
|
return (
|
|
661
699
|
<tr key={i} role="row" data-index={i}>
|
|
662
|
-
<td role="gridcell" data-resource-index={i} className="e-cal-
|
|
663
|
-
<div className="e-cal-
|
|
700
|
+
<td role="gridcell" data-resource-index={i} className="e-cal-timeline-table__datagrid-cell">
|
|
701
|
+
<div className="e-cal-timeline-table__cell-cushion e-cal-timeline-table__cell-cushion-title" dangerouslySetInnerHTML={{
|
|
664
702
|
__html: item.listSection.title
|
|
665
703
|
}} />
|
|
666
704
|
</td>
|
|
@@ -673,564 +711,483 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
673
711
|
|
|
674
712
|
function generateDaysUi(eventSourcesData: any[] = [], listSectionData: any = '', rowIndex: number = 0, showEvents: boolean = false) {
|
|
675
713
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
// colIndex
|
|
680
|
-
let colIndex = 0;
|
|
714
|
+
// colIndex
|
|
715
|
+
let colIndex = 0;
|
|
681
716
|
|
|
682
|
-
|
|
717
|
+
return getCells().map((item: any, j: number) => {
|
|
683
718
|
|
|
684
|
-
return item.col.map((dayIndex: number | null, i: number) => {
|
|
685
719
|
|
|
686
|
-
|
|
720
|
+
const isFirstRow = j === 0;
|
|
721
|
+
const isLastRow = j === getCells().length - 1;
|
|
687
722
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
const isLastCol = colIndex === 7 * getCells().length;
|
|
723
|
+
// forward fill
|
|
724
|
+
const __forwardFillNum: number[] = getForwardFill();
|
|
691
725
|
|
|
692
|
-
|
|
693
|
-
|
|
726
|
+
// back fill
|
|
727
|
+
const __backFillNum: number[] = getBackFill();
|
|
694
728
|
|
|
695
|
-
// days
|
|
696
|
-
//------
|
|
697
|
-
if (!showEvents) {
|
|
698
729
|
|
|
699
|
-
return d > 0 && d <= days[month] ? (
|
|
700
|
-
<th
|
|
701
|
-
className={combinedCls(
|
|
702
|
-
'e-cal-tl-table__cell-cushion-headercontent__container',
|
|
703
|
-
{
|
|
704
|
-
'empty': d <= 0,
|
|
705
|
-
'today': d === now.getDate(),
|
|
706
|
-
'selected': d === day,
|
|
707
|
-
'last-cell': isLastCol
|
|
708
|
-
}
|
|
709
|
-
)}
|
|
710
|
-
key={"col" + i}
|
|
711
|
-
data-index={colIndex-1}
|
|
712
|
-
data-datagrid-col={colIndex-1}
|
|
713
|
-
colSpan={1}
|
|
714
|
-
data-date={getCalendarDate(_dateShow)}
|
|
715
|
-
data-day={padZero(d)}
|
|
716
|
-
data-week={i}
|
|
717
|
-
style={{minWidth: CELL_MIN_W + 'px'}}
|
|
718
|
-
onClick={(e: React.MouseEvent) => {
|
|
719
730
|
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
731
|
+
return item.col.map((dayIndex: number | null, i: number) => {
|
|
732
|
+
|
|
733
|
+
colIndex++;
|
|
734
|
+
|
|
735
|
+
const d = typeof dayIndex === 'number' ? dayIndex - (startDay - 2) : 0;
|
|
736
|
+
const _currentData = eventSourcesData.filter((item: any) => getCalendarDate(item.date as string) === getCalendarDate(`${year}-${month + 1}-${d}`));
|
|
737
|
+
const isLastCol = colIndex === 7 * getCells().length;
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
// date
|
|
741
|
+
let _dateShow = d > 0 ? `${year}-${month + 1}-${d}` : '';
|
|
742
|
+
|
|
730
743
|
|
|
731
|
-
|
|
744
|
+
// forward & back
|
|
745
|
+
if (isFirstRow && __forwardFillNum && _dateShow === '') {
|
|
746
|
+
if (month + 1 === 1) {
|
|
747
|
+
_dateShow = `${year - 1}-12-${__forwardFillNum[i]}`;
|
|
748
|
+
} else {
|
|
749
|
+
_dateShow = `${year}-${month}-${__forwardFillNum[i]}`;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
if (isLastRow && __backFillNum && _dateShow === '') {
|
|
754
|
+
if (month + 1 === 12) {
|
|
755
|
+
_dateShow = `${year + 1}-1-${__backFillNum[i - item.col.filter(Boolean).length]}`;
|
|
756
|
+
} else {
|
|
757
|
+
_dateShow = `${year}-${month + 2}-${__backFillNum[i - item.col.filter(Boolean).length]}`;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
// days
|
|
764
|
+
//------
|
|
765
|
+
if (!showEvents) {
|
|
766
|
+
|
|
767
|
+
const _thContent = () => {
|
|
768
|
+
|
|
769
|
+
const isForward = isFirstRow && __forwardFillNum && typeof __forwardFillNum[i] !== 'undefined';
|
|
770
|
+
const isBack = isLastRow && __backFillNum && typeof __backFillNum[i - item.col.filter(Boolean).length] !== 'undefined';
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
return <th
|
|
774
|
+
className={combinedCls(
|
|
775
|
+
'e-cal-timeline-table__cell-cushion-headercontent__container',
|
|
776
|
+
{
|
|
777
|
+
'empty': d <= 0,
|
|
778
|
+
'today': d === now.getDate(),
|
|
779
|
+
'selected': d === day,
|
|
780
|
+
'last-cell': isLastCol
|
|
781
|
+
}
|
|
782
|
+
)}
|
|
783
|
+
key={"col" + i}
|
|
784
|
+
data-index={colIndex - 1}
|
|
785
|
+
data-datagrid-col={colIndex - 1}
|
|
786
|
+
colSpan={1}
|
|
787
|
+
data-date={getCalendarDate(_dateShow)}
|
|
788
|
+
data-day={padZero(d)}
|
|
789
|
+
data-week={i}
|
|
790
|
+
style={{ minWidth: CELL_MIN_W + 'px' }}
|
|
791
|
+
onClick={(e: React.MouseEvent) => {
|
|
792
|
+
|
|
793
|
+
// update row data
|
|
794
|
+
setTableRowNum(-1);
|
|
795
|
+
|
|
796
|
+
// update cell data
|
|
797
|
+
setTableCellId(-1);
|
|
798
|
+
|
|
799
|
+
if (_currentData.length > 0) {
|
|
800
|
+
_currentData[0].rowData = listSectionData;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
//
|
|
805
|
+
if (d > 0) {
|
|
806
|
+
handleDayChange(e, d); // update current day
|
|
807
|
+
|
|
808
|
+
onChangeDate?.(e, _currentData.length === 0 ? {
|
|
809
|
+
rowData: listSectionData,
|
|
810
|
+
id: 0,
|
|
811
|
+
date: getCalendarDate(`${year}-${month + 1}-${d}`)
|
|
812
|
+
} : _currentData[0]);
|
|
813
|
+
|
|
814
|
+
if (EVENTS_ENABLED) {
|
|
815
|
+
onModalEditOpen?.(_currentData.length === 0 ? {
|
|
732
816
|
rowData: listSectionData,
|
|
733
817
|
id: 0,
|
|
734
818
|
date: getCalendarDate(`${year}-${month + 1}-${d}`)
|
|
735
|
-
} : _currentData[0]);
|
|
736
|
-
|
|
737
|
-
if (EVENTS_ENABLED) {
|
|
738
|
-
onModalEditOpen?.(_currentData.length === 0 ? {
|
|
739
|
-
rowData: listSectionData,
|
|
740
|
-
id: 0,
|
|
741
|
-
date: getCalendarDate(`${year}-${month + 1}-${d}`)
|
|
742
|
-
} : _currentData[0], () => setShowEdit(true));
|
|
743
|
-
}
|
|
819
|
+
} : _currentData[0], () => setShowEdit(true), 'normal');
|
|
744
820
|
}
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
821
|
+
}
|
|
822
|
+
}}
|
|
823
|
+
>
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
{/* forward fill */}
|
|
827
|
+
{!FILL_BLANK_DATE_DISABLD && isForward ? <>
|
|
828
|
+
<div className="e-cal-timeline-table__cell-cushion e-cal-timeline-table__cell-cushion-headercontent disabled" style={{ width: (CELL_MIN_W - 1) + 'px' }}>
|
|
829
|
+
{__forwardFillNum[i]}
|
|
830
|
+
</div>
|
|
831
|
+
</> : null}
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
{/* day */}
|
|
836
|
+
{d > 0 ? <>
|
|
837
|
+
{FILL_BLANK_DATE_DISABLD ? <>
|
|
838
|
+
<div className="e-cal-timeline-table__cell-cushion e-cal-timeline-table__cell-cushion-headercontent" style={{ width: (CELL_MIN_W - 1) + 'px' }}>
|
|
752
839
|
{d}
|
|
753
840
|
{SHOW_WEEK ? <span dangerouslySetInnerHTML={{
|
|
754
841
|
__html: WEEK[i]
|
|
755
|
-
}}
|
|
842
|
+
}} /> : null}
|
|
756
843
|
</div>
|
|
757
|
-
</> :
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
844
|
+
</> : <>
|
|
845
|
+
<div className="e-cal-timeline-table__cell-cushion e-cal-timeline-table__cell-cushion-headercontent" style={{ width: (CELL_MIN_W - 1) + 'px' }}>
|
|
846
|
+
{d}
|
|
847
|
+
</div>
|
|
848
|
+
</>}
|
|
849
|
+
</> : null}
|
|
764
850
|
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
851
|
+
{/* back fill */}
|
|
852
|
+
{!FILL_BLANK_DATE_DISABLD && isBack ? <>
|
|
853
|
+
<div className="e-cal-timeline-table__cell-cushion e-cal-timeline-table__cell-cushion-headercontent disabled" style={{ width: (CELL_MIN_W - 1) + 'px' }}>
|
|
854
|
+
{__backFillNum[i - item.col.filter(Boolean).length]}
|
|
855
|
+
</div>
|
|
856
|
+
</> : null}
|
|
768
857
|
|
|
769
|
-
const _eventContentTooltip = _currentData.length > 0 ? (
|
|
770
|
-
typeof _currentData[0] !== 'undefined' ? (typeof _currentData[0].dataTooltip === 'undefined' ? '' : <>
|
|
771
|
-
<div
|
|
772
|
-
className="e-cal-tl__day__event-tooltipcontent"
|
|
773
|
-
dangerouslySetInnerHTML={{
|
|
774
|
-
__html: _currentData[0].dataTooltip
|
|
775
|
-
}}
|
|
776
|
-
></div>
|
|
777
|
-
</>) : ''
|
|
778
|
-
) : '';
|
|
779
|
-
|
|
780
|
-
const _eventContent = _currentData.length > 0 ? <>
|
|
781
|
-
<div
|
|
782
|
-
className="e-cal-tl__day__event"
|
|
783
|
-
style={typeof _currentData[0] !== 'undefined' && (_currentData[0] as any).eventStyles !== 'undefined' ? _currentData[0].eventStyles : {}}
|
|
784
|
-
dangerouslySetInnerHTML={{
|
|
785
|
-
__html: _currentData[0].data
|
|
786
|
-
}}
|
|
787
|
-
></div>
|
|
788
858
|
|
|
789
|
-
<div
|
|
790
|
-
className={`e-cal-tl__day__eventdel ${cellCloseBtnClassName || ''}`}
|
|
791
|
-
>
|
|
792
|
-
<a href="#" tabIndex={-1} className="align-middle" onClick={(e: React.MouseEvent) => {
|
|
793
|
-
e.preventDefault();
|
|
794
|
-
e.stopPropagation();
|
|
795
|
-
setShowDelete(true);
|
|
796
859
|
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
_existsContent.rowData = listSectionData;
|
|
800
|
-
}
|
|
860
|
+
</th>;
|
|
861
|
+
};
|
|
801
862
|
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
</a>
|
|
863
|
+
if (!FILL_BLANK_DATE_DISABLD) {
|
|
864
|
+
return <>{_thContent()}</>;
|
|
865
|
+
} else {
|
|
866
|
+
return d > 0 && d <= days[month] ? (
|
|
867
|
+
<>{_thContent()}</>
|
|
868
|
+
) : null;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
811
871
|
|
|
812
|
-
</div>
|
|
813
872
|
|
|
873
|
+
// events
|
|
874
|
+
//------
|
|
875
|
+
if (showEvents) {
|
|
814
876
|
|
|
815
|
-
</> : '';
|
|
816
877
|
|
|
817
|
-
|
|
878
|
+
const _eventContent = () => {
|
|
818
879
|
|
|
880
|
+
if (
|
|
881
|
+
_currentData.length === 0 ||
|
|
882
|
+
!Array.isArray(_currentData) ||
|
|
883
|
+
typeof _currentData[0].list === 'undefined'
|
|
884
|
+
) {
|
|
885
|
+
return null;
|
|
886
|
+
}
|
|
819
887
|
|
|
888
|
+
//
|
|
889
|
+
const _items = _currentData[0].list;
|
|
820
890
|
|
|
821
|
-
return
|
|
822
|
-
|
|
891
|
+
return _items.map((cellItem: any, cellItemIndex: number) => {
|
|
892
|
+
|
|
893
|
+
const _eventContentTooltip = typeof cellItem.dataTooltip === 'undefined' ? '' : <>
|
|
894
|
+
<div
|
|
895
|
+
className="e-cal-timeline__day__event-tooltipcontent"
|
|
896
|
+
dangerouslySetInnerHTML={{
|
|
897
|
+
__html: cellItem.dataTooltip
|
|
898
|
+
}}
|
|
899
|
+
></div>
|
|
900
|
+
</>;
|
|
901
|
+
|
|
902
|
+
return <div
|
|
823
903
|
className={combinedCls(
|
|
824
|
-
|
|
904
|
+
`e-cal-timeline-table__cell-cushion-content__item e-cal-timeline-table__cell-cushion-content__item-${cellItemIndex}`,
|
|
825
905
|
{
|
|
826
|
-
'
|
|
827
|
-
'
|
|
828
|
-
'today': d === now.getDate(),
|
|
829
|
-
'selected': d === day && tableRowNum === rowIndex,
|
|
830
|
-
'last-cell': isLastCol
|
|
906
|
+
'first': cellItemIndex === 0,
|
|
907
|
+
'last': cellItemIndex === _items.length-1
|
|
831
908
|
}
|
|
832
909
|
)}
|
|
833
|
-
key={
|
|
834
|
-
data-overlay-id={`e-cal-
|
|
835
|
-
data-index={
|
|
836
|
-
colSpan={1}
|
|
910
|
+
key={`cell-item-${rowIndex}-${cellItemIndex}}`}
|
|
911
|
+
data-overlay-id={`e-cal-timeline-table__cell-tooltipwrapper-${idRes}`}
|
|
912
|
+
data-cell-item-index={cellItemIndex}
|
|
837
913
|
data-date={getCalendarDate(_dateShow)}
|
|
838
914
|
data-day={padZero(d)}
|
|
839
915
|
data-week={i}
|
|
840
916
|
data-row={rowIndex}
|
|
841
917
|
onMouseEnter={(e: React.MouseEvent) => {
|
|
842
|
-
|
|
843
|
-
|
|
918
|
+
e.stopPropagation();
|
|
919
|
+
|
|
844
920
|
if (_eventContentTooltip !== '') {
|
|
845
921
|
if (typeof tableTooltipDisabled === 'undefined' || tableTooltipDisabled === false) {
|
|
846
|
-
|
|
847
|
-
handleTableTooltipMouseEnter(e, _eventContentTooltip);
|
|
848
|
-
}
|
|
922
|
+
handleTableTooltipMouseEnter(e, _eventContentTooltip);
|
|
849
923
|
}
|
|
850
924
|
}
|
|
851
925
|
}}
|
|
852
926
|
onMouseLeave={(e: React.MouseEvent) => {
|
|
853
|
-
|
|
927
|
+
e.stopPropagation();
|
|
854
928
|
|
|
855
929
|
if (_eventContentTooltip !== '') {
|
|
856
930
|
if (typeof tableTooltipDisabled === 'undefined' || tableTooltipDisabled === false) {
|
|
857
|
-
|
|
858
|
-
handleTableTooltipMouseLeave();
|
|
859
|
-
}
|
|
931
|
+
handleTableTooltipMouseLeave();
|
|
860
932
|
}
|
|
861
|
-
|
|
933
|
+
|
|
862
934
|
}
|
|
863
935
|
|
|
864
936
|
}}
|
|
865
937
|
onClick={(e: React.MouseEvent) => {
|
|
866
|
-
|
|
867
|
-
//
|
|
868
|
-
onCellClick?.(e);
|
|
938
|
+
e.stopPropagation();
|
|
869
939
|
|
|
870
940
|
// update row data
|
|
871
941
|
setTableRowNum(rowIndex);
|
|
872
|
-
if (_currentData.length > 0) {
|
|
873
|
-
_currentData[0].rowData = listSectionData;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
//
|
|
878
|
-
if (d > 0) {
|
|
879
|
-
handleDayChange(e, d);
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
onChangeDate?.(e, _currentData.length === 0 ? {
|
|
883
|
-
rowData: listSectionData,
|
|
884
|
-
id: 0,
|
|
885
|
-
date: getCalendarDate(`${year}-${month + 1}-${d}`)
|
|
886
|
-
} : _currentData[0]);
|
|
887
|
-
|
|
888
|
-
if (EVENTS_ENABLED) {
|
|
889
|
-
onModalEditOpen?.(_currentData.length === 0 ? {
|
|
890
|
-
rowData: listSectionData,
|
|
891
|
-
id: 0,
|
|
892
|
-
date: getCalendarDate(`${year}-${month + 1}-${d}`)
|
|
893
|
-
} : _currentData[0], () => setShowEdit(true));
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
}}
|
|
897
|
-
>
|
|
898
|
-
|
|
899
|
-
{/* day */}
|
|
900
|
-
{d > 0 ? <>
|
|
901
|
-
<div
|
|
902
|
-
className="e-cal-tl-table__cell-cushion e-cal-tl-table__cell-cushion-content"
|
|
903
|
-
>
|
|
904
|
-
{_eventContent}
|
|
905
|
-
</div>
|
|
906
|
-
</> : null}
|
|
907
|
-
|
|
908
|
-
</td>
|
|
909
|
-
) : null;
|
|
910
942
|
|
|
911
|
-
|
|
943
|
+
// update cell data
|
|
944
|
+
setTableCellId(cellItem.id);
|
|
912
945
|
|
|
913
|
-
|
|
914
|
-
});
|
|
946
|
+
cellItem.rowData = listSectionData;
|
|
915
947
|
|
|
916
|
-
})
|
|
917
948
|
|
|
918
|
-
|
|
919
|
-
|
|
949
|
+
// Callback
|
|
950
|
+
cellItem.callback?.();
|
|
920
951
|
|
|
921
|
-
} else {
|
|
922
|
-
//#######################
|
|
923
|
-
|
|
924
|
-
// colIndex
|
|
925
|
-
let colIndex = 0;
|
|
926
|
-
|
|
927
|
-
return getCells().map((item: any, j: number) => {
|
|
928
|
-
|
|
929
|
-
const isFirstRow = j === 0;
|
|
930
|
-
const isLastRow = j === getCells().length-1;
|
|
931
|
-
|
|
932
|
-
// forward fill
|
|
933
|
-
const __forwardFillNum: number[] = getForwardFill();
|
|
934
|
-
|
|
935
|
-
// back fill
|
|
936
|
-
const __backFillNum: number[] = getBackFill();
|
|
937
|
-
|
|
938
|
-
return item.col.map((dayIndex: number | null, i: number) => {
|
|
939
|
-
|
|
940
|
-
colIndex++;
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
const d = typeof dayIndex === 'number' ? dayIndex - (startDay - 2) : 0;
|
|
944
|
-
const _currentData = eventSourcesData.filter((item: any) => getCalendarDate(item.date as string) === getCalendarDate(`${year}-${month + 1}-${d}`));
|
|
945
|
-
const isLastCol = colIndex === 7 * getCells().length;
|
|
946
|
-
|
|
947
|
-
// date
|
|
948
|
-
let _dateShow = d > 0 ? `${year}-${month+1}-${d}` : '';
|
|
949
952
|
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
} else {
|
|
954
|
-
_dateShow = `${year}-${month}-${__forwardFillNum[i]}`;
|
|
955
|
-
}
|
|
956
|
-
}
|
|
953
|
+
//
|
|
954
|
+
if (d > 0) {
|
|
955
|
+
handleDayChange(e, d); // update current day
|
|
957
956
|
|
|
958
|
-
if (isLastRow && __backFillNum && _dateShow === '') {
|
|
959
|
-
if (month + 1 === 12) {
|
|
960
|
-
_dateShow = `${year+1}-1-${__backFillNum[i-item.col.filter(Boolean).length]}`;
|
|
961
|
-
} else {
|
|
962
|
-
_dateShow = `${year}-${month + 2}-${__backFillNum[i-item.col.filter(Boolean).length]}`;
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
|
|
966
957
|
|
|
967
|
-
|
|
968
|
-
//------
|
|
969
|
-
if (!showEvents) {
|
|
958
|
+
onChangeDate?.(e, cellItem);
|
|
970
959
|
|
|
971
|
-
return (
|
|
972
|
-
<th
|
|
973
|
-
className={combinedCls(
|
|
974
|
-
'e-cal-tl-table__cell-cushion-headercontent__container',
|
|
975
|
-
{
|
|
976
|
-
'empty': d <= 0,
|
|
977
|
-
'today': d === now.getDate(),
|
|
978
|
-
'selected': d === day,
|
|
979
|
-
'last-cell': isLastCol
|
|
980
|
-
}
|
|
981
|
-
)}
|
|
982
|
-
key={"col" + i}
|
|
983
|
-
data-index={colIndex-1}
|
|
984
|
-
data-datagrid-col={colIndex-1}
|
|
985
|
-
colSpan={1}
|
|
986
|
-
data-date={getCalendarDate(_dateShow)}
|
|
987
|
-
data-day={padZero(d)}
|
|
988
|
-
data-week={i}
|
|
989
|
-
style={{minWidth: CELL_MIN_W + 'px'}}
|
|
990
|
-
onClick={(e: React.MouseEvent) => {
|
|
991
|
-
|
|
992
|
-
// update row data
|
|
993
|
-
setTableRowNum(-1);
|
|
994
|
-
if (_currentData.length > 0) {
|
|
995
|
-
_currentData[0].rowData = listSectionData;
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
//
|
|
1000
|
-
if (d > 0) {
|
|
1001
|
-
handleDayChange(e, d);
|
|
1002
|
-
|
|
1003
|
-
onChangeDate?.(e, _currentData.length === 0 ? {
|
|
1004
|
-
rowData: listSectionData,
|
|
1005
|
-
id: 0,
|
|
1006
|
-
date: getCalendarDate(`${year}-${month + 1}-${d}`)
|
|
1007
|
-
} : _currentData[0]);
|
|
1008
|
-
|
|
1009
960
|
if (EVENTS_ENABLED) {
|
|
1010
|
-
onModalEditOpen?.(
|
|
1011
|
-
rowData: listSectionData,
|
|
1012
|
-
id: 0,
|
|
1013
|
-
date: getCalendarDate(`${year}-${month + 1}-${d}`)
|
|
1014
|
-
} : _currentData[0], () => setShowEdit(true));
|
|
961
|
+
onModalEditOpen?.(cellItem, () => setShowEdit(true), 'normal');
|
|
1015
962
|
}
|
|
1016
963
|
}
|
|
1017
964
|
}}
|
|
1018
965
|
>
|
|
1019
|
-
|
|
1020
|
-
{/* forward fill */}
|
|
1021
|
-
{isFirstRow && __forwardFillNum && typeof __forwardFillNum[i] !== 'undefined' ? <>
|
|
1022
|
-
<div className="e-cal-tl-table__cell-cushion e-cal-tl-table__cell-cushion-headercontent disabled" style={{width: (CELL_MIN_W - 1) + 'px'}}>
|
|
1023
|
-
{__forwardFillNum[i]}
|
|
1024
|
-
</div>
|
|
1025
|
-
</> : null}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
{/* day */}
|
|
1029
|
-
{d > 0 ? <>
|
|
1030
|
-
<div className="e-cal-tl-table__cell-cushion e-cal-tl-table__cell-cushion-headercontent" style={{width: (CELL_MIN_W - 1) + 'px'}}>
|
|
1031
|
-
{d}
|
|
1032
|
-
</div>
|
|
1033
|
-
</> : null}
|
|
1034
|
-
|
|
1035
|
-
{/* back fill */}
|
|
1036
|
-
{isLastRow && __backFillNum && typeof __backFillNum[i-item.col.filter(Boolean).length] !== 'undefined'? <>
|
|
1037
|
-
<div className="e-cal-tl-table__cell-cushion e-cal-tl-table__cell-cushion-headercontent disabled" style={{width: (CELL_MIN_W - 1) + 'px'}}>
|
|
1038
|
-
{__backFillNum[i-item.col.filter(Boolean).length]}
|
|
1039
|
-
</div>
|
|
1040
|
-
</> : null}
|
|
1041
|
-
|
|
1042
|
-
</th>
|
|
1043
|
-
);
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
966
|
|
|
1047
|
-
// events
|
|
1048
|
-
//------
|
|
1049
|
-
if (showEvents) {
|
|
1050
967
|
|
|
1051
968
|
|
|
1052
|
-
|
|
1053
|
-
typeof _currentData[0] !== 'undefined' ? (typeof _currentData[0].dataTooltip === 'undefined' ? '' : <>
|
|
969
|
+
{/* ITEM */}
|
|
1054
970
|
<div
|
|
1055
|
-
className="e-cal-
|
|
971
|
+
className="e-cal-timeline__day__event"
|
|
972
|
+
style={typeof cellItem !== 'undefined' && (cellItem as any).eventStyles !== 'undefined' ? cellItem.eventStyles : {}}
|
|
1056
973
|
dangerouslySetInnerHTML={{
|
|
1057
|
-
__html:
|
|
974
|
+
__html: cellItem.data
|
|
1058
975
|
}}
|
|
1059
976
|
></div>
|
|
1060
|
-
|
|
1061
|
-
) : '';
|
|
1062
|
-
|
|
1063
|
-
const _eventContent = _currentData.length > 0 ? <>
|
|
1064
|
-
<div
|
|
1065
|
-
className="e-cal-tl__day__event"
|
|
1066
|
-
style={typeof _currentData[0] !== 'undefined' && (_currentData[0] as any).eventStyles !== 'undefined' ? _currentData[0].eventStyles : {}}
|
|
1067
|
-
dangerouslySetInnerHTML={{
|
|
1068
|
-
__html: _currentData[0].data
|
|
1069
|
-
}}
|
|
1070
|
-
></div>
|
|
977
|
+
{/* /ITEM */}
|
|
1071
978
|
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
979
|
+
{/* DELETE BUTTON */}
|
|
980
|
+
<div
|
|
981
|
+
className={`e-cal-timeline__day__eventdel ${cellCloseBtnClassName || ''}`}
|
|
982
|
+
>
|
|
983
|
+
<a
|
|
984
|
+
href="#"
|
|
985
|
+
tabIndex={-1}
|
|
986
|
+
className="align-middle"
|
|
987
|
+
data-date={getCalendarDate(_dateShow)}
|
|
988
|
+
data-day={padZero(d)}
|
|
989
|
+
data-week={i}
|
|
990
|
+
data-row={rowIndex}
|
|
991
|
+
onClick={(e: React.MouseEvent) => {
|
|
992
|
+
e.preventDefault();
|
|
993
|
+
e.stopPropagation();
|
|
994
|
+
|
|
995
|
+
// update row data
|
|
996
|
+
setTableRowNum(rowIndex);
|
|
997
|
+
|
|
998
|
+
// update cell data
|
|
999
|
+
setTableCellId(cellItem.id);
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
const _existsContent = cellItem;
|
|
1003
|
+
if (typeof _existsContent !== 'undefined') {
|
|
1004
|
+
_existsContent.rowData = listSectionData;
|
|
1005
|
+
}
|
|
1079
1006
|
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
}
|
|
1007
|
+
//
|
|
1008
|
+
if (d > 0) {
|
|
1009
|
+
handleDayChange(e, d); // update current day
|
|
1084
1010
|
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1011
|
+
onChangeDate?.(e, {
|
|
1012
|
+
rowData: listSectionData,
|
|
1013
|
+
id: 0,
|
|
1014
|
+
date: getCalendarDate(`${year}-${month + 1}-${d}`)
|
|
1015
|
+
});
|
|
1016
|
+
|
|
1017
|
+
if (EVENTS_DELETE_ENABLED) {
|
|
1018
|
+
onModalDeleteOpen?.(_existsContent, () => setShowDelete(true));
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
|
|
1023
|
+
|
|
1024
|
+
}}
|
|
1025
|
+
>
|
|
1026
|
+
{_delBtn()}
|
|
1027
|
+
</a>
|
|
1094
1028
|
|
|
1029
|
+
</div>
|
|
1030
|
+
{/* /DELETE BUTTON */}
|
|
1095
1031
|
</div>
|
|
1032
|
+
});
|
|
1033
|
+
};
|
|
1096
1034
|
|
|
1035
|
+
|
|
1097
1036
|
|
|
1098
|
-
|
|
1037
|
+
const _tdContent = () => {
|
|
1038
|
+
|
|
1039
|
+
const isForward = isFirstRow && __forwardFillNum && typeof __forwardFillNum[i] !== 'undefined';
|
|
1040
|
+
const isBack = isLastRow && __backFillNum && typeof __backFillNum[i - item.col.filter(Boolean).length] !== 'undefined';
|
|
1041
|
+
|
|
1042
|
+
return <td
|
|
1043
|
+
className={combinedCls(
|
|
1044
|
+
'e-cal-timeline-table__cell-cushion-content__container e-cal-timeline-table__cell-tooltiptrigger',
|
|
1045
|
+
{
|
|
1046
|
+
'has-event': eventSourcesData && _currentData.length > 0,
|
|
1047
|
+
'empty': d <= 0,
|
|
1048
|
+
'today': d === now.getDate(),
|
|
1049
|
+
'selected': d === day && tableRowNum === rowIndex,
|
|
1050
|
+
'last-cell': isLastCol
|
|
1051
|
+
}
|
|
1052
|
+
)}
|
|
1053
|
+
key={"col" + i}
|
|
1054
|
+
data-index={colIndex - 1}
|
|
1055
|
+
colSpan={1}
|
|
1056
|
+
data-date={getCalendarDate(_dateShow)}
|
|
1057
|
+
data-day={padZero(d)}
|
|
1058
|
+
data-week={i}
|
|
1059
|
+
data-row={rowIndex}
|
|
1060
|
+
onMouseEnter={(e: React.MouseEvent) => {
|
|
1061
|
+
onCellMouseEnter?.(e);
|
|
1062
|
+
}}
|
|
1063
|
+
onMouseLeave={(e: React.MouseEvent) => {
|
|
1064
|
+
onCellMouseLeave?.(e);
|
|
1065
|
+
}}
|
|
1066
|
+
onClick={(e: React.MouseEvent) => {
|
|
1067
|
+
//
|
|
1068
|
+
onCellClick?.(e);
|
|
1069
|
+
|
|
1070
|
+
if (d > 0) {
|
|
1071
|
+
handleDayChange(e, d); // update current day
|
|
1072
|
+
onChangeDate?.(e, null);
|
|
1073
|
+
}
|
|
1074
|
+
}}
|
|
1075
|
+
>
|
|
1099
1076
|
|
|
1100
1077
|
|
|
1078
|
+
{/* forward fill */}
|
|
1079
|
+
{!FILL_BLANK_DATE_DISABLD && isForward ? <>
|
|
1080
|
+
<div className="e-cal-timeline-table__cell-cushion e-cal-timeline-table__cell-cushion-content disabled">
|
|
1081
|
+
|
|
1082
|
+
</div>
|
|
1083
|
+
</> : null}
|
|
1101
1084
|
|
|
1102
|
-
return (
|
|
1103
|
-
<td
|
|
1104
|
-
className={combinedCls(
|
|
1105
|
-
'e-cal-tl-table__cell-cushion-content__container e-cal-tl-table__cell-tooltiptrigger',
|
|
1106
|
-
{
|
|
1107
|
-
'has-event': _currentData.length > 0,
|
|
1108
|
-
'empty': d <= 0,
|
|
1109
|
-
'today': d === now.getDate(),
|
|
1110
|
-
'selected': d === day && tableRowNum === rowIndex,
|
|
1111
|
-
'last-cell': isLastCol
|
|
1112
|
-
}
|
|
1113
|
-
)}
|
|
1114
|
-
key={"col" + i}
|
|
1115
|
-
data-overlay-id={`e-cal-tl-table__cell-tooltipwrapper-${idRes}`}
|
|
1116
|
-
data-index={colIndex-1}
|
|
1117
|
-
colSpan={1}
|
|
1118
|
-
data-date={getCalendarDate(_dateShow)}
|
|
1119
|
-
data-day={padZero(d)}
|
|
1120
|
-
data-week={i}
|
|
1121
|
-
data-row={rowIndex}
|
|
1122
|
-
onMouseEnter={(e: React.MouseEvent) => {
|
|
1123
|
-
onCellMouseEnter?.(e);
|
|
1124
|
-
|
|
1125
|
-
if (_eventContentTooltip !== '') {
|
|
1126
|
-
if (typeof tableTooltipDisabled === 'undefined' || tableTooltipDisabled === false) {
|
|
1127
|
-
if (_eventContent !== '') {
|
|
1128
|
-
handleTableTooltipMouseEnter(e, _eventContentTooltip);
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
}}
|
|
1133
|
-
onMouseLeave={(e: React.MouseEvent) => {
|
|
1134
|
-
onCellMouseLeave?.(e);
|
|
1135
1085
|
|
|
1136
|
-
if (_eventContentTooltip !== '') {
|
|
1137
|
-
if (typeof tableTooltipDisabled === 'undefined' || tableTooltipDisabled === false) {
|
|
1138
|
-
if (_eventContent !== '') {
|
|
1139
|
-
handleTableTooltipMouseLeave();
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
}
|
|
1144
1086
|
|
|
1145
|
-
}}
|
|
1146
|
-
onClick={(e: React.MouseEvent) => {
|
|
1147
1087
|
|
|
1148
|
-
|
|
1149
|
-
|
|
1088
|
+
{/* day */}
|
|
1089
|
+
<div className="e-cal-timeline-table__cell-cushion e-cal-timeline-table__cell-cushion-content">
|
|
1090
|
+
{/*++++++++++++++++ EVENT ++++++++++++++++*/}
|
|
1091
|
+
{_eventContent()}
|
|
1092
|
+
{/*++++++++++++++++ /EVENT ++++++++++++++++*/}
|
|
1150
1093
|
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
//
|
|
1159
|
-
if (d > 0) {
|
|
1160
|
-
handleDayChange(e, d);
|
|
1161
|
-
|
|
1162
|
-
onChangeDate?.(e, _currentData.length === 0 ? {
|
|
1163
|
-
rowData: listSectionData,
|
|
1164
|
-
id: 0,
|
|
1165
|
-
date: getCalendarDate(`${year}-${month + 1}-${d}`)
|
|
1166
|
-
} : _currentData[0]);
|
|
1167
|
-
|
|
1168
|
-
if (EVENTS_ENABLED) {
|
|
1169
|
-
onModalEditOpen?.(_currentData.length === 0 ? {
|
|
1170
|
-
rowData: listSectionData,
|
|
1171
|
-
id: 0,
|
|
1172
|
-
date: getCalendarDate(`${year}-${month + 1}-${d}`)
|
|
1173
|
-
} : _currentData[0], () => setShowEdit(true));
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
}}
|
|
1177
|
-
>
|
|
1178
|
-
|
|
1179
|
-
{/* forward fill */}
|
|
1180
|
-
{isFirstRow && __forwardFillNum && typeof __forwardFillNum[i] !== 'undefined' ? <>
|
|
1181
|
-
<div className="e-cal-tl-table__cell-cushion e-cal-tl-table__cell-cushion-content disabled">
|
|
1182
|
-
|
|
1183
|
-
</div>
|
|
1184
|
-
</> : null}
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
{/* day */}
|
|
1188
|
-
{d > 0 ? <>
|
|
1189
|
-
<div
|
|
1190
|
-
className="e-cal-tl-table__cell-cushion e-cal-tl-table__cell-cushion-content"
|
|
1094
|
+
{/* ADD BUTTON */}
|
|
1095
|
+
{isForward || isBack ? null : <>
|
|
1096
|
+
<div
|
|
1097
|
+
className={`e-cal-timeline__day__eventadd ${cellAddBtnClassName || ''}`}
|
|
1191
1098
|
>
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1099
|
+
<a
|
|
1100
|
+
href="#"
|
|
1101
|
+
tabIndex={-1}
|
|
1102
|
+
className="align-middle"
|
|
1103
|
+
data-date={getCalendarDate(_dateShow)}
|
|
1104
|
+
data-day={padZero(d)}
|
|
1105
|
+
data-week={i}
|
|
1106
|
+
data-row={rowIndex}
|
|
1107
|
+
onClick={(e: React.MouseEvent) => {
|
|
1108
|
+
e.preventDefault();
|
|
1109
|
+
e.stopPropagation();
|
|
1110
|
+
|
|
1111
|
+
// update row data
|
|
1112
|
+
setTableRowNum(rowIndex);
|
|
1113
|
+
|
|
1114
|
+
// update cell data
|
|
1115
|
+
setTableCellId(-1);
|
|
1116
|
+
|
|
1117
|
+
//
|
|
1118
|
+
if (d > 0) {
|
|
1119
|
+
handleDayChange(e, d); // update current day
|
|
1120
|
+
|
|
1121
|
+
onChangeDate?.(e, {
|
|
1122
|
+
rowData: listSectionData,
|
|
1123
|
+
id: 0,
|
|
1124
|
+
date: getCalendarDate(`${year}-${month + 1}-${d}`)
|
|
1125
|
+
});
|
|
1126
|
+
|
|
1127
|
+
if (EVENTS_ENABLED) {
|
|
1128
|
+
onModalEditOpen?.({
|
|
1129
|
+
rowData: listSectionData,
|
|
1130
|
+
id: 0,
|
|
1131
|
+
date: getCalendarDate(`${year}-${month + 1}-${d}`)
|
|
1132
|
+
}, () => setShowEdit(true), 'new');
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
}}
|
|
1136
|
+
>
|
|
1137
|
+
{_addBtn()}
|
|
1138
|
+
</a>
|
|
1139
|
+
|
|
1200
1140
|
</div>
|
|
1201
|
-
</>
|
|
1141
|
+
</>}
|
|
1142
|
+
{/* /ADD BUTTON */}
|
|
1202
1143
|
|
|
1203
|
-
|
|
1204
|
-
</td>
|
|
1205
|
-
);
|
|
1144
|
+
</div>
|
|
1206
1145
|
|
|
1207
|
-
}
|
|
1208
1146
|
|
|
1209
|
-
|
|
1210
|
-
|
|
1147
|
+
{/* back fill */}
|
|
1148
|
+
{!FILL_BLANK_DATE_DISABLD && isBack ? <>
|
|
1149
|
+
<div className="e-cal-timeline-table__cell-cushion e-cal-timeline-table__cell-cushion-content disabled">
|
|
1150
|
+
|
|
1151
|
+
</div>
|
|
1152
|
+
</> : null}
|
|
1211
1153
|
|
|
1212
|
-
})
|
|
1213
1154
|
|
|
1214
|
-
|
|
1215
|
-
|
|
1155
|
+
|
|
1156
|
+
</td>;
|
|
1157
|
+
};
|
|
1216
1158
|
|
|
1217
1159
|
|
|
1160
|
+
if (!FILL_BLANK_DATE_DISABLD) {
|
|
1161
|
+
return <>{_tdContent()}</>;
|
|
1162
|
+
} else {
|
|
1163
|
+
return d > 0 && d <= days[month] ? (
|
|
1164
|
+
<>{_tdContent()}</>
|
|
1165
|
+
) : null;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
|
|
1172
|
+
});
|
|
1173
|
+
|
|
1174
|
+
})
|
|
1218
1175
|
|
|
1219
1176
|
}
|
|
1220
1177
|
|
|
1221
1178
|
function generateColUi() {
|
|
1222
1179
|
|
|
1223
|
-
if (
|
|
1180
|
+
if (FILL_BLANK_DATE_DISABLD) {
|
|
1224
1181
|
|
|
1225
1182
|
//#######################
|
|
1226
|
-
return Array.from({length: days[month]}).fill(0).map((item: any, i: number) => {
|
|
1183
|
+
return Array.from({ length: days[month] }).fill(0).map((item: any, i: number) => {
|
|
1227
1184
|
return (
|
|
1228
1185
|
<col
|
|
1229
1186
|
key={"col-placeholder-" + i}
|
|
1230
1187
|
data-index={i}
|
|
1231
1188
|
data-datagrid-col={i}
|
|
1232
|
-
style={{minWidth: CELL_MIN_W + 'px'}}
|
|
1233
|
-
|
|
1189
|
+
style={{ minWidth: CELL_MIN_W + 'px' }}
|
|
1190
|
+
|
|
1234
1191
|
/>
|
|
1235
1192
|
);
|
|
1236
1193
|
})
|
|
@@ -1241,7 +1198,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1241
1198
|
//#######################
|
|
1242
1199
|
// colIndex
|
|
1243
1200
|
let colIndex = 0;
|
|
1244
|
-
|
|
1201
|
+
|
|
1245
1202
|
return getCells().map((item: any, j: number) => {
|
|
1246
1203
|
return item.col.map((dayIndex: number | null, i: number) => {
|
|
1247
1204
|
|
|
@@ -1252,10 +1209,10 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1252
1209
|
<col
|
|
1253
1210
|
className={`${d > 0 ? '' : 'empty'}`}
|
|
1254
1211
|
key={"col-placeholder-" + i}
|
|
1255
|
-
data-index={colIndex-1}
|
|
1256
|
-
data-datagrid-col={colIndex-1}
|
|
1257
|
-
style={{minWidth: CELL_MIN_W + 'px'}}
|
|
1258
|
-
|
|
1212
|
+
data-index={colIndex - 1}
|
|
1213
|
+
data-datagrid-col={colIndex - 1}
|
|
1214
|
+
style={{ minWidth: CELL_MIN_W + 'px' }}
|
|
1215
|
+
|
|
1259
1216
|
/>
|
|
1260
1217
|
);
|
|
1261
1218
|
|
|
@@ -1275,8 +1232,8 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1275
1232
|
const _latestScrollLeft = el.scrollLeft;
|
|
1276
1233
|
|
|
1277
1234
|
if (scrollBodyRef.current) (scrollBodyRef.current as any).scrollLeft = _latestScrollLeft;
|
|
1278
|
-
|
|
1279
|
-
|
|
1235
|
+
|
|
1236
|
+
|
|
1280
1237
|
}
|
|
1281
1238
|
|
|
1282
1239
|
function syncTableScrollBody() {
|
|
@@ -1288,7 +1245,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1288
1245
|
|
|
1289
1246
|
if (scrollListRef.current) (scrollListRef.current as any).scrollTop = _latestScrollTop;
|
|
1290
1247
|
if (scrollHeaderRef.current) (scrollHeaderRef.current as any).scrollLeft = _latestScrollLeft;
|
|
1291
|
-
|
|
1248
|
+
|
|
1292
1249
|
}
|
|
1293
1250
|
|
|
1294
1251
|
function syncTableScrollList() {
|
|
@@ -1298,11 +1255,11 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1298
1255
|
const _latestScrollTop = el.scrollTop;
|
|
1299
1256
|
|
|
1300
1257
|
if (scrollBodyRef.current) (scrollBodyRef.current as any).scrollTop = _latestScrollTop;
|
|
1301
|
-
|
|
1258
|
+
|
|
1302
1259
|
}
|
|
1303
1260
|
|
|
1304
1261
|
|
|
1305
|
-
|
|
1262
|
+
|
|
1306
1263
|
function restoreTableGridInitStatus() {
|
|
1307
1264
|
|
|
1308
1265
|
// restore table grid init status
|
|
@@ -1312,7 +1269,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1312
1269
|
}
|
|
1313
1270
|
|
|
1314
1271
|
|
|
1315
|
-
function tableGridInit() {
|
|
1272
|
+
function tableGridInit(scrollBarInit: boolean = true) {
|
|
1316
1273
|
|
|
1317
1274
|
//
|
|
1318
1275
|
if (tableGridRef.current === null) return;
|
|
@@ -1326,7 +1283,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1326
1283
|
// calculate min width
|
|
1327
1284
|
//--------------
|
|
1328
1285
|
const cellMinWidth = CELL_MIN_W;
|
|
1329
|
-
const colCount =
|
|
1286
|
+
const colCount = FILL_BLANK_DATE_DISABLD ? days[month] : 7 * getCells().length;
|
|
1330
1287
|
const scrollableMinWidth = cellMinWidth * colCount;
|
|
1331
1288
|
|
|
1332
1289
|
//****************
|
|
@@ -1334,48 +1291,50 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1334
1291
|
//****************
|
|
1335
1292
|
// initialize scrollable wrapper (width)
|
|
1336
1293
|
//--------------
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
const _content = el.querySelector('.e-cal-tl-table__scroller');
|
|
1343
|
-
const tableMaxWidth = tableGridEl.clientWidth;
|
|
1344
|
-
const tableHeaderTitleWidth = tableGridEl.querySelector('.e-cal-tl-table__cell-cushion-headertitle').clientWidth;
|
|
1345
|
-
const tableDividerWidth = tableGridEl.querySelector('.e-cal-tl-table__timeline-divider').clientWidth;
|
|
1346
|
-
const tableBorderWidth = 4;
|
|
1347
|
-
const scrollMaxWidth = tableMaxWidth - tableHeaderTitleWidth - tableDividerWidth - tableBorderWidth;
|
|
1294
|
+
let _scrollableWrapper: HTMLElement[] = [];
|
|
1295
|
+
if (scrollBarInit) {
|
|
1296
|
+
_scrollableWrapper = tableGridEl.querySelectorAll('.e-cal-timeline-table__scroller-harness');
|
|
1297
|
+
[].slice.call(_scrollableWrapper).forEach((el: any) => {
|
|
1298
|
+
const scrollType = el.dataset.scroll;
|
|
1348
1299
|
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1300
|
+
if (scrollType !== 'list') {
|
|
1301
|
+
const _content = el.querySelector('.e-cal-timeline-table__scroller');
|
|
1302
|
+
const tableMaxWidth = tableGridEl.clientWidth;
|
|
1303
|
+
const tableHeaderTitleWidth = tableGridEl.querySelector('.e-cal-timeline-table__cell-cushion-headertitle').clientWidth;
|
|
1304
|
+
const tableDividerWidth = tableGridEl.querySelector('.e-cal-timeline-table__timeline-divider').clientWidth;
|
|
1305
|
+
const tableBorderWidth = 4;
|
|
1306
|
+
const scrollMaxWidth = tableMaxWidth - tableHeaderTitleWidth - tableDividerWidth - tableBorderWidth;
|
|
1353
1307
|
|
|
1354
|
-
}
|
|
1355
1308
|
|
|
1356
|
-
|
|
1357
|
-
|
|
1309
|
+
el.dataset.width = scrollMaxWidth;
|
|
1310
|
+
el.style.maxWidth = el.dataset.width + 'px';
|
|
1311
|
+
_content.style.minWidth = scrollableMinWidth + 'px';
|
|
1312
|
+
|
|
1313
|
+
}
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1358
1317
|
|
|
1359
1318
|
//****************
|
|
1360
1319
|
// STEP 3:
|
|
1361
1320
|
//****************
|
|
1362
1321
|
// initialize cell width
|
|
1363
1322
|
//--------------
|
|
1364
|
-
const headerThElements: any
|
|
1365
|
-
const colElements: any = tableGridEl.querySelector('.e-cal-
|
|
1366
|
-
const tdElements: any = tableGridEl.querySelector('.e-cal-
|
|
1367
|
-
const tdElementMaxWidth: number = typeof tdElements[0] === 'undefined' ? 0 : parseFloat(window.getComputedStyle(tdElements[0].querySelector('.e-cal-
|
|
1323
|
+
const headerThElements: any = tableGridEl.querySelector('.e-cal-timeline-table__datagrid-header__content tbody').getElementsByTagName('th');
|
|
1324
|
+
const colElements: any = tableGridEl.querySelector('.e-cal-timeline-table__datagrid-body__content colgroup').getElementsByTagName('col')
|
|
1325
|
+
const tdElements: any = tableGridEl.querySelector('.e-cal-timeline-table__datagrid-body__content tbody').getElementsByTagName('td');
|
|
1326
|
+
const tdElementMaxWidth: number = typeof tdElements[0] === 'undefined' ? 0 : parseFloat(window.getComputedStyle(tdElements[0].querySelector('.e-cal-timeline-table__cell-cushion-content')).maxWidth);
|
|
1368
1327
|
|
|
1369
1328
|
|
|
1370
1329
|
if (Array.isArray(eventsValue) && eventsValue.length > 0) {
|
|
1371
1330
|
|
|
1372
1331
|
for (let i = 0; i < headerThElements.length; i++) {
|
|
1373
|
-
|
|
1374
|
-
const curHeaderThElementMaxWidth = parseFloat(window.getComputedStyle(headerThElements[i].querySelector('.e-cal-
|
|
1332
|
+
|
|
1333
|
+
const curHeaderThElementMaxWidth = parseFloat(window.getComputedStyle(headerThElements[i].querySelector('.e-cal-timeline-table__cell-cushion-headercontent')).width);
|
|
1375
1334
|
const targetElement = headerThElements[i].offsetWidth > tdElements[i].offsetWidth ? headerThElements[i] : tdElements[i];
|
|
1376
1335
|
let tdOwidth = parseFloat(window.getComputedStyle(targetElement).width);
|
|
1377
1336
|
|
|
1378
|
-
|
|
1337
|
+
|
|
1379
1338
|
// check td max width
|
|
1380
1339
|
if (tdElementMaxWidth > 0 && tdOwidth > tdElementMaxWidth) {
|
|
1381
1340
|
tdOwidth = tdElementMaxWidth;
|
|
@@ -1389,8 +1348,8 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1389
1348
|
// Prevent the width from being +1 each time it is initialized
|
|
1390
1349
|
tdOwidth = tdOwidth - 1;
|
|
1391
1350
|
|
|
1392
|
-
headerThElements[i].querySelector('.e-cal-
|
|
1393
|
-
tdElements[i].querySelector('.e-cal-
|
|
1351
|
+
headerThElements[i].querySelector('.e-cal-timeline-table__cell-cushion-headercontent').style.width = tdOwidth + 'px';
|
|
1352
|
+
tdElements[i].querySelector('.e-cal-timeline-table__cell-cushion-content').style.minWidth = tdOwidth + 'px';
|
|
1394
1353
|
colElements[i].style.minWidth = tdOwidth + 'px';
|
|
1395
1354
|
|
|
1396
1355
|
|
|
@@ -1404,10 +1363,10 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1404
1363
|
// initialize max width of table content
|
|
1405
1364
|
//--------------
|
|
1406
1365
|
if (scrollBodyRef.current !== null && scrollHeaderRef.current !== null) {
|
|
1407
|
-
const tableContentWidth = window.getComputedStyle(tableGridEl.querySelector('.e-cal-
|
|
1366
|
+
const tableContentWidth = window.getComputedStyle(tableGridEl.querySelector('.e-cal-timeline-table__datagrid-body__content')).width;
|
|
1408
1367
|
const scrollBodyEl: any = scrollBodyRef.current;
|
|
1409
1368
|
const scrollHeaderEl: any = scrollHeaderRef.current;
|
|
1410
|
-
|
|
1369
|
+
|
|
1411
1370
|
scrollBodyEl.style.width = tableContentWidth;
|
|
1412
1371
|
scrollHeaderEl.style.width = tableContentWidth;
|
|
1413
1372
|
scrollBodyEl.dataset.width = parseFloat(tableContentWidth);
|
|
@@ -1416,9 +1375,9 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1416
1375
|
//
|
|
1417
1376
|
const tableWrapperMaxWidthLatest = tableGridEl.clientWidth;
|
|
1418
1377
|
if (tableWrapperMaxWidthLatest > parseFloat(tableContentWidth)) {
|
|
1419
|
-
tableGridEl.querySelector('.e-cal-
|
|
1378
|
+
tableGridEl.querySelector('.e-cal-timeline-table__timeline-table').style.width = tableContentWidth;
|
|
1420
1379
|
}
|
|
1421
|
-
|
|
1380
|
+
|
|
1422
1381
|
|
|
1423
1382
|
}
|
|
1424
1383
|
|
|
@@ -1429,15 +1388,13 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1429
1388
|
//****************
|
|
1430
1389
|
// initialize cell height
|
|
1431
1390
|
//--------------
|
|
1432
|
-
const headerTitleTrElements = tableGridEl.querySelector('.e-cal-
|
|
1433
|
-
const trElements = tableGridEl.querySelector('.e-cal-
|
|
1391
|
+
const headerTitleTrElements = tableGridEl.querySelector('.e-cal-timeline-table__datagrid-body__title tbody').getElementsByTagName('tr');
|
|
1392
|
+
const trElements = tableGridEl.querySelector('.e-cal-timeline-table__datagrid-body__content tbody').getElementsByTagName('tr');
|
|
1434
1393
|
|
|
1435
1394
|
for (let i = 0; i < headerTitleTrElements.length; i++) {
|
|
1436
1395
|
|
|
1437
|
-
|
|
1438
1396
|
const targetElement = headerTitleTrElements[i].offsetHeight > trElements[i].offsetHeight ? headerTitleTrElements[i] : trElements[i];
|
|
1439
|
-
|
|
1440
|
-
|
|
1397
|
+
const tdOHeight = window.getComputedStyle(targetElement).height;
|
|
1441
1398
|
headerTitleTrElements[i].style.height = tdOHeight;
|
|
1442
1399
|
trElements[i].style.height = tdOHeight;
|
|
1443
1400
|
|
|
@@ -1448,18 +1405,21 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1448
1405
|
//****************
|
|
1449
1406
|
//initialize scrollable wrapper (height)
|
|
1450
1407
|
//--------------
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1408
|
+
if (scrollBarInit) {
|
|
1409
|
+
[].slice.call(_scrollableWrapper).forEach((el: any) => {
|
|
1410
|
+
const scrollType = el.dataset.scroll;
|
|
1411
|
+
const oldHeight = el.clientHeight;
|
|
1412
|
+
|
|
1413
|
+
if (scrollType !== 'header') {
|
|
1414
|
+
const tableWrapperMaxHeight = window.getComputedStyle(tableGridEl as HTMLElement).height;
|
|
1415
|
+
if (oldHeight > parseFloat(tableWrapperMaxHeight)) {
|
|
1416
|
+
el.style.height = tableWrapperMaxHeight;
|
|
1417
|
+
}
|
|
1459
1418
|
}
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
}
|
|
1419
|
+
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1463
1423
|
|
|
1464
1424
|
|
|
1465
1425
|
//****************
|
|
@@ -1474,20 +1434,36 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1474
1434
|
}
|
|
1475
1435
|
|
|
1476
1436
|
|
|
1477
|
-
function tableGridReset() {
|
|
1437
|
+
function tableGridReset(scrollBarInit: boolean = true) {
|
|
1478
1438
|
if (tableGridRef.current === null) return;
|
|
1479
1439
|
|
|
1480
1440
|
const tableGridEl: any = tableGridRef.current;
|
|
1481
1441
|
|
|
1442
|
+
|
|
1482
1443
|
// initialize scrollable wrapper (width & height)
|
|
1483
1444
|
//--------------
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1445
|
+
if (scrollBarInit) {
|
|
1446
|
+
const _scrollableWrapper = tableGridEl.querySelectorAll('.e-cal-timeline-table__scroller-harness');
|
|
1447
|
+
[].slice.call(_scrollableWrapper).forEach((el: any) => {
|
|
1448
|
+
|
|
1449
|
+
const _content = el.querySelector('.e-cal-timeline-table__scroller');
|
|
1450
|
+
el.removeAttribute('data-width');
|
|
1451
|
+
el.removeAttribute('style');
|
|
1452
|
+
_content.removeAttribute('style');
|
|
1453
|
+
});
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
|
|
1457
|
+
// initialize cell height
|
|
1458
|
+
//--------------
|
|
1459
|
+
const headerTitleTrElements = tableGridEl.querySelector('.e-cal-timeline-table__datagrid-body__title tbody').getElementsByTagName('tr');
|
|
1460
|
+
const trElements = tableGridEl.querySelector('.e-cal-timeline-table__datagrid-body__content tbody').getElementsByTagName('tr');
|
|
1461
|
+
|
|
1462
|
+
for (let i = 0; i < headerTitleTrElements.length; i++) {
|
|
1463
|
+
headerTitleTrElements[i].removeAttribute('style');
|
|
1464
|
+
trElements[i].removeAttribute('style');
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1491
1467
|
}
|
|
1492
1468
|
|
|
1493
1469
|
|
|
@@ -1516,7 +1492,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1516
1492
|
// Guaranteed year change triggered by the front and rear buttons
|
|
1517
1493
|
onChangeYear?.({
|
|
1518
1494
|
day: padZero(day),
|
|
1519
|
-
month: padZero(month+1),
|
|
1495
|
+
month: padZero(month + 1),
|
|
1520
1496
|
year: year.toString()
|
|
1521
1497
|
});
|
|
1522
1498
|
}, [year]);
|
|
@@ -1526,9 +1502,9 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1526
1502
|
|
|
1527
1503
|
// update events value
|
|
1528
1504
|
if (Array.isArray(eventsValue)) setVal(eventsValue);
|
|
1529
|
-
|
|
1505
|
+
|
|
1530
1506
|
// update current today
|
|
1531
|
-
if (typeof customTodayDate !== 'undefined'
|
|
1507
|
+
if (typeof customTodayDate !== 'undefined' && isValidDate(customTodayDate)) {
|
|
1532
1508
|
const _customNow = new Date(customTodayDate);
|
|
1533
1509
|
setTodayDate(_customNow);
|
|
1534
1510
|
}
|
|
@@ -1539,7 +1515,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1539
1515
|
|
|
1540
1516
|
return () => {
|
|
1541
1517
|
|
|
1542
|
-
// table grid
|
|
1518
|
+
// reset table grid
|
|
1543
1519
|
tableGridReset();
|
|
1544
1520
|
}
|
|
1545
1521
|
|
|
@@ -1549,34 +1525,34 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1549
1525
|
|
|
1550
1526
|
return (
|
|
1551
1527
|
<>
|
|
1552
|
-
|
|
1528
|
+
|
|
1553
1529
|
{/*/////////////////////////////////////////////////// */}
|
|
1554
1530
|
{/*//////////////////// Calendar //////////////////// */}
|
|
1555
1531
|
{/*////////////////////////////////////////////////// */}
|
|
1556
1532
|
|
|
1557
1533
|
<div className={combinedCls(
|
|
1558
|
-
"e-cal-
|
|
1534
|
+
"e-cal-timeline__wrapper",
|
|
1559
1535
|
calendarWrapperClassName
|
|
1560
1536
|
)}>
|
|
1561
1537
|
|
|
1562
1538
|
{/*++++++++++++++++ MAIN ++++++++++++++++*/}
|
|
1563
|
-
<div className="e-cal-
|
|
1564
|
-
<button tabIndex={-1} type="button" className="e-cal-
|
|
1539
|
+
<div className="e-cal-timeline__header bg-body-tertiary">
|
|
1540
|
+
<button tabIndex={-1} type="button" className="e-cal-timeline__btn e-cal-timeline__btn--prev" onClick={handlePrevChange}>
|
|
1565
1541
|
<svg width="20px" height="20px" viewBox="0 0 24 24" fill="none">
|
|
1566
1542
|
<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" />
|
|
1567
1543
|
</svg>
|
|
1568
1544
|
</button>
|
|
1569
|
-
<div className="e-cal-
|
|
1570
|
-
<button tabIndex={-1} type="button" className={`e-cal-
|
|
1545
|
+
<div className="e-cal-timeline__header__btns">
|
|
1546
|
+
<button tabIndex={-1} type="button" className={`e-cal-timeline__btn ${winMonth ? 'active' : ''}`} onClick={handleShowWinMonth}>
|
|
1571
1547
|
{MONTHS[month]}
|
|
1572
1548
|
<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>
|
|
1573
1549
|
</button>
|
|
1574
|
-
<button tabIndex={-1} type="button" className={`e-cal-
|
|
1550
|
+
<button tabIndex={-1} type="button" className={`e-cal-timeline__btn ${winYear ? 'active' : ''}`} onClick={handleShowWinYear}>
|
|
1575
1551
|
{year}
|
|
1576
1552
|
<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>
|
|
1577
1553
|
</button>
|
|
1578
1554
|
</div>
|
|
1579
|
-
<button tabIndex={-1} type="button" className="e-cal-
|
|
1555
|
+
<button tabIndex={-1} type="button" className="e-cal-timeline__btn e-cal-timeline__btn--next" onClick={handleNextChange}>
|
|
1580
1556
|
<svg width="20px" height="20px" viewBox="0 0 24 24" fill="none">
|
|
1581
1557
|
<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" />
|
|
1582
1558
|
</svg>
|
|
@@ -1584,30 +1560,28 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1584
1560
|
</div>
|
|
1585
1561
|
|
|
1586
1562
|
|
|
1587
|
-
|
|
1588
|
-
<div className="e-cal-tl__body">
|
|
1589
1563
|
|
|
1564
|
+
<div className="e-cal-timeline__body">
|
|
1590
1565
|
|
|
1591
|
-
<div className="e-cal-tl__row">
|
|
1592
1566
|
|
|
1593
|
-
|
|
1594
|
-
|
|
1567
|
+
<div className="e-cal-timeline__row">
|
|
1568
|
+
{/* day */}
|
|
1569
|
+
|
|
1570
|
+
{/* /day */}
|
|
1571
|
+
</div>
|
|
1595
1572
|
|
|
1596
|
-
{/* /day */}
|
|
1597
|
-
</div>
|
|
1598
|
-
|
|
1599
1573
|
</div>
|
|
1600
1574
|
{/*++++++++++++++++ /MAIN ++++++++++++++++*/}
|
|
1601
1575
|
|
|
1602
1576
|
|
|
1603
1577
|
{/*++++++++++++++++ MONTH SELECTION TAB ++++++++++++++++*/}
|
|
1604
|
-
<div className={`e-cal-
|
|
1605
|
-
<div className="e-cal-
|
|
1578
|
+
<div className={`e-cal-timeline__month-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winMonth ? 'active' : ''}`}>
|
|
1579
|
+
<div className="e-cal-timeline__month-container">
|
|
1606
1580
|
{MONTHS_FULL.map((month, index) => {
|
|
1607
|
-
return <div
|
|
1608
|
-
data-month={padZero(index+1)}
|
|
1609
|
-
className={`e-cal-
|
|
1610
|
-
key={month + index}
|
|
1581
|
+
return <div
|
|
1582
|
+
data-month={padZero(index + 1)}
|
|
1583
|
+
className={`e-cal-timeline__month ${selectedMonth === index ? ' selected' : ''}`}
|
|
1584
|
+
key={month + index}
|
|
1611
1585
|
onClick={() => { handleMonthChange(index) }}
|
|
1612
1586
|
>{month}</div>
|
|
1613
1587
|
})}
|
|
@@ -1616,13 +1590,13 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1616
1590
|
{/*++++++++++++++++ /MONTH SELECTION TAB ++++++++++++++++*/}
|
|
1617
1591
|
|
|
1618
1592
|
{/*++++++++++++++++ YEAR SELECTION TAB ++++++++++++++++*/}
|
|
1619
|
-
<div className={`e-cal-
|
|
1620
|
-
<div className="e-cal-
|
|
1593
|
+
<div className={`e-cal-timeline__year-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winYear ? 'active' : ''}`}>
|
|
1594
|
+
<div className="e-cal-timeline__year-container bg-body-tertiary">
|
|
1621
1595
|
{yearsArray.map((year, index) => {
|
|
1622
|
-
return <div
|
|
1623
|
-
|
|
1624
|
-
className={`e-cal-
|
|
1625
|
-
key={year + index}
|
|
1596
|
+
return <div
|
|
1597
|
+
data-year={year}
|
|
1598
|
+
className={`e-cal-timeline__year ${selectedYear === year ? ' selected' : ''}`}
|
|
1599
|
+
key={year + index}
|
|
1626
1600
|
onClick={() => { handleYearChange(year) }}
|
|
1627
1601
|
>{year}</div>
|
|
1628
1602
|
})}
|
|
@@ -1634,15 +1608,15 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1634
1608
|
|
|
1635
1609
|
|
|
1636
1610
|
{/*++++++++++++++++ TODAY SELECTION TAB ++++++++++++++++*/}
|
|
1637
|
-
<div className="e-cal-
|
|
1638
|
-
<button tabIndex={-1} type="button" className="e-cal-
|
|
1611
|
+
<div className="e-cal-timeline__today-wrapper p-2">
|
|
1612
|
+
<button tabIndex={-1} type="button" className="e-cal-timeline__btn e-cal-timeline__btn--today" onClick={handleTodayChange}>
|
|
1639
1613
|
{langToday || 'Today'}
|
|
1640
1614
|
</button>
|
|
1641
1615
|
</div>
|
|
1642
1616
|
{/*++++++++++++++++ /TODAY SELECTION TAB ++++++++++++++++*/}
|
|
1643
1617
|
|
|
1644
1618
|
|
|
1645
|
-
</div>{/* /.e-cal-
|
|
1619
|
+
</div>{/* /.e-cal-timeline__wrapper */}
|
|
1646
1620
|
|
|
1647
1621
|
|
|
1648
1622
|
|
|
@@ -1651,37 +1625,38 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1651
1625
|
{/*////////////////////////////////////////////////// */}
|
|
1652
1626
|
{val.length === 0 ? null : <>
|
|
1653
1627
|
<div ref={tableGridRef} className={combinedCls(
|
|
1654
|
-
"e-cal-
|
|
1628
|
+
"e-cal-timeline-table__timeline-table__wrapper invisible",
|
|
1655
1629
|
tableWrapperClassName
|
|
1656
1630
|
)}>
|
|
1657
1631
|
<table role="grid" className={combinedCls(
|
|
1658
|
-
"e-cal-
|
|
1632
|
+
"e-cal-timeline-table__timeline-table",
|
|
1659
1633
|
tableClassName
|
|
1660
1634
|
)}>
|
|
1661
1635
|
<colgroup>
|
|
1662
|
-
<col className="e-cal-
|
|
1636
|
+
<col className="e-cal-timeline-table__datagrid-header" />
|
|
1663
1637
|
<col />
|
|
1664
1638
|
<col />
|
|
1665
1639
|
</colgroup>
|
|
1640
|
+
|
|
1666
1641
|
<thead className={combinedCls(
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
ref={tableGridHeaderRef}
|
|
1642
|
+
tableHeadClassName
|
|
1643
|
+
)}
|
|
1644
|
+
ref={tableGridHeaderRef}
|
|
1670
1645
|
role="rowgroup"
|
|
1671
1646
|
>
|
|
1672
1647
|
<tr role="presentation">
|
|
1673
1648
|
<th role="presentation">
|
|
1674
1649
|
{/*<!--///// HEADER LEFT //////-->*/}
|
|
1675
|
-
<div className="e-cal-
|
|
1650
|
+
<div className="e-cal-timeline-table__timeline-header e-cal-timeline-table__timeline-headertitle">
|
|
1676
1651
|
|
|
1677
|
-
<table role="presentation" className="e-cal-
|
|
1652
|
+
<table role="presentation" className="e-cal-timeline-table__datagrid-header__title">
|
|
1678
1653
|
<colgroup>
|
|
1679
1654
|
<col />
|
|
1680
1655
|
</colgroup>
|
|
1681
1656
|
<thead role="presentation">
|
|
1682
1657
|
<tr role="row">
|
|
1683
1658
|
<th role="columnheader">
|
|
1684
|
-
<div className="e-cal-
|
|
1659
|
+
<div className="e-cal-timeline-table__cell-cushion e-cal-timeline-table__cell-cushion-headertitle">
|
|
1685
1660
|
{tableListSectionTitle || ''}
|
|
1686
1661
|
</div>
|
|
1687
1662
|
</th>
|
|
@@ -1695,15 +1670,20 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1695
1670
|
|
|
1696
1671
|
|
|
1697
1672
|
</th>
|
|
1698
|
-
<
|
|
1673
|
+
<th role="presentation" className="e-cal-timeline-table__timeline-divider"><div></div></th>
|
|
1699
1674
|
<th role="presentation">
|
|
1700
|
-
<div
|
|
1701
|
-
|
|
1675
|
+
<div
|
|
1676
|
+
ref={scrollHeaderRef}
|
|
1677
|
+
className="e-cal-timeline-table__scroller-harness e-cal-timeline-table__scroller-harness--hide"
|
|
1678
|
+
data-scroll="header"
|
|
1679
|
+
onScroll={syncTableScrollHeader}
|
|
1680
|
+
>
|
|
1681
|
+
<div className="e-cal-timeline-table__scroller">
|
|
1702
1682
|
|
|
1703
1683
|
{/*<!--///// HEADER RIGHT //////-->*/}
|
|
1704
|
-
<div className="e-cal-
|
|
1684
|
+
<div className="e-cal-timeline-table__timeline-header">
|
|
1705
1685
|
|
|
1706
|
-
<table className="e-cal-
|
|
1686
|
+
<table className="e-cal-timeline-table__datagrid-header__content e-cal-timeline-table__scrollgrid-sync-table" >
|
|
1707
1687
|
<tbody>
|
|
1708
1688
|
<tr>
|
|
1709
1689
|
{generateDaysUi()}
|
|
@@ -1721,24 +1701,34 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1721
1701
|
|
|
1722
1702
|
|
|
1723
1703
|
<tbody className={combinedCls(
|
|
1724
|
-
|
|
1725
|
-
|
|
1704
|
+
tableBodyClassName
|
|
1705
|
+
)}
|
|
1726
1706
|
role="rowgroup"
|
|
1727
1707
|
>
|
|
1728
|
-
<tr role="presentation" className="e-cal-
|
|
1729
|
-
<td
|
|
1708
|
+
<tr role="presentation" className="e-cal-timeline-table__list-section">
|
|
1709
|
+
<td
|
|
1730
1710
|
role="presentation"
|
|
1731
1711
|
className={combinedCls(
|
|
1732
1712
|
tableListStartClassName
|
|
1733
|
-
)}
|
|
1734
|
-
|
|
1713
|
+
)}
|
|
1714
|
+
|
|
1735
1715
|
>
|
|
1736
1716
|
|
|
1737
|
-
<div
|
|
1738
|
-
|
|
1717
|
+
<div
|
|
1718
|
+
ref={scrollListRef}
|
|
1719
|
+
className={combinedCls(
|
|
1720
|
+
'e-cal-timeline-table__scroller-harness',
|
|
1721
|
+
{
|
|
1722
|
+
'autoscroll': AUTO_SCROLL
|
|
1723
|
+
}
|
|
1724
|
+
)}
|
|
1725
|
+
data-scroll="list"
|
|
1726
|
+
onScroll={syncTableScrollList}
|
|
1727
|
+
>
|
|
1728
|
+
<div className="e-cal-timeline-table__scroller">
|
|
1739
1729
|
|
|
1740
1730
|
{/*<!--///// RESOURCE LEFT //////-->*/}
|
|
1741
|
-
<table role="presentation" className="e-cal-
|
|
1731
|
+
<table role="presentation" className="e-cal-timeline-table__datagrid-body__title e-cal-timeline-table__scrollgrid-sync-table">
|
|
1742
1732
|
<colgroup>
|
|
1743
1733
|
<col />
|
|
1744
1734
|
</colgroup>
|
|
@@ -1756,28 +1746,42 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1756
1746
|
|
|
1757
1747
|
|
|
1758
1748
|
</td>
|
|
1759
|
-
<td
|
|
1760
|
-
role="presentation"
|
|
1749
|
+
<td
|
|
1750
|
+
role="presentation"
|
|
1761
1751
|
className={combinedCls(
|
|
1762
|
-
'e-cal-
|
|
1752
|
+
'e-cal-timeline-table__timeline-divider',
|
|
1763
1753
|
tableListDividerClassName
|
|
1764
|
-
)}
|
|
1754
|
+
)}
|
|
1765
1755
|
>
|
|
1766
1756
|
<div></div>
|
|
1767
1757
|
</td>
|
|
1768
|
-
<td
|
|
1758
|
+
<td
|
|
1769
1759
|
role="presentation"
|
|
1770
1760
|
className={combinedCls(
|
|
1771
1761
|
tableListEndClassName
|
|
1772
|
-
)}
|
|
1762
|
+
)}
|
|
1773
1763
|
>
|
|
1774
|
-
|
|
1775
1764
|
|
|
1776
|
-
|
|
1777
|
-
|
|
1765
|
+
|
|
1766
|
+
<div
|
|
1767
|
+
ref={scrollBodyRef}
|
|
1768
|
+
className={combinedCls(
|
|
1769
|
+
'e-cal-timeline-table__scroller-harness',
|
|
1770
|
+
{
|
|
1771
|
+
'autoscroll': AUTO_SCROLL
|
|
1772
|
+
}
|
|
1773
|
+
)}
|
|
1774
|
+
data-scroll="body"
|
|
1775
|
+
onScroll={syncTableScrollBody}
|
|
1776
|
+
onMouseMove={BODY_DRAG ? handleTableMove : () => { }}
|
|
1777
|
+
onMouseDown={BODY_DRAG ? handleTableDragStart : () => { }}
|
|
1778
|
+
onMouseUp={BODY_DRAG ? handleTableDragEnd : () => { }}
|
|
1779
|
+
onMouseLeave={BODY_DRAG ? handleTableDragEnd : () => { }}
|
|
1780
|
+
>
|
|
1781
|
+
<div className="e-cal-timeline-table__scroller">
|
|
1778
1782
|
{/*<!--///// RESOURCE RIGHT //////-->*/}
|
|
1779
|
-
<div className="e-cal-
|
|
1780
|
-
<table className="e-cal-
|
|
1783
|
+
<div className="e-cal-timeline-table__timeline-body">
|
|
1784
|
+
<table className="e-cal-timeline-table__datagrid-body__content e-cal-timeline-table__scrollgrid-sync-table">
|
|
1781
1785
|
<colgroup>
|
|
1782
1786
|
{generateColUi()}
|
|
1783
1787
|
</colgroup>
|
|
@@ -1809,7 +1813,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1809
1813
|
</tbody>
|
|
1810
1814
|
</table>
|
|
1811
1815
|
|
|
1812
|
-
</div>{/* /.e-cal-
|
|
1816
|
+
</div>{/* /.e-cal-timeline-table__timeline-table__wrapper */}
|
|
1813
1817
|
|
|
1814
1818
|
|
|
1815
1819
|
</>}
|
|
@@ -1836,22 +1840,18 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1836
1840
|
|
|
1837
1841
|
setTimeout(() => {
|
|
1838
1842
|
setShowDelete(false);
|
|
1839
|
-
|
|
1840
|
-
const _currentData = val.filter((item: any) => getCalendarDate(item.date as string) === getCalendarDate(`${year}-${month + 1}-${day}`));
|
|
1841
|
-
onModalDeleteClose?.(_currentData.length === 0 ? {
|
|
1842
|
-
id: 0,
|
|
1843
|
-
date: getCalendarDate(`${year}-${month + 1}-${day}`)
|
|
1844
|
-
} : _currentData[0]);
|
|
1843
|
+
onModalDeleteClose?.(queryItemObj());
|
|
1845
1844
|
}, 350);
|
|
1846
1845
|
}}
|
|
1847
1846
|
onSubmit={async (e: any, closewin: Function, data: any) => {
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1847
|
+
onModalDeleteEvent?.(queryItemObj(), closewin, () => {
|
|
1848
|
+
|
|
1849
|
+
// initialize table grid
|
|
1850
|
+
setTimeout(() => {
|
|
1851
|
+
tableGridReset(false);
|
|
1852
|
+
tableGridInit(false);
|
|
1853
|
+
}, 500);
|
|
1854
|
+
});
|
|
1855
1855
|
}}
|
|
1856
1856
|
>
|
|
1857
1857
|
{modalDeleteContent || 'Are you sure?'}
|
|
@@ -1877,21 +1877,19 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1877
1877
|
|
|
1878
1878
|
setTimeout(() => {
|
|
1879
1879
|
setShowEdit(false);
|
|
1880
|
-
|
|
1881
|
-
const _currentData = val.filter((item: any) => getCalendarDate(item.date as string) === getCalendarDate(`${year}-${month + 1}-${day}`));
|
|
1882
|
-
onModalEditClose?.(_currentData.length === 0 ? {
|
|
1883
|
-
id: 0,
|
|
1884
|
-
date: getCalendarDate(`${year}-${month + 1}-${day}`)
|
|
1885
|
-
} : _currentData[0]);
|
|
1880
|
+
onModalEditClose?.(queryItemObj());
|
|
1886
1881
|
}, 350);
|
|
1887
1882
|
}}
|
|
1888
1883
|
onSubmit={async (e: any, closewin: Function, data: any) => {
|
|
1889
1884
|
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1885
|
+
onModalEditEvent?.(queryItemObj(), closewin, () => {
|
|
1886
|
+
// initialize table grid
|
|
1887
|
+
setTimeout(() => {
|
|
1888
|
+
tableGridReset(false);
|
|
1889
|
+
tableGridInit(false);
|
|
1890
|
+
}, 500);
|
|
1891
|
+
});
|
|
1892
|
+
|
|
1895
1893
|
|
|
1896
1894
|
}}
|
|
1897
1895
|
>
|
|
@@ -1912,14 +1910,14 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
|
1912
1910
|
<RootPortal show={true} containerClassName="EventCalendarTimeline-TooltipModal">
|
|
1913
1911
|
<div
|
|
1914
1912
|
ref={tableTooltipModalRef}
|
|
1915
|
-
id={`e-cal-
|
|
1916
|
-
className={`e-cal-
|
|
1913
|
+
id={`e-cal-timeline-table__cell-tooltipwrapper-${idRes}`}
|
|
1914
|
+
className={`e-cal-timeline-table__cell-tooltipwrapper d-inline-block ${isShowTableTooltip ? 'active' : ''}`}
|
|
1917
1915
|
role="tooltip"
|
|
1918
1916
|
data-microtip-position={tableTooltipDirection || 'bottom'}
|
|
1919
1917
|
data-microtip-size={tableTooltipSize || 'auto'}
|
|
1920
|
-
style={{ display: 'none'}}
|
|
1918
|
+
style={{ display: 'none' }}
|
|
1921
1919
|
>
|
|
1922
|
-
<div className="e-cal-
|
|
1920
|
+
<div className="e-cal-timeline-table__cell-tooltipcontent">
|
|
1923
1921
|
{tableTooltipContent}
|
|
1924
1922
|
</div>
|
|
1925
1923
|
</div>
|