@progressive-development/pd-calendar 0.6.8 → 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 -2
- package/README.md +32 -57
- package/dist/generated/locales/be.d.ts +7 -0
- package/dist/generated/locales/be.d.ts.map +1 -1
- package/dist/generated/locales/de.d.ts +7 -0
- package/dist/generated/locales/de.d.ts.map +1 -1
- package/dist/generated/locales/en.d.ts +7 -0
- package/dist/generated/locales/en.d.ts.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -10
- package/dist/locales/be.js +10 -4
- package/dist/locales/de.js +10 -4
- package/dist/locales/en.js +10 -4
- package/dist/pd-calendar/PdCalendar.d.ts +133 -0
- package/dist/pd-calendar/PdCalendar.d.ts.map +1 -0
- package/dist/pd-calendar/PdCalendar.js +550 -0
- package/dist/pd-calendar/pd-calendar-cell/PdCalendarCell.d.ts +56 -0
- package/dist/pd-calendar/pd-calendar-cell/PdCalendarCell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-cell/PdCalendarCell.js +337 -0
- package/dist/pd-calendar/pd-calendar-cell/pd-calendar-cell.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-cell/pd-calendar-cell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-cell/pd-calendar-cell.js +8 -0
- package/dist/pd-calendar/pd-calendar-day-events-panel/PdCalendarDayEventsPanel.d.ts +27 -0
- package/dist/pd-calendar/pd-calendar-day-events-panel/PdCalendarDayEventsPanel.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-day-events-panel/PdCalendarDayEventsPanel.js +160 -0
- package/dist/pd-calendar/pd-calendar-day-events-panel/pd-calendar-day-events-panel.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-day-events-panel/pd-calendar-day-events-panel.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-day-events-panel/pd-calendar-day-events-panel.js +8 -0
- package/dist/pd-calendar/pd-calendar-event-cell/PdCalendarEventCell.d.ts +55 -0
- package/dist/pd-calendar/pd-calendar-event-cell/PdCalendarEventCell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-event-cell/PdCalendarEventCell.js +341 -0
- package/dist/pd-calendar/pd-calendar-event-cell/pd-calendar-event-cell.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-event-cell/pd-calendar-event-cell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-event-cell/pd-calendar-event-cell.js +8 -0
- package/dist/pd-calendar/pd-calendar-event-info-panel/PdCalendarEventInfoPanel.d.ts +29 -0
- package/dist/pd-calendar/pd-calendar-event-info-panel/PdCalendarEventInfoPanel.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-event-info-panel/PdCalendarEventInfoPanel.js +211 -0
- package/dist/pd-calendar/pd-calendar-event-info-panel/pd-calendar-event-info-panel.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-event-info-panel/pd-calendar-event-info-panel.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-event-info-panel/pd-calendar-event-info-panel.js +8 -0
- package/dist/pd-calendar/pd-calendar-list-cell/PdCalendarListCell.d.ts +28 -0
- package/dist/pd-calendar/pd-calendar-list-cell/PdCalendarListCell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-list-cell/PdCalendarListCell.js +252 -0
- package/dist/pd-calendar/pd-calendar-list-cell/pd-calendar-list-cell.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-list-cell/pd-calendar-list-cell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-list-cell/pd-calendar-list-cell.js +8 -0
- package/dist/pd-calendar/pd-calendar-list-view/PdCalendarListView.d.ts +26 -0
- package/dist/pd-calendar/pd-calendar-list-view/PdCalendarListView.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-list-view/PdCalendarListView.js +165 -0
- package/dist/pd-calendar/pd-calendar-list-view/pd-calendar-list-view.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-list-view/pd-calendar-list-view.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-list-view/pd-calendar-list-view.js +8 -0
- package/dist/pd-calendar/pd-calendar-month-view/PdCalendarMonthView.d.ts +55 -0
- package/dist/pd-calendar/pd-calendar-month-view/PdCalendarMonthView.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-month-view/PdCalendarMonthView.js +461 -0
- package/dist/pd-calendar/pd-calendar-month-view/pd-calendar-month-view.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-month-view/pd-calendar-month-view.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-month-view/pd-calendar-month-view.js +8 -0
- package/dist/pd-calendar/pd-calendar-time-grid-view/PdCalendarTimeGridView.d.ts +32 -0
- package/dist/pd-calendar/pd-calendar-time-grid-view/PdCalendarTimeGridView.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-time-grid-view/PdCalendarTimeGridView.js +468 -0
- package/dist/pd-calendar/pd-calendar-time-grid-view/pd-calendar-time-grid-view.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-time-grid-view/pd-calendar-time-grid-view.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-time-grid-view/pd-calendar-time-grid-view.js +8 -0
- package/dist/pd-calendar/pd-calendar-week-cell/PdCalendarWeekCell.d.ts +31 -0
- package/dist/pd-calendar/pd-calendar-week-cell/PdCalendarWeekCell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-week-cell/PdCalendarWeekCell.js +134 -0
- package/dist/pd-calendar/pd-calendar-week-cell/pd-calendar-week-cell.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-week-cell/pd-calendar-week-cell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-week-cell/pd-calendar-week-cell.js +8 -0
- package/dist/pd-calendar/pd-calendar.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar.stories.d.ts +83 -0
- package/dist/pd-calendar/pd-calendar.stories.d.ts.map +1 -0
- package/dist/pd-calendar/pd-year-popup/PdYearPopup.d.ts +38 -0
- package/dist/pd-calendar/pd-year-popup/PdYearPopup.d.ts.map +1 -0
- package/dist/pd-calendar/pd-year-popup/PdYearPopup.js +249 -0
- package/dist/pd-calendar/pd-year-popup/pd-year-popup.d.ts +3 -0
- package/dist/pd-calendar/pd-year-popup/pd-year-popup.d.ts.map +1 -0
- package/dist/pd-calendar/pd-year-popup/pd-year-popup.js +8 -0
- package/dist/pd-calendar.d.ts +2 -48
- package/dist/pd-calendar.js +6 -437
- package/dist/pd-datepicker/PdDatepicker.d.ts +181 -0
- package/dist/pd-datepicker/PdDatepicker.d.ts.map +1 -0
- package/dist/pd-datepicker/PdDatepicker.js +701 -0
- package/dist/pd-datepicker/pd-date-picker.stories.d.ts +81 -0
- package/dist/pd-datepicker/pd-date-picker.stories.d.ts.map +1 -0
- package/dist/pd-datepicker/pd-datepicker.d.ts +3 -0
- package/dist/pd-datepicker/pd-datepicker.d.ts.map +1 -0
- package/dist/pd-datepicker.d.ts +2 -0
- package/dist/pd-datepicker.js +8 -0
- package/dist/pd-slot-picker/PdSlotPicker.d.ts +102 -0
- package/dist/pd-slot-picker/PdSlotPicker.d.ts.map +1 -0
- package/dist/pd-slot-picker/PdSlotPicker.js +339 -0
- package/dist/pd-slot-picker/pd-slot-cell/PdSlotCell.d.ts +35 -0
- package/dist/pd-slot-picker/pd-slot-cell/PdSlotCell.d.ts.map +1 -0
- package/dist/pd-slot-picker/pd-slot-cell/PdSlotCell.js +188 -0
- package/dist/pd-slot-picker/pd-slot-cell/pd-slot-cell.d.ts +3 -0
- package/dist/pd-slot-picker/pd-slot-cell/pd-slot-cell.d.ts.map +1 -0
- package/dist/pd-slot-picker/pd-slot-cell/pd-slot-cell.js +8 -0
- package/dist/pd-slot-picker/pd-slot-picker.d.ts +3 -0
- package/dist/pd-slot-picker/pd-slot-picker.d.ts.map +1 -0
- package/dist/pd-slot-picker/pd-slot-picker.stories.d.ts +67 -0
- package/dist/pd-slot-picker/pd-slot-picker.stories.d.ts.map +1 -0
- package/dist/pd-slot-picker.d.ts +2 -0
- package/dist/pd-slot-picker.js +8 -0
- package/dist/shared/PdBaseCell.d.ts +68 -0
- package/dist/shared/PdBaseCell.d.ts.map +1 -0
- package/dist/shared/PdBaseCell.js +120 -0
- package/dist/shared/PdBaseView.d.ts +22 -0
- package/dist/shared/PdBaseView.d.ts.map +1 -0
- package/dist/shared/PdBaseView.js +46 -0
- package/dist/shared/PdCalendarPanelBase.d.ts +34 -0
- package/dist/shared/PdCalendarPanelBase.d.ts.map +1 -0
- package/dist/shared/PdCalendarPanelBase.js +169 -0
- package/dist/shared/calendar-button-bar/calendar-button-bar.d.ts +41 -0
- package/dist/shared/calendar-button-bar/calendar-button-bar.d.ts.map +1 -0
- package/dist/shared/calendar-button-bar/calendar-button-bar.js +435 -0
- package/dist/shared/calendar-locales.d.ts +9 -0
- package/dist/shared/calendar-locales.d.ts.map +1 -0
- package/dist/shared/calendar-locales.js +30 -0
- package/dist/shared/calendar-utils.d.ts +34 -0
- package/dist/shared/calendar-utils.d.ts.map +1 -0
- package/dist/shared/calendar-utils.js +99 -0
- package/dist/shared/calendar-utils.test.d.ts +2 -0
- package/dist/shared/calendar-utils.test.d.ts.map +1 -0
- package/dist/types.d.ts +102 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +35 -47
- package/dist/pd-calendar-cell.d.ts +0 -47
- package/dist/pd-calendar-cell.d.ts.map +0 -1
- package/dist/pd-calendar-cell.js +0 -282
- package/dist/pd-calendar.d.ts.map +0 -1
- package/dist/pd-year-popup.d.ts +0 -25
- package/dist/pd-year-popup.d.ts.map +0 -1
- package/dist/pd-year-popup.js +0 -136
- package/dist/stories/cell.stories.d.ts +0 -15
- package/dist/stories/cell.stories.d.ts.map +0 -1
- package/dist/stories/index.stories.d.ts +0 -23
- package/dist/stories/index.stories.d.ts.map +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CalendarWeek } from '../types.js';
|
|
2
|
+
export declare function isToday(date?: Date): boolean;
|
|
3
|
+
export declare function isSelected(date1?: Date, date2?: Date): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Generates a 2D array of weeks for a given month.
|
|
6
|
+
* Each week contains 7 days (or 5 if hideWeekend).
|
|
7
|
+
* null values represent empty padding cells.
|
|
8
|
+
*
|
|
9
|
+
* @param year - Full year (e.g. 2026)
|
|
10
|
+
* @param month - Zero-based month (0 = January)
|
|
11
|
+
* @param hideWeekend - If true, excludes Saturday and Sunday (5 columns)
|
|
12
|
+
*/
|
|
13
|
+
export declare function getWeeksArray(year: number, month: number, hideWeekend: boolean): CalendarWeek[];
|
|
14
|
+
export interface OverlapEvent {
|
|
15
|
+
startDecimal: number;
|
|
16
|
+
endDecimal: number;
|
|
17
|
+
index: number;
|
|
18
|
+
}
|
|
19
|
+
export interface OverlapResult {
|
|
20
|
+
index: number;
|
|
21
|
+
column: number;
|
|
22
|
+
totalColumns: number;
|
|
23
|
+
startDecimal: number;
|
|
24
|
+
endDecimal: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Google Calendar-style overlap layout.
|
|
28
|
+
* Assigns column positions to overlapping events so they render side by side.
|
|
29
|
+
*
|
|
30
|
+
* Events are grouped into clusters (connected components of overlap).
|
|
31
|
+
* Within each cluster, events are greedily assigned to the first available column.
|
|
32
|
+
*/
|
|
33
|
+
export declare function layoutOverlappingEvents(events: OverlapEvent[]): OverlapResult[];
|
|
34
|
+
//# sourceMappingURL=calendar-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-utils.d.ts","sourceRoot":"","sources":["../../src/shared/calendar-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,aAAa,CAAC;AAE7D,wBAAgB,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,OAAO,CAQ5C;AAED,wBAAgB,UAAU,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,OAAO,CAQ9D;AAMD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,OAAO,GACnB,YAAY,EAAE,CAgDhB;AAMD,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,YAAY,EAAE,GACrB,aAAa,EAAE,CAgEjB"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
function isToday(date) {
|
|
2
|
+
const today = /* @__PURE__ */ new Date();
|
|
3
|
+
return !!date && date.getDate() === today.getDate() && date.getMonth() === today.getMonth() && date.getFullYear() === today.getFullYear();
|
|
4
|
+
}
|
|
5
|
+
function isSelected(date1, date2) {
|
|
6
|
+
return !!date1 && !!date2 && date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear();
|
|
7
|
+
}
|
|
8
|
+
function getWeeksArray(year, month, hideWeekend) {
|
|
9
|
+
const weeks = [];
|
|
10
|
+
let currentWeek = [];
|
|
11
|
+
const daysPerWeek = hideWeekend ? 5 : 7;
|
|
12
|
+
const numberOfDays = new Date(year, month + 1, 0).getDate();
|
|
13
|
+
let firstWeekdayOfMonth = new Date(year, month, 1).getDay();
|
|
14
|
+
let firstDayNumber = 1;
|
|
15
|
+
if (hideWeekend) {
|
|
16
|
+
while (firstWeekdayOfMonth === 0 || firstWeekdayOfMonth === 6) {
|
|
17
|
+
firstDayNumber++;
|
|
18
|
+
firstWeekdayOfMonth = new Date(year, month, firstDayNumber).getDay();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const paddingDays = (firstWeekdayOfMonth + 6) % 7;
|
|
22
|
+
for (let i = 0; i < paddingDays; i++) {
|
|
23
|
+
currentWeek.push(null);
|
|
24
|
+
}
|
|
25
|
+
for (let day = 1; day <= numberOfDays; day++) {
|
|
26
|
+
const date = new Date(year, month, day);
|
|
27
|
+
const dayOfWeek = date.getDay();
|
|
28
|
+
if (hideWeekend && (dayOfWeek === 0 || dayOfWeek === 6)) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
currentWeek.push(date);
|
|
32
|
+
if (currentWeek.length === daysPerWeek) {
|
|
33
|
+
weeks.push(currentWeek);
|
|
34
|
+
currentWeek = [];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (currentWeek.length > 0) {
|
|
38
|
+
while (currentWeek.length < daysPerWeek) {
|
|
39
|
+
currentWeek.push(null);
|
|
40
|
+
}
|
|
41
|
+
weeks.push(currentWeek);
|
|
42
|
+
}
|
|
43
|
+
return weeks;
|
|
44
|
+
}
|
|
45
|
+
function layoutOverlappingEvents(events) {
|
|
46
|
+
if (events.length === 0) return [];
|
|
47
|
+
const sorted = [...events].sort((a, b) => {
|
|
48
|
+
if (a.startDecimal !== b.startDecimal)
|
|
49
|
+
return a.startDecimal - b.startDecimal;
|
|
50
|
+
return b.endDecimal - b.startDecimal - (a.endDecimal - a.startDecimal);
|
|
51
|
+
});
|
|
52
|
+
const clusters = [];
|
|
53
|
+
let currentCluster = [sorted[0]];
|
|
54
|
+
let clusterEnd = sorted[0].endDecimal;
|
|
55
|
+
for (let i = 1; i < sorted.length; i++) {
|
|
56
|
+
if (sorted[i].startDecimal < clusterEnd) {
|
|
57
|
+
currentCluster.push(sorted[i]);
|
|
58
|
+
clusterEnd = Math.max(clusterEnd, sorted[i].endDecimal);
|
|
59
|
+
} else {
|
|
60
|
+
clusters.push(currentCluster);
|
|
61
|
+
currentCluster = [sorted[i]];
|
|
62
|
+
clusterEnd = sorted[i].endDecimal;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
clusters.push(currentCluster);
|
|
66
|
+
const result = [];
|
|
67
|
+
for (const cluster of clusters) {
|
|
68
|
+
const columnEnds = [];
|
|
69
|
+
const assignments = [];
|
|
70
|
+
for (const event of cluster) {
|
|
71
|
+
let col = -1;
|
|
72
|
+
for (let c = 0; c < columnEnds.length; c++) {
|
|
73
|
+
if (columnEnds[c] <= event.startDecimal) {
|
|
74
|
+
col = c;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (col === -1) {
|
|
79
|
+
col = columnEnds.length;
|
|
80
|
+
columnEnds.push(0);
|
|
81
|
+
}
|
|
82
|
+
columnEnds[col] = event.endDecimal;
|
|
83
|
+
assignments.push({ event, column: col });
|
|
84
|
+
}
|
|
85
|
+
const totalColumns = columnEnds.length;
|
|
86
|
+
for (const { event, column } of assignments) {
|
|
87
|
+
result.push({
|
|
88
|
+
index: event.index,
|
|
89
|
+
column,
|
|
90
|
+
totalColumns,
|
|
91
|
+
startDecimal: event.startDecimal,
|
|
92
|
+
endDecimal: event.endDecimal
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { getWeeksArray, isSelected, isToday, layoutOverlappingEvents };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-utils.test.d.ts","sourceRoot":"","sources":["../../src/shared/calendar-utils.test.ts"],"names":[],"mappings":""}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,107 @@
|
|
|
1
1
|
export interface CalendarCellInfo {
|
|
2
|
+
/** Title/info text displayed in the cell (e.g., price, event name). */
|
|
2
3
|
info?: string;
|
|
3
|
-
|
|
4
|
+
/** Description text for list view display. */
|
|
5
|
+
desc?: string;
|
|
6
|
+
/** Category key (references CalendarConfig.categories). */
|
|
7
|
+
category?: string;
|
|
8
|
+
/** If true, the day is disabled and cannot be selected. */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Start time for the event (e.g., "08:30"). */
|
|
11
|
+
startTime?: string;
|
|
12
|
+
/** End time for the event (e.g., "14:30"). */
|
|
13
|
+
endTime?: string;
|
|
14
|
+
/** If true, the event spans the entire day. */
|
|
15
|
+
fullDay?: boolean;
|
|
16
|
+
/** Maximum capacity for this slot (number of bookable spots). */
|
|
17
|
+
capacity?: number;
|
|
18
|
+
/** Number of already booked spots. */
|
|
19
|
+
booked?: number;
|
|
20
|
+
/** Unique event ID for action events. */
|
|
21
|
+
id?: string;
|
|
22
|
+
/** Short location text (e.g., room name). */
|
|
23
|
+
location?: string;
|
|
24
|
+
/** Participant list. */
|
|
25
|
+
participants?: Array<{
|
|
26
|
+
name?: string;
|
|
27
|
+
email?: string;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
/** Configures which action icons are shown in the EventInfoPanel. */
|
|
31
|
+
export interface EventInfoActions {
|
|
32
|
+
detail?: boolean;
|
|
33
|
+
edit?: boolean;
|
|
34
|
+
delete?: boolean;
|
|
4
35
|
}
|
|
5
36
|
export type CalendarData = Record<string, CalendarCellInfo[]>;
|
|
37
|
+
/** Configuration for a single category. */
|
|
38
|
+
export interface CalendarCategoryConfig {
|
|
39
|
+
/** Display name of the category. */
|
|
40
|
+
name: string;
|
|
41
|
+
/** Background color for cells with this category. */
|
|
42
|
+
color?: string;
|
|
43
|
+
/** Text color for cells with this category. */
|
|
44
|
+
textColor?: string;
|
|
45
|
+
/** Optional icon identifier (e.g., from pd-icon). */
|
|
46
|
+
icon?: string;
|
|
47
|
+
}
|
|
48
|
+
/** Map of category keys to their configuration. */
|
|
49
|
+
export type CalendarCategoryMap = Record<string, CalendarCategoryConfig>;
|
|
50
|
+
/** Main calendar configuration. */
|
|
51
|
+
export interface CalendarConfig {
|
|
52
|
+
/** Category definitions. */
|
|
53
|
+
categories?: CalendarCategoryMap;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Defines a custom date range for list view display.
|
|
57
|
+
* When set, the list view shows entries within this range instead of the current month.
|
|
58
|
+
*/
|
|
59
|
+
export interface CalendarListRange {
|
|
60
|
+
/** Start date of the range (inclusive). Can be Date object or string in YYYY-MM-DD format. */
|
|
61
|
+
start: Date | string;
|
|
62
|
+
/** End date of the range (inclusive). Can be Date object or string in YYYY-MM-DD format. */
|
|
63
|
+
end: Date | string;
|
|
64
|
+
}
|
|
65
|
+
export interface PdEventInput {
|
|
66
|
+
id: string;
|
|
67
|
+
date: string | Date;
|
|
68
|
+
title: string;
|
|
69
|
+
color?: string;
|
|
70
|
+
}
|
|
71
|
+
/** Value returned by PdSlotPicker when a slot is selected. */
|
|
72
|
+
export interface SlotPickerValue {
|
|
73
|
+
/** Date key in YYYY-MM-DD format. */
|
|
74
|
+
dateKey: string;
|
|
75
|
+
/** Start time (e.g., "08:30"). */
|
|
76
|
+
startTime: string;
|
|
77
|
+
/** End time (e.g., "14:30"). */
|
|
78
|
+
endTime: string;
|
|
79
|
+
/** Index of the slot within the day's entries. */
|
|
80
|
+
index: number;
|
|
81
|
+
}
|
|
82
|
+
export type CalendarPeriodType = "Year" | "Month" | "Week" | "Day";
|
|
83
|
+
export type CalendarViewType = "dayGrid" | "timeGrid" | "list";
|
|
84
|
+
export interface AvailableCalendarViewTypes {
|
|
85
|
+
viewTypes: CalendarViewType[];
|
|
86
|
+
default?: number;
|
|
87
|
+
}
|
|
88
|
+
export interface AvailableCalendarPeriods {
|
|
89
|
+
periods: CalendarPeriodType[];
|
|
90
|
+
default?: number;
|
|
91
|
+
}
|
|
92
|
+
/** Monday-based day index: 0=Mo, 1=Di, ..., 6=So. Matches LOCALES.weekdaysShort order. */
|
|
93
|
+
export type WeekDayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
94
|
+
/** Configuration for the week (timeGrid) view. */
|
|
95
|
+
export interface WeekViewConfig {
|
|
96
|
+
/** Visible days. Default: [0,1,2,3,4] (Mo-Fr). */
|
|
97
|
+
visibleDays?: WeekDayIndex[];
|
|
98
|
+
/** Start hour (inclusive). Default: 0. Example: 8 for 08:00. */
|
|
99
|
+
startHour?: number;
|
|
100
|
+
/** End hour (exclusive). Default: 24. Example: 18 for up to 18:00. */
|
|
101
|
+
endHour?: number;
|
|
102
|
+
}
|
|
103
|
+
/** Represents a day in the calendar grid - null for empty cells (previous month padding) */
|
|
104
|
+
export type CalendarDay = Date | null;
|
|
105
|
+
/** A week is an array of 7 days (or 5 if hideWeekend) */
|
|
106
|
+
export type CalendarWeek = CalendarDay[];
|
|
6
107
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,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
|
"name": "@progressive-development/pd-calendar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Webcomponent for calendar",
|
|
5
5
|
"author": "PD Progressive Development",
|
|
6
|
-
"license": "
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
7
10
|
"main": "./dist/index.js",
|
|
8
11
|
"module": "./dist/index.js",
|
|
12
|
+
"type": "module",
|
|
9
13
|
"types": "./dist/index.d.ts",
|
|
10
14
|
"exports": {
|
|
11
15
|
".": "./dist/index.js",
|
|
12
16
|
"./pd-calendar": "./dist/pd-calendar.js",
|
|
17
|
+
"./pd-datepicker": "./dist/pd-datepicker.js",
|
|
18
|
+
"./pd-slot-picker": "./dist/pd-slot-picker.js",
|
|
13
19
|
"./locales/be": "./dist/locales/be.js",
|
|
14
20
|
"./locales/de": "./dist/locales/de.js",
|
|
15
21
|
"./locales/en": "./dist/locales/en.js"
|
|
@@ -20,52 +26,16 @@
|
|
|
20
26
|
"README.md",
|
|
21
27
|
"LICENSE"
|
|
22
28
|
],
|
|
23
|
-
"scripts": {
|
|
24
|
-
"analyze": "cem analyze --litelement --exclude dist,demo",
|
|
25
|
-
"start": "vite",
|
|
26
|
-
"build": "vite build",
|
|
27
|
-
"preview": "vite preview",
|
|
28
|
-
"clean": "rm -rf dist",
|
|
29
|
-
"lint": "eslint --ext .ts,.html src --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
|
|
30
|
-
"format": "eslint --ext .ts,.html src --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
|
|
31
|
-
"test": "vitest run --coverage",
|
|
32
|
-
"test:watch": "vitest --watch",
|
|
33
|
-
"check": "npm run lint && npm run build",
|
|
34
|
-
"prepublishOnly": "npm run clean && npm run check",
|
|
35
|
-
"localizeExtract": "lit-localize extract",
|
|
36
|
-
"localizeBuild": "lit-localize build",
|
|
37
|
-
"storybook": "storybook dev -p 6006",
|
|
38
|
-
"build-storybook": "storybook build"
|
|
39
|
-
},
|
|
40
29
|
"dependencies": {
|
|
30
|
+
"lit": "^3.3.1",
|
|
41
31
|
"@lit/localize": "^0.12.2",
|
|
42
|
-
"
|
|
43
|
-
"@progressive-development/pd-shared-styles": "^0.2.5",
|
|
32
|
+
"date-fns": "^2.30.0",
|
|
44
33
|
"fecha": "^4.2.3",
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@lit/localize-tools": "^0.6.10",
|
|
51
|
-
"@storybook/addon-essentials": "^8.6.14",
|
|
52
|
-
"@storybook/addon-links": "^8.6.14",
|
|
53
|
-
"@storybook/blocks": "^8.0.10",
|
|
54
|
-
"@storybook/test": "^8.6.14",
|
|
55
|
-
"@storybook/web-components": "^8.0.10",
|
|
56
|
-
"@storybook/web-components-vite": "^8.6.14",
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
58
|
-
"@typescript-eslint/parser": "^8.32.1",
|
|
59
|
-
"eslint": "^8.57.1",
|
|
60
|
-
"eslint-config-prettier": "^9.1.0",
|
|
61
|
-
"eslint-plugin-storybook": "^0.8.0",
|
|
62
|
-
"prettier": "^3.5.3",
|
|
63
|
-
"rollup-plugin-visualizer": "^5.14.0",
|
|
64
|
-
"storybook": "^8.6.14",
|
|
65
|
-
"typescript": "^5.8.3",
|
|
66
|
-
"vite": "^5.4.19",
|
|
67
|
-
"vite-plugin-dts": "^4.5.4",
|
|
68
|
-
"vitest": "^2.1.9"
|
|
34
|
+
"tslib": "^2.8.1",
|
|
35
|
+
"@progressive-development/pd-shared-styles": "0.3.1",
|
|
36
|
+
"@progressive-development/pd-utils": "1.0.0",
|
|
37
|
+
"@progressive-development/pd-forms": "1.0.0",
|
|
38
|
+
"@progressive-development/pd-icon": "1.0.0"
|
|
69
39
|
},
|
|
70
40
|
"customElements": "custom-elements.json",
|
|
71
41
|
"keywords": [
|
|
@@ -80,5 +50,23 @@
|
|
|
80
50
|
"day",
|
|
81
51
|
"month",
|
|
82
52
|
"week"
|
|
83
|
-
]
|
|
84
|
-
|
|
53
|
+
],
|
|
54
|
+
"scripts": {
|
|
55
|
+
"analyze": "cem analyze --litelement --exclude dist,demo",
|
|
56
|
+
"start": "vite",
|
|
57
|
+
"build": "pnpm run analyze && vite build",
|
|
58
|
+
"preview": "vite preview",
|
|
59
|
+
"clean": "rm -rf dist",
|
|
60
|
+
"clean:all": "rm -rf dist node_modules pnpm-lock.yaml",
|
|
61
|
+
"lint": "eslint --ext .ts,.html src --ignore-path ../../../.eslintignore && prettier \"**/*.ts\" --check --ignore-path ../../../.eslintignore",
|
|
62
|
+
"lint:lit": "lit-analyzer",
|
|
63
|
+
"format": "eslint --ext .ts,.html src --fix --ignore-path ../../../.eslintignore && prettier \"**/*.ts\" --write --ignore-path ../../../.eslintignore",
|
|
64
|
+
"test": "vitest run --coverage",
|
|
65
|
+
"test:watch": "vitest --watch",
|
|
66
|
+
"check": "pnpm run lint && pnpm run lint:lit && pnpm run build",
|
|
67
|
+
"localizeExtract": "lit-localize extract",
|
|
68
|
+
"localizeBuild": "lit-localize build",
|
|
69
|
+
"storybook": "storybook dev -p 6006",
|
|
70
|
+
"build-storybook": "storybook build"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { LitElement, CSSResultGroup } from 'lit';
|
|
2
|
-
/**
|
|
3
|
-
* Ein einzelnes Kalendertag-Element zur Anzeige in Monatsübersichten.
|
|
4
|
-
*
|
|
5
|
-
* Events:
|
|
6
|
-
* - `select-date`: Wird bei Klick auf ein auswählbares Feld ausgelöst
|
|
7
|
-
* - `mouse-enter-date`: Wird beim Hover über ein auswählbares Feld ausgelöst
|
|
8
|
-
* - `mouse-leave-date`: Wird beim Verlassen des Feldes ausgelöst
|
|
9
|
-
*/
|
|
10
|
-
export declare class PdCalendarCell extends LitElement {
|
|
11
|
-
/**
|
|
12
|
-
* If enabled, cell could be selected (with visible hover element and pointer)
|
|
13
|
-
* vy the user => results in fire cell-selected.
|
|
14
|
-
*/
|
|
15
|
-
selectEnabled: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* If enabled, highlight the current day
|
|
18
|
-
*/
|
|
19
|
-
today: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* If enabled, highlight the selected day
|
|
22
|
-
*/
|
|
23
|
-
selected: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* If enabled the cell gets an special class (e.g. green day).
|
|
26
|
-
*/
|
|
27
|
-
special: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* If set shows info text in the middle (hack) of the cell (e.g. price info).
|
|
30
|
-
*/
|
|
31
|
-
infoTxt: string;
|
|
32
|
-
/**
|
|
33
|
-
* CSS class for day number inside the cell, top-left and center available
|
|
34
|
-
*/
|
|
35
|
-
numberClass: string;
|
|
36
|
-
key: string;
|
|
37
|
-
weekDayNumber: number;
|
|
38
|
-
dayNumber: number;
|
|
39
|
-
static styles: CSSResultGroup;
|
|
40
|
-
render(): import('lit-html').TemplateResult<1>;
|
|
41
|
-
private _renderSelectableCell;
|
|
42
|
-
private _renderEmptyCell;
|
|
43
|
-
private _selectableCellClicked;
|
|
44
|
-
private _mouseEnter;
|
|
45
|
-
private _mouseLeave;
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=pd-calendar-cell.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pd-calendar-cell.d.ts","sourceRoot":"","sources":["../src/pd-calendar-cell.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAS5D;;;;;;;GAOG;AACH,qBACa,cAAe,SAAQ,UAAU;IAC5C;;;OAGG;IAEH,aAAa,UAAS;IAEtB;;OAEG;IAEH,KAAK,UAAS;IAEd;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,OAAO,SAAM;IAEb;;OAEG;IAEH,WAAW,SAAc;IAKzB,GAAG,SAAM;IAGT,aAAa,SAAM;IAGnB,SAAS,SAAM;IAEf,OAAgB,MAAM,EAAE,cAAc,CAoJpC;IAEO,MAAM;IAMf,OAAO,CAAC,qBAAqB;IA6B7B,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,sBAAsB;IAe9B,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,WAAW;CAQpB"}
|