@umituz/web-dashboard 11.7.0 → 11.8.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/web-dashboard",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.8.0",
|
|
4
4
|
"description": "Installable app skeleton for the fleet — layouts, analytics (dependency-free SVG charts), calendar, onboarding flow permissions/module registry; udb-* stylesheet on design-system tokens",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"version:major": "npm version major -m 'chore: release v%s'"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@umituz/web-design-system": ">=6.
|
|
71
|
+
"@umituz/web-design-system": ">=6.27.0",
|
|
72
72
|
"framer-motion": "^12.0.0",
|
|
73
73
|
"react": ">=18.0.0 || ^19.0.0",
|
|
74
74
|
"react-dom": ">=18.0.0 || ^19.0.0",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"@types/react-dom": "^19.2.3",
|
|
95
95
|
"@typescript-eslint/eslint-plugin": "^8.57.2",
|
|
96
96
|
"@typescript-eslint/parser": "^8.57.2",
|
|
97
|
-
"@umituz/web-design-system": "^6.
|
|
97
|
+
"@umituz/web-design-system": "^6.27.0",
|
|
98
98
|
"eslint": "^10.0.2",
|
|
99
99
|
"framer-motion": "^12.23.12",
|
|
100
100
|
"jsdom": "^29.1.1",
|
|
@@ -1,40 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addDays,
|
|
3
|
+
eachDayOfInterval,
|
|
4
|
+
endOfMonth,
|
|
5
|
+
endOfWeek,
|
|
6
|
+
formatDate as formatDateWithStyle,
|
|
7
|
+
formatTime,
|
|
8
|
+
startOfMonth,
|
|
9
|
+
startOfWeek,
|
|
10
|
+
type WeekStartsOn,
|
|
11
|
+
} from '@umituz/web-design-system';
|
|
1
12
|
import type { CalendarConfig } from '../types/calendar.types';
|
|
2
13
|
|
|
3
14
|
export { mapCalendarDocument, mapPostDocument } from './contentItemMapper';
|
|
4
15
|
export * from './layout';
|
|
5
16
|
export type { FirestoreDocument } from './contentItemMapper';
|
|
17
|
+
export { isSameDay } from '@umituz/web-design-system';
|
|
6
18
|
|
|
7
19
|
export function getWeekDates(
|
|
8
20
|
date: Date,
|
|
9
|
-
|
|
21
|
+
weekStartsOn: number = 0,
|
|
10
22
|
): [Date, Date, Date, Date, Date, Date, Date] {
|
|
11
|
-
const anchor =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
return [at(0), at(1), at(2), at(3), at(4), at(5), at(6)];
|
|
23
|
+
const anchor = startOfWeek(date, weekStartsOn as WeekStartsOn);
|
|
24
|
+
return [
|
|
25
|
+
addDays(anchor, 0),
|
|
26
|
+
addDays(anchor, 1),
|
|
27
|
+
addDays(anchor, 2),
|
|
28
|
+
addDays(anchor, 3),
|
|
29
|
+
addDays(anchor, 4),
|
|
30
|
+
addDays(anchor, 5),
|
|
31
|
+
addDays(anchor, 6),
|
|
32
|
+
];
|
|
23
33
|
}
|
|
24
34
|
|
|
25
35
|
export function getMonthDays(date: Date): Date[] {
|
|
26
|
-
|
|
27
|
-
const month = date.getMonth();
|
|
28
|
-
const days: Date[] = [];
|
|
29
|
-
|
|
30
|
-
const firstDay = new Date(year, month, 1);
|
|
31
|
-
const lastDay = new Date(year, month + 1, 0);
|
|
32
|
-
|
|
33
|
-
for (let d = new Date(firstDay); d <= lastDay; d.setDate(d.getDate() + 1)) {
|
|
34
|
-
days.push(new Date(d));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return days;
|
|
36
|
+
return eachDayOfInterval({ start: startOfMonth(date), end: endOfMonth(date) });
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
export function isDateInRange(date: Date, range: { start: Date; end: Date }): boolean {
|
|
@@ -47,43 +46,25 @@ export function formatDate(
|
|
|
47
46
|
locale: string = 'en-US',
|
|
48
47
|
): string {
|
|
49
48
|
if (format === 'time') {
|
|
50
|
-
return date
|
|
51
|
-
hour: '2-digit',
|
|
52
|
-
minute: '2-digit',
|
|
53
|
-
});
|
|
49
|
+
return formatTime(date, { locale });
|
|
54
50
|
}
|
|
55
51
|
|
|
56
|
-
return date
|
|
52
|
+
return formatDateWithStyle(date, 'long', {
|
|
53
|
+
weekday: 'none',
|
|
57
54
|
month: format === 'long' ? 'long' : 'short',
|
|
58
|
-
|
|
59
|
-
year: 'numeric',
|
|
55
|
+
locale,
|
|
60
56
|
});
|
|
61
57
|
}
|
|
62
58
|
|
|
63
|
-
export function isSameDay(date1: Date, date2: Date): boolean {
|
|
64
|
-
return (
|
|
65
|
-
date1.getFullYear() === date2.getFullYear() &&
|
|
66
|
-
date1.getMonth() === date2.getMonth() &&
|
|
67
|
-
date1.getDate() === date2.getDate()
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
59
|
export function getViewRange(
|
|
72
60
|
view: 'month' | 'week',
|
|
73
61
|
date: Date,
|
|
74
62
|
): { start: Date; end: Date } {
|
|
75
63
|
if (view === 'month') {
|
|
76
|
-
|
|
77
|
-
const end = new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
78
|
-
return { start, end };
|
|
64
|
+
return { start: startOfMonth(date), end: endOfMonth(date) };
|
|
79
65
|
}
|
|
80
66
|
|
|
81
|
-
|
|
82
|
-
const firstDay = new Date(week[0]);
|
|
83
|
-
firstDay.setHours(0, 0, 0, 0);
|
|
84
|
-
const lastDay = new Date(week[6]);
|
|
85
|
-
lastDay.setHours(23, 59, 59, 999);
|
|
86
|
-
return { start: firstDay, end: lastDay };
|
|
67
|
+
return { start: startOfWeek(date), end: endOfWeek(date) };
|
|
87
68
|
}
|
|
88
69
|
|
|
89
70
|
export function generateTimeSlots(
|