pds-dev-kit-web-test 2.7.2 → 2.7.3
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/dist/src/desktop/components/Calendar/Calendar.d.ts +1 -1
- package/dist/src/desktop/components/Calendar/Calendar.js +71 -74
- package/dist/src/desktop/components/Calendar/{CurrentTimeIndicator.js → components/CurrentTimeIndicator/CurrentTimeIndicator.js} +10 -12
- package/dist/src/desktop/components/Calendar/components/CurrentTimeIndicator/index.d.ts +2 -0
- package/dist/src/desktop/components/Calendar/components/CurrentTimeIndicator/index.js +4 -0
- package/dist/src/desktop/components/Calendar/{AllDaySchedulesSection.d.ts → components/Schedule/AllDaySchedulesSection.d.ts} +3 -3
- package/dist/src/desktop/components/Calendar/{AllDaySchedulesSection.js → components/Schedule/AllDaySchedulesSection.js} +15 -9
- package/dist/src/desktop/components/Calendar/{MultiWeekSchedulesLayer.d.ts → components/Schedule/MultiWeekSchedulesLayer.d.ts} +1 -1
- package/dist/src/desktop/components/Calendar/{MultiWeekSchedulesLayer.js → components/Schedule/MultiWeekSchedulesLayer.js} +3 -3
- package/dist/src/desktop/components/Calendar/{ScheduleItem.d.ts → components/Schedule/ScheduleItem.d.ts} +1 -1
- package/dist/src/desktop/components/Calendar/{ScheduleItem.js → components/Schedule/ScheduleItem.js} +1 -1
- package/dist/src/desktop/components/Calendar/{TimeBasedScheduleItem.d.ts → components/Schedule/TimeBasedScheduleItem.d.ts} +1 -1
- package/dist/src/desktop/components/Calendar/{TimeBasedScheduleItem.js → components/Schedule/TimeBasedScheduleItem.js} +4 -5
- package/dist/src/desktop/components/Calendar/components/Schedule/index.d.ts +4 -0
- package/dist/src/desktop/components/Calendar/components/Schedule/index.js +11 -0
- package/dist/src/desktop/components/Calendar/constants.d.ts +1 -0
- package/dist/src/desktop/components/Calendar/constants.js +19 -1
- package/dist/src/desktop/components/Calendar/{CalendarContext.d.ts → context/CalendarContext.d.ts} +2 -2
- package/dist/src/desktop/components/Calendar/{CalendarContext.js → context/CalendarContext.js} +2 -16
- package/dist/src/desktop/components/Calendar/hooks/useTimeDragSelection.d.ts +16 -0
- package/dist/src/desktop/components/Calendar/hooks/useTimeDragSelection.js +81 -0
- package/dist/src/desktop/components/Calendar/index.d.ts +8 -13
- package/dist/src/desktop/components/Calendar/index.js +11 -22
- package/dist/src/desktop/components/Calendar/{types.d.ts → types/types.d.ts} +6 -1
- package/dist/src/desktop/components/Calendar/types/types.js +10 -0
- package/dist/src/desktop/components/Calendar/{calendarUtils.d.ts → utils/calendarUtils.d.ts} +1 -1
- package/dist/src/desktop/components/Calendar/{calendarUtils.js → utils/calendarUtils.js} +6 -5
- package/dist/src/desktop/components/Calendar/utils/index.d.ts +2 -0
- package/dist/src/desktop/components/Calendar/utils/index.js +18 -0
- package/dist/src/desktop/components/Calendar/{DailyView.d.ts → views/DailyView.d.ts} +1 -1
- package/dist/src/desktop/components/Calendar/{DailyView.js → views/DailyView.js} +26 -82
- package/dist/src/desktop/components/Calendar/{MonthlyView.d.ts → views/MonthlyView.d.ts} +1 -1
- package/dist/src/desktop/components/Calendar/{MonthlyView.js → views/MonthlyView.js} +22 -15
- package/dist/src/desktop/components/Calendar/{WeeklyView.d.ts → views/WeeklyView.d.ts} +1 -1
- package/dist/src/desktop/components/Calendar/{WeeklyView.js → views/WeeklyView.js} +25 -95
- package/dist/src/desktop/components/Calendar/{YearlyView.d.ts → views/YearlyView.d.ts} +1 -1
- package/dist/src/desktop/components/Calendar/{YearlyView.js → views/YearlyView.js} +3 -2
- package/dist/src/desktop/panels/LocalizedContentModal/LocalizedContentModal.js +3 -4
- package/package.json +1 -1
- package/release-note.md +3 -3
- package/dist/src/desktop/components/Calendar/types.js +0 -2
- /package/dist/src/desktop/components/Calendar/{CurrentTimeIndicator.d.ts → components/CurrentTimeIndicator/CurrentTimeIndicator.d.ts} +0 -0
- /package/dist/src/desktop/components/Calendar/{timeFormatUtils.d.ts → utils/timeFormatUtils.d.ts} +0 -0
- /package/dist/src/desktop/components/Calendar/{timeFormatUtils.js → utils/timeFormatUtils.js} +0 -0
package/dist/src/desktop/components/Calendar/{CalendarContext.js → context/CalendarContext.js}
RENAMED
@@ -14,8 +14,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.CalendarProvider = exports.useCalendarContext = void 0;
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
16
16
|
var react_1 = require("react");
|
17
|
-
var
|
18
|
-
var ScheduleItem_1 = require("./ScheduleItem");
|
17
|
+
var utils_1 = require("../utils");
|
19
18
|
var CalendarContext = (0, react_1.createContext)(null);
|
20
19
|
var useCalendarContext = function () {
|
21
20
|
var context = (0, react_1.useContext)(CalendarContext);
|
@@ -35,21 +34,7 @@ var CalendarProvider = function (_a) {
|
|
35
34
|
getSchedulesForDate = _a.getSchedulesForDate, isToday = _a.isToday, isPastDate = _a.isPastDate, getDayTextByDate = _a.getDayTextByDate,
|
36
35
|
// 상태값
|
37
36
|
isDragOverDate = _a.isDragOverDate, selectedDate = _a.selectedDate, displayAllDayScheduleMode = _a.displayAllDayScheduleMode;
|
38
|
-
var renderScheduleItem = (0, react_1.useCallback)(function (schedule, extraProps) {
|
39
|
-
if (extraProps === void 0) { extraProps = {}; }
|
40
|
-
var isAllDay = (0, calendarUtils_1.calculateIsAllDay)(new Date(schedule.startDate), new Date(schedule.endDate));
|
41
|
-
var isSelected = selectedSchedules.some(function (s) { return s.id === schedule.id; });
|
42
|
-
return ((0, jsx_runtime_1.jsx)(ScheduleItem_1.ScheduleItem, { schedule: schedule, extraProps: extraProps, onDragStart: handleScheduleDragStart, onDragEnd: handleScheduleDragEnd, onClick: handleScheduleClick, isSelected: isSelected, isAllDay: isAllDay, isDraggable: isDraggable }));
|
43
|
-
}, [
|
44
|
-
selectedSchedules,
|
45
|
-
isDraggable,
|
46
|
-
handleScheduleClick,
|
47
|
-
handleScheduleDragStart,
|
48
|
-
handleScheduleDragEnd
|
49
|
-
]);
|
50
37
|
var value = {
|
51
|
-
// 스케줄 렌더링 관련
|
52
|
-
renderScheduleItem: renderScheduleItem,
|
53
38
|
// 스케줄 이벤트 핸들러
|
54
39
|
handleScheduleClick: handleScheduleClick,
|
55
40
|
handleScheduleDragStart: handleScheduleDragStart,
|
@@ -65,6 +50,7 @@ var CalendarProvider = function (_a) {
|
|
65
50
|
isToday: isToday,
|
66
51
|
isPastDate: isPastDate,
|
67
52
|
getDayTextByDate: getDayTextByDate,
|
53
|
+
calculateIsAllDay: utils_1.calculateIsAllDay,
|
68
54
|
// 상태값
|
69
55
|
selectedSchedules: selectedSchedules,
|
70
56
|
isDragOverDate: isDragOverDate,
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import type { Action, Schedule } from '../types/types';
|
2
|
+
type TimeSlot = {
|
3
|
+
date: Date;
|
4
|
+
hour: number;
|
5
|
+
};
|
6
|
+
export declare function useTimeDragSelection({ enabled, schedules, onComplete }: {
|
7
|
+
enabled: boolean;
|
8
|
+
schedules: Schedule[];
|
9
|
+
onComplete: (action: Action) => void;
|
10
|
+
}): {
|
11
|
+
onMouseDown: (slot: TimeSlot, e: React.MouseEvent) => void;
|
12
|
+
onMouseEnter: (slot: TimeSlot) => void;
|
13
|
+
isSlotInRange: (slot: TimeSlot) => boolean;
|
14
|
+
dragging: boolean;
|
15
|
+
};
|
16
|
+
export {};
|
@@ -0,0 +1,81 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.useTimeDragSelection = void 0;
|
4
|
+
// src/desktop/components/Calendar/hooks/useTimeDragSelection.ts
|
5
|
+
var react_1 = require("react");
|
6
|
+
function useTimeDragSelection(_a) {
|
7
|
+
var enabled = _a.enabled, schedules = _a.schedules, onComplete = _a.onComplete;
|
8
|
+
var _b = (0, react_1.useState)(null), start = _b[0], setStart = _b[1];
|
9
|
+
var _c = (0, react_1.useState)(null), end = _c[0], setEnd = _c[1];
|
10
|
+
var _d = (0, react_1.useState)(false), dragging = _d[0], setDragging = _d[1];
|
11
|
+
var toStartOfSlot = function (slot) {
|
12
|
+
var d = new Date(slot.date);
|
13
|
+
d.setHours(slot.hour, 0, 0, 0);
|
14
|
+
return d;
|
15
|
+
};
|
16
|
+
var toEndOfSlot = function (slot) {
|
17
|
+
var d = new Date(slot.date);
|
18
|
+
d.setHours(slot.hour, 59, 59, 999);
|
19
|
+
return d;
|
20
|
+
};
|
21
|
+
var onMouseDown = (0, react_1.useCallback)(function (slot, e) {
|
22
|
+
if (!enabled)
|
23
|
+
return;
|
24
|
+
e.preventDefault();
|
25
|
+
setStart(slot);
|
26
|
+
setEnd(slot);
|
27
|
+
setDragging(true);
|
28
|
+
}, [enabled]);
|
29
|
+
var onMouseEnter = (0, react_1.useCallback)(function (slot) {
|
30
|
+
if (!dragging)
|
31
|
+
return;
|
32
|
+
setEnd(slot);
|
33
|
+
}, [dragging]);
|
34
|
+
var isSlotInRange = (0, react_1.useCallback)(function (slot) {
|
35
|
+
if (!start || !end)
|
36
|
+
return false;
|
37
|
+
var t = toStartOfSlot(slot).getTime();
|
38
|
+
var a = Math.min(toStartOfSlot(start).getTime(), toStartOfSlot(end).getTime());
|
39
|
+
var b = Math.max(toEndOfSlot(start).getTime(), toEndOfSlot(end).getTime());
|
40
|
+
return t >= a && t <= b;
|
41
|
+
}, [start, end]);
|
42
|
+
(0, react_1.useEffect)(function () {
|
43
|
+
if (!dragging)
|
44
|
+
return;
|
45
|
+
var handleMouseUp = function () {
|
46
|
+
if (dragging && start && end && enabled) {
|
47
|
+
var actualStart_1 = new Date(Math.min(toStartOfSlot(start).getTime(), toStartOfSlot(end).getTime()));
|
48
|
+
var actualEnd_1 = new Date(Math.max(toEndOfSlot(start).getTime(), toEndOfSlot(end).getTime()));
|
49
|
+
var schedulesInRange = schedules.filter(function (s) {
|
50
|
+
var s0 = new Date(s.startDate);
|
51
|
+
var s1 = new Date(s.endDate);
|
52
|
+
return s0 <= actualEnd_1 && s1 >= actualStart_1;
|
53
|
+
});
|
54
|
+
var selectedDates = [];
|
55
|
+
var cur = new Date(actualStart_1);
|
56
|
+
cur.setHours(0, 0, 0, 0);
|
57
|
+
var last = new Date(actualEnd_1);
|
58
|
+
last.setHours(0, 0, 0, 0);
|
59
|
+
while (cur <= last) {
|
60
|
+
selectedDates.push(new Date(cur));
|
61
|
+
cur.setDate(cur.getDate() + 1);
|
62
|
+
}
|
63
|
+
onComplete({
|
64
|
+
action: 'DRAG',
|
65
|
+
target: 'DATE',
|
66
|
+
dates: selectedDates,
|
67
|
+
schedules: schedulesInRange,
|
68
|
+
startDate: actualStart_1.toISOString(),
|
69
|
+
endDate: actualEnd_1.toISOString()
|
70
|
+
});
|
71
|
+
}
|
72
|
+
setDragging(false);
|
73
|
+
setStart(null);
|
74
|
+
setEnd(null);
|
75
|
+
};
|
76
|
+
document.addEventListener('mouseup', handleMouseUp);
|
77
|
+
return function () { return document.removeEventListener('mouseup', handleMouseUp); };
|
78
|
+
}, [dragging, start, end, enabled, schedules, onComplete]);
|
79
|
+
return { onMouseDown: onMouseDown, onMouseEnter: onMouseEnter, isSlotInRange: isSlotInRange, dragging: dragging };
|
80
|
+
}
|
81
|
+
exports.useTimeDragSelection = useTimeDragSelection;
|
@@ -1,14 +1,9 @@
|
|
1
|
-
export
|
1
|
+
export * from './types/types';
|
2
|
+
export * from './context/CalendarContext';
|
2
3
|
export { default as Calendar } from './Calendar';
|
3
|
-
export
|
4
|
-
export
|
5
|
-
export
|
6
|
-
export
|
7
|
-
export {
|
8
|
-
export
|
9
|
-
export { YearlyView } from './YearlyView';
|
10
|
-
export * from './timeFormatUtils';
|
11
|
-
export type { CalendarProps, Schedule, CalendarViewType, displayAllDayScheduleMode, StartOfWeek, TodayBtnMode, Config, CalendarAction } from './types';
|
12
|
-
export { getLocaleFromLang } from './constants';
|
13
|
-
export type { ScheduleItemExtraProps } from './ScheduleItem';
|
14
|
-
export type { ScheduleItemExtraProps as CalendarContextExtraProps } from './CalendarContext';
|
4
|
+
export * from './views/DailyView';
|
5
|
+
export * from './views/WeeklyView';
|
6
|
+
export * from './views/MonthlyView';
|
7
|
+
export * from './views/YearlyView';
|
8
|
+
export { default as CurrentTimeIndicator } from './components/CurrentTimeIndicator';
|
9
|
+
export * from './components/Schedule';
|
@@ -17,26 +17,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
18
18
|
};
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
20
|
-
exports.
|
21
|
-
|
22
|
-
|
23
|
-
var Calendar_1 = require("./Calendar");
|
20
|
+
exports.CurrentTimeIndicator = exports.Calendar = void 0;
|
21
|
+
__exportStar(require("./types/types"), exports);
|
22
|
+
__exportStar(require("./context/CalendarContext"), exports);
|
23
|
+
var Calendar_1 = require("./Calendar"); // 필요 시
|
24
24
|
Object.defineProperty(exports, "Calendar", { enumerable: true, get: function () { return __importDefault(Calendar_1).default; } });
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
var ScheduleItem_1 = require("./ScheduleItem");
|
33
|
-
Object.defineProperty(exports, "ScheduleItem", { enumerable: true, get: function () { return ScheduleItem_1.ScheduleItem; } });
|
34
|
-
var TimeBasedScheduleItem_1 = require("./TimeBasedScheduleItem");
|
35
|
-
Object.defineProperty(exports, "TimeBasedScheduleItem", { enumerable: true, get: function () { return TimeBasedScheduleItem_1.TimeBasedScheduleItem; } });
|
36
|
-
var WeeklyView_1 = require("./WeeklyView");
|
37
|
-
Object.defineProperty(exports, "WeeklyView", { enumerable: true, get: function () { return WeeklyView_1.WeeklyView; } });
|
38
|
-
var YearlyView_1 = require("./YearlyView");
|
39
|
-
Object.defineProperty(exports, "YearlyView", { enumerable: true, get: function () { return YearlyView_1.YearlyView; } });
|
40
|
-
__exportStar(require("./timeFormatUtils"), exports);
|
41
|
-
var constants_1 = require("./constants");
|
42
|
-
Object.defineProperty(exports, "getLocaleFromLang", { enumerable: true, get: function () { return constants_1.getLocaleFromLang; } });
|
25
|
+
__exportStar(require("./views/DailyView"), exports);
|
26
|
+
__exportStar(require("./views/WeeklyView"), exports);
|
27
|
+
__exportStar(require("./views/MonthlyView"), exports);
|
28
|
+
__exportStar(require("./views/YearlyView"), exports);
|
29
|
+
var CurrentTimeIndicator_1 = require("./components/CurrentTimeIndicator");
|
30
|
+
Object.defineProperty(exports, "CurrentTimeIndicator", { enumerable: true, get: function () { return __importDefault(CurrentTimeIndicator_1).default; } });
|
31
|
+
__exportStar(require("./components/Schedule"), exports);
|
@@ -1,5 +1,10 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
export
|
2
|
+
export declare enum CalendarViewType {
|
3
|
+
MONTH = "month",
|
4
|
+
WEEK = "week",
|
5
|
+
DAY = "day",
|
6
|
+
YEAR = "year"
|
7
|
+
}
|
3
8
|
export type displayAllDayScheduleMode = 'none' | 'use';
|
4
9
|
export type StartOfWeek = 'sunday' | 'monday';
|
5
10
|
export type TodayBtnMode = 'none' | 'use';
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.CalendarViewType = void 0;
|
4
|
+
var CalendarViewType;
|
5
|
+
(function (CalendarViewType) {
|
6
|
+
CalendarViewType["MONTH"] = "month";
|
7
|
+
CalendarViewType["WEEK"] = "week";
|
8
|
+
CalendarViewType["DAY"] = "day";
|
9
|
+
CalendarViewType["YEAR"] = "year";
|
10
|
+
})(CalendarViewType = exports.CalendarViewType || (exports.CalendarViewType = {}));
|
@@ -1,7 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.toUTC = exports.calculateDateRange = exports.calculateIsAllDay = void 0;
|
4
|
-
var dateHelper_1 = require("
|
4
|
+
var dateHelper_1 = require("../../../../common/utils/dateHelper");
|
5
|
+
var types_1 = require("../types/types");
|
5
6
|
/**
|
6
7
|
* 일정이 종일 일정인지 확인하는 함수
|
7
8
|
* @param startDate 시작 날짜
|
@@ -22,16 +23,16 @@ var calculateIsAllDay = function (startDate, endDate) {
|
|
22
23
|
exports.calculateIsAllDay = calculateIsAllDay;
|
23
24
|
var calculateDateRange = function (viewType, baseDate) {
|
24
25
|
switch (viewType) {
|
25
|
-
case
|
26
|
+
case types_1.CalendarViewType.DAY:
|
26
27
|
return { startDate: baseDate, endDate: baseDate };
|
27
|
-
case
|
28
|
+
case types_1.CalendarViewType.WEEK: {
|
28
29
|
var start = new Date(baseDate);
|
29
30
|
start.setDate(baseDate.getDate() - baseDate.getDay());
|
30
31
|
var end = new Date(start);
|
31
32
|
end.setDate(start.getDate() + 6);
|
32
33
|
return { startDate: start, endDate: end };
|
33
34
|
}
|
34
|
-
case
|
35
|
+
case types_1.CalendarViewType.MONTH: {
|
35
36
|
var startDate = new Date(baseDate.getFullYear(), baseDate.getMonth(), 1);
|
36
37
|
// 실제 MonthlyView에서 보여지는 날짜 배열을 구함
|
37
38
|
var days = dateHelper_1.DateHelper.getCalendarDatesForCalendar(startDate, 'sunday');
|
@@ -40,7 +41,7 @@ var calculateDateRange = function (viewType, baseDate) {
|
|
40
41
|
endDate: days[days.length - 1]
|
41
42
|
};
|
42
43
|
}
|
43
|
-
case
|
44
|
+
case types_1.CalendarViewType.YEAR:
|
44
45
|
return {
|
45
46
|
startDate: new Date(baseDate.getFullYear(), 0, 1),
|
46
47
|
endDate: new Date(baseDate.getFullYear(), 11, 31)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./timeFormatUtils"), exports);
|
18
|
+
__exportStar(require("./calendarUtils"), exports);
|
@@ -37,26 +37,26 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
37
37
|
__setModuleDefault(result, mod);
|
38
38
|
return result;
|
39
39
|
};
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
42
|
+
};
|
40
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
41
44
|
exports.DailyView = void 0;
|
42
45
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
43
46
|
var react_1 = require("react");
|
44
47
|
var react_i18next_1 = require("react-i18next");
|
45
48
|
var styled_components_1 = __importStar(require("styled-components"));
|
46
|
-
var TextLabel_1 = require("
|
47
|
-
var
|
48
|
-
var
|
49
|
-
var
|
50
|
-
var
|
51
|
-
var timeFormatUtils_1 = require("
|
49
|
+
var TextLabel_1 = require("../../TextLabel");
|
50
|
+
var CurrentTimeIndicator_1 = __importDefault(require("../components/CurrentTimeIndicator"));
|
51
|
+
var Schedule_1 = require("../components/Schedule");
|
52
|
+
var CalendarContext_1 = require("../context/CalendarContext");
|
53
|
+
var useTimeDragSelection_1 = require("../hooks/useTimeDragSelection");
|
54
|
+
var timeFormatUtils_1 = require("../utils/timeFormatUtils");
|
52
55
|
var DailyView = function (_a) {
|
56
|
+
var _b, _c;
|
53
57
|
var schedules = _a.schedules, config = _a.config;
|
54
58
|
var i18n = (0, react_i18next_1.useTranslation)('translation').i18n;
|
55
|
-
var
|
56
|
-
// 시간 드래그 상태
|
57
|
-
var _c = (0, react_1.useState)(null), timeSelectionStart = _c[0], setTimeSelectionStart = _c[1];
|
58
|
-
var _d = (0, react_1.useState)(null), timeSelectionEnd = _d[0], setTimeSelectionEnd = _d[1];
|
59
|
-
var _e = (0, react_1.useState)(false), isTimeDragging = _e[0], setIsTimeDragging = _e[1];
|
59
|
+
var _d = (0, CalendarContext_1.useCalendarContext)(), selectedDate = _d.selectedDate, selectedSchedules = _d.selectedSchedules, displayAllDayScheduleMode = _d.displayAllDayScheduleMode, getSchedulesForDate = _d.getSchedulesForDate, isDragOverDate = _d.isDragOverDate, handleDateDragOver = _d.handleDateDragOver, handleDateDragLeave = _d.handleDateDragLeave, handleDateDrop = _d.handleDateDrop, handleDateClick = _d.handleDateClick, handleDateDrag = _d.handleDateDrag, handleScheduleDragStart = _d.handleScheduleDragStart, handleScheduleDragEnd = _d.handleScheduleDragEnd, handleScheduleClick = _d.handleScheduleClick;
|
60
60
|
var currentDateForDaily = [selectedDate][0];
|
61
61
|
var HOURS_IN_DAY = Array.from({ length: 24 }, function (_, i) { return i; });
|
62
62
|
var getTimeSlotDate = function (baseDate, hour) {
|
@@ -64,79 +64,23 @@ var DailyView = function (_a) {
|
|
64
64
|
date.setHours(hour, 0, 0, 0);
|
65
65
|
return date;
|
66
66
|
};
|
67
|
-
//
|
68
|
-
var
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
if (!isTimeDragging)
|
80
|
-
return;
|
81
|
-
setTimeSelectionEnd(hour);
|
82
|
-
}, [isTimeDragging]);
|
83
|
-
// 드래그 종료 시 콜백 호출
|
84
|
-
(0, react_1.useEffect)(function () {
|
85
|
-
var handleMouseUp = function () {
|
86
|
-
var _a;
|
87
|
-
if (isTimeDragging &&
|
88
|
-
timeSelectionStart !== null &&
|
89
|
-
timeSelectionEnd !== null &&
|
90
|
-
((_a = config === null || config === void 0 ? void 0 : config.DATE) === null || _a === void 0 ? void 0 : _a.DRAG)) {
|
91
|
-
// 선택된 시간 범위 계산
|
92
|
-
var startHour = Math.min(timeSelectionStart, timeSelectionEnd);
|
93
|
-
var endHour = Math.max(timeSelectionStart, timeSelectionEnd);
|
94
|
-
var startDateTime_1 = new Date(selectedDate);
|
95
|
-
startDateTime_1.setHours(startHour, 0, 0, 0);
|
96
|
-
var endDateTime_1 = new Date(selectedDate);
|
97
|
-
endDateTime_1.setHours(endHour, 59, 59, 999);
|
98
|
-
// 선택된 시간 범위에 포함되는 스케줄들 찾기
|
99
|
-
var schedulesInRange_1 = [];
|
100
|
-
schedules.forEach(function (schedule) {
|
101
|
-
var scheduleStart = new Date(schedule.startDate);
|
102
|
-
var scheduleEnd = new Date(schedule.endDate);
|
103
|
-
// 스케줄이 선택된 시간 범위와 겹치는지 확인
|
104
|
-
if (scheduleStart <= endDateTime_1 && scheduleEnd >= startDateTime_1) {
|
105
|
-
schedulesInRange_1.push(schedule);
|
106
|
-
}
|
107
|
-
});
|
108
|
-
// 선택된 날짜 (현재 날짜만)
|
109
|
-
var selectedDates = [new Date(selectedDate)];
|
110
|
-
handleDateDrag({
|
111
|
-
action: 'DRAG',
|
112
|
-
target: 'DATE',
|
113
|
-
dates: selectedDates,
|
114
|
-
schedules: schedulesInRange_1,
|
115
|
-
startDate: startDateTime_1.toISOString(),
|
116
|
-
endDate: endDateTime_1.toISOString()
|
117
|
-
});
|
118
|
-
}
|
119
|
-
setIsTimeDragging(false);
|
120
|
-
setTimeSelectionStart(null);
|
121
|
-
setTimeSelectionEnd(null);
|
122
|
-
};
|
123
|
-
if (isTimeDragging) {
|
124
|
-
document.addEventListener('mouseup', handleMouseUp);
|
125
|
-
return function () { return document.removeEventListener('mouseup', handleMouseUp); };
|
126
|
-
}
|
127
|
-
}, [isTimeDragging, timeSelectionStart, timeSelectionEnd, config, schedules, selectedDate]);
|
128
|
-
// 선택한 시간이 드래그 범위에 포함되는지 확인
|
129
|
-
var isTimeSlotInDragRange = (0, react_1.useCallback)(function (hour) {
|
130
|
-
if (timeSelectionStart === null || timeSelectionEnd === null)
|
131
|
-
return false;
|
132
|
-
var startHour = Math.min(timeSelectionStart, timeSelectionEnd);
|
133
|
-
var endHour = Math.max(timeSelectionStart, timeSelectionEnd);
|
134
|
-
return hour >= startHour && hour <= endHour;
|
135
|
-
}, [timeSelectionStart, timeSelectionEnd]);
|
136
|
-
return ((0, jsx_runtime_1.jsxs)(S_DailyContainer, { children: [(0, jsx_runtime_1.jsx)(AllDaySchedulesSection_1.AllDaySchedulesSection, { calendarDates: [selectedDate], displayAllDayScheduleMode: displayAllDayScheduleMode, getSchedulesForDate: getSchedulesForDate, handleDateDragOver: handleDateDragOver, handleDateDragLeave: handleDateDragLeave, handleDateDrop: handleDateDrop }), (0, jsx_runtime_1.jsxs)(S_DailyTimeGrid, __assign({ "$displayAllDayScheduleMode": displayAllDayScheduleMode }, { children: [(0, jsx_runtime_1.jsx)(CurrentTimeIndicator_1.CurrentTimeIndicator, { show: true, leftOffset: "80px" }), HOURS_IN_DAY.map(function (hour) {
|
67
|
+
// useTimeDragSelection hook 사용
|
68
|
+
var _e = (0, useTimeDragSelection_1.useTimeDragSelection)({
|
69
|
+
enabled: (_c = (_b = config === null || config === void 0 ? void 0 : config.DATE) === null || _b === void 0 ? void 0 : _b.DRAG) !== null && _c !== void 0 ? _c : false,
|
70
|
+
schedules: schedules,
|
71
|
+
onComplete: handleDateDrag
|
72
|
+
}), onMouseDown = _e.onMouseDown, onMouseEnter = _e.onMouseEnter, isSlotInRange = _e.isSlotInRange, dragging = _e.dragging;
|
73
|
+
// 시간 슬롯을 위한 헬퍼 함수
|
74
|
+
var createTimeSlot = (0, react_1.useCallback)(function (hour) { return ({
|
75
|
+
date: new Date(selectedDate),
|
76
|
+
hour: hour
|
77
|
+
}); }, [selectedDate]);
|
78
|
+
return ((0, jsx_runtime_1.jsxs)(S_DailyContainer, { children: [(0, jsx_runtime_1.jsx)(Schedule_1.AllDaySchedulesSection, { calendarDates: [selectedDate], displayAllDayScheduleMode: displayAllDayScheduleMode, getSchedulesForDate: getSchedulesForDate, handleDateDragOver: handleDateDragOver, handleDateDragLeave: handleDateDragLeave, handleDateDrop: handleDateDrop }), (0, jsx_runtime_1.jsxs)(S_DailyTimeGrid, __assign({ "$displayAllDayScheduleMode": displayAllDayScheduleMode }, { children: [(0, jsx_runtime_1.jsx)(CurrentTimeIndicator_1.default, { show: true, leftOffset: "80px" }), HOURS_IN_DAY.map(function (hour) {
|
137
79
|
var timeSlotDate = getTimeSlotDate(currentDateForDaily, hour);
|
80
|
+
var timeSlot = createTimeSlot(hour);
|
138
81
|
var isDragOver = (isDragOverDate === null || isDragOverDate === void 0 ? void 0 : isDragOverDate.getTime()) === timeSlotDate.getTime();
|
139
|
-
|
82
|
+
var isInDragRange = isSlotInRange(timeSlot);
|
83
|
+
return ((0, jsx_runtime_1.jsxs)(S_DailyTimeRow, { children: [(0, jsx_runtime_1.jsx)(S_DailyTimeLabel, { children: (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { styleTheme: "caption2Bold", text: (0, timeFormatUtils_1.formatHour)(hour, 0, i18n.language), colorTheme: "sysTextTertiary" }) }), (0, jsx_runtime_1.jsx)(S_DailyTimeSlot, __assign({ "$isDragOver": isDragOver, "$isInTimeDragRange": isInDragRange, "$isTimeDragging": dragging, onClick: function () { return handleDateClick(timeSlotDate, {}); }, onDragOver: function (e) { return handleDateDragOver(timeSlotDate, e); }, onDragLeave: handleDateDragLeave, onDrop: function (e) { return handleDateDrop(timeSlotDate, e); }, onMouseDown: function (e) { return onMouseDown(timeSlot, e); }, onMouseEnter: function () { return onMouseEnter(timeSlot); } }, { children: hour === 0 && ((0, jsx_runtime_1.jsx)(Schedule_1.TimeBasedScheduleItem, { schedules: getSchedulesForDate(currentDateForDaily), selectedSchedules: selectedSchedules, onClick: handleScheduleClick, handleScheduleDragStart: handleScheduleDragStart, handleScheduleDragEnd: handleScheduleDragEnd })) }))] }, hour));
|
140
84
|
})] }))] }));
|
141
85
|
};
|
142
86
|
exports.DailyView = DailyView;
|
@@ -31,19 +31,18 @@ exports.MonthlyView = void 0;
|
|
31
31
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
32
32
|
var react_1 = require("react");
|
33
33
|
var react_i18next_1 = require("react-i18next");
|
34
|
-
var useResizeObserver_1 = require("
|
35
|
-
var useWindowSize_1 = require("
|
36
|
-
var dateHelper_1 = require("
|
37
|
-
var components_1 = require("
|
34
|
+
var useResizeObserver_1 = require("../../../../common/hooks/useResizeObserver");
|
35
|
+
var useWindowSize_1 = require("../../../../common/hooks/useWindowSize");
|
36
|
+
var dateHelper_1 = require("../../../../common/utils/dateHelper");
|
37
|
+
var components_1 = require("../../../../hybrid/components");
|
38
38
|
var styled_components_1 = __importDefault(require("styled-components"));
|
39
|
-
var TextLabel_1 = require("
|
40
|
-
var
|
41
|
-
var
|
42
|
-
var MultiWeekSchedulesLayer_1 = require("./MultiWeekSchedulesLayer");
|
39
|
+
var TextLabel_1 = require("../../TextLabel");
|
40
|
+
var Schedule_1 = require("../components/Schedule");
|
41
|
+
var CalendarContext_1 = require("../context/CalendarContext");
|
43
42
|
var MonthlyView = function (_a) {
|
44
43
|
var getDayTextByDate = _a.getDayTextByDate, startOfWeek = _a.startOfWeek, selectedDate = _a.selectedDate, selectedDates = _a.selectedDates, selectedSchedules = _a.selectedSchedules, dragStartDate = _a.dragStartDate, dragEndDate = _a.dragEndDate, isDragOverDate = _a.isDragOverDate, schedules = _a.schedules, getSchedulesForDate = _a.getSchedulesForDate, isToday = _a.isToday, isPastDate = _a.isPastDate, handleDateClick = _a.handleDateClick, handleScheduleClick = _a.handleScheduleClick, handleMouseUp = _a.handleMouseUp, handleDateDragOver = _a.handleDateDragOver, handleDateDragLeave = _a.handleDateDragLeave, handleDateDrop = _a.handleDateDrop, handleScheduleDragStart = _a.handleScheduleDragStart, handleScheduleDragEnd = _a.handleScheduleDragEnd, _b = _a.isDraggable, isDraggable = _b === void 0 ? false : _b, onSwitchToWeeklyView = _a.onSwitchToWeeklyView, config = _a.config;
|
45
44
|
var t = (0, react_i18next_1.useTranslation)('translation').t;
|
46
|
-
var _c = (0, CalendarContext_1.useCalendarContext)(),
|
45
|
+
var _c = (0, CalendarContext_1.useCalendarContext)(), handleDateDrag = _c.handleDateDrag, calculateIsAllDay = _c.calculateIsAllDay;
|
47
46
|
var height = (0, useWindowSize_1.useWindowSize)().height;
|
48
47
|
var calendarCellRef = (0, react_1.useRef)(null);
|
49
48
|
var _d = (0, react_1.useState)(3), maxSchedulesPerDay = _d[0], setMaxSchedulesPerDay = _d[1];
|
@@ -163,7 +162,7 @@ var MonthlyView = function (_a) {
|
|
163
162
|
scheduleStart.setHours(0, 0, 0, 0);
|
164
163
|
scheduleEnd.setHours(0, 0, 0, 0);
|
165
164
|
// All day 이벤트이거나 다중 날짜 이벤트인지 확인
|
166
|
-
var isAllDay =
|
165
|
+
var isAllDay = calculateIsAllDay(new Date(schedule.startDate), new Date(schedule.endDate));
|
167
166
|
var isMultiDay = scheduleStart.getTime() !== scheduleEnd.getTime();
|
168
167
|
if (isAllDay || isMultiDay) {
|
169
168
|
// 이벤트가 현재 캘린더 범위와 교차하는지 확인
|
@@ -432,16 +431,24 @@ var MonthlyView = function (_a) {
|
|
432
431
|
'endDate' in schedule)) {
|
433
432
|
return null;
|
434
433
|
}
|
435
|
-
return ((0, jsx_runtime_1.jsx)(S_VisibleRowContainer, __assign({ "$top": rowIndex * scheduleItemHeight }, { children:
|
436
|
-
|
437
|
-
|
438
|
-
|
434
|
+
return ((0, jsx_runtime_1.jsx)(S_VisibleRowContainer, __assign({ "$top": rowIndex * scheduleItemHeight }, { children: (0, jsx_runtime_1.jsx)(Schedule_1.ScheduleItem, { schedule: schedule, extraProps: {
|
435
|
+
onDragStart: function (e) {
|
436
|
+
return handleScheduleDragStart === null || handleScheduleDragStart === void 0 ? void 0 : handleScheduleDragStart(schedule, e);
|
437
|
+
},
|
438
|
+
onDragEnd: function () { return handleScheduleDragEnd === null || handleScheduleDragEnd === void 0 ? void 0 : handleScheduleDragEnd(); }
|
439
|
+
}, onDragStart: handleScheduleDragStart ||
|
440
|
+
(function () {
|
441
|
+
/* no-op */
|
442
|
+
}), onDragEnd: handleScheduleDragEnd ||
|
443
|
+
(function () {
|
444
|
+
/* no-op */
|
445
|
+
}), onClick: handleScheduleClick, isSelected: selectedSchedules.some(function (s) { return s.id === schedule.id; }), isAllDay: calculateIsAllDay(new Date(schedule.startDate), new Date(schedule.endDate)), isDraggable: isDraggable }) }), schedule.id));
|
439
446
|
});
|
440
447
|
}), hiddenSchedulesCount > 0 && ((0, jsx_runtime_1.jsxs)(S_MoreSchedulesButton, __assign({ "$top": maxRows * scheduleItemHeight + 6, onClick: function (e) {
|
441
448
|
e.stopPropagation();
|
442
449
|
onSwitchToWeeklyView === null || onSwitchToWeeklyView === void 0 ? void 0 : onSwitchToWeeklyView(date);
|
443
450
|
} }, { children: [(0, jsx_runtime_1.jsx)(components_1.Spacing, { size: "spacing_b", spacingType: "width" }), (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: t('str_calendar_schedule_more', { count: hiddenSchedulesCount }), styleTheme: "caption2Regular", colorTheme: "sysTextSecondary" }), (0, jsx_runtime_1.jsx)(components_1.Spacing, { size: "spacing_b", spacingType: "width" })] })))] }))] }), index));
|
444
|
-
}), (0, jsx_runtime_1.jsx)(
|
451
|
+
}), (0, jsx_runtime_1.jsx)(Schedule_1.MultiWeekSchedulesLayer, { multiWeekSchedules: getMultiWeekSchedules, selectedSchedules: selectedSchedules, handleScheduleClick: handleScheduleClick, handleScheduleDragStart: handleScheduleDragStart, handleScheduleDragEnd: handleScheduleDragEnd, isDraggable: isDraggable, maxSchedulesPerDay: maxSchedulesPerDay })] })));
|
445
452
|
};
|
446
453
|
exports.MonthlyView = MonthlyView;
|
447
454
|
var S_MonthlyGrid = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: grid;\n gap: 0;\n grid-template-columns: repeat(7, 1fr);\n grid-template-rows: auto repeat(6, 1fr); /* \uD5E4\uB354\uB294 auto, \uB098\uBA38\uC9C0 6\uC8FC\uB294 \uB3D9\uC77C\uD55C \uB192\uC774 */\n height: 100%; /* \uC140 \uAC04\uACA9\uC744 \uC81C\uAC70\uD558\uC5EC \uC774\uBCA4\uD2B8\uAC00 \uC5F0\uACB0\uB418\uC5B4 \uBCF4\uC774\uB3C4\uB85D */\n overflow-x: hidden; /* \uADF8\uB9AC\uB4DC \uACBD\uACC4\uB97C \uB118\uB294 \uC694\uC18C\uB97C \uC228\uAE40 */\n position: relative;\n"], ["\n display: grid;\n gap: 0;\n grid-template-columns: repeat(7, 1fr);\n grid-template-rows: auto repeat(6, 1fr); /* \uD5E4\uB354\uB294 auto, \uB098\uBA38\uC9C0 6\uC8FC\uB294 \uB3D9\uC77C\uD55C \uB192\uC774 */\n height: 100%; /* \uC140 \uAC04\uACA9\uC744 \uC81C\uAC70\uD558\uC5EC \uC774\uBCA4\uD2B8\uAC00 \uC5F0\uACB0\uB418\uC5B4 \uBCF4\uC774\uB3C4\uB85D */\n overflow-x: hidden; /* \uADF8\uB9AC\uB4DC \uACBD\uACC4\uB97C \uB118\uB294 \uC694\uC18C\uB97C \uC228\uAE40 */\n position: relative;\n"])));
|