pds-dev-kit-web 2.2.211 → 2.2.212
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/common/services/i18n/resources/en.json +14 -14
- package/dist/src/common/styles/scroll/scrollbarStyle.d.ts +2 -0
- package/dist/src/common/styles/scroll/scrollbarStyle.js +4 -3
- package/dist/src/desktop/components/Calendar/Calendar.js +46 -51
- package/dist/src/desktop/components/Calendar/CalendarContext.d.ts +3 -1
- package/dist/src/desktop/components/Calendar/CalendarContext.js +2 -1
- package/dist/src/desktop/components/Calendar/DailyView.d.ts +8 -2
- package/dist/src/desktop/components/Calendar/DailyView.js +88 -7
- package/dist/src/desktop/components/Calendar/MonthlyView.d.ts +2 -1
- package/dist/src/desktop/components/Calendar/MonthlyView.js +81 -6
- package/dist/src/desktop/components/Calendar/WeeklyView.d.ts +3 -0
- package/dist/src/desktop/components/Calendar/WeeklyView.js +113 -7
- package/dist/src/desktop/components/Calendar/calendarUtils.js +20 -10
- package/dist/src/desktop/components/Calendar/types.d.ts +8 -4
- package/dist/src/desktop/panels/DesktopBasicModal/DesktopBasicModal.d.ts +2 -1
- package/dist/src/desktop/panels/DesktopBasicModal/DesktopBasicModal.js +13 -15
- package/dist/src/desktop/panels/DesktopBasicModalWithTab/DesktopBasicModalWithTab.d.ts +3 -1
- package/dist/src/desktop/panels/DesktopBasicModalWithTab/DesktopBasicModalWithTab.js +16 -10
- package/dist/src/desktop/panels/DesktopHeadlessModal/DesktopHeadlessModal.d.ts +2 -1
- package/dist/src/desktop/panels/DesktopHeadlessModal/DesktopHeadlessModal.js +7 -27
- package/dist/src/desktop/panels/DesktopTutorialModal/DesktopTutorialModal.d.ts +3 -1
- package/dist/src/desktop/panels/DesktopTutorialModal/DesktopTutorialModal.js +11 -5
- package/dist/src/desktop/panels/MultilingualModal/MultilingualModal.d.ts +3 -1
- package/dist/src/desktop/panels/MultilingualModal/MultilingualModal.js +11 -4
- package/dist/src/mobile/panels/MobileBasicModal/MobileBasicModal.d.ts +3 -1
- package/dist/src/mobile/panels/MobileBasicModal/MobileBasicModal.js +13 -6
- package/package.json +1 -1
- package/release-note.md +3 -2
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
"str_calendar_all_day": "All day",
|
|
38
38
|
"str_calendar_schedule_more": "{{count}} more",
|
|
39
39
|
"str_calendar_today": "Today",
|
|
40
|
-
"calendar_month_1": "
|
|
41
|
-
"calendar_month_2": "
|
|
42
|
-
"calendar_month_3": "
|
|
43
|
-
"calendar_month_4": "
|
|
40
|
+
"calendar_month_1": "January",
|
|
41
|
+
"calendar_month_2": "February",
|
|
42
|
+
"calendar_month_3": "March",
|
|
43
|
+
"calendar_month_4": "April",
|
|
44
44
|
"calendar_month_5": "May",
|
|
45
|
-
"calendar_month_6": "
|
|
46
|
-
"calendar_month_7": "
|
|
47
|
-
"calendar_month_8": "
|
|
48
|
-
"calendar_month_9": "
|
|
49
|
-
"calendar_month_10": "
|
|
50
|
-
"calendar_month_11": "
|
|
51
|
-
"calendar_month_12": "
|
|
45
|
+
"calendar_month_6": "June",
|
|
46
|
+
"calendar_month_7": "July",
|
|
47
|
+
"calendar_month_8": "August",
|
|
48
|
+
"calendar_month_9": "September",
|
|
49
|
+
"calendar_month_10": "October",
|
|
50
|
+
"calendar_month_11": "November",
|
|
51
|
+
"calendar_month_12": "December",
|
|
52
52
|
"str_fm_datetime_am": "{{hour}} AM",
|
|
53
53
|
"str_fm_datetime_pm": "{{hour}} PM",
|
|
54
54
|
"str_fm_am": "AM",
|
|
@@ -60,14 +60,14 @@
|
|
|
60
60
|
"calendar_header_weekly_same_month": "{{month}} {{startDay}} - {{endDay}}",
|
|
61
61
|
"calendar_header_weekly_diff_month": "{{startMonth}} {{startDay}} - {{endMonth}} {{endDay}}",
|
|
62
62
|
"str_calendar_yearly_header": "{{year}}",
|
|
63
|
-
"str_calendar_monthly_header": "{{month}}
|
|
64
|
-
"str_calendar_weekly_header": "{{month}}
|
|
63
|
+
"str_calendar_monthly_header": "{{month}} {{year}}",
|
|
64
|
+
"str_calendar_weekly_header": "{{month}} {{year}}",
|
|
65
65
|
"calendar_view_monthly": "Monthly",
|
|
66
66
|
"calendar_view_weekly": "Weekly",
|
|
67
67
|
"calendar_view_daily": "Daily",
|
|
68
68
|
"calendar_view_yearly": "Yearly",
|
|
69
69
|
"calendar_date_format": "{{day}} ({{dayText}})",
|
|
70
|
-
"str_calendar_weekly_date": "{{month}}
|
|
70
|
+
"str_calendar_weekly_date": "{{month}} {{date}} ({{day}})",
|
|
71
71
|
"str_fm_year": "Year",
|
|
72
72
|
"str_fm_month": "Month",
|
|
73
73
|
"str_fm_day": "Day",
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export declare const scrollbarStyle: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
2
2
|
export declare const scrollbarWithPaddingStyle: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
3
|
+
export declare const scrollInvisible: import("styled-components").FlattenSimpleInterpolation;
|
|
4
|
+
export type ScrollVisibleType = 'hidden' | 'visible';
|
|
@@ -4,11 +4,12 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
4
4
|
return cooked;
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.scrollbarWithPaddingStyle = exports.scrollbarStyle = void 0;
|
|
7
|
+
exports.scrollInvisible = exports.scrollbarWithPaddingStyle = exports.scrollbarStyle = void 0;
|
|
8
8
|
var styled_components_1 = require("styled-components");
|
|
9
|
-
exports.scrollbarStyle = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n background-clip: padding-box;\n border-radius: 5px;\n border: 2px solid transparent;\n }\n\n ::-webkit-scrollbar {\n display: block;\n width: 10px;\n }\n"], ["\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n background-clip: padding-box;\n border-radius: 5px;\n border: 2px solid transparent;\n }\n\n ::-webkit-scrollbar {\n display: block;\n width: 10px;\n }\n"])), function (_a) {
|
|
9
|
+
exports.scrollbarStyle = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n background-clip: padding-box;\n border-radius: 5px;\n border: 2px solid transparent;\n }\n\n ::-webkit-scrollbar {\n display: block;\n width: 10px;\n }\n\n scrollbar-width: auto;\n"], ["\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n background-clip: padding-box;\n border-radius: 5px;\n border: 2px solid transparent;\n }\n\n ::-webkit-scrollbar {\n display: block;\n width: 10px;\n }\n\n scrollbar-width: auto;\n"])), function (_a) {
|
|
10
10
|
var theme = _a.theme;
|
|
11
11
|
return theme.ui_container_scroll;
|
|
12
12
|
});
|
|
13
13
|
exports.scrollbarWithPaddingStyle = (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n\n ::-webkit-scrollbar-track {\n margin-bottom: 24px;\n margin-top: 24px;\n }\n"], ["\n ", "\n\n ::-webkit-scrollbar-track {\n margin-bottom: 24px;\n margin-top: 24px;\n }\n"])), exports.scrollbarStyle);
|
|
14
|
-
|
|
14
|
+
exports.scrollInvisible = (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ::-webkit-scrollbar {\n background: transparent;\n display: block;\n width: 10px;\n }\n scrollbar-width: auto;\n"], ["\n ::-webkit-scrollbar {\n background: transparent;\n display: block;\n width: 10px;\n }\n scrollbar-width: auto;\n"])));
|
|
15
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -44,27 +44,9 @@ var WeeklyView_1 = require("./WeeklyView");
|
|
|
44
44
|
var YearlyView_1 = require("./YearlyView");
|
|
45
45
|
var Calendar = function (_a) {
|
|
46
46
|
var _b;
|
|
47
|
-
var _c = _a.defaultViewType, defaultViewType = _c === void 0 ? '
|
|
48
|
-
// 다국어 키를 CalendarViewType으로 매핑하는 함수
|
|
49
|
-
var mapI18nKeyToViewType = function (key) {
|
|
50
|
-
switch (key) {
|
|
51
|
-
case 'str_fm_month':
|
|
52
|
-
return 'MONTHLY';
|
|
53
|
-
case 'str_fm_week':
|
|
54
|
-
return 'WEEKLY';
|
|
55
|
-
case 'str_fm_day':
|
|
56
|
-
return 'DAILY';
|
|
57
|
-
case 'str_fm_year':
|
|
58
|
-
return 'YEARLY';
|
|
59
|
-
default:
|
|
60
|
-
return key;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
// 다국어 키를 받아서 내부적으로 매핑
|
|
64
|
-
var actualDefaultViewType = mapI18nKeyToViewType(defaultViewType);
|
|
65
|
-
var actualViewTypes = viewTypes.map(mapI18nKeyToViewType);
|
|
47
|
+
var _c = _a.defaultViewType, defaultViewType = _c === void 0 ? 'str_fm_month' : _c, _d = _a.viewTypes, viewTypes = _d === void 0 ? ['str_fm_month', 'str_fm_week', 'str_fm_day', 'str_fm_year'] : _d, _e = _a.displayAllDayScheduleMode, displayAllDayScheduleMode = _e === void 0 ? 'none' : _e, _f = _a.startOfWeek, startOfWeek = _f === void 0 ? 'sunday' : _f, _g = _a.todayBtnMode, todayBtnMode = _g === void 0 ? 'use' : _g, _h = _a.schedules, schedules = _h === void 0 ? [] : _h, config = _a.config, onActionDispatch = _a.onActionDispatch;
|
|
66
48
|
var t = (0, react_i18next_1.useTranslation)().t;
|
|
67
|
-
var _j = (0, react_1.useState)(
|
|
49
|
+
var _j = (0, react_1.useState)(defaultViewType), currentViewType = _j[0], setCurrentViewType = _j[1];
|
|
68
50
|
var _k = (0, react_1.useState)(new Date()), selectedDate = _k[0], setSelectedDate = _k[1];
|
|
69
51
|
var _l = (0, react_1.useState)(null), dragStartDate = _l[0], setDragStartDate = _l[1];
|
|
70
52
|
var _m = (0, react_1.useState)(null), dragEndDate = _m[0], setDragEndDate = _m[1];
|
|
@@ -115,13 +97,13 @@ var Calendar = function (_a) {
|
|
|
115
97
|
var increment = direction === 'next' ? 1 : -1;
|
|
116
98
|
var getNewDateByViewType = function (viewType) {
|
|
117
99
|
switch (viewType) {
|
|
118
|
-
case '
|
|
100
|
+
case 'str_fm_day':
|
|
119
101
|
return dateHelper_1.DateHelper.addDays(selectedDate, increment);
|
|
120
|
-
case '
|
|
102
|
+
case 'str_fm_week':
|
|
121
103
|
return dateHelper_1.DateHelper.addDays(selectedDate, increment * 7);
|
|
122
|
-
case '
|
|
104
|
+
case 'str_fm_month':
|
|
123
105
|
return dateHelper_1.DateHelper.addMonths(selectedDate, increment);
|
|
124
|
-
case '
|
|
106
|
+
case 'str_fm_year':
|
|
125
107
|
return new Date(selectedDate.getFullYear() + increment, selectedDate.getMonth(), selectedDate.getDate());
|
|
126
108
|
default:
|
|
127
109
|
return selectedDate;
|
|
@@ -193,6 +175,21 @@ var Calendar = function (_a) {
|
|
|
193
175
|
setDragStartDate(null);
|
|
194
176
|
setDragEndDate(null);
|
|
195
177
|
}, [isDragging, dragStartDate, dragEndDate]);
|
|
178
|
+
// 날짜 드래그 이벤트 처리
|
|
179
|
+
var handleDateDrag = (0, react_1.useCallback)(function (action) {
|
|
180
|
+
var _a, _b;
|
|
181
|
+
if (action.action === 'DRAG' && action.target === 'DATE') {
|
|
182
|
+
// 선택된 스케줄들을 selectedSchedules state에 반영
|
|
183
|
+
if (action.schedules && action.schedules.length > 0) {
|
|
184
|
+
setSelectedSchedules(action.schedules);
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
setSelectedSchedules([]);
|
|
188
|
+
}
|
|
189
|
+
// 원래 config.DATE.DRAG 콜백이 있다면 호출
|
|
190
|
+
(_b = (_a = config === null || config === void 0 ? void 0 : config.DATE) === null || _a === void 0 ? void 0 : _a.DRAG) === null || _b === void 0 ? void 0 : _b.call(_a, action);
|
|
191
|
+
}
|
|
192
|
+
}, [config]);
|
|
196
193
|
// 이벤트 드래그 핸들러
|
|
197
194
|
var handleScheduleDragStart = (0, react_1.useCallback)(function (schedule, e) {
|
|
198
195
|
setDraggedSchedule(schedule);
|
|
@@ -224,20 +221,24 @@ var Calendar = function (_a) {
|
|
|
224
221
|
}, []);
|
|
225
222
|
// 삭제 키 이벤트 처리
|
|
226
223
|
var handleKeyDown = (0, react_1.useCallback)(function (e) {
|
|
227
|
-
var _a, _b
|
|
228
|
-
if (e.key === 'Backspace' &&
|
|
229
|
-
selectedSchedules.length > 0
|
|
230
|
-
|
|
231
|
-
(
|
|
224
|
+
var _a, _b;
|
|
225
|
+
if ((e.key === 'Backspace' || e.key === 'Delete') &&
|
|
226
|
+
(selectedSchedules.length > 0 || selectedDates.length > 0)) {
|
|
227
|
+
// config 콜백이 있으면 호출
|
|
228
|
+
(_b = (_a = config === null || config === void 0 ? void 0 : config.SCHEDULE) === null || _a === void 0 ? void 0 : _a.DELETE_KEY_DOWN) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
232
229
|
action: 'DELETE_KEY_DOWN',
|
|
233
230
|
target: 'SCHEDULE',
|
|
234
231
|
schedules: selectedSchedules,
|
|
235
232
|
startDate: (0, calendarUtils_1.toUTC)(startDate),
|
|
236
233
|
endDate: (0, calendarUtils_1.toUTC)(endDate)
|
|
237
234
|
});
|
|
235
|
+
// 항상 선택된 스케줄들 해제
|
|
238
236
|
setSelectedSchedules([]);
|
|
237
|
+
setSelectedDates([]);
|
|
238
|
+
// 브라우저 기본 동작 방지 (뒤로가기 등)
|
|
239
|
+
e.preventDefault();
|
|
239
240
|
}
|
|
240
|
-
}, [config, selectedSchedules]);
|
|
241
|
+
}, [config, selectedSchedules, startDate, endDate]);
|
|
241
242
|
// 날짜 드래그 놓기
|
|
242
243
|
var handleDateDrop = (0, react_1.useCallback)(function (date, e) {
|
|
243
244
|
var _a, _b, _c;
|
|
@@ -253,7 +254,7 @@ var Calendar = function (_a) {
|
|
|
253
254
|
var duration = originalEndDate.getTime() - originalStartDate.getTime();
|
|
254
255
|
var getAdjustedStartDate = function () {
|
|
255
256
|
var baseDate = new Date(date);
|
|
256
|
-
if (currentViewType === '
|
|
257
|
+
if (currentViewType === 'str_fm_month') {
|
|
257
258
|
var target = e.target;
|
|
258
259
|
var gridContainer = target.closest('[data-calendar-grid]');
|
|
259
260
|
if (gridContainer) {
|
|
@@ -299,17 +300,11 @@ var Calendar = function (_a) {
|
|
|
299
300
|
};
|
|
300
301
|
// 뷰 타입을 위한 드롭다운 옵션 생성
|
|
301
302
|
var viewTypeOptions = (0, react_1.useMemo)(function () {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
WEEKLY: t('str_fm_week'),
|
|
305
|
-
DAILY: t('str_fm_day'),
|
|
306
|
-
YEARLY: t('str_fm_year')
|
|
307
|
-
};
|
|
308
|
-
return actualViewTypes.map(function (viewType) { return ({
|
|
309
|
-
text: viewTypeTextMap[viewType] || viewType,
|
|
303
|
+
return viewTypes.map(function (viewType) { return ({
|
|
304
|
+
text: t(viewType),
|
|
310
305
|
value: viewType
|
|
311
306
|
}); });
|
|
312
|
-
}, [
|
|
307
|
+
}, [viewTypes, t]);
|
|
313
308
|
// 특정 월의 캘린더 날짜 생성 (연간 보기용)
|
|
314
309
|
var getMonthDates = (0, react_1.useCallback)(function (year, month) {
|
|
315
310
|
var monthDate = new Date(year, month, 1);
|
|
@@ -350,14 +345,14 @@ var Calendar = function (_a) {
|
|
|
350
345
|
};
|
|
351
346
|
// 주간 뷰로 전환하는 핸들러
|
|
352
347
|
var handleSwitchToWeeklyView = (0, react_1.useCallback)(function (date) {
|
|
353
|
-
setCurrentViewType('
|
|
348
|
+
setCurrentViewType('str_fm_week');
|
|
354
349
|
setSelectedDate(date);
|
|
355
350
|
// 주간 뷰로 전환할 때의 startDate와 endDate 계산
|
|
356
|
-
var _a = (0, calendarUtils_1.calculateDateRange)('
|
|
351
|
+
var _a = (0, calendarUtils_1.calculateDateRange)('str_fm_week', date), newStartDate = _a.startDate, newEndDate = _a.endDate;
|
|
357
352
|
onActionDispatch === null || onActionDispatch === void 0 ? void 0 : onActionDispatch({
|
|
358
353
|
type: 'CALENDAR_TYPE_CHANGE',
|
|
359
354
|
payload: {
|
|
360
|
-
type: '
|
|
355
|
+
type: 'str_fm_week',
|
|
361
356
|
startDate: (0, calendarUtils_1.toUTC)(newStartDate),
|
|
362
357
|
endDate: (0, calendarUtils_1.toUTC)(newEndDate)
|
|
363
358
|
}
|
|
@@ -366,13 +361,13 @@ var Calendar = function (_a) {
|
|
|
366
361
|
// 뷰 타입에 따른 캘린더 콘텐츠 렌더링
|
|
367
362
|
var renderCalendarContent = function () {
|
|
368
363
|
switch (currentViewType) {
|
|
369
|
-
case '
|
|
370
|
-
return ((0, jsx_runtime_1.jsx)(MonthlyView_1.MonthlyView, { getDayTextByDate: getDayTextByDate, startOfWeek: startOfWeek, selectedDate: selectedDate, selectedDates: selectedDates, dragStartDate: dragStartDate, selectedSchedules: selectedSchedules, dragEndDate: dragEndDate, isDragOverDate: isDragOverDate, schedules: schedules, getSchedulesForDate: getSchedulesForDate, isToday: isToday, isPastDate: isPastDate, handleDateClick: handleDateClick, handleScheduleClick: handleScheduleClick, handleMouseUp: handleMouseUp, handleDateDragOver: handleDateDragOver, handleDateDragLeave: handleDateDragLeave, handleDateDrop: handleDateDrop, handleScheduleDragStart: handleScheduleDragStart, handleScheduleDragEnd: handleScheduleDragEnd, isDraggable: isDraggable, onSwitchToWeeklyView: handleSwitchToWeeklyView }));
|
|
371
|
-
case '
|
|
372
|
-
return (0, jsx_runtime_1.jsx)(WeeklyView_1.WeeklyView, { startOfWeek: startOfWeek });
|
|
373
|
-
case '
|
|
374
|
-
return (0, jsx_runtime_1.jsx)(DailyView_1.DailyView, {});
|
|
375
|
-
case '
|
|
364
|
+
case 'str_fm_month':
|
|
365
|
+
return ((0, jsx_runtime_1.jsx)(MonthlyView_1.MonthlyView, { getDayTextByDate: getDayTextByDate, startOfWeek: startOfWeek, selectedDate: selectedDate, selectedDates: selectedDates, dragStartDate: dragStartDate, selectedSchedules: selectedSchedules, dragEndDate: dragEndDate, isDragOverDate: isDragOverDate, schedules: schedules, getSchedulesForDate: getSchedulesForDate, isToday: isToday, isPastDate: isPastDate, handleDateClick: handleDateClick, handleScheduleClick: handleScheduleClick, handleMouseUp: handleMouseUp, handleDateDragOver: handleDateDragOver, handleDateDragLeave: handleDateDragLeave, handleDateDrop: handleDateDrop, handleScheduleDragStart: handleScheduleDragStart, handleScheduleDragEnd: handleScheduleDragEnd, isDraggable: isDraggable, onSwitchToWeeklyView: handleSwitchToWeeklyView, config: config }));
|
|
366
|
+
case 'str_fm_week':
|
|
367
|
+
return (0, jsx_runtime_1.jsx)(WeeklyView_1.WeeklyView, { startOfWeek: startOfWeek, schedules: schedules, config: config });
|
|
368
|
+
case 'str_fm_day':
|
|
369
|
+
return (0, jsx_runtime_1.jsx)(DailyView_1.DailyView, { schedules: schedules, config: config });
|
|
370
|
+
case 'str_fm_year':
|
|
376
371
|
return ((0, jsx_runtime_1.jsx)(YearlyView_1.YearlyView, { selectedDate: selectedDate, getMonthDates: getMonthDates, getDayTextByDate: getDayTextByDate, startOfWeek: startOfWeek, isToday: isToday, handleDateClick: handleDateClick, getSchedulesForDate: getSchedulesForDate }));
|
|
377
372
|
default:
|
|
378
373
|
return null;
|
|
@@ -384,7 +379,7 @@ var Calendar = function (_a) {
|
|
|
384
379
|
// 스케줄 관련
|
|
385
380
|
selectedSchedules: selectedSchedules, isDraggable: isDraggable, handleScheduleClick: handleScheduleClick, handleScheduleDragStart: handleScheduleDragStart, handleScheduleDragEnd: handleScheduleDragEnd,
|
|
386
381
|
// 날짜 관련
|
|
387
|
-
handleDateClick: handleDateClick, handleDateDragOver: handleDateDragOver, handleDateDragLeave: handleDateDragLeave, handleDateDrop: handleDateDrop,
|
|
382
|
+
handleDateClick: handleDateClick, handleDateDrag: handleDateDrag, handleDateDragOver: handleDateDragOver, handleDateDragLeave: handleDateDragLeave, handleDateDrop: handleDateDrop,
|
|
388
383
|
// 유틸리티 함수
|
|
389
384
|
getSchedulesForDate: getSchedulesForDate, isToday: isToday, isPastDate: isPastDate, getDayTextByDate: getDayTextByDate,
|
|
390
385
|
// 상태값
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Schedule, displayAllDayScheduleMode } from './types';
|
|
2
|
+
import type { Schedule, displayAllDayScheduleMode, Action } from './types';
|
|
3
3
|
export interface ScheduleItemExtraProps {
|
|
4
4
|
onDragStart?: (e: React.DragEvent) => void;
|
|
5
5
|
onDragEnd?: () => void;
|
|
@@ -14,6 +14,7 @@ interface CalendarContextValue {
|
|
|
14
14
|
handleScheduleDragStart: (schedule: Schedule, e: React.DragEvent) => void;
|
|
15
15
|
handleScheduleDragEnd: () => void;
|
|
16
16
|
handleDateClick: (date: Date, e: React.MouseEvent) => void;
|
|
17
|
+
handleDateDrag: (action: Action) => void;
|
|
17
18
|
handleDateDragOver: (date: Date, e: React.DragEvent) => void;
|
|
18
19
|
handleDateDragLeave: () => void;
|
|
19
20
|
handleDateDrop: (date: Date, e: React.DragEvent) => void;
|
|
@@ -36,6 +37,7 @@ interface CalendarProviderProps {
|
|
|
36
37
|
handleScheduleDragStart: (schedule: Schedule, e: React.DragEvent) => void;
|
|
37
38
|
handleScheduleDragEnd: () => void;
|
|
38
39
|
handleDateClick: (date: Date, e: React.MouseEvent) => void;
|
|
40
|
+
handleDateDrag: (action: Action) => void;
|
|
39
41
|
handleDateDragOver: (date: Date, e: React.DragEvent) => void;
|
|
40
42
|
handleDateDragLeave: () => void;
|
|
41
43
|
handleDateDrop: (date: Date, e: React.DragEvent) => void;
|
|
@@ -30,7 +30,7 @@ var CalendarProvider = function (_a) {
|
|
|
30
30
|
// 스케줄 관련
|
|
31
31
|
selectedSchedules = _a.selectedSchedules, isDraggable = _a.isDraggable, handleScheduleClick = _a.handleScheduleClick, handleScheduleDragStart = _a.handleScheduleDragStart, handleScheduleDragEnd = _a.handleScheduleDragEnd,
|
|
32
32
|
// 날짜 관련
|
|
33
|
-
handleDateClick = _a.handleDateClick, handleDateDragOver = _a.handleDateDragOver, handleDateDragLeave = _a.handleDateDragLeave, handleDateDrop = _a.handleDateDrop,
|
|
33
|
+
handleDateClick = _a.handleDateClick, handleDateDrag = _a.handleDateDrag, handleDateDragOver = _a.handleDateDragOver, handleDateDragLeave = _a.handleDateDragLeave, handleDateDrop = _a.handleDateDrop,
|
|
34
34
|
// 유틸리티 함수
|
|
35
35
|
getSchedulesForDate = _a.getSchedulesForDate, isToday = _a.isToday, isPastDate = _a.isPastDate, getDayTextByDate = _a.getDayTextByDate,
|
|
36
36
|
// 상태값
|
|
@@ -56,6 +56,7 @@ var CalendarProvider = function (_a) {
|
|
|
56
56
|
handleScheduleDragEnd: handleScheduleDragEnd,
|
|
57
57
|
// 날짜 이벤트 핸들러
|
|
58
58
|
handleDateClick: handleDateClick,
|
|
59
|
+
handleDateDrag: handleDateDrag,
|
|
59
60
|
handleDateDragOver: handleDateDragOver,
|
|
60
61
|
handleDateDragLeave: handleDateDragLeave,
|
|
61
62
|
handleDateDrop: handleDateDrop,
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Schedule } from './types';
|
|
3
|
+
interface DailyViewProps {
|
|
4
|
+
schedules: Schedule[];
|
|
5
|
+
config?: any;
|
|
6
|
+
}
|
|
7
|
+
export declare const DailyView: React.FC<DailyViewProps>;
|
|
8
|
+
export {};
|
|
@@ -40,6 +40,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.DailyView = void 0;
|
|
42
42
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
43
|
+
var react_1 = require("react");
|
|
43
44
|
var react_i18next_1 = require("react-i18next");
|
|
44
45
|
var styled_components_1 = __importStar(require("styled-components"));
|
|
45
46
|
var TextLabel_1 = require("../TextLabel");
|
|
@@ -48,9 +49,14 @@ var CalendarContext_1 = require("./CalendarContext");
|
|
|
48
49
|
var CurrentTimeIndicator_1 = require("./CurrentTimeIndicator");
|
|
49
50
|
var TimeBasedScheduleItem_1 = require("./TimeBasedScheduleItem");
|
|
50
51
|
var timeFormatUtils_1 = require("./timeFormatUtils");
|
|
51
|
-
var DailyView = function () {
|
|
52
|
+
var DailyView = function (_a) {
|
|
53
|
+
var schedules = _a.schedules, config = _a.config;
|
|
52
54
|
var i18n = (0, react_i18next_1.useTranslation)().i18n;
|
|
53
|
-
var
|
|
55
|
+
var _b = (0, CalendarContext_1.useCalendarContext)(), selectedDate = _b.selectedDate, selectedSchedules = _b.selectedSchedules, displayAllDayScheduleMode = _b.displayAllDayScheduleMode, getSchedulesForDate = _b.getSchedulesForDate, isDragOverDate = _b.isDragOverDate, handleDateDragOver = _b.handleDateDragOver, handleDateDragLeave = _b.handleDateDragLeave, handleDateDrop = _b.handleDateDrop, handleDateClick = _b.handleDateClick, handleDateDrag = _b.handleDateDrag, handleScheduleDragStart = _b.handleScheduleDragStart, handleScheduleDragEnd = _b.handleScheduleDragEnd, handleScheduleClick = _b.handleScheduleClick;
|
|
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];
|
|
54
60
|
var currentDateForDaily = [selectedDate][0];
|
|
55
61
|
var HOURS_IN_DAY = Array.from({ length: 24 }, function (_, i) { return i; });
|
|
56
62
|
var getTimeSlotDate = function (baseDate, hour) {
|
|
@@ -58,10 +64,79 @@ var DailyView = function () {
|
|
|
58
64
|
date.setHours(hour, 0, 0, 0);
|
|
59
65
|
return date;
|
|
60
66
|
};
|
|
67
|
+
// 시간 드래그 시작
|
|
68
|
+
var handleTimeMouseDown = (0, react_1.useCallback)(function (hour, e) {
|
|
69
|
+
var _a;
|
|
70
|
+
if (!((_a = config === null || config === void 0 ? void 0 : config.DATE) === null || _a === void 0 ? void 0 : _a.DRAG))
|
|
71
|
+
return;
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
setTimeSelectionStart(hour);
|
|
74
|
+
setTimeSelectionEnd(hour);
|
|
75
|
+
setIsTimeDragging(true);
|
|
76
|
+
}, [config]);
|
|
77
|
+
// 시간 드래그 중
|
|
78
|
+
var handleTimeMouseEnter = (0, react_1.useCallback)(function (hour) {
|
|
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]);
|
|
61
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) {
|
|
62
137
|
var timeSlotDate = getTimeSlotDate(currentDateForDaily, hour);
|
|
63
138
|
var isDragOver = (isDragOverDate === null || isDragOverDate === void 0 ? void 0 : isDragOverDate.getTime()) === timeSlotDate.getTime();
|
|
64
|
-
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, onClick: function () { return handleDateClick(timeSlotDate, {}); }, onDragOver: function (e) { return handleDateDragOver(timeSlotDate, e); }, onDragLeave: handleDateDragLeave, onDrop: function (e) { return handleDateDrop(timeSlotDate, e); } }, { children: hour === 0 && ((0, jsx_runtime_1.jsx)(TimeBasedScheduleItem_1.TimeBasedScheduleItem, { schedules: getSchedulesForDate(currentDateForDaily), selectedSchedules: selectedSchedules, onClick: handleScheduleClick, handleScheduleDragStart: handleScheduleDragStart, handleScheduleDragEnd: handleScheduleDragEnd })) }))] }, hour));
|
|
139
|
+
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": isTimeSlotInDragRange(hour), "$isTimeDragging": isTimeDragging, 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 handleTimeMouseDown(hour, e); }, onMouseEnter: function () { return handleTimeMouseEnter(hour); } }, { children: hour === 0 && ((0, jsx_runtime_1.jsx)(TimeBasedScheduleItem_1.TimeBasedScheduleItem, { schedules: getSchedulesForDate(currentDateForDaily), selectedSchedules: selectedSchedules, onClick: handleScheduleClick, handleScheduleDragStart: handleScheduleDragStart, handleScheduleDragEnd: handleScheduleDragEnd })) }))] }, hour));
|
|
65
140
|
})] }))] }));
|
|
66
141
|
};
|
|
67
142
|
exports.DailyView = DailyView;
|
|
@@ -74,18 +149,24 @@ var S_DailyTimeGrid = styled_components_1.default.div(templateObject_3 || (templ
|
|
|
74
149
|
});
|
|
75
150
|
});
|
|
76
151
|
var S_DailyTimeRow = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n min-height: 60px;\n"], ["\n display: flex;\n min-height: 60px;\n"])));
|
|
77
|
-
var S_DailyTimeLabel = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n align-items: center;\n border-bottom: 1px solid ", ";\n border-right: 1px solid ", ";\n display: flex;\n justify-content: center;\n min-width:
|
|
152
|
+
var S_DailyTimeLabel = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n align-items: center;\n border-bottom: 1px solid ", ";\n border-right: 1px solid ", ";\n display: flex;\n justify-content: center;\n min-width: 63px;\n padding: 8px;\n"], ["\n align-items: center;\n border-bottom: 1px solid ", ";\n border-right: 1px solid ", ";\n display: flex;\n justify-content: center;\n min-width: 63px;\n padding: 8px;\n"])), function (_a) {
|
|
78
153
|
var theme = _a.theme;
|
|
79
154
|
return theme.ui_cpnt_divider;
|
|
80
155
|
}, function (_a) {
|
|
81
156
|
var theme = _a.theme;
|
|
82
157
|
return theme.ui_cpnt_divider;
|
|
83
158
|
});
|
|
84
|
-
var S_DailyTimeSlot = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background: ", ";\n border-bottom: 1px solid ", ";\n cursor:
|
|
159
|
+
var S_DailyTimeSlot = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background: ", ";\n border-bottom: 1px solid ", ";\n cursor: ", ";\n flex: 1;\n min-width: 0;\n overflow: visible;\n padding: 4px;\n position: relative;\n user-select: ", ";\n\n &:hover {\n background: ", ";\n }\n"], ["\n background: ", ";\n border-bottom: 1px solid ", ";\n cursor: ", ";\n flex: 1;\n min-width: 0;\n overflow: visible;\n padding: 4px;\n position: relative;\n user-select: ", ";\n\n &:hover {\n background: ", ";\n }\n"])), function (props) {
|
|
160
|
+
if (props.$isInTimeDragRange)
|
|
161
|
+
return props.theme.ui_cpnt_sheet_base;
|
|
162
|
+
if (props.$isDragOver)
|
|
163
|
+
return props.theme.ui_cpnt_sheet_base;
|
|
164
|
+
return 'transparent';
|
|
165
|
+
}, function (_a) {
|
|
85
166
|
var theme = _a.theme;
|
|
86
167
|
return theme.ui_cpnt_divider;
|
|
87
|
-
}, function (_a) {
|
|
168
|
+
}, function (props) { return (props.$isTimeDragging ? 'grabbing' : 'pointer'); }, function (props) { return (props.$isTimeDragging ? 'none' : 'auto'); }, function (_a) {
|
|
88
169
|
var theme = _a.theme;
|
|
89
|
-
return theme.
|
|
170
|
+
return theme.ui_cpnt_sheet_base;
|
|
90
171
|
});
|
|
91
172
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Schedule } from './types';
|
|
1
|
+
import type { Schedule, Config } from './types';
|
|
2
2
|
import type React from 'react';
|
|
3
3
|
interface MonthlyViewProps {
|
|
4
4
|
getDayTextByDate: (date: Date) => string;
|
|
@@ -23,6 +23,7 @@ interface MonthlyViewProps {
|
|
|
23
23
|
handleScheduleDragEnd?: () => void;
|
|
24
24
|
isDraggable?: boolean;
|
|
25
25
|
onSwitchToWeeklyView?: (date: Date) => void;
|
|
26
|
+
config?: Config;
|
|
26
27
|
}
|
|
27
28
|
export declare const MonthlyView: React.FC<MonthlyViewProps>;
|
|
28
29
|
export {};
|
|
@@ -41,17 +41,85 @@ var CalendarContext_1 = require("./CalendarContext");
|
|
|
41
41
|
var calendarUtils_1 = require("./calendarUtils");
|
|
42
42
|
var MultiWeekSchedulesLayer_1 = require("./MultiWeekSchedulesLayer");
|
|
43
43
|
var MonthlyView = function (_a) {
|
|
44
|
-
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;
|
|
44
|
+
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
45
|
var t = (0, react_i18next_1.useTranslation)().t;
|
|
46
|
-
var
|
|
46
|
+
var _c = (0, CalendarContext_1.useCalendarContext)(), renderScheduleItem = _c.renderScheduleItem, handleDateDrag = _c.handleDateDrag;
|
|
47
47
|
var height = (0, useWindowSize_1.useWindowSize)().height;
|
|
48
48
|
var calendarCellRef = (0, react_1.useRef)(null);
|
|
49
|
-
var
|
|
49
|
+
var _d = (0, react_1.useState)(3), maxSchedulesPerDay = _d[0], setMaxSchedulesPerDay = _d[1];
|
|
50
50
|
var scheduleItemHeight = 22; // 스케줄 아이템 대략 높이
|
|
51
|
+
// 날짜 드래그 상태
|
|
52
|
+
var _e = (0, react_1.useState)(null), dateSelectionStart = _e[0], setDateSelectionStart = _e[1];
|
|
53
|
+
var _f = (0, react_1.useState)(null), dateSelectionEnd = _f[0], setDateSelectionEnd = _f[1];
|
|
54
|
+
var _g = (0, react_1.useState)(false), isDateDragging = _g[0], setIsDateDragging = _g[1];
|
|
51
55
|
var days = (0, react_1.useMemo)(function () {
|
|
52
56
|
var monthDate = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), 1);
|
|
53
57
|
return dateHelper_1.DateHelper.getCalendarDatesForCalendar(monthDate, startOfWeek);
|
|
54
58
|
}, [selectedDate, startOfWeek]);
|
|
59
|
+
// 날짜 드래그 시작
|
|
60
|
+
var handleDateMouseDown = function (date, e) {
|
|
61
|
+
var _a;
|
|
62
|
+
if (!((_a = config === null || config === void 0 ? void 0 : config.DATE) === null || _a === void 0 ? void 0 : _a.DRAG))
|
|
63
|
+
return;
|
|
64
|
+
e.preventDefault(); // 텍스트 선택 방지
|
|
65
|
+
setDateSelectionStart(date);
|
|
66
|
+
setDateSelectionEnd(date);
|
|
67
|
+
setIsDateDragging(true);
|
|
68
|
+
};
|
|
69
|
+
// 날짜 드래그 중
|
|
70
|
+
var handleDateMouseEnter = function (date) {
|
|
71
|
+
var _a;
|
|
72
|
+
if (!((_a = config === null || config === void 0 ? void 0 : config.DATE) === null || _a === void 0 ? void 0 : _a.DRAG))
|
|
73
|
+
return;
|
|
74
|
+
if (!isDateDragging)
|
|
75
|
+
return;
|
|
76
|
+
setDateSelectionEnd(date);
|
|
77
|
+
};
|
|
78
|
+
// 드래그 종료 시 콜백 호출
|
|
79
|
+
(0, react_1.useEffect)(function () {
|
|
80
|
+
var handleMouseUp = function () {
|
|
81
|
+
var _a;
|
|
82
|
+
if (isDateDragging && dateSelectionStart && dateSelectionEnd && ((_a = config === null || config === void 0 ? void 0 : config.DATE) === null || _a === void 0 ? void 0 : _a.DRAG)) {
|
|
83
|
+
var startDate_1 = new Date(Math.min(dateSelectionStart.getTime(), dateSelectionEnd.getTime()));
|
|
84
|
+
var endDate_1 = new Date(Math.max(dateSelectionStart.getTime(), dateSelectionEnd.getTime()));
|
|
85
|
+
// 선택된 날짜 구간의 모든 날짜를 생성
|
|
86
|
+
var selectedDates_1 = [];
|
|
87
|
+
var current = new Date(startDate_1);
|
|
88
|
+
while (current <= endDate_1) {
|
|
89
|
+
selectedDates_1.push(new Date(current));
|
|
90
|
+
current.setDate(current.getDate() + 1);
|
|
91
|
+
}
|
|
92
|
+
// 선택된 날짜 구간에 포함되는 스케줄들 찾기
|
|
93
|
+
var schedulesInRange_1 = [];
|
|
94
|
+
schedules.forEach(function (schedule) {
|
|
95
|
+
var scheduleStartDate = new Date(schedule.startDate);
|
|
96
|
+
scheduleStartDate.setHours(0, 0, 0, 0);
|
|
97
|
+
var scheduleEndDate = new Date(schedule.endDate);
|
|
98
|
+
scheduleEndDate.setHours(0, 0, 0, 0);
|
|
99
|
+
// 스케줄과 선택된 구간이 겹치는지 확인
|
|
100
|
+
// 스케줄 시작 <= 선택된 구간 끝 && 스케줄 끝 >= 선택된 구간 시작
|
|
101
|
+
if (scheduleStartDate <= endDate_1 && scheduleEndDate >= startDate_1) {
|
|
102
|
+
schedulesInRange_1.push(schedule);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
handleDateDrag({
|
|
106
|
+
action: 'DRAG',
|
|
107
|
+
target: 'DATE',
|
|
108
|
+
dates: selectedDates_1,
|
|
109
|
+
schedules: schedulesInRange_1,
|
|
110
|
+
startDate: startDate_1.toISOString(),
|
|
111
|
+
endDate: endDate_1.toISOString()
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
setIsDateDragging(false);
|
|
115
|
+
setDateSelectionStart(null);
|
|
116
|
+
setDateSelectionEnd(null);
|
|
117
|
+
};
|
|
118
|
+
if (isDateDragging) {
|
|
119
|
+
document.addEventListener('mouseup', handleMouseUp);
|
|
120
|
+
return function () { return document.removeEventListener('mouseup', handleMouseUp); };
|
|
121
|
+
}
|
|
122
|
+
}, [isDateDragging, dateSelectionStart, dateSelectionEnd, config, schedules]);
|
|
55
123
|
// 셀 높이 기반으로 최대 스케줄 개수 계산
|
|
56
124
|
var calculateMaxSchedules = (0, react_1.useCallback)(function () {
|
|
57
125
|
if (!calendarCellRef.current)
|
|
@@ -344,10 +412,14 @@ var MonthlyView = function (_a) {
|
|
|
344
412
|
!!(dragStartDate &&
|
|
345
413
|
dragEndDate &&
|
|
346
414
|
date.getTime() >= Math.min(dragStartDate.getTime(), dragEndDate.getTime()) &&
|
|
347
|
-
date.getTime() <= Math.max(dragStartDate.getTime(), dragEndDate.getTime()))
|
|
415
|
+
date.getTime() <= Math.max(dragStartDate.getTime(), dragEndDate.getTime())) ||
|
|
416
|
+
!!(dateSelectionStart &&
|
|
417
|
+
dateSelectionEnd &&
|
|
418
|
+
date.getTime() >= Math.min(dateSelectionStart.getTime(), dateSelectionEnd.getTime()) &&
|
|
419
|
+
date.getTime() <= Math.max(dateSelectionStart.getTime(), dateSelectionEnd.getTime()));
|
|
348
420
|
return ((0, jsx_runtime_1.jsxs)(S_CalendarCell, __assign({ ref: date.getMonth() === selectedDate.getMonth() && date.getDate() === 1
|
|
349
421
|
? calendarCellRef
|
|
350
|
-
: undefined, "data-calendar-cell": true, "$isCurrentMonth": date.getMonth() === selectedDate.getMonth(), "$isToday": isToday(date), "$isSelected": isCellSelected, "$isPast": isPastDate(date), "$isDragOver": (isDragOverDate === null || isDragOverDate === void 0 ? void 0 : isDragOverDate.toDateString()) === date.toDateString(), onClick: function (e) { return handleDateClick(date, e); }, onMouseUp: handleMouseUp, onDragOver: function (e) { return handleDateDragOver(date, e); }, onDragLeave: handleDateDragLeave, onDrop: function (e) { return handleDateDrop(date, e); } }, { children: [(0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { styleTheme: isToday(date) ? 'caption2Bold' : 'caption2Regular', textAlign: "center", colorTheme: isToday(date) ? 'sysTextBrandPrimary' : 'sysTextSecondary', text: date.getDate().toString() }), (0, jsx_runtime_1.jsxs)(S_SchedulesContainer, __assign({ "$multiWeekSchedulesCount": visibleRows.length, id: "schedule container" }, { children: [visibleRows.map(function (_a) {
|
|
422
|
+
: undefined, "data-calendar-cell": true, "$isCurrentMonth": date.getMonth() === selectedDate.getMonth(), "$isToday": isToday(date), "$isSelected": isCellSelected, "$isPast": isPastDate(date), "$isDragOver": (isDragOverDate === null || isDragOverDate === void 0 ? void 0 : isDragOverDate.toDateString()) === date.toDateString(), "$isDateDragging": isDateDragging, onClick: function (e) { return handleDateClick(date, e); }, onMouseUp: handleMouseUp, onDragOver: function (e) { return handleDateDragOver(date, e); }, onDragLeave: handleDateDragLeave, onDrop: function (e) { return handleDateDrop(date, e); }, onMouseDown: function (e) { return handleDateMouseDown(date, e); }, onMouseEnter: function () { return handleDateMouseEnter(date); } }, { children: [(0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { styleTheme: isToday(date) ? 'caption2Bold' : 'caption2Regular', textAlign: "center", colorTheme: isToday(date) ? 'sysTextBrandPrimary' : 'sysTextSecondary', text: date.getDate().toString() }), (0, jsx_runtime_1.jsxs)(S_SchedulesContainer, __assign({ "$multiWeekSchedulesCount": visibleRows.length, id: "schedule container" }, { children: [visibleRows.map(function (_a) {
|
|
351
423
|
var rowIndex = _a.rowIndex, items = _a.items;
|
|
352
424
|
return items.map(function (item) {
|
|
353
425
|
var schedule = item.data;
|
|
@@ -377,7 +449,7 @@ var S_DayHeader = styled_components_1.default.div(templateObject_2 || (templateO
|
|
|
377
449
|
var theme = _a.theme;
|
|
378
450
|
return theme.ui_cpnt_divider;
|
|
379
451
|
});
|
|
380
|
-
var S_CalendarCell = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-color: ", ";\n border-bottom: 1px solid ", ";\n border-right: 1px solid ", ";\n min-height: 80px;\n min-width: 0;\n overflow: hidden;\n padding: 4px;\n position: relative;\n transition: background-color 0.2s;\n\n &:hover {\n background-color: ", ";\n }\n\n &:nth-child(7n + 1) {\n border-left: 1px solid ", ";\n }\n\n &:nth-child(-n + 7) {\n border-top: 1px solid ", ";\n }\n"], ["\n background-color: ", ";\n border-bottom: 1px solid ", ";\n border-right: 1px solid ", ";\n min-height: 80px;\n min-width: 0;\n overflow: hidden;\n padding: 4px;\n position: relative;\n transition: background-color 0.2s;\n\n &:hover {\n background-color: ", ";\n }\n\n &:nth-child(7n + 1) {\n border-left: 1px solid ", ";\n }\n\n &:nth-child(-n + 7) {\n border-top: 1px solid ", ";\n }\n"])), function (_a) {
|
|
452
|
+
var S_CalendarCell = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-color: ", ";\n border-bottom: 1px solid ", ";\n border-right: 1px solid ", ";\n min-height: 80px;\n min-width: 0;\n overflow: hidden;\n padding: 4px;\n position: relative;\n transition: background-color 0.2s;\n user-select: ", ";\n\n &:hover {\n background-color: ", ";\n }\n\n &:nth-child(7n + 1) {\n border-left: 1px solid ", ";\n }\n\n &:nth-child(-n + 7) {\n border-top: 1px solid ", ";\n }\n"], ["\n background-color: ", ";\n border-bottom: 1px solid ", ";\n border-right: 1px solid ", ";\n min-height: 80px;\n min-width: 0;\n overflow: hidden;\n padding: 4px;\n position: relative;\n transition: background-color 0.2s;\n user-select: ", ";\n\n &:hover {\n background-color: ", ";\n }\n\n &:nth-child(7n + 1) {\n border-left: 1px solid ", ";\n }\n\n &:nth-child(-n + 7) {\n border-top: 1px solid ", ";\n }\n"])), function (_a) {
|
|
381
453
|
var $isSelected = _a.$isSelected, theme = _a.theme;
|
|
382
454
|
if ($isSelected)
|
|
383
455
|
return theme.ui_cpnt_sheet_base;
|
|
@@ -388,6 +460,9 @@ var S_CalendarCell = styled_components_1.default.div(templateObject_3 || (templa
|
|
|
388
460
|
}, function (_a) {
|
|
389
461
|
var theme = _a.theme;
|
|
390
462
|
return theme.ui_cpnt_divider;
|
|
463
|
+
}, function (_a) {
|
|
464
|
+
var $isDateDragging = _a.$isDateDragging;
|
|
465
|
+
return ($isDateDragging ? 'none' : 'auto');
|
|
391
466
|
}, function (_a) {
|
|
392
467
|
var theme = _a.theme;
|
|
393
468
|
return theme.ui_cpnt_sheet_base;
|