react-schedule-picker 1.0.0
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/LICENSE +21 -0
- package/README.md +268 -0
- package/dist/index.css +253 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +196 -0
- package/dist/index.d.ts +196 -0
- package/dist/index.js +956 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +906 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +68 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type LocaleKey = "en" | "en-US" | "ko" | "ja" | "zh-CN" | "zh-TW";
|
|
4
|
+
type WeekStartsOn = "mon" | "sun" | "sat";
|
|
5
|
+
interface Messages {
|
|
6
|
+
clear: string;
|
|
7
|
+
noSelection: string;
|
|
8
|
+
presets: {
|
|
9
|
+
weekdayDay: string;
|
|
10
|
+
weekdayNight: string;
|
|
11
|
+
weekendDay: string;
|
|
12
|
+
weekendNight: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** 요일별 CSS color. "none" = 강조 없음 */
|
|
16
|
+
type WeekendHighlight = Record<string, string> | "none";
|
|
17
|
+
interface LocalePreset {
|
|
18
|
+
messages: Messages;
|
|
19
|
+
weekStartsOn: WeekStartsOn;
|
|
20
|
+
weekendHighlight: WeekendHighlight;
|
|
21
|
+
formatHour: (hour: number) => string;
|
|
22
|
+
dayLabels: Record<string, string>;
|
|
23
|
+
}
|
|
24
|
+
/** resolveLocaleConfig 결과 — 컴포넌트가 실제 사용하는 값 */
|
|
25
|
+
interface ResolvedLocaleConfig {
|
|
26
|
+
messages: Messages;
|
|
27
|
+
weekStartsOn: WeekStartsOn;
|
|
28
|
+
weekendHighlight: Record<string, string>;
|
|
29
|
+
formatHour: (hour: number) => string;
|
|
30
|
+
dayLabels: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
declare const LOCALE_PRESETS: Record<LocaleKey, LocalePreset>;
|
|
33
|
+
interface ResolveLocaleInput {
|
|
34
|
+
locale?: LocaleKey;
|
|
35
|
+
messages?: Partial<Messages>;
|
|
36
|
+
weekStartsOn?: WeekStartsOn;
|
|
37
|
+
weekendHighlight?: WeekendHighlight;
|
|
38
|
+
}
|
|
39
|
+
declare function resolveLocaleConfig(input?: ResolveLocaleInput): ResolvedLocaleConfig;
|
|
40
|
+
declare function rotateDays(weekStartsOn: WeekStartsOn): string[];
|
|
41
|
+
declare function getDefaultPresets(messages: Messages): Preset[];
|
|
42
|
+
|
|
43
|
+
/** 주간 스케줄 데이터: 요일 키 → 슬롯 배열 */
|
|
44
|
+
type Schedule = Record<string, number[]>;
|
|
45
|
+
/** 프리셋 정의 */
|
|
46
|
+
interface Preset {
|
|
47
|
+
label: string;
|
|
48
|
+
days: string[];
|
|
49
|
+
hours: number[];
|
|
50
|
+
}
|
|
51
|
+
/** SchedulePicker Props */
|
|
52
|
+
interface SchedulePickerProps {
|
|
53
|
+
/** 현재 스케줄 값 (controlled) */
|
|
54
|
+
value: Schedule;
|
|
55
|
+
/** 스케줄 변경 핸들러 */
|
|
56
|
+
onChange: (schedule: Schedule) => void;
|
|
57
|
+
/** 드래그 완료 시 호출되는 콜백 */
|
|
58
|
+
onSelectEnd?: (schedule: Schedule) => void;
|
|
59
|
+
/** 프리셋 버튼 목록. 미제공 시 내장 프리셋 4종 사용. 빈 배열이면 프리셋 숨김 */
|
|
60
|
+
presets?: Preset[];
|
|
61
|
+
/** 프리셋 툴바 숨김 */
|
|
62
|
+
hideToolbar?: boolean;
|
|
63
|
+
/** 읽기 전용 모드 */
|
|
64
|
+
readOnly?: boolean;
|
|
65
|
+
/** 비활성화 모드 */
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
/** 표시할 최소 시간 (기본: 0) */
|
|
68
|
+
minHour?: number;
|
|
69
|
+
/** 표시할 최대 시간 (기본: 23) */
|
|
70
|
+
maxHour?: number;
|
|
71
|
+
/** 표시할 요일 및 순서 (기본: ["mon","tue","wed","thu","fri","sat","sun"]) */
|
|
72
|
+
visibleDays?: string[];
|
|
73
|
+
/** 요일 라벨 */
|
|
74
|
+
dayLabels?: Record<string, string>;
|
|
75
|
+
/** 요일 축 방향: "x"면 요일이 열, "y"면 요일이 행 (기본: "x") */
|
|
76
|
+
dayAxis?: "x" | "y";
|
|
77
|
+
/** 시간 라벨을 압축해서 표시. true면 3의 배수만 숫자, 나머지는 · (기본: false) */
|
|
78
|
+
compactHourLabels?: boolean;
|
|
79
|
+
/** 시간 라벨 포맷 함수. compactHourLabels보다 우선 적용 */
|
|
80
|
+
formatHour?: (hour: number) => string;
|
|
81
|
+
/** 선택 불가 슬롯. Schedule과 동일한 형태 */
|
|
82
|
+
disabledSlots?: Schedule;
|
|
83
|
+
/** 최외곽 className 추가 */
|
|
84
|
+
className?: string;
|
|
85
|
+
/** 로케일 프리셋 키. 기본값 "en" */
|
|
86
|
+
locale?: LocaleKey;
|
|
87
|
+
/** locale 프리셋 위에 개별 메시지 덮어쓰기 */
|
|
88
|
+
messages?: Partial<Messages>;
|
|
89
|
+
/** 주 시작일. locale 기본값 대신 강제 지정 */
|
|
90
|
+
weekStartsOn?: WeekStartsOn;
|
|
91
|
+
/** 요일별 강조 색상 (CSS color). "none"이면 강조 없음 */
|
|
92
|
+
weekendHighlight?: WeekendHighlight;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
declare function SchedulePicker({ value, onChange, onSelectEnd, presets: presetsProp, hideToolbar, readOnly, disabled, minHour, maxHour, visibleDays: visibleDaysProp, dayLabels: dayLabelsProp, dayAxis, compactHourLabels, formatHour, disabledSlots, className, locale, messages, weekStartsOn, weekendHighlight, }: SchedulePickerProps): react_jsx_runtime.JSX.Element;
|
|
96
|
+
|
|
97
|
+
/** 요일 표시 순서: 월~일 */
|
|
98
|
+
declare const DAY_ORDER: readonly ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
99
|
+
/** 기본 요일 라벨 (영어) */
|
|
100
|
+
declare const DAY_LABELS: Record<string, string>;
|
|
101
|
+
/** 0~23 시간 배열 */
|
|
102
|
+
declare const HOURS: number[];
|
|
103
|
+
/**
|
|
104
|
+
* 내장 프리셋 4종 (영어 라벨 고정).
|
|
105
|
+
* @deprecated v1.1+ — 로케일 기반 번역된 프리셋을 얻으려면 `getDefaultPresets(messages)`
|
|
106
|
+
* 또는 `<SchedulePicker locale="..." />`를 사용하세요. 이 상수는 하위호환 목적으로만 유지됩니다.
|
|
107
|
+
*/
|
|
108
|
+
declare const DEFAULT_PRESETS: Preset[];
|
|
109
|
+
|
|
110
|
+
/** hourlyChunks에 따른 슬롯 배열 생성 */
|
|
111
|
+
declare function generateSlots(minHour: number, maxHour: number, hourlyChunks: number): number[];
|
|
112
|
+
/** 슬롯 값을 시간 문자열로 변환 (예: 9.5 → "9:30") */
|
|
113
|
+
declare function slotToTimeString(slot: number): string;
|
|
114
|
+
/** 특정 요일-슬롯이 선택되었는지 확인 */
|
|
115
|
+
declare function hasHour(schedule: Schedule, day: string, hour: number): boolean;
|
|
116
|
+
/** 특정 요일-슬롯이 disabled인지 확인 */
|
|
117
|
+
declare function isSlotDisabled(disabledSlots: Schedule | undefined, day: string, hour: number): boolean;
|
|
118
|
+
/** 특정 요일-슬롯을 선택/해제한 새 Schedule 반환 */
|
|
119
|
+
declare function toggleHour(schedule: Schedule, day: string, hour: number, selected: boolean): Schedule;
|
|
120
|
+
/** 시작점~끝점 사각형 영역을 일괄 선택/해제한 새 Schedule 반환 */
|
|
121
|
+
declare function applyRect(base: Schedule, visibleDays: readonly string[], startDayIdx: number, startHour: number, endDayIdx: number, endHour: number, selected: boolean, slots: number[], maxSelections?: number, disabledSlots?: Schedule): Schedule;
|
|
122
|
+
/** 시간 헤더 포맷: 3의 배수는 숫자, 나머지는 "·" */
|
|
123
|
+
declare function formatHourHeader(hour: number): string;
|
|
124
|
+
/** 선택된 총 슬롯 수 계산 */
|
|
125
|
+
declare function countSelectedHours(schedule: Schedule): number;
|
|
126
|
+
/** 모든 시간이 선택되었는지 확인 */
|
|
127
|
+
declare function isAllSelected(schedule: Schedule, visibleDays?: readonly string[]): boolean;
|
|
128
|
+
/** 선택된 스케줄을 사람이 읽기 쉬운 요약 문자열로 변환 */
|
|
129
|
+
declare function summarizeSchedule(schedule: Schedule, dayLabels?: Record<string, string>, visibleDays?: readonly string[], hourlyChunks?: number, noSelectionLabel?: string): string;
|
|
130
|
+
/** 빈 Schedule 생성 */
|
|
131
|
+
declare function createEmptySchedule(): Schedule;
|
|
132
|
+
/** 모든 시간이 선택된 Schedule 생성 */
|
|
133
|
+
declare function createFullSchedule(visibleDays?: readonly string[]): Schedule;
|
|
134
|
+
|
|
135
|
+
/** ISO 8601 요일 번호 (1=월 ... 7=일) */
|
|
136
|
+
type IsoDayOfWeek = 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
137
|
+
/** 단일 시간 구간 (반-개방 구간: [start, end)) */
|
|
138
|
+
interface TimeRange {
|
|
139
|
+
/** ISO 요일 번호 (1=월 ... 7=일) */
|
|
140
|
+
day: IsoDayOfWeek;
|
|
141
|
+
/** 시작 시각 "HH:mm" (포함) */
|
|
142
|
+
start: string;
|
|
143
|
+
/** 종료 시각 "HH:mm" (제외). 24:00이면 자정 직전까지 */
|
|
144
|
+
end: string;
|
|
145
|
+
}
|
|
146
|
+
/** 구간 기반 직렬화 결과 */
|
|
147
|
+
interface RangesPayload {
|
|
148
|
+
version: 1;
|
|
149
|
+
/** IANA 타임존 (예: "Asia/Seoul"). 없으면 생략 */
|
|
150
|
+
timezone?: string;
|
|
151
|
+
/** 선택된 구간들 */
|
|
152
|
+
ranges: TimeRange[];
|
|
153
|
+
/** 사용자 정의 메타데이터 */
|
|
154
|
+
meta?: Record<string, unknown>;
|
|
155
|
+
}
|
|
156
|
+
/** toRanges 옵션 */
|
|
157
|
+
interface ToRangesOptions {
|
|
158
|
+
timezone?: string;
|
|
159
|
+
meta?: Record<string, unknown>;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Schedule을 구간 기반 포맷으로 변환합니다.
|
|
163
|
+
* - 연속된 시간은 하나의 구간으로 압축됩니다 (예: [9,10,11] → 09:00~12:00).
|
|
164
|
+
* - 요일 키는 ISO 8601 번호(1=월~7=일)로 변환되어 정렬됩니다.
|
|
165
|
+
* - 타임존/메타데이터를 함께 담을 수 있습니다.
|
|
166
|
+
*/
|
|
167
|
+
declare function toRanges(schedule: Schedule, options?: ToRangesOptions): RangesPayload;
|
|
168
|
+
/**
|
|
169
|
+
* 구간 기반 포맷을 Schedule로 역변환합니다.
|
|
170
|
+
* - 1시간 정렬되지 않은 구간(예: 09:30)은 에러를 던집니다.
|
|
171
|
+
* - "24:00"은 자정으로 해석됩니다.
|
|
172
|
+
*/
|
|
173
|
+
declare function fromRanges(payload: RangesPayload): Schedule;
|
|
174
|
+
/** toISO 옵션 */
|
|
175
|
+
interface ToISOOptions {
|
|
176
|
+
timezone?: string;
|
|
177
|
+
meta?: Record<string, unknown>;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Schedule을 ISO 8601 호환 문자열 배열로 직렬화합니다.
|
|
181
|
+
* - 각 항목은 `{day, startTime, endTime, timezone?}` 형태로, 캘린더 시스템에
|
|
182
|
+
* 전달하기 쉬운 형태입니다. (iCalendar BYDAY 규약과 유사)
|
|
183
|
+
* - 주의: 이 출력은 "주간 반복 가용시간"의 표현이며, 특정 날짜가 아닙니다.
|
|
184
|
+
*/
|
|
185
|
+
declare function toISO(schedule: Schedule, options?: ToISOOptions): {
|
|
186
|
+
version: 1;
|
|
187
|
+
timezone?: string;
|
|
188
|
+
availability: Array<{
|
|
189
|
+
day: IsoDayOfWeek;
|
|
190
|
+
startTime: string;
|
|
191
|
+
endTime: string;
|
|
192
|
+
}>;
|
|
193
|
+
meta?: Record<string, unknown>;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export { DAY_LABELS, DAY_ORDER, DEFAULT_PRESETS, HOURS, type IsoDayOfWeek, LOCALE_PRESETS, type LocaleKey, type LocalePreset, type Messages, type Preset, type RangesPayload, type ResolveLocaleInput, type ResolvedLocaleConfig, type Schedule, SchedulePicker, type SchedulePickerProps, type TimeRange, type ToISOOptions, type ToRangesOptions, type WeekStartsOn, type WeekendHighlight, applyRect, countSelectedHours, createEmptySchedule, createFullSchedule, formatHourHeader, fromRanges, generateSlots, getDefaultPresets, hasHour, isAllSelected, isSlotDisabled, resolveLocaleConfig, rotateDays, slotToTimeString, summarizeSchedule, toISO, toRanges, toggleHour };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type LocaleKey = "en" | "en-US" | "ko" | "ja" | "zh-CN" | "zh-TW";
|
|
4
|
+
type WeekStartsOn = "mon" | "sun" | "sat";
|
|
5
|
+
interface Messages {
|
|
6
|
+
clear: string;
|
|
7
|
+
noSelection: string;
|
|
8
|
+
presets: {
|
|
9
|
+
weekdayDay: string;
|
|
10
|
+
weekdayNight: string;
|
|
11
|
+
weekendDay: string;
|
|
12
|
+
weekendNight: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** 요일별 CSS color. "none" = 강조 없음 */
|
|
16
|
+
type WeekendHighlight = Record<string, string> | "none";
|
|
17
|
+
interface LocalePreset {
|
|
18
|
+
messages: Messages;
|
|
19
|
+
weekStartsOn: WeekStartsOn;
|
|
20
|
+
weekendHighlight: WeekendHighlight;
|
|
21
|
+
formatHour: (hour: number) => string;
|
|
22
|
+
dayLabels: Record<string, string>;
|
|
23
|
+
}
|
|
24
|
+
/** resolveLocaleConfig 결과 — 컴포넌트가 실제 사용하는 값 */
|
|
25
|
+
interface ResolvedLocaleConfig {
|
|
26
|
+
messages: Messages;
|
|
27
|
+
weekStartsOn: WeekStartsOn;
|
|
28
|
+
weekendHighlight: Record<string, string>;
|
|
29
|
+
formatHour: (hour: number) => string;
|
|
30
|
+
dayLabels: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
declare const LOCALE_PRESETS: Record<LocaleKey, LocalePreset>;
|
|
33
|
+
interface ResolveLocaleInput {
|
|
34
|
+
locale?: LocaleKey;
|
|
35
|
+
messages?: Partial<Messages>;
|
|
36
|
+
weekStartsOn?: WeekStartsOn;
|
|
37
|
+
weekendHighlight?: WeekendHighlight;
|
|
38
|
+
}
|
|
39
|
+
declare function resolveLocaleConfig(input?: ResolveLocaleInput): ResolvedLocaleConfig;
|
|
40
|
+
declare function rotateDays(weekStartsOn: WeekStartsOn): string[];
|
|
41
|
+
declare function getDefaultPresets(messages: Messages): Preset[];
|
|
42
|
+
|
|
43
|
+
/** 주간 스케줄 데이터: 요일 키 → 슬롯 배열 */
|
|
44
|
+
type Schedule = Record<string, number[]>;
|
|
45
|
+
/** 프리셋 정의 */
|
|
46
|
+
interface Preset {
|
|
47
|
+
label: string;
|
|
48
|
+
days: string[];
|
|
49
|
+
hours: number[];
|
|
50
|
+
}
|
|
51
|
+
/** SchedulePicker Props */
|
|
52
|
+
interface SchedulePickerProps {
|
|
53
|
+
/** 현재 스케줄 값 (controlled) */
|
|
54
|
+
value: Schedule;
|
|
55
|
+
/** 스케줄 변경 핸들러 */
|
|
56
|
+
onChange: (schedule: Schedule) => void;
|
|
57
|
+
/** 드래그 완료 시 호출되는 콜백 */
|
|
58
|
+
onSelectEnd?: (schedule: Schedule) => void;
|
|
59
|
+
/** 프리셋 버튼 목록. 미제공 시 내장 프리셋 4종 사용. 빈 배열이면 프리셋 숨김 */
|
|
60
|
+
presets?: Preset[];
|
|
61
|
+
/** 프리셋 툴바 숨김 */
|
|
62
|
+
hideToolbar?: boolean;
|
|
63
|
+
/** 읽기 전용 모드 */
|
|
64
|
+
readOnly?: boolean;
|
|
65
|
+
/** 비활성화 모드 */
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
/** 표시할 최소 시간 (기본: 0) */
|
|
68
|
+
minHour?: number;
|
|
69
|
+
/** 표시할 최대 시간 (기본: 23) */
|
|
70
|
+
maxHour?: number;
|
|
71
|
+
/** 표시할 요일 및 순서 (기본: ["mon","tue","wed","thu","fri","sat","sun"]) */
|
|
72
|
+
visibleDays?: string[];
|
|
73
|
+
/** 요일 라벨 */
|
|
74
|
+
dayLabels?: Record<string, string>;
|
|
75
|
+
/** 요일 축 방향: "x"면 요일이 열, "y"면 요일이 행 (기본: "x") */
|
|
76
|
+
dayAxis?: "x" | "y";
|
|
77
|
+
/** 시간 라벨을 압축해서 표시. true면 3의 배수만 숫자, 나머지는 · (기본: false) */
|
|
78
|
+
compactHourLabels?: boolean;
|
|
79
|
+
/** 시간 라벨 포맷 함수. compactHourLabels보다 우선 적용 */
|
|
80
|
+
formatHour?: (hour: number) => string;
|
|
81
|
+
/** 선택 불가 슬롯. Schedule과 동일한 형태 */
|
|
82
|
+
disabledSlots?: Schedule;
|
|
83
|
+
/** 최외곽 className 추가 */
|
|
84
|
+
className?: string;
|
|
85
|
+
/** 로케일 프리셋 키. 기본값 "en" */
|
|
86
|
+
locale?: LocaleKey;
|
|
87
|
+
/** locale 프리셋 위에 개별 메시지 덮어쓰기 */
|
|
88
|
+
messages?: Partial<Messages>;
|
|
89
|
+
/** 주 시작일. locale 기본값 대신 강제 지정 */
|
|
90
|
+
weekStartsOn?: WeekStartsOn;
|
|
91
|
+
/** 요일별 강조 색상 (CSS color). "none"이면 강조 없음 */
|
|
92
|
+
weekendHighlight?: WeekendHighlight;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
declare function SchedulePicker({ value, onChange, onSelectEnd, presets: presetsProp, hideToolbar, readOnly, disabled, minHour, maxHour, visibleDays: visibleDaysProp, dayLabels: dayLabelsProp, dayAxis, compactHourLabels, formatHour, disabledSlots, className, locale, messages, weekStartsOn, weekendHighlight, }: SchedulePickerProps): react_jsx_runtime.JSX.Element;
|
|
96
|
+
|
|
97
|
+
/** 요일 표시 순서: 월~일 */
|
|
98
|
+
declare const DAY_ORDER: readonly ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
99
|
+
/** 기본 요일 라벨 (영어) */
|
|
100
|
+
declare const DAY_LABELS: Record<string, string>;
|
|
101
|
+
/** 0~23 시간 배열 */
|
|
102
|
+
declare const HOURS: number[];
|
|
103
|
+
/**
|
|
104
|
+
* 내장 프리셋 4종 (영어 라벨 고정).
|
|
105
|
+
* @deprecated v1.1+ — 로케일 기반 번역된 프리셋을 얻으려면 `getDefaultPresets(messages)`
|
|
106
|
+
* 또는 `<SchedulePicker locale="..." />`를 사용하세요. 이 상수는 하위호환 목적으로만 유지됩니다.
|
|
107
|
+
*/
|
|
108
|
+
declare const DEFAULT_PRESETS: Preset[];
|
|
109
|
+
|
|
110
|
+
/** hourlyChunks에 따른 슬롯 배열 생성 */
|
|
111
|
+
declare function generateSlots(minHour: number, maxHour: number, hourlyChunks: number): number[];
|
|
112
|
+
/** 슬롯 값을 시간 문자열로 변환 (예: 9.5 → "9:30") */
|
|
113
|
+
declare function slotToTimeString(slot: number): string;
|
|
114
|
+
/** 특정 요일-슬롯이 선택되었는지 확인 */
|
|
115
|
+
declare function hasHour(schedule: Schedule, day: string, hour: number): boolean;
|
|
116
|
+
/** 특정 요일-슬롯이 disabled인지 확인 */
|
|
117
|
+
declare function isSlotDisabled(disabledSlots: Schedule | undefined, day: string, hour: number): boolean;
|
|
118
|
+
/** 특정 요일-슬롯을 선택/해제한 새 Schedule 반환 */
|
|
119
|
+
declare function toggleHour(schedule: Schedule, day: string, hour: number, selected: boolean): Schedule;
|
|
120
|
+
/** 시작점~끝점 사각형 영역을 일괄 선택/해제한 새 Schedule 반환 */
|
|
121
|
+
declare function applyRect(base: Schedule, visibleDays: readonly string[], startDayIdx: number, startHour: number, endDayIdx: number, endHour: number, selected: boolean, slots: number[], maxSelections?: number, disabledSlots?: Schedule): Schedule;
|
|
122
|
+
/** 시간 헤더 포맷: 3의 배수는 숫자, 나머지는 "·" */
|
|
123
|
+
declare function formatHourHeader(hour: number): string;
|
|
124
|
+
/** 선택된 총 슬롯 수 계산 */
|
|
125
|
+
declare function countSelectedHours(schedule: Schedule): number;
|
|
126
|
+
/** 모든 시간이 선택되었는지 확인 */
|
|
127
|
+
declare function isAllSelected(schedule: Schedule, visibleDays?: readonly string[]): boolean;
|
|
128
|
+
/** 선택된 스케줄을 사람이 읽기 쉬운 요약 문자열로 변환 */
|
|
129
|
+
declare function summarizeSchedule(schedule: Schedule, dayLabels?: Record<string, string>, visibleDays?: readonly string[], hourlyChunks?: number, noSelectionLabel?: string): string;
|
|
130
|
+
/** 빈 Schedule 생성 */
|
|
131
|
+
declare function createEmptySchedule(): Schedule;
|
|
132
|
+
/** 모든 시간이 선택된 Schedule 생성 */
|
|
133
|
+
declare function createFullSchedule(visibleDays?: readonly string[]): Schedule;
|
|
134
|
+
|
|
135
|
+
/** ISO 8601 요일 번호 (1=월 ... 7=일) */
|
|
136
|
+
type IsoDayOfWeek = 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
137
|
+
/** 단일 시간 구간 (반-개방 구간: [start, end)) */
|
|
138
|
+
interface TimeRange {
|
|
139
|
+
/** ISO 요일 번호 (1=월 ... 7=일) */
|
|
140
|
+
day: IsoDayOfWeek;
|
|
141
|
+
/** 시작 시각 "HH:mm" (포함) */
|
|
142
|
+
start: string;
|
|
143
|
+
/** 종료 시각 "HH:mm" (제외). 24:00이면 자정 직전까지 */
|
|
144
|
+
end: string;
|
|
145
|
+
}
|
|
146
|
+
/** 구간 기반 직렬화 결과 */
|
|
147
|
+
interface RangesPayload {
|
|
148
|
+
version: 1;
|
|
149
|
+
/** IANA 타임존 (예: "Asia/Seoul"). 없으면 생략 */
|
|
150
|
+
timezone?: string;
|
|
151
|
+
/** 선택된 구간들 */
|
|
152
|
+
ranges: TimeRange[];
|
|
153
|
+
/** 사용자 정의 메타데이터 */
|
|
154
|
+
meta?: Record<string, unknown>;
|
|
155
|
+
}
|
|
156
|
+
/** toRanges 옵션 */
|
|
157
|
+
interface ToRangesOptions {
|
|
158
|
+
timezone?: string;
|
|
159
|
+
meta?: Record<string, unknown>;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Schedule을 구간 기반 포맷으로 변환합니다.
|
|
163
|
+
* - 연속된 시간은 하나의 구간으로 압축됩니다 (예: [9,10,11] → 09:00~12:00).
|
|
164
|
+
* - 요일 키는 ISO 8601 번호(1=월~7=일)로 변환되어 정렬됩니다.
|
|
165
|
+
* - 타임존/메타데이터를 함께 담을 수 있습니다.
|
|
166
|
+
*/
|
|
167
|
+
declare function toRanges(schedule: Schedule, options?: ToRangesOptions): RangesPayload;
|
|
168
|
+
/**
|
|
169
|
+
* 구간 기반 포맷을 Schedule로 역변환합니다.
|
|
170
|
+
* - 1시간 정렬되지 않은 구간(예: 09:30)은 에러를 던집니다.
|
|
171
|
+
* - "24:00"은 자정으로 해석됩니다.
|
|
172
|
+
*/
|
|
173
|
+
declare function fromRanges(payload: RangesPayload): Schedule;
|
|
174
|
+
/** toISO 옵션 */
|
|
175
|
+
interface ToISOOptions {
|
|
176
|
+
timezone?: string;
|
|
177
|
+
meta?: Record<string, unknown>;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Schedule을 ISO 8601 호환 문자열 배열로 직렬화합니다.
|
|
181
|
+
* - 각 항목은 `{day, startTime, endTime, timezone?}` 형태로, 캘린더 시스템에
|
|
182
|
+
* 전달하기 쉬운 형태입니다. (iCalendar BYDAY 규약과 유사)
|
|
183
|
+
* - 주의: 이 출력은 "주간 반복 가용시간"의 표현이며, 특정 날짜가 아닙니다.
|
|
184
|
+
*/
|
|
185
|
+
declare function toISO(schedule: Schedule, options?: ToISOOptions): {
|
|
186
|
+
version: 1;
|
|
187
|
+
timezone?: string;
|
|
188
|
+
availability: Array<{
|
|
189
|
+
day: IsoDayOfWeek;
|
|
190
|
+
startTime: string;
|
|
191
|
+
endTime: string;
|
|
192
|
+
}>;
|
|
193
|
+
meta?: Record<string, unknown>;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export { DAY_LABELS, DAY_ORDER, DEFAULT_PRESETS, HOURS, type IsoDayOfWeek, LOCALE_PRESETS, type LocaleKey, type LocalePreset, type Messages, type Preset, type RangesPayload, type ResolveLocaleInput, type ResolvedLocaleConfig, type Schedule, SchedulePicker, type SchedulePickerProps, type TimeRange, type ToISOOptions, type ToRangesOptions, type WeekStartsOn, type WeekendHighlight, applyRect, countSelectedHours, createEmptySchedule, createFullSchedule, formatHourHeader, fromRanges, generateSlots, getDefaultPresets, hasHour, isAllSelected, isSlotDisabled, resolveLocaleConfig, rotateDays, slotToTimeString, summarizeSchedule, toISO, toRanges, toggleHour };
|