funda-ui 4.3.555 → 4.4.15
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 +104 -0
- package/EventCalendar/index.css +7 -0
- package/EventCalendar/index.d.ts +2 -0
- package/EventCalendar/index.js +228 -89
- package/EventCalendarTimeline/index.css +29 -1
- package/EventCalendarTimeline/index.d.ts +11 -1
- package/EventCalendarTimeline/index.js +796 -298
- package/MultipleSelect/index.js +1 -1
- package/NativeSelect/index.js +1 -1
- package/Select/index.css +17 -0
- package/Select/index.d.ts +1 -0
- package/Select/index.js +83 -38
- package/Table/index.d.ts +4 -4
- package/Table/index.js +17 -17
- package/Tree/index.js +1 -1
- package/Utils/date.d.ts +27 -1
- package/Utils/date.js +92 -0
- package/lib/cjs/Date/index.js +104 -0
- package/lib/cjs/EventCalendar/index.d.ts +2 -0
- package/lib/cjs/EventCalendar/index.js +228 -89
- package/lib/cjs/EventCalendarTimeline/index.d.ts +11 -1
- package/lib/cjs/EventCalendarTimeline/index.js +796 -298
- package/lib/cjs/MultipleSelect/index.js +1 -1
- package/lib/cjs/NativeSelect/index.js +1 -1
- package/lib/cjs/Select/index.d.ts +1 -0
- package/lib/cjs/Select/index.js +83 -38
- package/lib/cjs/Table/index.d.ts +4 -4
- package/lib/cjs/Table/index.js +17 -17
- package/lib/cjs/Tree/index.js +1 -1
- package/lib/cjs/Utils/date.d.ts +27 -1
- package/lib/cjs/Utils/date.js +92 -0
- package/lib/css/EventCalendar/index.css +7 -0
- package/lib/css/EventCalendarTimeline/index.css +29 -1
- package/lib/css/Select/index.css +17 -0
- package/lib/esm/EventCalendar/index.scss +9 -0
- package/lib/esm/EventCalendar/index.tsx +203 -156
- package/lib/esm/EventCalendarTimeline/index.scss +46 -1
- package/lib/esm/EventCalendarTimeline/index.tsx +815 -358
- package/lib/esm/MultipleSelect/ItemList.tsx +1 -1
- package/lib/esm/MultipleSelect/index.tsx +1 -1
- package/lib/esm/NativeSelect/index.tsx +1 -1
- package/lib/esm/Select/index.scss +36 -1
- package/lib/esm/Select/index.tsx +179 -30
- package/lib/esm/Table/Table.tsx +2 -2
- package/lib/esm/Table/TableCell.tsx +2 -2
- package/lib/esm/Table/TableRow.tsx +1 -1
- package/lib/esm/Table/index.tsx +4 -4
- package/lib/esm/Tree/TreeList.tsx +1 -1
- package/lib/esm/Utils/libs/date.ts +101 -1
- package/package.json +1 -1
- /package/lib/esm/MultipleSelect/{multiple-select-utils → utils}/func.ts +0 -0
- /package/lib/esm/NativeSelect/{native-select-utils → utils}/func.ts +0 -0
- /package/lib/esm/Select/{select-utils → utils}/func.ts +0 -0
- /package/lib/esm/Table/{table-utils → utils}/DragHandleSprite.tsx +0 -0
- /package/lib/esm/Table/{table-utils → utils}/SortSprite.tsx +0 -0
- /package/lib/esm/Table/{table-utils → utils}/TableFilter.tsx +0 -0
- /package/lib/esm/Table/{table-utils → utils}/ToggleSelection.tsx +0 -0
- /package/lib/esm/Table/{table-utils → utils}/func.ts +0 -0
- /package/lib/esm/Table/{table-utils → utils}/hooks/useTableDraggable.tsx +0 -0
- /package/lib/esm/Table/{table-utils → utils}/hooks/useTableKeyPress.tsx +0 -0
- /package/lib/esm/Table/{table-utils → utils}/hooks/useTableResponsive.tsx +0 -0
- /package/lib/esm/Table/{table-utils → utils}/hooks/useTableSort.tsx +0 -0
- /package/lib/esm/Tree/{tree-utils.ts → utils/func.ts} +0 -0
|
@@ -5,7 +5,6 @@ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
|
|
|
5
5
|
import ModalDialog from 'funda-modaldialog';
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
export interface EventsValueConfig {
|
|
10
9
|
id: string | number;
|
|
11
10
|
date: string,
|
|
@@ -65,7 +64,8 @@ export type EventCalendarProps = {
|
|
|
65
64
|
onCellMouseEnter?: (el: any) => void;
|
|
66
65
|
onCellMouseLeave?: (el: any) => void;
|
|
67
66
|
onCellClick?: (el: any) => void;
|
|
68
|
-
|
|
67
|
+
onCellMouseUp?: (el: any) => void;
|
|
68
|
+
onKeyPressed?: (el: any) => void;
|
|
69
69
|
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -119,6 +119,8 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
119
119
|
onCellMouseEnter,
|
|
120
120
|
onCellMouseLeave,
|
|
121
121
|
onCellClick,
|
|
122
|
+
onCellMouseUp,
|
|
123
|
+
onKeyPressed
|
|
122
124
|
} = props;
|
|
123
125
|
|
|
124
126
|
const DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
@@ -153,7 +155,7 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
153
155
|
const EVENTS_DELETE_ENABLED = typeof modalDeleteContent !== 'undefined';
|
|
154
156
|
const [showEdit, setShowEdit] = useState<boolean>(false);
|
|
155
157
|
const [showDelete, setShowDelete] = useState<boolean>(false);
|
|
156
|
-
|
|
158
|
+
|
|
157
159
|
// Open temporary storage for pop-ups
|
|
158
160
|
const [tableCellId, setTableCellId] = useState<number>(-1);
|
|
159
161
|
|
|
@@ -162,10 +164,10 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
162
164
|
contentRef,
|
|
163
165
|
() => ({
|
|
164
166
|
gridInit: () => {
|
|
165
|
-
|
|
167
|
+
|
|
166
168
|
},
|
|
167
169
|
gridReset: (cb?: any) => {
|
|
168
|
-
|
|
170
|
+
|
|
169
171
|
}
|
|
170
172
|
}),
|
|
171
173
|
[contentRef],
|
|
@@ -235,60 +237,112 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
235
237
|
currentStartDay = getStartDayOfMonth(_date);
|
|
236
238
|
}
|
|
237
239
|
|
|
238
|
-
|
|
240
|
+
|
|
239
241
|
//
|
|
240
|
-
const allDays = Array(days[currentMonth] + (currentStartDay - 1)).fill(null).map((_: any, i: number) => i
|
|
242
|
+
const allDays = Array(days[currentMonth] + (currentStartDay - 1)).fill(null).map((_: any, i: number) => i); // [0,1,..,30,31]
|
|
241
243
|
const rows = Math.ceil(allDays.length / 7); // 5
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
|
|
245
|
+
//
|
|
246
|
+
const _tempCells: any[] = Array.from({ length: rows }).fill(null);
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
const _getForwardFill = (_year: number, _month: number) => {
|
|
250
|
+
// Get the last day of the previous month
|
|
251
|
+
const lastDayOfLastMonth = new Date(_year, _month - 1, 0);
|
|
252
|
+
const last7Days: Date[] = [];
|
|
253
|
+
|
|
254
|
+
// Rewind 7 days forward from the last day
|
|
255
|
+
for (let i = 0; i < 7; i++) {
|
|
256
|
+
last7Days.unshift(new Date(lastDayOfLastMonth));
|
|
257
|
+
lastDayOfLastMonth.setDate(lastDayOfLastMonth.getDate() - 1);
|
|
258
|
+
}
|
|
259
|
+
return last7Days.map((v: Date) => getCalendarDate(v));
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
const _getBackFill = (_year: number, _month: number) => {
|
|
263
|
+
// Get the first day of the next month
|
|
264
|
+
const firstDayOfNextMonth = new Date(_year, _month, 1);
|
|
265
|
+
const first7Days: Date[] = [];
|
|
266
|
+
|
|
267
|
+
// Rewind 7 days forward from the first day of the next month
|
|
268
|
+
for (let i = 0; i < 7; i++) {
|
|
269
|
+
first7Days.push(new Date(firstDayOfNextMonth));
|
|
270
|
+
firstDayOfNextMonth.setDate(firstDayOfNextMonth.getDate() + 1);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return first7Days.map((v: Date) => getCalendarDate(v));
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
return _tempCells.map((_: any, j: number) => {
|
|
278
|
+
const _col = allDays.slice(j * 7, (j + 1) * 7);
|
|
279
|
+
|
|
280
|
+
|
|
246
281
|
// back fill
|
|
247
282
|
const backFillArr: null[] = [];
|
|
248
|
-
for (let k = 0; k < 7-_col.length; k++) {
|
|
283
|
+
for (let k = 0; k < 7 - _col.length; k++) {
|
|
249
284
|
backFillArr.push(null);
|
|
250
285
|
}
|
|
251
286
|
_col.splice(_col.length, 0, ...backFillArr as any);
|
|
252
|
-
|
|
253
|
-
return {
|
|
254
|
-
month: currentMonth,
|
|
255
|
-
startDay: currentStartDay,
|
|
256
|
-
row: i,
|
|
257
|
-
col: _col
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
};
|
|
261
287
|
|
|
262
|
-
const getForwardFill = () => {
|
|
263
|
-
const prevMonthStartDay = getCells('forward').at(-1)?.startDay;
|
|
264
|
-
const prevMonthLastRowNums: any = getCells('forward').at(-1)?.col.filter(Boolean);
|
|
265
288
|
|
|
266
|
-
|
|
267
|
-
|
|
289
|
+
//
|
|
290
|
+
const isFirstGroup = j === 0;
|
|
291
|
+
const isLastGroup = j === _tempCells.length - 1;
|
|
268
292
|
|
|
269
|
-
return prevMonthLastRowNums.map((dayIndex: number) => {
|
|
270
|
-
const d = typeof dayIndex === 'number' ? dayIndex - (prevMonthStartDay - 2) : 0;
|
|
271
|
-
return d;
|
|
272
|
-
});
|
|
273
|
-
} else {
|
|
274
|
-
return [];
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
293
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
const prevMonthLastRowNums: any = getCells('back').at(0)?.col.filter(Boolean);
|
|
294
|
+
// forward fill
|
|
295
|
+
const __forwardFillDate: string[] = _getForwardFill(year, month + 1);
|
|
281
296
|
|
|
282
|
-
|
|
283
|
-
|
|
297
|
+
// back fill
|
|
298
|
+
const __backFillDate: string[] = _getBackFill(year, month + 1);
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
const _getDateShow = (_dayIndex: number, _m: number, _startDay: number, _month: number) => {
|
|
302
|
+
const currentDay = typeof _dayIndex === 'number' ? _dayIndex - (_startDay - 2) : 0; // ..., -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, ...
|
|
303
|
+
|
|
304
|
+
// date
|
|
305
|
+
let _dateShow: any = currentDay > 0 ? `${year}-${_month + 1}-${currentDay}` : '';
|
|
306
|
+
|
|
307
|
+
// forward & back
|
|
308
|
+
if (isFirstGroup && _dateShow === '') {
|
|
309
|
+
_dateShow = __forwardFillDate.at(currentDay - 1);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if (isLastGroup && _dateShow === '') {
|
|
313
|
+
_dateShow = __backFillDate.at(_m);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
return {
|
|
318
|
+
date: getCalendarDate(_dateShow),
|
|
319
|
+
firstGroup: isFirstGroup,
|
|
320
|
+
lastGroup: isLastGroup,
|
|
321
|
+
validDisplayDate: currentDay > 0 && currentDay <= days[month]
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
//
|
|
327
|
+
return {
|
|
328
|
+
month: currentMonth,
|
|
329
|
+
startDay: currentStartDay,
|
|
330
|
+
row: j,
|
|
331
|
+
col: _col,
|
|
332
|
+
dateInfo: _col.map((k: number, m: number) => {
|
|
333
|
+
const _lastWeekDays: number = _col.filter(Boolean).length;
|
|
334
|
+
return _getDateShow(k, m - _lastWeekDays, currentStartDay, currentMonth);
|
|
335
|
+
}),
|
|
336
|
+
weekDisplay: _col.map((k: number, m: number) => {
|
|
337
|
+
return WEEK[m]
|
|
338
|
+
}),
|
|
339
|
+
week: _col.map((k: number, m: number) => {
|
|
340
|
+
return m
|
|
341
|
+
}),
|
|
342
|
+
|
|
343
|
+
}
|
|
344
|
+
});
|
|
284
345
|
|
|
285
|
-
return prevMonthLastRowNums.map((dayIndex: number) => {
|
|
286
|
-
const d = typeof dayIndex === 'number' ? dayIndex - (prevMonthStartDay - 2) : 0;
|
|
287
|
-
return d;
|
|
288
|
-
}).filter((n: number) => n > 0);
|
|
289
|
-
} else {
|
|
290
|
-
return [];
|
|
291
|
-
}
|
|
292
346
|
};
|
|
293
347
|
|
|
294
348
|
|
|
@@ -329,7 +383,7 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
329
383
|
//
|
|
330
384
|
onChangeMonth?.({
|
|
331
385
|
day: padZero(day),
|
|
332
|
-
month: padZero(_date.getMonth()+1),
|
|
386
|
+
month: padZero(_date.getMonth() + 1),
|
|
333
387
|
year: _date.getFullYear().toString()
|
|
334
388
|
});
|
|
335
389
|
|
|
@@ -351,7 +405,7 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
351
405
|
//
|
|
352
406
|
onChangeMonth?.({
|
|
353
407
|
day: padZero(day),
|
|
354
|
-
month: padZero(_date.getMonth()+1),
|
|
408
|
+
month: padZero(_date.getMonth() + 1),
|
|
355
409
|
year: _date.getFullYear().toString()
|
|
356
410
|
});
|
|
357
411
|
|
|
@@ -386,7 +440,7 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
386
440
|
//
|
|
387
441
|
onChangeMonth?.({
|
|
388
442
|
day: padZero(day),
|
|
389
|
-
month: padZero(currentIndex+1),
|
|
443
|
+
month: padZero(currentIndex + 1),
|
|
390
444
|
year: year.toString()
|
|
391
445
|
});
|
|
392
446
|
|
|
@@ -433,7 +487,7 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
433
487
|
// Guaranteed year change triggered by the front and rear buttons
|
|
434
488
|
onChangeYear?.({
|
|
435
489
|
day: padZero(day),
|
|
436
|
-
month: padZero(month+1),
|
|
490
|
+
month: padZero(month + 1),
|
|
437
491
|
year: year.toString()
|
|
438
492
|
});
|
|
439
493
|
}, [year]);
|
|
@@ -449,7 +503,7 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
449
503
|
|
|
450
504
|
// update events value
|
|
451
505
|
if (Array.isArray(eventsValue)) setVal(eventsValue);
|
|
452
|
-
|
|
506
|
+
|
|
453
507
|
// update current today
|
|
454
508
|
if (typeof customTodayDate === 'string' && customTodayDate !== '' && isValidDate(customTodayDate)) {
|
|
455
509
|
const _customNow = new Date(customTodayDate);
|
|
@@ -465,10 +519,16 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
465
519
|
return (
|
|
466
520
|
<>
|
|
467
521
|
|
|
468
|
-
<div
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
522
|
+
<div
|
|
523
|
+
className={combinedCls(
|
|
524
|
+
"e-cal-normal__wrapper",
|
|
525
|
+
calendarWrapperClassName
|
|
526
|
+
)}
|
|
527
|
+
onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
528
|
+
onKeyPressed?.(e);
|
|
529
|
+
}}
|
|
530
|
+
tabIndex={-1}
|
|
531
|
+
>
|
|
472
532
|
|
|
473
533
|
|
|
474
534
|
{/*++++++++++++++++ MAIN ++++++++++++++++*/}
|
|
@@ -496,69 +556,50 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
496
556
|
</div>
|
|
497
557
|
<div className="e-cal-normal__body">
|
|
498
558
|
|
|
499
|
-
|
|
500
|
-
|
|
559
|
+
{/* week */}
|
|
560
|
+
<div className="e-cal-normal__row">
|
|
501
561
|
{WEEK.map((s: string, i: number) => (
|
|
502
|
-
<div
|
|
562
|
+
<div
|
|
503
563
|
className={combinedCls(
|
|
504
564
|
'e-cal-normal__cell e-cal-normal__day e-cal-normal__day--week e-cal-normal__day--disabled bg-secondary-subtle empty',
|
|
505
565
|
{
|
|
506
|
-
'last-cell': i === WEEK.length-1
|
|
566
|
+
'last-cell': i === WEEK.length - 1
|
|
507
567
|
}
|
|
508
|
-
)}
|
|
509
|
-
key={i}
|
|
510
|
-
data-week={i}
|
|
568
|
+
)}
|
|
569
|
+
key={i}
|
|
570
|
+
data-week={i}
|
|
511
571
|
dangerouslySetInnerHTML={{
|
|
512
572
|
__html: s
|
|
513
|
-
}}
|
|
573
|
+
}}
|
|
514
574
|
/>
|
|
515
575
|
))}
|
|
516
|
-
|
|
517
|
-
|
|
576
|
+
</div>
|
|
577
|
+
{/* /week */}
|
|
518
578
|
|
|
519
|
-
|
|
579
|
+
{/* day */}
|
|
520
580
|
{getCells().map((item: any, j: number) => {
|
|
521
581
|
|
|
522
|
-
const
|
|
523
|
-
const isLastRow = j === getCells().length-1;
|
|
524
|
-
|
|
525
|
-
// forward fill
|
|
526
|
-
const __forwardFillNum: number[] = getForwardFill();
|
|
527
|
-
|
|
528
|
-
// back fill
|
|
529
|
-
const __backFillNum: number[] = getBackFill();
|
|
530
|
-
|
|
582
|
+
const isLastRow = j === getCells().length - 1;
|
|
531
583
|
|
|
532
584
|
return <div key={'row' + item.row} className="e-cal-normal__row">
|
|
533
585
|
{item.col.map((dayIndex: number | null, i: number) => {
|
|
534
|
-
const d = typeof dayIndex === 'number' ? dayIndex - (startDay - 2) : 0;
|
|
535
|
-
const _currentData = val.filter((item: any) => getCalendarDate(item.date as string) === getCalendarDate(`${year}-${month + 1}-${d}`));
|
|
536
|
-
const isLastCol = i === item.col.length-1;
|
|
537
586
|
|
|
538
|
-
|
|
587
|
+
const isLastCell = i === item.col.length - 1;
|
|
588
|
+
|
|
539
589
|
// date
|
|
540
|
-
|
|
590
|
+
const _dateShow = item.dateInfo[i].date;
|
|
591
|
+
const _dateDayShow = _dateShow.split('-').at(-1);
|
|
541
592
|
|
|
542
|
-
|
|
543
|
-
const
|
|
544
|
-
|
|
593
|
+
// week day
|
|
594
|
+
const weekDay = item.week[i];
|
|
545
595
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
}
|
|
596
|
+
// helper
|
|
597
|
+
const d = parseFloat(_dateDayShow);
|
|
598
|
+
const _currentData = val.filter((item: any) => getCalendarDate(item.date as string) === _dateShow);
|
|
599
|
+
const isInteractive = item.dateInfo[i].validDisplayDate; // The date on which the user interaction can occur, e.g. click, modify
|
|
600
|
+
const isForward = item.dateInfo[i].firstGroup && !isInteractive;
|
|
601
|
+
const isBack = item.dateInfo[i].lastGroup && !isInteractive;
|
|
553
602
|
|
|
554
|
-
if (isBack && _dateShow === '') {
|
|
555
|
-
if (month + 1 === 12) {
|
|
556
|
-
_dateShow = `${year+1}-1-${__backFillNum[i-item.col.filter(Boolean).length]}`;
|
|
557
|
-
} else {
|
|
558
|
-
_dateShow = `${year}-${month + 2}-${__backFillNum[i-item.col.filter(Boolean).length]}`;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
603
|
|
|
563
604
|
const _eventContent = () => {
|
|
564
605
|
|
|
@@ -569,24 +610,24 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
569
610
|
) {
|
|
570
611
|
return null;
|
|
571
612
|
}
|
|
572
|
-
|
|
613
|
+
|
|
573
614
|
//
|
|
574
615
|
const _items = _currentData[0].list;
|
|
575
|
-
|
|
616
|
+
|
|
576
617
|
return _items.map((cellItem: any, cellItemIndex: number) => {
|
|
577
|
-
|
|
618
|
+
|
|
578
619
|
return <div
|
|
579
620
|
className={combinedCls(
|
|
580
621
|
`e-cal-normal__cell-item e-cal-normal__cell-item-${cellItemIndex}`,
|
|
581
622
|
{
|
|
582
623
|
'first': cellItemIndex === 0,
|
|
583
|
-
'last': cellItemIndex === _items.length-1
|
|
624
|
+
'last': cellItemIndex === _items.length - 1
|
|
584
625
|
}
|
|
585
626
|
)}
|
|
586
627
|
key={`cell-item-${cellItemIndex}}`}
|
|
587
|
-
data-date={
|
|
588
|
-
data-day={
|
|
589
|
-
data-week={
|
|
628
|
+
data-date={_dateShow}
|
|
629
|
+
data-day={_dateDayShow}
|
|
630
|
+
data-week={weekDay}
|
|
590
631
|
onClick={(e: React.MouseEvent) => {
|
|
591
632
|
e.stopPropagation();
|
|
592
633
|
|
|
@@ -596,37 +637,39 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
596
637
|
// Callback
|
|
597
638
|
cellItem.callback?.();
|
|
598
639
|
|
|
599
|
-
|
|
600
|
-
if (
|
|
640
|
+
|
|
641
|
+
if (isInteractive) {
|
|
601
642
|
handleDayChange(e, d); // update current day
|
|
602
|
-
|
|
643
|
+
|
|
603
644
|
onChangeDate?.(e, cellItem);
|
|
604
|
-
|
|
645
|
+
|
|
605
646
|
if (EVENTS_ENABLED) {
|
|
606
647
|
onModalEditOpen?.(cellItem, () => setShowEdit(true), 'normal');
|
|
607
648
|
}
|
|
608
649
|
}
|
|
609
650
|
}}
|
|
610
651
|
>
|
|
611
|
-
|
|
652
|
+
|
|
612
653
|
{/* ITEM */}
|
|
613
654
|
<div
|
|
614
655
|
className="e-cal-normal__day__event"
|
|
615
656
|
style={typeof cellItem !== 'undefined' && (cellItem as any).eventStyles !== 'undefined' ? cellItem.eventStyles : {}}
|
|
616
|
-
dangerouslySetInnerHTML={{
|
|
657
|
+
dangerouslySetInnerHTML={typeof cellItem.data === 'string' ? {
|
|
617
658
|
__html: cellItem.data
|
|
618
|
-
}}
|
|
619
|
-
|
|
659
|
+
} : undefined}
|
|
660
|
+
>
|
|
661
|
+
{React.isValidElement(cellItem.data) ? <>{cellItem.data}</> : null}
|
|
662
|
+
</div>
|
|
620
663
|
{/* /ITEM */}
|
|
621
|
-
|
|
664
|
+
|
|
622
665
|
{/* DELETE BUTTON */}
|
|
623
666
|
<div
|
|
624
667
|
className={`e-cal-normal__day__eventdel ${cellCloseBtnClassName || ''}`}
|
|
625
668
|
>
|
|
626
|
-
<a
|
|
627
|
-
href="#"
|
|
628
|
-
tabIndex={-1}
|
|
629
|
-
className="align-middle"
|
|
669
|
+
<a
|
|
670
|
+
href="#"
|
|
671
|
+
tabIndex={-1}
|
|
672
|
+
className="align-middle"
|
|
630
673
|
data-date={getCalendarDate(_dateShow)}
|
|
631
674
|
data-day={padZero(d)}
|
|
632
675
|
data-week={i}
|
|
@@ -636,12 +679,12 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
636
679
|
|
|
637
680
|
// update cell data
|
|
638
681
|
setTableCellId(cellItem.id);
|
|
639
|
-
|
|
682
|
+
|
|
640
683
|
|
|
641
684
|
const _existsContent = cellItem;
|
|
642
685
|
|
|
643
686
|
//
|
|
644
|
-
if (
|
|
687
|
+
if (isInteractive) {
|
|
645
688
|
handleDayChange(e, d); // update current day
|
|
646
689
|
|
|
647
690
|
onChangeDate?.(e, {
|
|
@@ -653,29 +696,29 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
653
696
|
onModalDeleteOpen?.(_existsContent, () => setShowDelete(true));
|
|
654
697
|
}
|
|
655
698
|
}
|
|
656
|
-
|
|
699
|
+
|
|
657
700
|
}}
|
|
658
701
|
>
|
|
659
702
|
{_delBtn()}
|
|
660
703
|
</a>
|
|
661
|
-
|
|
704
|
+
|
|
662
705
|
</div>
|
|
663
706
|
{/* /DELETE BUTTON */}
|
|
664
707
|
</div>
|
|
665
708
|
});
|
|
666
709
|
};
|
|
667
|
-
|
|
710
|
+
|
|
668
711
|
|
|
669
712
|
return (
|
|
670
713
|
<div
|
|
671
714
|
className={combinedCls(
|
|
672
715
|
'e-cal-normal__cell e-cal-normal__day',
|
|
673
716
|
{
|
|
674
|
-
'empty':
|
|
717
|
+
'empty': !isInteractive,
|
|
675
718
|
'today': d === now.getDate(),
|
|
676
719
|
'selected': d === day,
|
|
677
|
-
'last-cell':
|
|
678
|
-
'last-row': isLastRow
|
|
720
|
+
'last-cell': isLastCell,
|
|
721
|
+
'last-row': isLastRow,
|
|
679
722
|
}
|
|
680
723
|
)}
|
|
681
724
|
key={"col" + i}
|
|
@@ -685,29 +728,34 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
685
728
|
onMouseEnter={(e: React.MouseEvent) => {
|
|
686
729
|
onCellMouseEnter?.(e);
|
|
687
730
|
}}
|
|
688
|
-
|
|
689
|
-
onCellMouseLeave?.(e);
|
|
690
|
-
}}
|
|
691
|
-
onClick={(e: React.MouseEvent) => {
|
|
731
|
+
onMouseDown={(e: React.MouseEvent) => {
|
|
692
732
|
//
|
|
693
733
|
onCellClick?.(e);
|
|
694
734
|
|
|
695
|
-
if (
|
|
735
|
+
if (isInteractive) {
|
|
696
736
|
handleDayChange(e, d); // update current day
|
|
697
737
|
onChangeDate?.(e, null);
|
|
698
738
|
}
|
|
699
739
|
}}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
{
|
|
704
|
-
|
|
740
|
+
onMouseLeave={(e: React.MouseEvent) => {
|
|
741
|
+
onCellMouseLeave?.(e);
|
|
742
|
+
}}
|
|
743
|
+
onMouseUp={(e: React.MouseEvent) => {
|
|
744
|
+
onCellMouseUp?.(e);
|
|
745
|
+
}}
|
|
705
746
|
|
|
706
|
-
|
|
707
|
-
{d > 0 ? <span>{d}</span> : null}
|
|
747
|
+
>
|
|
708
748
|
|
|
709
|
-
{/* back fill */}
|
|
710
|
-
|
|
749
|
+
{/* forward fill & day & back fill */}
|
|
750
|
+
<span
|
|
751
|
+
className={combinedCls(
|
|
752
|
+
{
|
|
753
|
+
'disabled': !isInteractive
|
|
754
|
+
}
|
|
755
|
+
)}
|
|
756
|
+
>
|
|
757
|
+
{d}
|
|
758
|
+
</span>
|
|
711
759
|
|
|
712
760
|
{/*++++++++++++++++ EVENT ++++++++++++++++*/}
|
|
713
761
|
{_eventContent()}
|
|
@@ -718,10 +766,10 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
718
766
|
<div
|
|
719
767
|
className={`e-cal-normal__day__eventadd ${cellAddBtnClassName || ''}`}
|
|
720
768
|
>
|
|
721
|
-
<a
|
|
722
|
-
href="#"
|
|
723
|
-
tabIndex={-1}
|
|
724
|
-
className="align-middle"
|
|
769
|
+
<a
|
|
770
|
+
href="#"
|
|
771
|
+
tabIndex={-1}
|
|
772
|
+
className="align-middle"
|
|
725
773
|
data-date={getCalendarDate(_dateShow)}
|
|
726
774
|
data-day={padZero(d)}
|
|
727
775
|
data-week={i}
|
|
@@ -733,7 +781,7 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
733
781
|
setTableCellId(-1);
|
|
734
782
|
|
|
735
783
|
//
|
|
736
|
-
if (
|
|
784
|
+
if (isInteractive) {
|
|
737
785
|
handleDayChange(e, d); // update current day
|
|
738
786
|
|
|
739
787
|
onChangeDate?.(e, {
|
|
@@ -756,7 +804,6 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
756
804
|
</div>
|
|
757
805
|
</>}
|
|
758
806
|
{/* /ADD BUTTON */}
|
|
759
|
-
|
|
760
807
|
|
|
761
808
|
</div>
|
|
762
809
|
);
|
|
@@ -765,8 +812,8 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
765
812
|
|
|
766
813
|
})}
|
|
767
814
|
|
|
768
|
-
|
|
769
|
-
|
|
815
|
+
{/* /day */}
|
|
816
|
+
|
|
770
817
|
</div>
|
|
771
818
|
{/*++++++++++++++++ /MAIN ++++++++++++++++*/}
|
|
772
819
|
|
|
@@ -775,10 +822,10 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
775
822
|
<div className={`e-cal-normal__month-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winMonth ? 'active' : ''}`}>
|
|
776
823
|
<div className="e-cal-normal__month-container">
|
|
777
824
|
{MONTHS_FULL.map((month, index) => {
|
|
778
|
-
return <div
|
|
779
|
-
data-month={padZero(index+1)}
|
|
780
|
-
className={`e-cal-normal__month ${selectedMonth === index ? ' selected' : ''}`}
|
|
781
|
-
key={month + index}
|
|
825
|
+
return <div
|
|
826
|
+
data-month={padZero(index + 1)}
|
|
827
|
+
className={`e-cal-normal__month ${selectedMonth === index ? ' selected' : ''}`}
|
|
828
|
+
key={month + index}
|
|
782
829
|
onClick={() => { handleMonthChange(index) }}
|
|
783
830
|
>{month}</div>
|
|
784
831
|
})}
|
|
@@ -790,10 +837,10 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
790
837
|
<div className={`e-cal-normal__year-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winYear ? 'active' : ''}`}>
|
|
791
838
|
<div className="e-cal-normal__year-container bg-body-tertiary">
|
|
792
839
|
{yearsArray.map((year, index) => {
|
|
793
|
-
return <div
|
|
840
|
+
return <div
|
|
794
841
|
data-year={year}
|
|
795
|
-
className={`e-cal-normal__year ${selectedYear === year ? ' selected' : ''}`}
|
|
796
|
-
key={year + index}
|
|
842
|
+
className={`e-cal-normal__year ${selectedYear === year ? ' selected' : ''}`}
|
|
843
|
+
key={year + index}
|
|
797
844
|
onClick={() => { handleYearChange(year) }}
|
|
798
845
|
>{year}</div>
|
|
799
846
|
})}
|
|
@@ -846,7 +893,7 @@ const EventCalendar = (props: EventCalendarProps) => {
|
|
|
846
893
|
</ModalDialog>
|
|
847
894
|
{/*<!-- /DELETE -->*/}
|
|
848
895
|
|
|
849
|
-
|
|
896
|
+
|
|
850
897
|
{/*<!-- EDIT -->*/}
|
|
851
898
|
<ModalDialog
|
|
852
899
|
show={showEdit}
|