@molecule/app-class-schedule-vue 0.0.0-stage → 1.1.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 +202 -0
- package/README.md +277 -2
- package/dist/ClassSchedule.d.ts +79 -0
- package/dist/ClassSchedule.d.ts.map +1 -0
- package/dist/ClassSchedule.js +293 -0
- package/dist/ClassSchedule.js.map +1 -0
- package/dist/helpers.d.ts +34 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +65 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +65 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,278 @@
|
|
|
1
|
-
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-11-18T23:41:40.018Z
|
|
7
|
+
-->
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
# @molecule/app-class-schedule-vue
|
|
10
|
+
|
|
11
|
+
Vue weekly class-schedule grid.
|
|
12
|
+
|
|
13
|
+
Renders a 7-day × N-hour time grid with absolutely positioned event
|
|
14
|
+
tiles inside each day column. Overlapping events on the same weekday
|
|
15
|
+
are split into side-by-side lanes. Click handlers fire separately for
|
|
16
|
+
event tiles and empty time slots.
|
|
17
|
+
|
|
18
|
+
Designed for school timetables, virtual classroom schedules, gym /
|
|
19
|
+
studio class calendars, conference tracks, and any other weekly
|
|
20
|
+
recurring time-of-day grid.
|
|
21
|
+
|
|
22
|
+
This is the Vue counterpart of `@molecule/app-class-schedule-react`: the
|
|
23
|
+
same exports (React prop names), the same ClassMap tokens and the same DOM
|
|
24
|
+
for the same input.
|
|
25
|
+
|
|
26
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
27
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
28
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { createApp, defineComponent, h } from 'vue'
|
|
34
|
+
import { ClassSchedule } from '@molecule/app-class-schedule-vue'
|
|
35
|
+
|
|
36
|
+
const App = defineComponent({
|
|
37
|
+
setup() {
|
|
38
|
+
return () =>
|
|
39
|
+
h(ClassSchedule, {
|
|
40
|
+
events: [
|
|
41
|
+
{
|
|
42
|
+
id: 'math',
|
|
43
|
+
weekday: 1,
|
|
44
|
+
start: 9 * 60,
|
|
45
|
+
end: 10 * 60,
|
|
46
|
+
title: 'Math 101',
|
|
47
|
+
subtitle: 'Room 4B',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'eng',
|
|
51
|
+
weekday: 3,
|
|
52
|
+
start: 11 * 60,
|
|
53
|
+
end: 12 * 60,
|
|
54
|
+
title: 'English',
|
|
55
|
+
subtitle: 'Room 12',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
onEventClick: (e) => console.log('clicked', e.id),
|
|
59
|
+
onSlotClick: (s) => console.log('empty slot', s),
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
createApp(App).mount('#app')
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Type
|
|
68
|
+
|
|
69
|
+
`feature`
|
|
70
|
+
|
|
71
|
+
## Installation
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install @molecule/app-class-schedule-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## API
|
|
78
|
+
|
|
79
|
+
### Interfaces
|
|
80
|
+
|
|
81
|
+
#### `ScheduleEvent`
|
|
82
|
+
|
|
83
|
+
A single event on the weekly schedule grid.
|
|
84
|
+
|
|
85
|
+
`start` and `end` are minute offsets from midnight (`0`–`1440`). For
|
|
86
|
+
example a class running 09:00–10:30 is `{ start: 540, end: 630 }`.
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
interface ScheduleEvent {
|
|
90
|
+
/** Stable identifier (passed to click handlers). */
|
|
91
|
+
id: string
|
|
92
|
+
/** ISO weekday: `0` = Sunday, `1` = Monday … `6` = Saturday. */
|
|
93
|
+
weekday: 0 | 1 | 2 | 3 | 4 | 5 | 6
|
|
94
|
+
/** Start time in minutes from midnight (e.g. `540` = 09:00). */
|
|
95
|
+
start: number
|
|
96
|
+
/** End time in minutes from midnight (e.g. `630` = 10:30). */
|
|
97
|
+
end: number
|
|
98
|
+
/** Primary label rendered inside the event tile. */
|
|
99
|
+
title: VNodeChild
|
|
100
|
+
/** Secondary line — typically room or location. */
|
|
101
|
+
subtitle?: VNodeChild
|
|
102
|
+
/** Tertiary line — typically teacher or instructor. */
|
|
103
|
+
meta?: VNodeChild
|
|
104
|
+
/** Optional accent color applied as a left border on the tile. */
|
|
105
|
+
accentColor?: string
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### `ScheduleSlot`
|
|
110
|
+
|
|
111
|
+
Empty-slot click payload — `weekday` plus the start of the clicked hour
|
|
112
|
+
(in minutes from midnight, snapped down to the row).
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
interface ScheduleSlot {
|
|
116
|
+
weekday: 0 | 1 | 2 | 3 | 4 | 5 | 6
|
|
117
|
+
/** Hour-of-day boundary in minutes (e.g. `540` for the 09:00 row). */
|
|
118
|
+
start: number
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### `ClassScheduleProps`
|
|
123
|
+
|
|
124
|
+
Props for the {@link ClassSchedule} weekly timetable component.
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
interface ClassScheduleProps {
|
|
128
|
+
/** Events to render. */
|
|
129
|
+
events: ScheduleEvent[]
|
|
130
|
+
/** First day-of-week (`0` = Sunday, `1` = Monday). Defaults to `1`. */
|
|
131
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6
|
|
132
|
+
/** Visible hour range as `[startHour, endHour]` in 24-hour clock. Defaults to `[8, 18]`. */
|
|
133
|
+
dayHours?: [number, number]
|
|
134
|
+
/** Pixel height of one hour row. Defaults to `60`. */
|
|
135
|
+
cellHeight?: number
|
|
136
|
+
/** Whether to show Saturday + Sunday columns. Defaults to `true`. */
|
|
137
|
+
showWeekendCols?: boolean
|
|
138
|
+
/**
|
|
139
|
+
* Locale for weekday name formatting. Defaults to the app's active locale
|
|
140
|
+
* (`useLocale()`), so the names follow a locale switch; an explicit `locale`
|
|
141
|
+
* still wins.
|
|
142
|
+
*/
|
|
143
|
+
locale?: string
|
|
144
|
+
/** Called when an event tile is clicked. */
|
|
145
|
+
onEventClick?: (event: ScheduleEvent) => void
|
|
146
|
+
/** Called when an empty grid cell is clicked. */
|
|
147
|
+
onSlotClick?: (slot: ScheduleSlot) => void
|
|
148
|
+
/** Extra classes for the root container. */
|
|
149
|
+
className?: string
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Functions
|
|
154
|
+
|
|
155
|
+
#### `formatHourLabel(minutes)`
|
|
156
|
+
|
|
157
|
+
Format a minute-of-day value (0–1440) as `HH:MM` 24-hour clock.
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
function formatHourLabel(minutes: number): string
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
- `minutes` — Minutes from midnight.
|
|
164
|
+
|
|
165
|
+
**Returns:** Zero-padded `HH:MM` string.
|
|
166
|
+
|
|
167
|
+
#### `assignLanes(events)`
|
|
168
|
+
|
|
169
|
+
Lay out events that share a weekday into non-overlapping side-by-side
|
|
170
|
+
lanes. Each event gets a `lane` index (0…N) and a `lanes` count for the
|
|
171
|
+
group it belongs to so the caller can compute width/left as
|
|
172
|
+
`width = (1/lanes) * 100%` / `left = (lane/lanes) * 100%`.
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
function assignLanes<E extends { start: number; end: number }>(
|
|
176
|
+
events: E[],
|
|
177
|
+
): Array<{ event: E; lane: number; lanes: number }>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
- `events` — Events occurring on a single weekday.
|
|
181
|
+
|
|
182
|
+
**Returns:** Array of `{ event, lane, lanes }` records, in input order.
|
|
183
|
+
|
|
184
|
+
### Constants
|
|
185
|
+
|
|
186
|
+
#### `ClassSchedule`
|
|
187
|
+
|
|
188
|
+
Weekly class-schedule grid. Renders a 7-column (or 5-column when
|
|
189
|
+
`showWeekendCols` is `false`) timetable with hour rows down the left
|
|
190
|
+
and absolutely positioned event tiles inside each day column. Events
|
|
191
|
+
that overlap on the same weekday are split into side-by-side lanes.
|
|
192
|
+
|
|
193
|
+
Suitable for school timetables, virtual-classroom schedules, gym
|
|
194
|
+
class calendars, conference tracks, or any weekly recurring time
|
|
195
|
+
grid.
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
const ClassSchedule: DefineComponent<
|
|
199
|
+
ExtractPropTypes<{
|
|
200
|
+
events: { type: PropType<ScheduleEvent[]>; required: true }
|
|
201
|
+
weekStartsOn: { type: PropType<0 | 1 | 2 | 3 | 4 | 5 | 6>; default: number }
|
|
202
|
+
dayHours: { type: PropType<number[]>; default: () => number[] }
|
|
203
|
+
cellHeight: { type: NumberConstructor; default: number }
|
|
204
|
+
showWeekendCols: { type: BooleanConstructor; default: boolean }
|
|
205
|
+
locale: StringConstructor
|
|
206
|
+
onEventClick: PropType<(event: ScheduleEvent) => void>
|
|
207
|
+
onSlotClick: PropType<(slot: ScheduleSlot) => void>
|
|
208
|
+
className: StringConstructor
|
|
209
|
+
}>,
|
|
210
|
+
() => VNode,
|
|
211
|
+
{},
|
|
212
|
+
{},
|
|
213
|
+
{},
|
|
214
|
+
ComponentOptionsMixin,
|
|
215
|
+
ComponentOptionsMixin,
|
|
216
|
+
{},
|
|
217
|
+
string,
|
|
218
|
+
PublicProps,
|
|
219
|
+
Readonly<
|
|
220
|
+
ExtractPropTypes<{
|
|
221
|
+
events: { type: PropType<ScheduleEvent[]>; required: true }
|
|
222
|
+
weekStartsOn: { type: PropType<0 | 1 | 2 | 3 | 4 | 5 | 6>; default: number }
|
|
223
|
+
dayHours: { type: PropType<number[]>; default: () => number[] }
|
|
224
|
+
cellHeight: { type: NumberConstructor; default: number }
|
|
225
|
+
showWeekendCols: { type: BooleanConstructor; default: boolean }
|
|
226
|
+
locale: StringConstructor
|
|
227
|
+
onEventClick: PropType<(event: ScheduleEvent) => void>
|
|
228
|
+
onSlotClick: PropType<(slot: ScheduleSlot) => void>
|
|
229
|
+
className: StringConstructor
|
|
230
|
+
}>
|
|
231
|
+
> &
|
|
232
|
+
Readonly<{}>,
|
|
233
|
+
{
|
|
234
|
+
weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6
|
|
235
|
+
dayHours: number[]
|
|
236
|
+
cellHeight: number
|
|
237
|
+
showWeekendCols: boolean
|
|
238
|
+
},
|
|
239
|
+
{},
|
|
240
|
+
{},
|
|
241
|
+
{},
|
|
242
|
+
string,
|
|
243
|
+
ComponentProvideOptions,
|
|
244
|
+
true,
|
|
245
|
+
{},
|
|
246
|
+
any
|
|
247
|
+
>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
- `props` — Component props (see {@link ClassScheduleProps}).
|
|
251
|
+
|
|
252
|
+
**Returns:** The schedule grid component.
|
|
253
|
+
|
|
254
|
+
## Injection Notes
|
|
255
|
+
|
|
256
|
+
### Requirements
|
|
257
|
+
|
|
258
|
+
Peer dependencies:
|
|
259
|
+
|
|
260
|
+
- `@molecule/app-ui` ^1.3.11
|
|
261
|
+
- `@molecule/app-ui-vue` ^1.1.0
|
|
262
|
+
- `@molecule/app-vue` ^3.5.0
|
|
263
|
+
- `vue` ^3.4.0
|
|
264
|
+
|
|
265
|
+
### Runtime Dependencies
|
|
266
|
+
|
|
267
|
+
- `@molecule/app-ui`
|
|
268
|
+
- `@molecule/app-ui-vue`
|
|
269
|
+
- `@molecule/app-vue`
|
|
270
|
+
- `vue`
|
|
271
|
+
|
|
272
|
+
Pair with `@molecule/app-locales-class-schedule` for translations
|
|
273
|
+
in 79 languages. All styling routes through `getClassMap()`; all
|
|
274
|
+
user-facing text routes through `t()`.
|
|
275
|
+
|
|
276
|
+
## Translations
|
|
277
|
+
|
|
278
|
+
Translation strings are provided by `@molecule/app-locales-class-schedule`.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue weekly class-schedule grid — the counterpart of
|
|
3
|
+
* `@molecule/app-class-schedule-react`'s `ClassSchedule`: the same props
|
|
4
|
+
* (React names), the same DOM for the same input.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { type PropType, type VNode } from 'vue';
|
|
9
|
+
import type { ScheduleEvent, ScheduleSlot } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Weekly class-schedule grid. Renders a 7-column (or 5-column when
|
|
12
|
+
* `showWeekendCols` is `false`) timetable with hour rows down the left
|
|
13
|
+
* and absolutely positioned event tiles inside each day column. Events
|
|
14
|
+
* that overlap on the same weekday are split into side-by-side lanes.
|
|
15
|
+
*
|
|
16
|
+
* Suitable for school timetables, virtual-classroom schedules, gym
|
|
17
|
+
* class calendars, conference tracks, or any weekly recurring time
|
|
18
|
+
* grid.
|
|
19
|
+
*
|
|
20
|
+
* @param props - Component props (see {@link ClassScheduleProps}).
|
|
21
|
+
* @returns The schedule grid component.
|
|
22
|
+
*/
|
|
23
|
+
export declare const ClassSchedule: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
24
|
+
events: {
|
|
25
|
+
type: PropType<ScheduleEvent[]>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
weekStartsOn: {
|
|
29
|
+
type: PropType<0 | 1 | 2 | 3 | 4 | 5 | 6>;
|
|
30
|
+
default: number;
|
|
31
|
+
};
|
|
32
|
+
dayHours: {
|
|
33
|
+
type: PropType<number[]>;
|
|
34
|
+
default: () => number[];
|
|
35
|
+
};
|
|
36
|
+
cellHeight: {
|
|
37
|
+
type: NumberConstructor;
|
|
38
|
+
default: number;
|
|
39
|
+
};
|
|
40
|
+
showWeekendCols: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: boolean;
|
|
43
|
+
};
|
|
44
|
+
locale: StringConstructor;
|
|
45
|
+
onEventClick: PropType<(event: ScheduleEvent) => void>;
|
|
46
|
+
onSlotClick: PropType<(slot: ScheduleSlot) => void>;
|
|
47
|
+
className: StringConstructor;
|
|
48
|
+
}>, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
49
|
+
events: {
|
|
50
|
+
type: PropType<ScheduleEvent[]>;
|
|
51
|
+
required: true;
|
|
52
|
+
};
|
|
53
|
+
weekStartsOn: {
|
|
54
|
+
type: PropType<0 | 1 | 2 | 3 | 4 | 5 | 6>;
|
|
55
|
+
default: number;
|
|
56
|
+
};
|
|
57
|
+
dayHours: {
|
|
58
|
+
type: PropType<number[]>;
|
|
59
|
+
default: () => number[];
|
|
60
|
+
};
|
|
61
|
+
cellHeight: {
|
|
62
|
+
type: NumberConstructor;
|
|
63
|
+
default: number;
|
|
64
|
+
};
|
|
65
|
+
showWeekendCols: {
|
|
66
|
+
type: BooleanConstructor;
|
|
67
|
+
default: boolean;
|
|
68
|
+
};
|
|
69
|
+
locale: StringConstructor;
|
|
70
|
+
onEventClick: PropType<(event: ScheduleEvent) => void>;
|
|
71
|
+
onSlotClick: PropType<(slot: ScheduleSlot) => void>;
|
|
72
|
+
className: StringConstructor;
|
|
73
|
+
}>> & Readonly<{}>, {
|
|
74
|
+
weekStartsOn: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
75
|
+
dayHours: number[];
|
|
76
|
+
cellHeight: number;
|
|
77
|
+
showWeekendCols: boolean;
|
|
78
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
79
|
+
//# sourceMappingURL=ClassSchedule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClassSchedule.d.ts","sourceRoot":"","sources":["../src/ClassSchedule.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAGL,KAAK,QAAQ,EAEb,KAAK,KAAK,EAGX,MAAM,KAAK,CAAA;AAMZ,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAsB7D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa;;cAIL,QAAQ,CAAC,aAAa,EAAE,CAAC;;;;cAIxB,QAAQ,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;;;;cAIpC,QAAQ,CAAC,MAAM,EAAE,CAAC;;;;;;;;;;;;kBAYT,QAAQ,CAAC,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;iBACzC,QAAQ,CAAC,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;;UAsBpD,KAAK;;cA3CC,QAAQ,CAAC,aAAa,EAAE,CAAC;;;;cAIxB,QAAQ,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;;;;cAIpC,QAAQ,CAAC,MAAM,EAAE,CAAC;;;;;;;;;;;;kBAYT,QAAQ,CAAC,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;iBACzC,QAAQ,CAAC,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;;;;;;;4EAwTjE,CAAA"}
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue weekly class-schedule grid — the counterpart of
|
|
3
|
+
* `@molecule/app-class-schedule-react`'s `ClassSchedule`: the same props
|
|
4
|
+
* (React names), the same DOM for the same input.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { defineComponent, h, useId, } from 'vue';
|
|
9
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
10
|
+
import { useLocale, useTranslation } from '@molecule/app-vue';
|
|
11
|
+
import { assignLanes, formatHourLabel } from './helpers.js';
|
|
12
|
+
/** Minutes in one hour. */
|
|
13
|
+
const MINUTES_PER_HOUR = 60;
|
|
14
|
+
/** Weekday numbers that fall on the weekend (`0` = Sunday, `6` = Saturday). */
|
|
15
|
+
const WEEKEND_DAYS = new Set([0, 6]);
|
|
16
|
+
/** The ISO weekday numbers, Sunday first. */
|
|
17
|
+
const ALL_WEEKDAYS = [0, 1, 2, 3, 4, 5, 6];
|
|
18
|
+
/**
|
|
19
|
+
* The children `h()` accepts, from a node-valued line (React's `ReactNode`):
|
|
20
|
+
* a `null`/`undefined` line renders nothing but its parent element (the line
|
|
21
|
+
* is only passed when the caller set it, so this is the empty fallback).
|
|
22
|
+
*
|
|
23
|
+
* @param value - The caller's node-valued line.
|
|
24
|
+
* @returns A value `h()` accepts as children.
|
|
25
|
+
*/
|
|
26
|
+
const content = (value) => value ?? '';
|
|
27
|
+
/**
|
|
28
|
+
* Weekly class-schedule grid. Renders a 7-column (or 5-column when
|
|
29
|
+
* `showWeekendCols` is `false`) timetable with hour rows down the left
|
|
30
|
+
* and absolutely positioned event tiles inside each day column. Events
|
|
31
|
+
* that overlap on the same weekday are split into side-by-side lanes.
|
|
32
|
+
*
|
|
33
|
+
* Suitable for school timetables, virtual-classroom schedules, gym
|
|
34
|
+
* class calendars, conference tracks, or any weekly recurring time
|
|
35
|
+
* grid.
|
|
36
|
+
*
|
|
37
|
+
* @param props - Component props (see {@link ClassScheduleProps}).
|
|
38
|
+
* @returns The schedule grid component.
|
|
39
|
+
*/
|
|
40
|
+
export const ClassSchedule = defineComponent({
|
|
41
|
+
name: 'ClassSchedule',
|
|
42
|
+
props: {
|
|
43
|
+
events: {
|
|
44
|
+
type: Array,
|
|
45
|
+
required: true,
|
|
46
|
+
},
|
|
47
|
+
weekStartsOn: {
|
|
48
|
+
type: Number,
|
|
49
|
+
default: 1,
|
|
50
|
+
},
|
|
51
|
+
dayHours: {
|
|
52
|
+
type: Array,
|
|
53
|
+
default: () => [8, 18],
|
|
54
|
+
},
|
|
55
|
+
cellHeight: {
|
|
56
|
+
type: Number,
|
|
57
|
+
default: 60,
|
|
58
|
+
},
|
|
59
|
+
showWeekendCols: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: true,
|
|
62
|
+
},
|
|
63
|
+
locale: String,
|
|
64
|
+
onEventClick: Function,
|
|
65
|
+
onSlotClick: Function,
|
|
66
|
+
className: String,
|
|
67
|
+
},
|
|
68
|
+
setup(props) {
|
|
69
|
+
const { t } = useTranslation();
|
|
70
|
+
// Base of the day headers' ids — the columns' `aria-labelledby` names them
|
|
71
|
+
// (a generated id, never one derived from data).
|
|
72
|
+
const baseId = useId();
|
|
73
|
+
// Read in the render (below), so the weekday headers re-word on a locale switch.
|
|
74
|
+
const activeLocale = useLocale();
|
|
75
|
+
/**
|
|
76
|
+
* Localized short weekday name for a given ISO weekday number.
|
|
77
|
+
*
|
|
78
|
+
* @param fmt - The weekday formatter for this render.
|
|
79
|
+
* @param weekday - ISO weekday number (0 = Sunday … 6 = Saturday).
|
|
80
|
+
* @returns Localized short weekday name, e.g. `"Mon"`.
|
|
81
|
+
*/
|
|
82
|
+
const weekdayLabel = (fmt, weekday) =>
|
|
83
|
+
// 1970-01-04 = Sunday → add `weekday` days to get the right name.
|
|
84
|
+
fmt.format(new Date(Date.UTC(1970, 0, 4 + weekday)));
|
|
85
|
+
return () => {
|
|
86
|
+
const cm = getClassMap();
|
|
87
|
+
const [startHour, endHour] = props.dayHours;
|
|
88
|
+
const safeStart = Math.max(0, Math.min(23, Math.floor(startHour)));
|
|
89
|
+
const safeEnd = Math.max(safeStart + 1, Math.min(24, Math.floor(endHour)));
|
|
90
|
+
const startMinutes = safeStart * MINUTES_PER_HOUR;
|
|
91
|
+
const endMinutes = safeEnd * MINUTES_PER_HOUR;
|
|
92
|
+
const totalMinutes = endMinutes - startMinutes;
|
|
93
|
+
const hourCount = safeEnd - safeStart;
|
|
94
|
+
// Column ordering: rotate weekdays so `weekStartsOn` is first.
|
|
95
|
+
const weekStartsOn = props.weekStartsOn;
|
|
96
|
+
const rotated = [
|
|
97
|
+
...ALL_WEEKDAYS.slice(weekStartsOn),
|
|
98
|
+
...ALL_WEEKDAYS.slice(0, weekStartsOn),
|
|
99
|
+
];
|
|
100
|
+
const visibleWeekdays = props.showWeekendCols
|
|
101
|
+
? rotated
|
|
102
|
+
: rotated.filter((d) => !WEEKEND_DAYS.has(d));
|
|
103
|
+
// Localized weekday header — locale data, not phrases, so it is Intl
|
|
104
|
+
// output in the app's active locale (an explicit `locale` prop still
|
|
105
|
+
// wins), and it follows a locale switch.
|
|
106
|
+
const weekdayFmt = new Intl.DateTimeFormat(props.locale ?? activeLocale.value, {
|
|
107
|
+
weekday: 'short',
|
|
108
|
+
});
|
|
109
|
+
// Group events by weekday + run lane assignment per day.
|
|
110
|
+
const eventsByDay = new Map();
|
|
111
|
+
for (const event of props.events) {
|
|
112
|
+
if (!visibleWeekdays.includes(event.weekday))
|
|
113
|
+
continue;
|
|
114
|
+
const list = eventsByDay.get(event.weekday) ?? [];
|
|
115
|
+
list.push(event);
|
|
116
|
+
eventsByDay.set(event.weekday, list);
|
|
117
|
+
}
|
|
118
|
+
const totalHeightPx = hourCount * props.cellHeight;
|
|
119
|
+
const headers = visibleWeekdays.map((weekday) => h('div', {
|
|
120
|
+
key: `head-${weekday}`,
|
|
121
|
+
id: `${baseId}-day-${weekday}`,
|
|
122
|
+
'data-mol-id': 'class-schedule-day-header',
|
|
123
|
+
'data-weekday': weekday,
|
|
124
|
+
class: cm.cn(cm.textSize('xs'), cm.fontWeight('semibold'), cm.textCenter, cm.sp('p', 2)),
|
|
125
|
+
}, weekdayLabel(weekdayFmt, weekday)));
|
|
126
|
+
const hourLabels = Array.from({ length: hourCount }).map((_, i) => {
|
|
127
|
+
const hourMinutes = startMinutes + i * MINUTES_PER_HOUR;
|
|
128
|
+
return h('div', {
|
|
129
|
+
key: `hour-${i}`,
|
|
130
|
+
'data-mol-id': 'class-schedule-hour-label',
|
|
131
|
+
class: cm.cn(cm.textSize('xs'), cm.sp('px', 2)),
|
|
132
|
+
style: {
|
|
133
|
+
position: 'absolute',
|
|
134
|
+
top: `${i * props.cellHeight}px`,
|
|
135
|
+
height: `${props.cellHeight}px`,
|
|
136
|
+
right: '0px',
|
|
137
|
+
left: '0px',
|
|
138
|
+
textAlign: 'right',
|
|
139
|
+
},
|
|
140
|
+
}, formatHourLabel(hourMinutes));
|
|
141
|
+
});
|
|
142
|
+
const timeAxis = h('div', {
|
|
143
|
+
'data-mol-id': 'class-schedule-time-axis',
|
|
144
|
+
class: cm.cn(cm.position('relative')),
|
|
145
|
+
style: { height: `${totalHeightPx}px` },
|
|
146
|
+
}, hourLabels);
|
|
147
|
+
const dayColumns = visibleWeekdays.map((weekday) => {
|
|
148
|
+
const dayEvents = eventsByDay.get(weekday) ?? [];
|
|
149
|
+
const laned = assignLanes(dayEvents);
|
|
150
|
+
// Empty-slot click targets — one button per hour row, only while
|
|
151
|
+
// `onSlotClick` is set: a focusable button that does nothing would be
|
|
152
|
+
// a keyboard trap.
|
|
153
|
+
const slots = props.onSlotClick
|
|
154
|
+
? Array.from({ length: hourCount }).map((_, i) => {
|
|
155
|
+
const slotStart = startMinutes + i * MINUTES_PER_HOUR;
|
|
156
|
+
return h('button', {
|
|
157
|
+
key: `slot-${weekday}-${i}`,
|
|
158
|
+
type: 'button',
|
|
159
|
+
'data-mol-id': 'class-schedule-slot',
|
|
160
|
+
'data-weekday': weekday,
|
|
161
|
+
'data-start': slotStart,
|
|
162
|
+
'aria-label': t('classSchedule.aria.slot', { weekday: weekdayLabel(weekdayFmt, weekday), time: formatHourLabel(slotStart) }, { defaultValue: 'Empty slot, {{weekday}} {{time}}' }),
|
|
163
|
+
onClick: () => props.onSlotClick?.({ weekday, start: slotStart }),
|
|
164
|
+
/* mol-bespoke-button: an INVISIBLE hour-slot hit target,
|
|
165
|
+
absolutely positioned over the grid — it has no label,
|
|
166
|
+
no surface and no chrome, so the inline
|
|
167
|
+
background/border/padding are native resets. A
|
|
168
|
+
`cm.button()` fill would paint the empty grid. */
|
|
169
|
+
style: {
|
|
170
|
+
position: 'absolute',
|
|
171
|
+
top: `${i * props.cellHeight}px`,
|
|
172
|
+
left: '0px',
|
|
173
|
+
right: '0px',
|
|
174
|
+
height: `${props.cellHeight}px`,
|
|
175
|
+
background: 'transparent',
|
|
176
|
+
border: '0px',
|
|
177
|
+
padding: '0px',
|
|
178
|
+
cursor: 'pointer',
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
})
|
|
182
|
+
: [];
|
|
183
|
+
// Event tiles.
|
|
184
|
+
const tiles = laned.flatMap(({ event, lane, lanes }) => {
|
|
185
|
+
const eventStart = Math.max(event.start, startMinutes);
|
|
186
|
+
const eventEnd = Math.min(event.end, endMinutes);
|
|
187
|
+
if (eventEnd <= eventStart)
|
|
188
|
+
return [];
|
|
189
|
+
const topPx = ((eventStart - startMinutes) / totalMinutes) * totalHeightPx;
|
|
190
|
+
const heightPx = ((eventEnd - eventStart) / totalMinutes) * totalHeightPx;
|
|
191
|
+
const leftPct = (lane / lanes) * 100;
|
|
192
|
+
const widthPct = (1 / lanes) * 100;
|
|
193
|
+
const lines = [
|
|
194
|
+
h('span', { 'data-mol-id': 'class-schedule-event-title' }, content(event.title)),
|
|
195
|
+
];
|
|
196
|
+
if (event.subtitle) {
|
|
197
|
+
lines.push(h('span', {
|
|
198
|
+
'data-mol-id': 'class-schedule-event-subtitle',
|
|
199
|
+
class: cm.cn(cm.textSize('xs'), cm.fontWeight('normal')),
|
|
200
|
+
}, content(event.subtitle)));
|
|
201
|
+
}
|
|
202
|
+
if (event.meta) {
|
|
203
|
+
lines.push(h('span', {
|
|
204
|
+
'data-mol-id': 'class-schedule-event-meta',
|
|
205
|
+
class: event.accentColor
|
|
206
|
+
? cm.accentCardLabel({ tone: 'custom' })
|
|
207
|
+
: cm.cn(cm.textSize('xs'), cm.fontWeight('normal')),
|
|
208
|
+
}, content(event.meta)));
|
|
209
|
+
}
|
|
210
|
+
// The tile's accessible name is its content — title, subtitle, meta,
|
|
211
|
+
// then the time, through a visually hidden run (the former
|
|
212
|
+
// `aria-label` REPLACED that content as the name, so a screen reader
|
|
213
|
+
// never heard the class).
|
|
214
|
+
lines.push(h('span', { class: cm.srOnly }, t('classSchedule.aria.event', {
|
|
215
|
+
weekday: weekdayLabel(weekdayFmt, weekday),
|
|
216
|
+
start: formatHourLabel(event.start),
|
|
217
|
+
end: formatHourLabel(event.end),
|
|
218
|
+
}, { defaultValue: '{{weekday}} {{start}} – {{end}}' })));
|
|
219
|
+
/* mol-bespoke-button: a calendar EVENT TILE, not a CTA —
|
|
220
|
+
it is absolutely positioned and sized from the event's
|
|
221
|
+
start/end times and lane, and its accent bar carries
|
|
222
|
+
the caller's own `accentColor` (data, not a design
|
|
223
|
+
token). No `cm.button()` tier can express either. */
|
|
224
|
+
// A `<button>` only while `onEventClick` is set: without a handler
|
|
225
|
+
// the tile is static content — a focusable button that does nothing
|
|
226
|
+
// would be a keyboard trap.
|
|
227
|
+
const tileProps = {
|
|
228
|
+
key: event.id,
|
|
229
|
+
'data-mol-id': 'class-schedule-event',
|
|
230
|
+
'data-event-id': event.id,
|
|
231
|
+
class: cm.cn(cm.flex({ direction: 'col', align: 'start' }), cm.sp('p', 1), cm.textSize('xs'), cm.fontWeight('semibold'),
|
|
232
|
+
// The caller's accentColor drives an inset bar (DESIGN.md →
|
|
233
|
+
// "Accent bars"), not a hard border-left.
|
|
234
|
+
event.accentColor && cm.accentCard({ tone: 'custom' })),
|
|
235
|
+
style: {
|
|
236
|
+
position: 'absolute',
|
|
237
|
+
top: `${topPx}px`,
|
|
238
|
+
height: `${heightPx}px`,
|
|
239
|
+
left: `calc(${leftPct}% + 2px)`,
|
|
240
|
+
width: `calc(${widthPct}% - 4px)`,
|
|
241
|
+
overflow: 'hidden',
|
|
242
|
+
textAlign: 'left',
|
|
243
|
+
cursor: props.onEventClick ? 'pointer' : 'default',
|
|
244
|
+
...(event.accentColor ? { '--mol-accent': event.accentColor } : {}),
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
return [
|
|
248
|
+
props.onEventClick
|
|
249
|
+
? h('button', { ...tileProps, type: 'button', onClick: () => props.onEventClick?.(event) }, lines)
|
|
250
|
+
: h('div', tileProps, lines),
|
|
251
|
+
];
|
|
252
|
+
});
|
|
253
|
+
return h('div', {
|
|
254
|
+
key: `col-${weekday}`,
|
|
255
|
+
role: 'group',
|
|
256
|
+
'aria-labelledby': `${baseId}-day-${weekday}`,
|
|
257
|
+
'data-mol-id': 'class-schedule-day-column',
|
|
258
|
+
'data-weekday': weekday,
|
|
259
|
+
class: cm.cn(cm.position('relative')),
|
|
260
|
+
style: { height: `${totalHeightPx}px` },
|
|
261
|
+
}, [...slots, ...tiles]);
|
|
262
|
+
});
|
|
263
|
+
// A named `group`, not a `grid`: the layout is a CSS grid, not an ARIA
|
|
264
|
+
// grid — it has no rows and no grid keyboard model, and `role="grid"`
|
|
265
|
+
// would promise one (axe: aria-required-children).
|
|
266
|
+
return h('div', {
|
|
267
|
+
class: cm.cn(props.className),
|
|
268
|
+
'data-mol-id': 'class-schedule',
|
|
269
|
+
role: 'group',
|
|
270
|
+
'aria-label': t('classSchedule.aria.region', {}, {
|
|
271
|
+
defaultValue: 'Weekly class schedule',
|
|
272
|
+
}),
|
|
273
|
+
}, [
|
|
274
|
+
h('div', {
|
|
275
|
+
class: cm.cn(cm.grid({ cols: visibleWeekdays.length + 1, gap: 'none' })),
|
|
276
|
+
style: {
|
|
277
|
+
gridTemplateColumns: `auto repeat(${visibleWeekdays.length}, minmax(0, 1fr))`,
|
|
278
|
+
},
|
|
279
|
+
}, [
|
|
280
|
+
// Header row.
|
|
281
|
+
h('div', {
|
|
282
|
+
class: cm.cn(cm.textSize('xs'), cm.fontWeight('semibold'), cm.sp('p', 2)),
|
|
283
|
+
'aria-hidden': 'true',
|
|
284
|
+
}),
|
|
285
|
+
...headers,
|
|
286
|
+
timeAxis,
|
|
287
|
+
...dayColumns,
|
|
288
|
+
]),
|
|
289
|
+
]);
|
|
290
|
+
};
|
|
291
|
+
},
|
|
292
|
+
});
|
|
293
|
+
//# sourceMappingURL=ClassSchedule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClassSchedule.js","sourceRoot":"","sources":["../src/ClassSchedule.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,eAAe,EACf,CAAC,EAED,KAAK,GAIN,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAA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34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lane layout and time formatting for the weekly class-schedule grid.
|
|
3
|
+
*
|
|
4
|
+
* Both helpers are plain framework-neutral functions, ported verbatim from
|
|
5
|
+
* `@molecule/app-class-schedule-react` so every framework package exports the
|
|
6
|
+
* same values for the same input.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Format a minute-of-day value (0–1440) as `HH:MM` 24-hour clock.
|
|
12
|
+
*
|
|
13
|
+
* @param minutes - Minutes from midnight.
|
|
14
|
+
* @returns Zero-padded `HH:MM` string.
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatHourLabel(minutes: number): string;
|
|
17
|
+
/**
|
|
18
|
+
* Lay out events that share a weekday into non-overlapping side-by-side
|
|
19
|
+
* lanes. Each event gets a `lane` index (0…N) and a `lanes` count for the
|
|
20
|
+
* group it belongs to so the caller can compute width/left as
|
|
21
|
+
* `width = (1/lanes) * 100%` / `left = (lane/lanes) * 100%`.
|
|
22
|
+
*
|
|
23
|
+
* @param events - Events occurring on a single weekday.
|
|
24
|
+
* @returns Array of `{ event, lane, lanes }` records, in input order.
|
|
25
|
+
*/
|
|
26
|
+
export declare function assignLanes<E extends {
|
|
27
|
+
start: number;
|
|
28
|
+
end: number;
|
|
29
|
+
}>(events: E[]): Array<{
|
|
30
|
+
event: E;
|
|
31
|
+
lane: number;
|
|
32
|
+
lanes: number;
|
|
33
|
+
}>;
|
|
34
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAClE,MAAM,EAAE,CAAC,EAAE,GACV,KAAK,CAAC;IAAE,KAAK,EAAE,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAgClD"}
|
package/dist/helpers.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lane layout and time formatting for the weekly class-schedule grid.
|
|
3
|
+
*
|
|
4
|
+
* Both helpers are plain framework-neutral functions, ported verbatim from
|
|
5
|
+
* `@molecule/app-class-schedule-react` so every framework package exports the
|
|
6
|
+
* same values for the same input.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
/** Minutes in one hour. */
|
|
11
|
+
const MINUTES_PER_HOUR = 60;
|
|
12
|
+
/**
|
|
13
|
+
* Format a minute-of-day value (0–1440) as `HH:MM` 24-hour clock.
|
|
14
|
+
*
|
|
15
|
+
* @param minutes - Minutes from midnight.
|
|
16
|
+
* @returns Zero-padded `HH:MM` string.
|
|
17
|
+
*/
|
|
18
|
+
export function formatHourLabel(minutes) {
|
|
19
|
+
const h = Math.floor(minutes / MINUTES_PER_HOUR);
|
|
20
|
+
const m = minutes % MINUTES_PER_HOUR;
|
|
21
|
+
return `${String(h).padStart(2, '0')}:${String(m).padStart(2, '0')}`;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Lay out events that share a weekday into non-overlapping side-by-side
|
|
25
|
+
* lanes. Each event gets a `lane` index (0…N) and a `lanes` count for the
|
|
26
|
+
* group it belongs to so the caller can compute width/left as
|
|
27
|
+
* `width = (1/lanes) * 100%` / `left = (lane/lanes) * 100%`.
|
|
28
|
+
*
|
|
29
|
+
* @param events - Events occurring on a single weekday.
|
|
30
|
+
* @returns Array of `{ event, lane, lanes }` records, in input order.
|
|
31
|
+
*/
|
|
32
|
+
export function assignLanes(events) {
|
|
33
|
+
const sorted = events
|
|
34
|
+
.map((event, originalIndex) => ({ event, originalIndex }))
|
|
35
|
+
.sort((a, b) => a.event.start - b.event.start || a.event.end - b.event.end);
|
|
36
|
+
const groups = [];
|
|
37
|
+
let current = [];
|
|
38
|
+
let currentMaxEnd = -Infinity;
|
|
39
|
+
for (const { event, originalIndex } of sorted) {
|
|
40
|
+
if (event.start >= currentMaxEnd && current.length > 0) {
|
|
41
|
+
groups.push(current);
|
|
42
|
+
current = [];
|
|
43
|
+
currentMaxEnd = -Infinity;
|
|
44
|
+
}
|
|
45
|
+
// Find lowest free lane in `current`.
|
|
46
|
+
const taken = new Set(current.filter((a) => a.event.end > event.start).map((a) => a.lane));
|
|
47
|
+
let lane = 0;
|
|
48
|
+
while (taken.has(lane))
|
|
49
|
+
lane++;
|
|
50
|
+
current.push({ event, lane, originalIndex });
|
|
51
|
+
if (event.end > currentMaxEnd)
|
|
52
|
+
currentMaxEnd = event.end;
|
|
53
|
+
}
|
|
54
|
+
if (current.length > 0)
|
|
55
|
+
groups.push(current);
|
|
56
|
+
const result = [];
|
|
57
|
+
for (const group of groups) {
|
|
58
|
+
const lanes = group.reduce((max, a) => Math.max(max, a.lane + 1), 1);
|
|
59
|
+
for (const a of group)
|
|
60
|
+
result.push({ ...a, lanes });
|
|
61
|
+
}
|
|
62
|
+
result.sort((a, b) => a.originalIndex - b.originalIndex);
|
|
63
|
+
return result.map(({ event, lane, lanes }) => ({ event, lane, lanes }));
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,2BAA2B;AAC3B,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAE3B;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,O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1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue weekly class-schedule grid.
|
|
3
|
+
*
|
|
4
|
+
* Renders a 7-day × N-hour time grid with absolutely positioned event
|
|
5
|
+
* tiles inside each day column. Overlapping events on the same weekday
|
|
6
|
+
* are split into side-by-side lanes. Click handlers fire separately for
|
|
7
|
+
* event tiles and empty time slots.
|
|
8
|
+
*
|
|
9
|
+
* Designed for school timetables, virtual classroom schedules, gym /
|
|
10
|
+
* studio class calendars, conference tracks, and any other weekly
|
|
11
|
+
* recurring time-of-day grid.
|
|
12
|
+
*
|
|
13
|
+
* This is the Vue counterpart of `@molecule/app-class-schedule-react`: the
|
|
14
|
+
* same exports (React prop names), the same ClassMap tokens and the same DOM
|
|
15
|
+
* for the same input.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { createApp, defineComponent, h } from 'vue'
|
|
20
|
+
* import { ClassSchedule } from '@molecule/app-class-schedule-vue'
|
|
21
|
+
*
|
|
22
|
+
* const App = defineComponent({
|
|
23
|
+
* setup() {
|
|
24
|
+
* return () =>
|
|
25
|
+
* h(ClassSchedule, {
|
|
26
|
+
* events: [
|
|
27
|
+
* { id: 'math', weekday: 1, start: 9 * 60, end: 10 * 60, title: 'Math 101', subtitle: 'Room 4B' },
|
|
28
|
+
* { id: 'eng', weekday: 3, start: 11 * 60, end: 12 * 60, title: 'English', subtitle: 'Room 12' },
|
|
29
|
+
* ],
|
|
30
|
+
* onEventClick: (e) => console.log('clicked', e.id),
|
|
31
|
+
* onSlotClick: (s) => console.log('empty slot', s),
|
|
32
|
+
* })
|
|
33
|
+
* },
|
|
34
|
+
* })
|
|
35
|
+
*
|
|
36
|
+
* createApp(App).mount('#app')
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* Pair with `@molecule/app-locales-class-schedule` for translations
|
|
41
|
+
* in 79 languages. All styling routes through `getClassMap()`; all
|
|
42
|
+
* user-facing text routes through `t()`.
|
|
43
|
+
*
|
|
44
|
+
* @module
|
|
45
|
+
*/
|
|
46
|
+
export * from './ClassSchedule.js';
|
|
47
|
+
export * from './helpers.js';
|
|
48
|
+
export * from './types.js';
|
|
49
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue weekly class-schedule grid.
|
|
3
|
+
*
|
|
4
|
+
* Renders a 7-day × N-hour time grid with absolutely positioned event
|
|
5
|
+
* tiles inside each day column. Overlapping events on the same weekday
|
|
6
|
+
* are split into side-by-side lanes. Click handlers fire separately for
|
|
7
|
+
* event tiles and empty time slots.
|
|
8
|
+
*
|
|
9
|
+
* Designed for school timetables, virtual classroom schedules, gym /
|
|
10
|
+
* studio class calendars, conference tracks, and any other weekly
|
|
11
|
+
* recurring time-of-day grid.
|
|
12
|
+
*
|
|
13
|
+
* This is the Vue counterpart of `@molecule/app-class-schedule-react`: the
|
|
14
|
+
* same exports (React prop names), the same ClassMap tokens and the same DOM
|
|
15
|
+
* for the same input.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { createApp, defineComponent, h } from 'vue'
|
|
20
|
+
* import { ClassSchedule } from '@molecule/app-class-schedule-vue'
|
|
21
|
+
*
|
|
22
|
+
* const App = defineComponent({
|
|
23
|
+
* setup() {
|
|
24
|
+
* return () =>
|
|
25
|
+
* h(ClassSchedule, {
|
|
26
|
+
* events: [
|
|
27
|
+
* { id: 'math', weekday: 1, start: 9 * 60, end: 10 * 60, title: 'Math 101', subtitle: 'Room 4B' },
|
|
28
|
+
* { id: 'eng', weekday: 3, start: 11 * 60, end: 12 * 60, title: 'English', subtitle: 'Room 12' },
|
|
29
|
+
* ],
|
|
30
|
+
* onEventClick: (e) => console.log('clicked', e.id),
|
|
31
|
+
* onSlotClick: (s) => console.log('empty slot', s),
|
|
32
|
+
* })
|
|
33
|
+
* },
|
|
34
|
+
* })
|
|
35
|
+
*
|
|
36
|
+
* createApp(App).mount('#app')
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* Pair with `@molecule/app-locales-class-schedule` for translations
|
|
41
|
+
* in 79 languages. All styling routes through `getClassMap()`; all
|
|
42
|
+
* user-facing text routes through `t()`.
|
|
43
|
+
*
|
|
44
|
+
* @module
|
|
45
|
+
*/
|
|
46
|
+
export * from './ClassSchedule.js';
|
|
47
|
+
export * from './helpers.js';
|
|
48
|
+
export * from './types.js';
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the Vue weekly class-schedule grid.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { VNodeChild } from 'vue';
|
|
7
|
+
/**
|
|
8
|
+
* A single event on the weekly schedule grid.
|
|
9
|
+
*
|
|
10
|
+
* `start` and `end` are minute offsets from midnight (`0`–`1440`). For
|
|
11
|
+
* example a class running 09:00–10:30 is `{ start: 540, end: 630 }`.
|
|
12
|
+
*/
|
|
13
|
+
export interface ScheduleEvent {
|
|
14
|
+
/** Stable identifier (passed to click handlers). */
|
|
15
|
+
id: string;
|
|
16
|
+
/** ISO weekday: `0` = Sunday, `1` = Monday … `6` = Saturday. */
|
|
17
|
+
weekday: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
18
|
+
/** Start time in minutes from midnight (e.g. `540` = 09:00). */
|
|
19
|
+
start: number;
|
|
20
|
+
/** End time in minutes from midnight (e.g. `630` = 10:30). */
|
|
21
|
+
end: number;
|
|
22
|
+
/** Primary label rendered inside the event tile. */
|
|
23
|
+
title: VNodeChild;
|
|
24
|
+
/** Secondary line — typically room or location. */
|
|
25
|
+
subtitle?: VNodeChild;
|
|
26
|
+
/** Tertiary line — typically teacher or instructor. */
|
|
27
|
+
meta?: VNodeChild;
|
|
28
|
+
/** Optional accent color applied as a left border on the tile. */
|
|
29
|
+
accentColor?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Empty-slot click payload — `weekday` plus the start of the clicked hour
|
|
33
|
+
* (in minutes from midnight, snapped down to the row).
|
|
34
|
+
*/
|
|
35
|
+
export interface ScheduleSlot {
|
|
36
|
+
weekday: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
37
|
+
/** Hour-of-day boundary in minutes (e.g. `540` for the 09:00 row). */
|
|
38
|
+
start: number;
|
|
39
|
+
}
|
|
40
|
+
/** Props for the {@link ClassSchedule} weekly timetable component. */
|
|
41
|
+
export interface ClassScheduleProps {
|
|
42
|
+
/** Events to render. */
|
|
43
|
+
events: ScheduleEvent[];
|
|
44
|
+
/** First day-of-week (`0` = Sunday, `1` = Monday). Defaults to `1`. */
|
|
45
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
46
|
+
/** Visible hour range as `[startHour, endHour]` in 24-hour clock. Defaults to `[8, 18]`. */
|
|
47
|
+
dayHours?: [number, number];
|
|
48
|
+
/** Pixel height of one hour row. Defaults to `60`. */
|
|
49
|
+
cellHeight?: number;
|
|
50
|
+
/** Whether to show Saturday + Sunday columns. Defaults to `true`. */
|
|
51
|
+
showWeekendCols?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Locale for weekday name formatting. Defaults to the app's active locale
|
|
54
|
+
* (`useLocale()`), so the names follow a locale switch; an explicit `locale`
|
|
55
|
+
* still wins.
|
|
56
|
+
*/
|
|
57
|
+
locale?: string;
|
|
58
|
+
/** Called when an event tile is clicked. */
|
|
59
|
+
onEventClick?: (event: ScheduleEvent) => void;
|
|
60
|
+
/** Called when an empty grid cell is clicked. */
|
|
61
|
+
onSlotClick?: (slot: ScheduleSlot) => void;
|
|
62
|
+
/** Extra classes for the root container. */
|
|
63
|
+
className?: string;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAErC;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAA;IACV,gEAAgE;IAChE,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAClC,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAA;IACb,8DAA8D;IAC9D,GAAG,EAAE,MAAM,CAAA;IACX,oDAAoD;IACpD,KAAK,EAAE,UAAU,CAAA;IACjB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB,uDAAuD;IACvD,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAClC,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;CACd;AAED,sEAAsE;AACtE,MAAM,WAAW,kBAAkB;IACjC,wBAAwB;IACxB,MAAM,EAAE,aAAa,EAAE,CAAA;IACvB,uEAAuE;IACvE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACxC,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC3B,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,qEAAqE;IACrE,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,4CAA4C;IAC5C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IAC7C,iDAAiD;IACjD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAA;IAC1C,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,67 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-class-schedule-vue",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Weekly class-schedule grid — 7-day × N-hour time grid with absolutely positioned events, click-event vs click-empty-slot dispatch, side-by-side stacking for overlaps",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/app-class-schedule-vue",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"dev": "vue-tsc --watch",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"molecule",
|
|
27
|
+
"class-schedule",
|
|
28
|
+
"weekly-schedule",
|
|
29
|
+
"timetable",
|
|
30
|
+
"vue"
|
|
31
|
+
],
|
|
32
|
+
"author": "Molecule Dev, Inc. (https://molecule.dev)",
|
|
33
|
+
"license": "Apache-2.0",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
37
|
+
"directory": "packages/app/features/class-schedule-vue"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=20"
|
|
41
|
+
},
|
|
42
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@molecule/app-ui": "^1.3.11",
|
|
48
|
+
"@molecule/app-ui-vue": "^1.1.0",
|
|
49
|
+
"@molecule/app-vue": "^3.5.0",
|
|
50
|
+
"vue": "^3.4.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@molecule/app-framework-conformance": "0.0.0",
|
|
54
|
+
"@molecule/app-i18n": "1.2.2",
|
|
55
|
+
"@molecule/app-icons": "1.0.4",
|
|
56
|
+
"@molecule/app-ui": "1.4.0",
|
|
57
|
+
"@molecule/app-ui-vue": "1.1.5",
|
|
58
|
+
"@molecule/app-vue": "3.7.2",
|
|
59
|
+
"@types/node": "26.6.5",
|
|
60
|
+
"jsdom": "30.1.3",
|
|
61
|
+
"typescript": "6.0.3",
|
|
62
|
+
"vite": "8.3.5",
|
|
63
|
+
"vitest": "4.1.12",
|
|
64
|
+
"vue": "3.5.44",
|
|
65
|
+
"vue-tsc": "3.3.13"
|
|
66
|
+
}
|
|
67
|
+
}
|