ngx-resource-scheduler 0.1.3 → 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 +180 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# ngx-resource-scheduler
|
|
2
|
+
|
|
3
|
+
A lightweight, flexible **resource scheduler** for Angular.
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
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)
|
|
16
|
+
|
|
17
|
+
## 📦 Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install ngx-resource-scheduler
|
|
21
|
+
````
|
|
22
|
+
|
|
23
|
+
## 🚀 Basic Usage
|
|
24
|
+
|
|
25
|
+
### html
|
|
26
|
+
```html
|
|
27
|
+
<ngx-resource-scheduler
|
|
28
|
+
[startDate]="startDate"
|
|
29
|
+
[resources]="resources"
|
|
30
|
+
[events]="events">
|
|
31
|
+
</ngx-resource-scheduler>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### TS
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
startDate = new Date();
|
|
38
|
+
|
|
39
|
+
resources = [
|
|
40
|
+
{ id: 'r1', title: 'Room A' },
|
|
41
|
+
{ id: 'r2', title: 'Room B' },
|
|
42
|
+
];
|
|
43
|
+
|
|
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-resource-scheduler",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Angular scheduler with date columns and nested resource columns or inverted",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "https://github.com/
|
|
14
|
+
"url": "https://github.com/rmpt/ngx-resource-scheduler"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@angular/common": ">=20.0.0 <22.0.0",
|