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
@@ -36,16 +36,22 @@ var Dropdown_1 = require("../Dropdown");
|
|
36
36
|
var IconButton_1 = require("../IconButton");
|
37
37
|
var TextButton_1 = require("../TextButton");
|
38
38
|
var TextLabel_1 = require("../TextLabel");
|
39
|
-
var CalendarContext_1 = require("./CalendarContext");
|
40
|
-
var calendarUtils_1 = require("./calendarUtils");
|
41
39
|
var constants_1 = require("./constants");
|
42
|
-
var
|
43
|
-
var
|
44
|
-
var
|
45
|
-
var
|
40
|
+
var CalendarContext_1 = require("./context/CalendarContext");
|
41
|
+
var types_1 = require("./types/types");
|
42
|
+
var utils_1 = require("./utils");
|
43
|
+
var DailyView_1 = require("./views/DailyView");
|
44
|
+
var MonthlyView_1 = require("./views/MonthlyView");
|
45
|
+
var WeeklyView_1 = require("./views/WeeklyView");
|
46
|
+
var YearlyView_1 = require("./views/YearlyView");
|
46
47
|
var Calendar = function (_a) {
|
47
48
|
var _b;
|
48
|
-
var _c = _a.defaultViewType, defaultViewType = _c === void 0 ?
|
49
|
+
var _c = _a.defaultViewType, defaultViewType = _c === void 0 ? types_1.CalendarViewType.MONTH : _c, _d = _a.viewTypes, viewTypes = _d === void 0 ? [
|
50
|
+
types_1.CalendarViewType.MONTH,
|
51
|
+
types_1.CalendarViewType.WEEK,
|
52
|
+
types_1.CalendarViewType.DAY,
|
53
|
+
types_1.CalendarViewType.YEAR
|
54
|
+
] : _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;
|
49
55
|
var _j = (0, react_i18next_1.useTranslation)('translation'), t = _j.t, i18n = _j.i18n;
|
50
56
|
var _k = (0, react_1.useState)(defaultViewType), currentViewType = _k[0], setCurrentViewType = _k[1];
|
51
57
|
var _l = (0, react_1.useState)(new Date()), selectedDate = _l[0], setSelectedDate = _l[1];
|
@@ -64,47 +70,47 @@ var Calendar = function (_a) {
|
|
64
70
|
// 과거 날짜인지 확인
|
65
71
|
var isPastDate = (0, react_1.useCallback)(function (date) { return dateHelper_1.DateHelper.isBefore(date, today) && !dateHelper_1.DateHelper.isSameDay(date, today); }, [today]);
|
66
72
|
// 뷰 타입에 따른 시작일과 종료일 계산
|
67
|
-
var _v = (0,
|
73
|
+
var _v = (0, utils_1.calculateDateRange)(currentViewType, selectedDate), startDate = _v.startDate, endDate = _v.endDate;
|
68
74
|
// 뷰 타입 변경 처리
|
69
75
|
var handleViewTypeChange = (0, react_1.useCallback)(function (option) {
|
70
76
|
var newViewType = option.value;
|
71
77
|
setCurrentViewType(newViewType);
|
72
78
|
// 새로운 뷰 타입 기준으로 startDate와 endDate 계산
|
73
|
-
var _a = (0,
|
79
|
+
var _a = (0, utils_1.calculateDateRange)(newViewType, selectedDate), newStartDate = _a.startDate, newEndDate = _a.endDate;
|
74
80
|
onActionDispatch === null || onActionDispatch === void 0 ? void 0 : onActionDispatch({
|
75
81
|
type: 'CALENDAR_TYPE_CHANGE',
|
76
82
|
payload: {
|
77
83
|
type: newViewType,
|
78
|
-
startDate: (0,
|
79
|
-
endDate: (0,
|
84
|
+
startDate: (0, utils_1.toUTC)(newStartDate),
|
85
|
+
endDate: (0, utils_1.toUTC)(newEndDate)
|
80
86
|
}
|
81
87
|
});
|
82
|
-
}, [selectedDate, onActionDispatch,
|
88
|
+
}, [selectedDate, onActionDispatch, utils_1.calculateDateRange]);
|
83
89
|
// "오늘" 버튼 클릭 이벤트
|
84
90
|
var handleTodayClick = (0, react_1.useCallback)(function () {
|
85
91
|
setSelectedDate(today);
|
86
92
|
// 오늘 날짜 기준으로 startDate와 endDate 계산
|
87
|
-
var _a = (0,
|
93
|
+
var _a = (0, utils_1.calculateDateRange)(currentViewType, today), newStartDate = _a.startDate, newEndDate = _a.endDate;
|
88
94
|
onActionDispatch === null || onActionDispatch === void 0 ? void 0 : onActionDispatch({
|
89
95
|
type: 'TODAY_BUTTON_CLICK',
|
90
96
|
payload: {
|
91
|
-
startDate: (0,
|
92
|
-
endDate: (0,
|
97
|
+
startDate: (0, utils_1.toUTC)(newStartDate),
|
98
|
+
endDate: (0, utils_1.toUTC)(newEndDate)
|
93
99
|
}
|
94
100
|
});
|
95
|
-
}, [today, currentViewType, onActionDispatch,
|
101
|
+
}, [today, currentViewType, onActionDispatch, utils_1.calculateDateRange]);
|
96
102
|
// 이전/다음 이동 함수
|
97
103
|
var navigateDate = (0, react_1.useCallback)(function (direction) {
|
98
104
|
var increment = direction === 'next' ? 1 : -1;
|
99
105
|
var getNewDateByViewType = function (viewType) {
|
100
106
|
switch (viewType) {
|
101
|
-
case
|
107
|
+
case types_1.CalendarViewType.DAY:
|
102
108
|
return dateHelper_1.DateHelper.addDays(selectedDate, increment);
|
103
|
-
case
|
109
|
+
case types_1.CalendarViewType.WEEK:
|
104
110
|
return dateHelper_1.DateHelper.addDays(selectedDate, increment * 7);
|
105
|
-
case
|
111
|
+
case types_1.CalendarViewType.MONTH:
|
106
112
|
return dateHelper_1.DateHelper.addMonths(selectedDate, increment);
|
107
|
-
case
|
113
|
+
case types_1.CalendarViewType.YEAR:
|
108
114
|
return new Date(selectedDate.getFullYear() + increment, selectedDate.getMonth(), selectedDate.getDate());
|
109
115
|
default:
|
110
116
|
return selectedDate;
|
@@ -113,15 +119,15 @@ var Calendar = function (_a) {
|
|
113
119
|
var newDate = getNewDateByViewType(currentViewType);
|
114
120
|
setSelectedDate(newDate);
|
115
121
|
// 새로운 날짜 기준으로 startDate와 endDate 계산
|
116
|
-
var _a = (0,
|
122
|
+
var _a = (0, utils_1.calculateDateRange)(currentViewType, newDate), newStartDate = _a.startDate, newEndDate = _a.endDate;
|
117
123
|
onActionDispatch === null || onActionDispatch === void 0 ? void 0 : onActionDispatch({
|
118
124
|
type: direction === 'prev' ? 'PREV_BUTTON_CLICK' : 'NEXT_BUTTON_CLICK',
|
119
125
|
payload: {
|
120
|
-
startDate: (0,
|
121
|
-
endDate: (0,
|
126
|
+
startDate: (0, utils_1.toUTC)(newStartDate),
|
127
|
+
endDate: (0, utils_1.toUTC)(newEndDate)
|
122
128
|
}
|
123
129
|
});
|
124
|
-
}, [selectedDate, currentViewType, onActionDispatch,
|
130
|
+
}, [selectedDate, currentViewType, onActionDispatch, utils_1.calculateDateRange]);
|
125
131
|
// 특정 날짜의 이벤트 가져오기
|
126
132
|
var getSchedulesForDate = (0, react_1.useCallback)(function (date) {
|
127
133
|
return schedules.filter(function (schedule) {
|
@@ -154,8 +160,8 @@ var Calendar = function (_a) {
|
|
154
160
|
action: 'CLICK_WITH_SHIFT_KEY_DOWN',
|
155
161
|
target: 'DATE',
|
156
162
|
dates: newSelectedDates,
|
157
|
-
startDate: (0,
|
158
|
-
endDate: (0,
|
163
|
+
startDate: (0, utils_1.toUTC)(startDate),
|
164
|
+
endDate: (0, utils_1.toUTC)(endDate)
|
159
165
|
});
|
160
166
|
}
|
161
167
|
setSelectedDate(date);
|
@@ -165,8 +171,8 @@ var Calendar = function (_a) {
|
|
165
171
|
action: 'CLICK',
|
166
172
|
target: 'DATE',
|
167
173
|
date: date,
|
168
|
-
startDate: (0,
|
169
|
-
endDate: (0,
|
174
|
+
startDate: (0, utils_1.toUTC)(startDate),
|
175
|
+
endDate: (0, utils_1.toUTC)(endDate)
|
170
176
|
});
|
171
177
|
}
|
172
178
|
}, [isPastDate, config, lastSelectedDate, selectedDates, startDate, endDate]);
|
@@ -230,8 +236,8 @@ var Calendar = function (_a) {
|
|
230
236
|
action: 'DELETE_KEY_DOWN',
|
231
237
|
target: 'SCHEDULE',
|
232
238
|
schedules: selectedSchedules,
|
233
|
-
startDate: (0,
|
234
|
-
endDate: (0,
|
239
|
+
startDate: (0, utils_1.toUTC)(startDate),
|
240
|
+
endDate: (0, utils_1.toUTC)(endDate)
|
235
241
|
});
|
236
242
|
// 항상 선택된 스케줄들 해제
|
237
243
|
setSelectedSchedules([]);
|
@@ -255,7 +261,7 @@ var Calendar = function (_a) {
|
|
255
261
|
var duration = originalEndDate.getTime() - originalStartDate.getTime();
|
256
262
|
var getAdjustedStartDate = function () {
|
257
263
|
var baseDate = new Date(date);
|
258
|
-
if (currentViewType ===
|
264
|
+
if (currentViewType === types_1.CalendarViewType.MONTH) {
|
259
265
|
var target = e.target;
|
260
266
|
var gridContainer = target.closest('[data-calendar-grid]');
|
261
267
|
if (gridContainer) {
|
@@ -281,8 +287,8 @@ var Calendar = function (_a) {
|
|
281
287
|
action: 'DRAG',
|
282
288
|
target: 'SCHEDULE',
|
283
289
|
schedule: updatedSchedule,
|
284
|
-
startDate: (0,
|
285
|
-
endDate: (0,
|
290
|
+
startDate: (0, utils_1.toUTC)(startDate),
|
291
|
+
endDate: (0, utils_1.toUTC)(endDate)
|
286
292
|
});
|
287
293
|
setIsDragOverDate(null);
|
288
294
|
}, [draggedSchedule, config, currentViewType]);
|
@@ -295,18 +301,26 @@ var Calendar = function (_a) {
|
|
295
301
|
t('str_3891'),
|
296
302
|
t('str_3892') // 토 - 6
|
297
303
|
]; }, [t]);
|
298
|
-
// 날짜의 실제 요일에 따른 요일 텍스트 가져오기
|
299
304
|
var getDayTextByDate = function (date) {
|
300
305
|
return defaultDayTexts[date.getDay()];
|
301
306
|
};
|
302
|
-
|
307
|
+
var getTranslationKey = function (viewType) {
|
308
|
+
var _a;
|
309
|
+
var _b;
|
310
|
+
var TRANSLATION_KEYS = (_a = {},
|
311
|
+
_a[types_1.CalendarViewType.MONTH] = 'str_fm_month',
|
312
|
+
_a[types_1.CalendarViewType.WEEK] = 'str_fm_week',
|
313
|
+
_a[types_1.CalendarViewType.DAY] = 'str_fm_day',
|
314
|
+
_a[types_1.CalendarViewType.YEAR] = 'str_fm_year',
|
315
|
+
_a);
|
316
|
+
return (_b = TRANSLATION_KEYS[viewType]) !== null && _b !== void 0 ? _b : 'str_fm_month';
|
317
|
+
};
|
303
318
|
var viewTypeOptions = (0, react_1.useMemo)(function () {
|
304
319
|
return viewTypes.map(function (viewType) { return ({
|
305
|
-
text: t(viewType),
|
320
|
+
text: t(getTranslationKey(viewType)),
|
306
321
|
value: viewType
|
307
322
|
}); });
|
308
323
|
}, [viewTypes, t]);
|
309
|
-
// 특정 월의 캘린더 날짜 생성 (연간 보기용)
|
310
324
|
var getMonthDates = (0, react_1.useCallback)(function (year, month) {
|
311
325
|
var monthDate = new Date(year, month, 1);
|
312
326
|
return dateHelper_1.DateHelper.getCalendarDates(monthDate, startOfWeek);
|
@@ -326,8 +340,8 @@ var Calendar = function (_a) {
|
|
326
340
|
action: 'CLICK_WITH_SHIFT_KEY_DOWN',
|
327
341
|
target: 'SCHEDULE',
|
328
342
|
schedules: newSelectedSchedules,
|
329
|
-
startDate: (0,
|
330
|
-
endDate: (0,
|
343
|
+
startDate: (0, utils_1.toUTC)(startDate),
|
344
|
+
endDate: (0, utils_1.toUTC)(endDate)
|
331
345
|
});
|
332
346
|
return;
|
333
347
|
}
|
@@ -338,65 +352,48 @@ var Calendar = function (_a) {
|
|
338
352
|
action: 'CLICK',
|
339
353
|
target: 'SCHEDULE',
|
340
354
|
schedule: schedule,
|
341
|
-
startDate: (0,
|
342
|
-
endDate: (0,
|
355
|
+
startDate: (0, utils_1.toUTC)(startDate),
|
356
|
+
endDate: (0, utils_1.toUTC)(endDate)
|
343
357
|
});
|
344
358
|
return;
|
345
359
|
}
|
346
360
|
};
|
347
361
|
// 주간 뷰로 전환하는 핸들러
|
348
362
|
var handleSwitchToWeeklyView = (0, react_1.useCallback)(function (date) {
|
349
|
-
setCurrentViewType(
|
363
|
+
setCurrentViewType(types_1.CalendarViewType.WEEK);
|
350
364
|
setSelectedDate(date);
|
351
365
|
// 주간 뷰로 전환할 때의 startDate와 endDate 계산
|
352
|
-
var _a = (0,
|
366
|
+
var _a = (0, utils_1.calculateDateRange)(types_1.CalendarViewType.WEEK, date), newStartDate = _a.startDate, newEndDate = _a.endDate;
|
353
367
|
onActionDispatch === null || onActionDispatch === void 0 ? void 0 : onActionDispatch({
|
354
368
|
type: 'CALENDAR_TYPE_CHANGE',
|
355
369
|
payload: {
|
356
|
-
type:
|
357
|
-
startDate: (0,
|
358
|
-
endDate: (0,
|
370
|
+
type: types_1.CalendarViewType.WEEK,
|
371
|
+
startDate: (0, utils_1.toUTC)(newStartDate),
|
372
|
+
endDate: (0, utils_1.toUTC)(newEndDate)
|
359
373
|
}
|
360
374
|
});
|
361
|
-
}, [onActionDispatch,
|
362
|
-
var getMonthStringKey = function (monthNumber) {
|
363
|
-
var monthKeys = [
|
364
|
-
'str_month_january',
|
365
|
-
'str_month_february',
|
366
|
-
'str_month_march',
|
367
|
-
'str_month_april',
|
368
|
-
'str_month_may',
|
369
|
-
'str_month_june',
|
370
|
-
'str_month_july',
|
371
|
-
'str_month_august',
|
372
|
-
'str_month_september',
|
373
|
-
'str_month_october',
|
374
|
-
'str_month_november',
|
375
|
-
'str_month_december'
|
376
|
-
];
|
377
|
-
return monthKeys[monthNumber - 1];
|
378
|
-
};
|
375
|
+
}, [onActionDispatch, utils_1.calculateDateRange]);
|
379
376
|
var getHeaderText = function (viewType, selectedDate) {
|
380
377
|
var year = selectedDate.getFullYear();
|
381
378
|
var monthNumber = selectedDate.getMonth() + 1;
|
382
379
|
var day = selectedDate.getDate();
|
383
380
|
var locale = (0, constants_1.getLocaleFromLang)(i18n.language);
|
384
|
-
if (viewType ===
|
381
|
+
if (viewType === types_1.CalendarViewType.DAY) {
|
385
382
|
return t('str_calendar_daily_header', { year: year, month: monthNumber, day: day });
|
386
383
|
}
|
387
|
-
if (viewType ===
|
384
|
+
if (viewType === types_1.CalendarViewType.WEEK) {
|
388
385
|
return t('str_calendar_weekly_header', {
|
389
386
|
year: year,
|
390
|
-
month: locale === 'en-US' ? t(getMonthStringKey(monthNumber)) : monthNumber
|
387
|
+
month: locale === 'en-US' ? t((0, constants_1.getMonthStringKey)(monthNumber)) : monthNumber
|
391
388
|
});
|
392
389
|
}
|
393
|
-
if (viewType ===
|
390
|
+
if (viewType === types_1.CalendarViewType.MONTH) {
|
394
391
|
return t('str_calendar_monthly_header', {
|
395
392
|
year: year,
|
396
|
-
month: locale === 'en-US' ? t(getMonthStringKey(monthNumber)) : monthNumber
|
393
|
+
month: locale === 'en-US' ? t((0, constants_1.getMonthStringKey)(monthNumber)) : monthNumber
|
397
394
|
});
|
398
395
|
}
|
399
|
-
if (viewType ===
|
396
|
+
if (viewType === types_1.CalendarViewType.YEAR) {
|
400
397
|
return t('str_calendar_yearly_header', { year: year });
|
401
398
|
}
|
402
399
|
return '';
|
@@ -404,13 +401,13 @@ var Calendar = function (_a) {
|
|
404
401
|
// 뷰 타입에 따른 캘린더 콘텐츠 렌더링
|
405
402
|
var renderCalendarContent = function () {
|
406
403
|
switch (currentViewType) {
|
407
|
-
case
|
404
|
+
case types_1.CalendarViewType.MONTH:
|
408
405
|
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 }));
|
409
|
-
case
|
406
|
+
case types_1.CalendarViewType.WEEK:
|
410
407
|
return (0, jsx_runtime_1.jsx)(WeeklyView_1.WeeklyView, { startOfWeek: startOfWeek, schedules: schedules, config: config });
|
411
|
-
case
|
408
|
+
case types_1.CalendarViewType.DAY:
|
412
409
|
return (0, jsx_runtime_1.jsx)(DailyView_1.DailyView, { schedules: schedules, config: config });
|
413
|
-
case
|
410
|
+
case types_1.CalendarViewType.YEAR:
|
414
411
|
return ((0, jsx_runtime_1.jsx)(YearlyView_1.YearlyView, { selectedDate: selectedDate, getMonthDates: getMonthDates, getDayTextByDate: getDayTextByDate, startOfWeek: startOfWeek, isToday: isToday, handleDateClick: handleDateClick, getSchedulesForDate: getSchedulesForDate }));
|
415
412
|
default:
|
416
413
|
return null;
|
@@ -9,24 +9,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
10
|
exports.CurrentTimeIndicator = void 0;
|
11
11
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
12
|
-
var i18next_1 = __importDefault(require("i18next"));
|
13
12
|
var react_1 = require("react");
|
14
|
-
var react_i18next_1 = require("react-i18next");
|
15
13
|
var styled_components_1 = __importDefault(require("styled-components"));
|
16
|
-
var constants_1 = require("./constants");
|
17
14
|
var CurrentTimeIndicator = function (_a) {
|
18
15
|
var show = _a.show, _b = _a.leftOffset, leftOffset = _b === void 0 ? '80px' : _b;
|
19
|
-
var i18n = (0, react_i18next_1.useTranslation)('translation').i18n;
|
20
16
|
var getCurrentTime = (0, react_1.useCallback)(function () {
|
21
|
-
var
|
22
|
-
var
|
23
|
-
var
|
17
|
+
var timeInTimezone = new Date();
|
18
|
+
var hour = timeInTimezone.getHours();
|
19
|
+
var minute = timeInTimezone.getMinutes();
|
20
|
+
// 절대 위치 계산 (각 시간 슬롯이 60px 높이)
|
21
|
+
var pixelPosition = hour * 60 + (minute / 60) * 60;
|
24
22
|
return {
|
25
|
-
hour:
|
26
|
-
minute:
|
27
|
-
|
23
|
+
hour: hour,
|
24
|
+
minute: minute,
|
25
|
+
pixelPosition: pixelPosition
|
28
26
|
};
|
29
|
-
}, [
|
27
|
+
}, []);
|
30
28
|
var _c = (0, react_1.useState)(getCurrentTime()), currentTime = _c[0], setCurrentTime = _c[1];
|
31
29
|
(0, react_1.useEffect)(function () {
|
32
30
|
var updateTime = function () {
|
@@ -36,7 +34,7 @@ var CurrentTimeIndicator = function (_a) {
|
|
36
34
|
var interval = setInterval(updateTime, 60000);
|
37
35
|
return function () { return clearInterval(interval); };
|
38
36
|
}, [getCurrentTime]);
|
39
|
-
return ((0, jsx_runtime_1.jsx)(S_CurrentTimeIndicator, { "$show": show, "$top": "".concat(currentTime.
|
37
|
+
return ((0, jsx_runtime_1.jsx)(S_CurrentTimeIndicator, { "$show": show, "$top": "".concat(currentTime.pixelPosition, "px"), "$leftOffset": leftOffset }));
|
40
38
|
};
|
41
39
|
exports.CurrentTimeIndicator = CurrentTimeIndicator;
|
42
40
|
var S_CurrentTimeIndicator = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: ", ";\n display: ", ";\n height: 2px;\n left: ", ";\n position: absolute;\n right: 0;\n top: ", ";\n z-index: 10;\n\n &::before {\n background: ", ";\n border-radius: 50%;\n content: '';\n height: 8px;\n left: -4px;\n position: absolute;\n top: -3px;\n width: 8px;\n }\n"], ["\n background: ", ";\n display: ", ";\n height: 2px;\n left: ", ";\n position: absolute;\n right: 0;\n top: ", ";\n z-index: 10;\n\n &::before {\n background: ", ";\n border-radius: 50%;\n content: '';\n height: 8px;\n left: -4px;\n position: absolute;\n top: -3px;\n width: 8px;\n }\n"])), function (_a) {
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import
|
2
|
-
import type
|
1
|
+
import React from 'react';
|
2
|
+
import type { displayAllDayScheduleMode, Schedule } from '../../types/types';
|
3
3
|
interface AllDaySchedulesSectionProps {
|
4
4
|
calendarDates: Date[];
|
5
|
-
displayAllDayScheduleMode
|
5
|
+
displayAllDayScheduleMode: displayAllDayScheduleMode;
|
6
6
|
getSchedulesForDate: (date: Date) => Schedule[];
|
7
7
|
handleDateDragOver: (date: Date, e: React.DragEvent) => void;
|
8
8
|
handleDateDragLeave: () => void;
|
@@ -20,25 +20,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
21
21
|
exports.AllDaySchedulesSection = void 0;
|
22
22
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
23
|
-
var react_1 = require("react");
|
23
|
+
var react_1 = __importDefault(require("react"));
|
24
24
|
var react_i18next_1 = require("react-i18next");
|
25
25
|
var styled_components_1 = __importDefault(require("styled-components"));
|
26
|
-
var TextLabel_1 = require("
|
27
|
-
var CalendarContext_1 = require("
|
28
|
-
var
|
26
|
+
var TextLabel_1 = require("../../../TextLabel");
|
27
|
+
var CalendarContext_1 = require("../../context/CalendarContext");
|
28
|
+
var ScheduleItem_1 = require("./ScheduleItem");
|
29
29
|
var AllDaySchedulesSection = function (_a) {
|
30
|
-
var calendarDates = _a.calendarDates,
|
30
|
+
var calendarDates = _a.calendarDates, displayAllDayScheduleMode = _a.displayAllDayScheduleMode, getSchedulesForDate = _a.getSchedulesForDate, handleDateDragOver = _a.handleDateDragOver, handleDateDragLeave = _a.handleDateDragLeave, handleDateDrop = _a.handleDateDrop;
|
31
31
|
var t = (0, react_i18next_1.useTranslation)().t;
|
32
|
-
var
|
32
|
+
var _b = (0, CalendarContext_1.useCalendarContext)(), selectedSchedules = _b.selectedSchedules, isDraggable = _b.isDraggable, handleScheduleClick = _b.handleScheduleClick, handleScheduleDragStart = _b.handleScheduleDragStart, handleScheduleDragEnd = _b.handleScheduleDragEnd, calculateIsAllDay = _b.calculateIsAllDay;
|
33
33
|
// 다중 날짜 종일 이벤트 계산
|
34
|
-
var multiDayAllDaySchedules =
|
34
|
+
var multiDayAllDaySchedules = react_1.default.useMemo(function () {
|
35
35
|
var allSchedules = new Map();
|
36
36
|
var multiDaySchedules = [];
|
37
37
|
// 모든 종일 이벤트 수집
|
38
38
|
calendarDates.forEach(function (date) {
|
39
39
|
var schedulesForDate = getSchedulesForDate(date);
|
40
40
|
schedulesForDate.forEach(function (schedule) {
|
41
|
-
if (!
|
41
|
+
if (!calculateIsAllDay(new Date(schedule.startDate), new Date(schedule.endDate))) {
|
42
42
|
return;
|
43
43
|
}
|
44
44
|
var scheduleStart = new Date(schedule.startDate);
|
@@ -101,10 +101,16 @@ var AllDaySchedulesSection = function (_a) {
|
|
101
101
|
if (displayAllDayScheduleMode === 'none') {
|
102
102
|
return null;
|
103
103
|
}
|
104
|
+
var renderScheduleItem = function (schedule, extraProps) {
|
105
|
+
if (extraProps === void 0) { extraProps = {}; }
|
106
|
+
var isAllDay = calculateIsAllDay(new Date(schedule.startDate), new Date(schedule.endDate));
|
107
|
+
var isSelected = selectedSchedules.some(function (s) { return s.id === schedule.id; });
|
108
|
+
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 }, schedule.id));
|
109
|
+
};
|
104
110
|
return ((0, jsx_runtime_1.jsxs)(S_WeeklyAllDaySection, __assign({ "$rowCount": Math.max(1, multiDayAllDaySchedules.length) }, { children: [(0, jsx_runtime_1.jsx)(S_AllDayLabel, { children: (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { styleTheme: "caption1Regular", colorTheme: "sysTextTertiary", text: t('calendar_all_day') }) }), (0, jsx_runtime_1.jsx)(S_WeeklyAllDayGrid, { children: calendarDates.map(function (date, index) {
|
105
111
|
// 단일 날짜 종일 이벤트만 표시
|
106
112
|
var singleDayAllDaySchedules = getSchedulesForDate(date).filter(function (schedule) {
|
107
|
-
var isAllDay =
|
113
|
+
var isAllDay = calculateIsAllDay(new Date(schedule.startDate), new Date(schedule.endDate));
|
108
114
|
if (!isAllDay)
|
109
115
|
return false;
|
110
116
|
var scheduleStart = new Date(schedule.startDate);
|
@@ -30,10 +30,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.MultiWeekSchedulesLayer = void 0;
|
31
31
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
32
32
|
var react_1 = require("react");
|
33
|
-
var useParentResizeObserver_1 = require("
|
34
|
-
var useWindowSize_1 = require("
|
33
|
+
var useParentResizeObserver_1 = require("../../../../../common/hooks/useParentResizeObserver");
|
34
|
+
var useWindowSize_1 = require("../../../../../common/hooks/useWindowSize");
|
35
35
|
var styled_components_1 = __importDefault(require("styled-components"));
|
36
|
-
var TextLabel_1 = require("
|
36
|
+
var TextLabel_1 = require("../../../TextLabel");
|
37
37
|
var ScheduleItem_1 = require("./ScheduleItem");
|
38
38
|
var MultiWeekSchedulesLayer = function (_a) {
|
39
39
|
var multiWeekSchedules = _a.multiWeekSchedules, selectedSchedules = _a.selectedSchedules, handleScheduleClick = _a.handleScheduleClick, handleScheduleDragStart = _a.handleScheduleDragStart, handleScheduleDragEnd = _a.handleScheduleDragEnd, _b = _a.isDraggable, isDraggable = _b === void 0 ? false : _b, _c = _a.maxSchedulesPerDay, maxSchedulesPerDay = _c === void 0 ? 3 : _c;
|
package/dist/src/desktop/components/Calendar/{ScheduleItem.js → components/Schedule/ScheduleItem.js}
RENAMED
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.S_Dot = exports.ScheduleItem = void 0;
|
22
22
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
23
23
|
var styled_components_1 = __importDefault(require("styled-components"));
|
24
|
-
var TextLabel_1 = require("
|
24
|
+
var TextLabel_1 = require("../../../TextLabel");
|
25
25
|
var ScheduleItem = function (_a) {
|
26
26
|
var schedule = _a.schedule, _b = _a.extraProps, extraProps = _b === void 0 ? {} : _b, onDragStart = _a.onDragStart, onDragEnd = _a.onDragEnd, onClick = _a.onClick, _c = _a.isSelected, isSelected = _c === void 0 ? false : _c, _d = _a.isAllDay, isAllDay = _d === void 0 ? false : _d, _e = _a.isDraggable, isDraggable = _e === void 0 ? false : _e;
|
27
27
|
return ((0, jsx_runtime_1.jsxs)(S_ScheduleItem, __assign({ "$color": schedule.color, "$position": "single", "$isSelected": isSelected, "$isAllday": isAllDay, "$isDraggable": isDraggable, draggable: isDraggable, onDragStart: isDraggable ? function (e) { return onDragStart(schedule, e); } : undefined, onDragEnd: isDraggable ? onDragEnd : undefined, onClick: function (e) {
|
@@ -32,15 +32,14 @@ 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
34
|
var styled_components_1 = __importDefault(require("styled-components"));
|
35
|
-
var TextLabel_1 = require("
|
36
|
-
var
|
37
|
-
var timeFormatUtils_1 = require("./timeFormatUtils");
|
35
|
+
var TextLabel_1 = require("../../../TextLabel");
|
36
|
+
var utils_1 = require("../../utils");
|
38
37
|
var TimeBasedScheduleItem = function (_a) {
|
39
38
|
var schedules = _a.schedules, selectedSchedules = _a.selectedSchedules, _b = _a.isDraggable, isDraggable = _b === void 0 ? false : _b, onClick = _a.onClick, handleScheduleDragStart = _a.handleScheduleDragStart, handleScheduleDragEnd = _a.handleScheduleDragEnd;
|
40
39
|
var _c = (0, react_i18next_1.useTranslation)('translation'), i18n = _c.i18n, t = _c.t;
|
41
40
|
// 시간별 스케줄 계산 및 grid 위치 할당
|
42
41
|
var timedSchedulesWithGrid = (0, react_1.useMemo)(function () {
|
43
|
-
var filteredSchedules = schedules.filter(function (schedule) { return !(0,
|
42
|
+
var filteredSchedules = schedules.filter(function (schedule) { return !(0, utils_1.calculateIsAllDay)(new Date(schedule.startDate), new Date(schedule.endDate)); });
|
44
43
|
// 시간 순으로 정렬 (시작 시간 기준, 시작시간이 같으면 duration이 짧은 순)
|
45
44
|
var sortedSchedules = __spreadArray([], filteredSchedules, true).sort(function (a, b) {
|
46
45
|
var startTimeA = new Date(a.startDate).getTime();
|
@@ -142,7 +141,7 @@ var TimeBasedScheduleItem = function (_a) {
|
|
142
141
|
return ((0, jsx_runtime_1.jsx)(S_ScheduleItem, __assign({ "$top": top, "$height": height, "$gridColumn": schedule.gridColumn, "$totalColumns": schedule.totalColumns, "$isSelected": isSelected, "$isDraggable": isDraggable, draggable: isDraggable, onClick: function (e) {
|
143
142
|
e.stopPropagation();
|
144
143
|
onClick === null || onClick === void 0 ? void 0 : onClick(schedule, e);
|
145
|
-
}, onDragStart: function (e) { return handleScheduleDragStart === null || handleScheduleDragStart === void 0 ? void 0 : handleScheduleDragStart(schedule, e); }, onDragEnd: function () { return handleScheduleDragEnd === null || handleScheduleDragEnd === void 0 ? void 0 : handleScheduleDragEnd(); } }, { children: (0, jsx_runtime_1.jsxs)(S_ScheduleContent, { children: [(0, jsx_runtime_1.jsx)(S_ScheduleTime, { children: (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { styleTheme: "caption2Regular", text: "".concat((0,
|
144
|
+
}, onDragStart: function (e) { return handleScheduleDragStart === null || handleScheduleDragStart === void 0 ? void 0 : handleScheduleDragStart(schedule, e); }, onDragEnd: function () { return handleScheduleDragEnd === null || handleScheduleDragEnd === void 0 ? void 0 : handleScheduleDragEnd(); } }, { children: (0, jsx_runtime_1.jsxs)(S_ScheduleContent, { children: [(0, jsx_runtime_1.jsx)(S_ScheduleTime, { children: (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { styleTheme: "caption2Regular", text: "".concat((0, utils_1.formatTimeWithLocale)(localStartHour, localStartMinutes, i18n.language, t)), ellipsisMode: "use", singleLineMode: "use", colorTheme: isSelected ? 'sysTextWhite' : undefined }) }), (0, jsx_runtime_1.jsx)(S_ScheduleTitle, { children: (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { styleTheme: "caption2Bold", text: schedule.title, ellipsisMode: "use", singleLineMode: "use", colorTheme: isSelected ? 'sysTextWhite' : undefined }) })] }) }), schedule.id));
|
146
145
|
}) }));
|
147
146
|
};
|
148
147
|
exports.TimeBasedScheduleItem = TimeBasedScheduleItem;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.AllDaySchedulesSection = exports.TimeBasedScheduleItem = exports.ScheduleItem = exports.MultiWeekSchedulesLayer = void 0;
|
4
|
+
var MultiWeekSchedulesLayer_1 = require("./MultiWeekSchedulesLayer");
|
5
|
+
Object.defineProperty(exports, "MultiWeekSchedulesLayer", { enumerable: true, get: function () { return MultiWeekSchedulesLayer_1.MultiWeekSchedulesLayer; } });
|
6
|
+
var ScheduleItem_1 = require("./ScheduleItem");
|
7
|
+
Object.defineProperty(exports, "ScheduleItem", { enumerable: true, get: function () { return ScheduleItem_1.ScheduleItem; } });
|
8
|
+
var TimeBasedScheduleItem_1 = require("./TimeBasedScheduleItem");
|
9
|
+
Object.defineProperty(exports, "TimeBasedScheduleItem", { enumerable: true, get: function () { return TimeBasedScheduleItem_1.TimeBasedScheduleItem; } });
|
10
|
+
var AllDaySchedulesSection_1 = require("./AllDaySchedulesSection");
|
11
|
+
Object.defineProperty(exports, "AllDaySchedulesSection", { enumerable: true, get: function () { return AllDaySchedulesSection_1.AllDaySchedulesSection; } });
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getLocaleFromLang = void 0;
|
3
|
+
exports.getMonthStringKey = exports.getLocaleFromLang = void 0;
|
4
4
|
// Map language codes to locales for toLocaleString
|
5
5
|
var getLocaleFromLang = function (lang) {
|
6
6
|
switch (lang === null || lang === void 0 ? void 0 : lang.toLowerCase()) {
|
@@ -29,3 +29,21 @@ var getLocaleFromLang = function (lang) {
|
|
29
29
|
}
|
30
30
|
};
|
31
31
|
exports.getLocaleFromLang = getLocaleFromLang;
|
32
|
+
var getMonthStringKey = function (monthNumber) {
|
33
|
+
var monthKeys = [
|
34
|
+
'str_month_january',
|
35
|
+
'str_month_february',
|
36
|
+
'str_month_march',
|
37
|
+
'str_month_april',
|
38
|
+
'str_month_may',
|
39
|
+
'str_month_june',
|
40
|
+
'str_month_july',
|
41
|
+
'str_month_august',
|
42
|
+
'str_month_september',
|
43
|
+
'str_month_october',
|
44
|
+
'str_month_november',
|
45
|
+
'str_month_december'
|
46
|
+
];
|
47
|
+
return monthKeys[monthNumber - 1];
|
48
|
+
};
|
49
|
+
exports.getMonthStringKey = getMonthStringKey;
|
package/dist/src/desktop/components/Calendar/{CalendarContext.d.ts → context/CalendarContext.d.ts}
RENAMED
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import type { Schedule, displayAllDayScheduleMode, Action } from '
|
2
|
+
import type { Schedule, displayAllDayScheduleMode, Action } from '../types/types';
|
3
3
|
export interface ScheduleItemExtraProps {
|
4
4
|
onDragStart?: (e: React.DragEvent) => void;
|
5
5
|
onDragEnd?: () => void;
|
@@ -9,7 +9,6 @@ export interface ScheduleItemExtraProps {
|
|
9
9
|
[key: string]: unknown;
|
10
10
|
}
|
11
11
|
interface CalendarContextValue {
|
12
|
-
renderScheduleItem: (schedule: Schedule, extraProps?: ScheduleItemExtraProps) => React.ReactNode;
|
13
12
|
handleScheduleClick: (schedule: Schedule, e?: React.MouseEvent) => void;
|
14
13
|
handleScheduleDragStart: (schedule: Schedule, e: React.DragEvent) => void;
|
15
14
|
handleScheduleDragEnd: () => void;
|
@@ -22,6 +21,7 @@ interface CalendarContextValue {
|
|
22
21
|
isToday: (date: Date) => boolean;
|
23
22
|
isPastDate: (date: Date) => boolean;
|
24
23
|
getDayTextByDate: (date: Date) => string;
|
24
|
+
calculateIsAllDay: (startDate: Date, endDate: Date) => boolean;
|
25
25
|
selectedSchedules: Schedule[];
|
26
26
|
isDragOverDate: Date | null;
|
27
27
|
selectedDate: Date;
|