ngx-resource-scheduler 0.1.1 → 0.1.4

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/README.md CHANGED
@@ -1,24 +1,180 @@
1
- # NgxResourceScheduler
1
+ # ngx-resource-scheduler
2
2
 
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.2.0.
3
+ A lightweight, flexible **resource scheduler** for Angular.
4
4
 
5
- ## Code scaffolding
5
+ ## Features
6
6
 
7
- Run `ng generate component component-name --project ngx-resource-scheduler` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-resource-scheduler`.
8
- > Note: Don't forget to add `--project ngx-resource-scheduler` or else it will be added to the default project in your `angular.json` file.
7
+ - Days Resources as primary axis
8
+ - Configurable visible range (1–7 days)
9
+ - Configurable working hours (e.g. `08:00–20:00`)
10
+ - Timezone-aware (UTC, local, or IANA zones)
11
+ - Overlapping event layout
12
+ - Slot & event click callbacks
13
+ - Custom event rendering via `ng-template`
14
+ - Built-in toolbar **or** external navigation
15
+ - Clean, modern styling (system fonts)
9
16
 
10
- ## Build
17
+ ## 📦 Installation
11
18
 
12
- Run `ng build ngx-resource-scheduler` to build the project. The build artifacts will be stored in the `dist/` directory.
19
+ ```bash
20
+ npm install ngx-resource-scheduler
21
+ ````
13
22
 
14
- ## Publishing
23
+ ## 🚀 Basic Usage
15
24
 
16
- After building your library with `ng build ngx-resource-scheduler`, go to the dist folder `cd dist/ngx-resource-scheduler` and run `npm publish`.
25
+ ### html
26
+ ```html
27
+ <ngx-resource-scheduler
28
+ [startDate]="startDate"
29
+ [resources]="resources"
30
+ [events]="events">
31
+ </ngx-resource-scheduler>
32
+ ```
17
33
 
18
- ## Running unit tests
34
+ ### TS
19
35
 
20
- Run `ng test ngx-resource-scheduler` to execute the unit tests via [Karma](https://karma-runner.github.io).
36
+ ```ts
37
+ startDate = new Date();
21
38
 
22
- ## Further help
39
+ resources = [
40
+ { id: 'r1', title: 'Room A' },
41
+ { id: 'r2', title: 'Room B' },
42
+ ];
23
43
 
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
44
+ events = [
45
+ {
46
+ id: 'e1',
47
+ title: 'Meeting',
48
+ resourceId: 'r1',
49
+ start: new Date('2025-01-10T10:00:00Z'),
50
+ end: new Date('2025-01-10T11:00:00Z'),
51
+ },
52
+ ];
53
+ ```
54
+
55
+ ## 🔧 Inputs
56
+
57
+ ### Required
58
+ | Input | Type | Type |
59
+ | ------------- | ------------- | ------------- |
60
+ | startDate | Date | First visible day (recommended at 00:00) |
61
+ | resources | SchedulerResource[] | List of schedulable resources
62
+ | events | SchedulerEvent[] | Events (UTC instants recommended)
63
+
64
+ ### Layout & Range
65
+
66
+ | Input | Default | Description |
67
+ | ------------- | ------------- | ------------- |
68
+ | `nDays` | `7` | Number of visible days (1–7) |
69
+ | `primaryAxis` | `days` | `days` or `resources` |
70
+ | `dayStart` | `08:00` | Start of visible hours |
71
+ | `dayEnd` | `20:00` | End of visible hours |
72
+ | `slotDuration` | `00:30` | Slot resolution |
73
+ | `snapToSlot` | `true` | Snap clicks to slots |
74
+
75
+ ### Appearance
76
+
77
+ | Input | Default | Description |
78
+ | ------------- | ------------- | ------------- |
79
+ | `showToolbar` | `true` | Show built-in navigation toolbar |
80
+ | `showSlotLines` | `true` | Show slot grid lines |
81
+ | `slotLineStyle` | `slot` | `slot`, `hour`, or `both` |
82
+ | `readonly` | `false` | Disable interactions |
83
+ | `timezone` | `local` | `local`, `UTC`, or IANA zone (e.g. `Europe/Kiev`) |
84
+
85
+ > **Important**
86
+ >
87
+ > Events should be provided as UTC instants. The scheduler converts them for display using timezone.
88
+
89
+ ## 🎯 Outputs
90
+
91
+ | Output | Payload | Description |
92
+ | ------------- | ------------- | ------------- |
93
+ | `slotClick` | `SchedulerSlotClick` | User clicked an empty slot |
94
+ | `eventClick` | `SchedulerEventClick` | User clicked an event |
95
+ | `rangeChange` | `SchedulerRangeChange` | Visible date range changed |
96
+ | `startDateChange` | `Date` | Navigation occurred |
97
+ | `eventChange` | - | Under development |
98
+
99
+ ## 🧭 Navigation example (External Controls)
100
+
101
+ You can hide the toolbar and control navigation from outside the scheduler.
102
+
103
+ ```html
104
+ <button (click)="scheduler.prev()">Prev</button>
105
+ <button (click)="scheduler.today()">Today</button>
106
+ <button (click)="scheduler.next()">Next</button>
107
+
108
+ <ngx-resource-scheduler
109
+ #scheduler
110
+ [showToolbar]="false"
111
+ [nDays]="7"
112
+ [resources]="resources"
113
+ [events]="events">
114
+ </ngx-resource-scheduler>
115
+ ```
116
+
117
+ No date math required.
118
+
119
+ ## 🎨 Custom Event Template
120
+
121
+ You can fully customize how events are rendered.
122
+
123
+ ```html
124
+ <ngx-resource-scheduler
125
+ [events]="events"
126
+ [eventTemplate]="eventTpl">
127
+ </ngx-resource-scheduler>
128
+
129
+ <ng-template
130
+ #eventTpl
131
+ let-event
132
+ let-startZoned="startZoned"
133
+ let-endZoned="endZoned">
134
+ <div>
135
+ <strong>{{ event.title }}</strong>
136
+ <div>
137
+ {{ startZoned | date:'HH:mm' }}–{{ endZoned | date:'HH:mm' }}
138
+ </div>
139
+ </div>
140
+ </ng-template>
141
+ ```
142
+
143
+ ### Template Context
144
+
145
+ | Variable | Description |
146
+ | ------------- | ------------- |
147
+ | `event` / `$implicit` | The event |
148
+ | `startZoned` | Start date in scheduler timezone |
149
+ | `endZoned` | End date in scheduler timezone |
150
+ | `resourceId` | Resource id |
151
+ | `day` | Day of the cell |
152
+
153
+ ## 🧩 Styling Events
154
+
155
+ ### HTML
156
+ ```html
157
+ <ngx-resource-scheduler
158
+ [eventClass]="eventClass"
159
+ [eventStyle]="eventStyle">
160
+ </ngx-resource-scheduler>
161
+ ```
162
+
163
+ ### TS
164
+ ```ts
165
+ eventClass = (e) => ({
166
+ 'is-important': e.title.includes('Important'),
167
+ });
168
+
169
+ eventStyle = (e) => ({
170
+ backgroundColor: '#ffe4e6',
171
+ });
172
+ ```
173
+
174
+ > Layout styles (top, left, height, width) are managed internally and cannot be overridden.
175
+
176
+ ## 📌 Notes
177
+
178
+ * Drag & resize are not included in v1 (comming to v2)
179
+ * Designed for clarity and extensibility
180
+ * No external calendar dependencies