@eeplatform/nuxt-layer-common 1.2.10 → 1.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @eeplatform/nuxt-layer-common
2
2
 
3
+ ## 1.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 215fdff: Curriculum mgmt - initial release
8
+
9
+ ## 1.2.11
10
+
11
+ ### Patch Changes
12
+
13
+ - 11f490f: School Mgmt - table hight and props adjustment
14
+
3
15
  ## 1.2.10
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,199 @@
1
+ <template>
2
+ <v-card
3
+ :width="width"
4
+ :variant="variant"
5
+ :border="border"
6
+ :rounded="rounded"
7
+ :class="cardClass"
8
+ >
9
+ <!-- Month View (Default) -->
10
+ <CalendarMonth
11
+ v-if="view === 'month'"
12
+ :current="current"
13
+ :events="events"
14
+ :calendar-height="calendarHeight"
15
+ @day-click="onDayClick"
16
+ >
17
+ <template #header="headerProps">
18
+ <slot name="header" v-bind="headerProps" />
19
+ </template>
20
+ <template #day="dayProps">
21
+ <slot name="day" v-bind="dayProps" />
22
+ </template>
23
+ </CalendarMonth>
24
+
25
+ <!-- Week View -->
26
+ <CalendarWeek
27
+ v-else-if="view === 'week'"
28
+ :current="current"
29
+ :events="events"
30
+ :calendar-height="calendarHeight"
31
+ @minute-click="onMinuteClick"
32
+ @event-click="onEventClick"
33
+ />
34
+
35
+ <!-- Day View -->
36
+ <CalendarDay
37
+ v-else-if="view === 'day'"
38
+ :current="current"
39
+ :events="events"
40
+ :calendar-height="calendarHeight"
41
+ @hour-click="onHourClick"
42
+ @minute-click="onMinuteClick"
43
+ @event-click="onEventClick"
44
+ />
45
+
46
+ <!-- Year View -->
47
+ <CalendarYear
48
+ v-else-if="view === 'year'"
49
+ :current="current"
50
+ :events="events"
51
+ :calendar-height="calendarHeight"
52
+ @month-click="onMonthClick"
53
+ />
54
+ </v-card>
55
+ </template>
56
+
57
+ <script setup>
58
+ import { ref, computed, watch } from "vue";
59
+ import CalendarMonth from "./CalendarMonth.vue";
60
+ import CalendarWeek from "./CalendarWeek.vue";
61
+ import CalendarDay from "./CalendarDay.vue";
62
+ import CalendarYear from "./CalendarYear.vue";
63
+
64
+ // Props
65
+ const props = defineProps({
66
+ // Calendar props
67
+ modelValue: {
68
+ type: Date,
69
+ default: () => new Date(),
70
+ },
71
+ events: {
72
+ type: Array,
73
+ default: () => [],
74
+ validator: (events) => {
75
+ return events.every(
76
+ (event) =>
77
+ event.startDate &&
78
+ event.endDate &&
79
+ event.startDate instanceof Date &&
80
+ event.endDate instanceof Date
81
+ );
82
+ },
83
+ },
84
+ view: {
85
+ type: String,
86
+ default: "month",
87
+ validator: (value) => ["day", "week", "month", "year"].includes(value),
88
+ },
89
+ height: {
90
+ type: String,
91
+ default: "calc(100vh - 100px)",
92
+ },
93
+ // Card styling props
94
+ width: {
95
+ type: String,
96
+ default: "100%",
97
+ },
98
+ variant: {
99
+ type: String,
100
+ default: "outlined",
101
+ },
102
+ border: {
103
+ type: String,
104
+ default: "thin",
105
+ },
106
+ rounded: {
107
+ type: String,
108
+ default: "lg",
109
+ },
110
+ cardClass: {
111
+ type: String,
112
+ default: "",
113
+ },
114
+ });
115
+
116
+ // Emits
117
+ const emit = defineEmits([
118
+ "update:modelValue",
119
+ "dayClick",
120
+ "hourClick",
121
+ "eventClick",
122
+ "monthClick",
123
+ ]);
124
+
125
+ // Reactive data
126
+ const current = ref(new Date(props.modelValue));
127
+
128
+ // Computed properties
129
+ const calendarHeight = computed(() => props.height);
130
+
131
+ // Watch for external changes to modelValue
132
+ watch(
133
+ () => props.modelValue,
134
+ (newDate) => {
135
+ current.value = new Date(newDate);
136
+ }
137
+ );
138
+
139
+ // Handle day click
140
+ const onDayClick = (dayData) => {
141
+ emit("dayClick", dayData);
142
+ };
143
+
144
+ // Handle hour click for day/week views
145
+ const onHourClick = (hourData) => {
146
+ emit("hourClick", hourData);
147
+ };
148
+
149
+ // Handle minute click for table-based day view
150
+ const onMinuteClick = (minuteData) => {
151
+ emit("hourClick", minuteData);
152
+ };
153
+
154
+ // Handle event click
155
+ const onEventClick = (event) => {
156
+ emit("eventClick", event);
157
+ };
158
+
159
+ // Handle month click in year view
160
+ const onMonthClick = (monthData) => {
161
+ const newDate = new Date(current.value.getFullYear(), monthData.month, 1);
162
+ current.value = newDate;
163
+ emit("update:modelValue", newDate);
164
+ emit("monthClick", monthData);
165
+ };
166
+
167
+ // Methods to expose for parent components
168
+ const goToNextMonth = () => {
169
+ const newDate = new Date(current.value);
170
+ newDate.setMonth(newDate.getMonth() + 1);
171
+ current.value = newDate;
172
+ emit("update:modelValue", newDate);
173
+ };
174
+
175
+ const goToPrevMonth = () => {
176
+ const newDate = new Date(current.value);
177
+ newDate.setMonth(newDate.getMonth() - 1);
178
+ current.value = newDate;
179
+ emit("update:modelValue", newDate);
180
+ };
181
+
182
+ const goToToday = () => {
183
+ const today = new Date();
184
+ current.value = today;
185
+ emit("update:modelValue", today);
186
+ };
187
+
188
+ // Expose methods for parent component access
189
+ defineExpose({
190
+ goToNextMonth,
191
+ goToPrevMonth,
192
+ goToToday,
193
+ current,
194
+ });
195
+ </script>
196
+
197
+ <style scoped>
198
+ /* Main calendar wrapper styles */
199
+ </style>