@timelinekit/react 1.0.1 → 1.0.3
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 +46 -0
- package/README.md +145 -0
- package/dist/__tests__/eventcalendar.test.d.ts +1 -0
- package/dist/eventcalendar.component.d.ts +39 -0
- package/dist/ganttchart.component.d.ts +13 -8
- package/dist/index.d.ts +5 -2
- package/dist/index.js +1 -1
- package/dist/resourcescheduler.component.d.ts +33 -6
- package/package.json +38 -34
package/LICENSE
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
TimelineKit Commercial License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present TimelineKit. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This software is licensed under the TimelineKit Commercial License.
|
|
6
|
+
|
|
7
|
+
1. FREE TIER
|
|
8
|
+
|
|
9
|
+
You may use the Free tier of TimelineKit in any project (including commercial
|
|
10
|
+
projects) without purchasing a license. The Free tier includes core Gantt
|
|
11
|
+
chart functionality with a watermark overlay.
|
|
12
|
+
|
|
13
|
+
2. PRO TIER
|
|
14
|
+
|
|
15
|
+
A paid license key is required to unlock Pro features and remove the
|
|
16
|
+
watermark. Pro features include: Critical Path, Baseline, Resource
|
|
17
|
+
Management, Working Calendar, Markers, Filtering, Undo/Redo, Clipboard,
|
|
18
|
+
Constraints, Custom Properties, Resource Scheduler, Export, Additional
|
|
19
|
+
Themes, and Additional Locales.
|
|
20
|
+
|
|
21
|
+
3. PERPETUAL LICENSE
|
|
22
|
+
|
|
23
|
+
A purchased license is perpetual for the major version it was purchased for.
|
|
24
|
+
It never expires and does not require renewal to continue using the same
|
|
25
|
+
major version.
|
|
26
|
+
|
|
27
|
+
If a new major version is released during the active subscription period,
|
|
28
|
+
the license also covers that new version — perpetually.
|
|
29
|
+
|
|
30
|
+
If a new major version is released after the subscription period has ended,
|
|
31
|
+
a subscription renewal is required to use that new version.
|
|
32
|
+
|
|
33
|
+
4. RESTRICTIONS
|
|
34
|
+
|
|
35
|
+
You may not:
|
|
36
|
+
- Redistribute, sublicense, or resell the Pro software or license keys
|
|
37
|
+
- Remove or circumvent the licensing mechanism or watermark
|
|
38
|
+
- Use a single license key across multiple organizations
|
|
39
|
+
|
|
40
|
+
5. NO WARRANTY
|
|
41
|
+
|
|
42
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
43
|
+
IMPLIED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR
|
|
44
|
+
OTHER LIABILITY ARISING FROM THE USE OF THE SOFTWARE.
|
|
45
|
+
|
|
46
|
+
For questions, contact support@timelinekit.com.
|
package/README.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# @timelinekit/react
|
|
2
|
+
|
|
3
|
+
React components for [TimelineKit](https://timelinekit.com) — high-performance, canvas-rendered scheduling components.
|
|
4
|
+
|
|
5
|
+
For a full feature overview, themes, localization, and export options, see the [`@timelinekit/core` README](https://www.npmjs.com/package/@timelinekit/core).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @timelinekit/react @timelinekit/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Requires React 18 or later.
|
|
14
|
+
|
|
15
|
+
## Components
|
|
16
|
+
|
|
17
|
+
| Component | Import | Ref Type | Styles Import |
|
|
18
|
+
|-----------|--------|----------|---------------|
|
|
19
|
+
| Gantt Chart | `GanttChart` | `GanttChartRef` | `@timelinekit/core/styles` |
|
|
20
|
+
| Resource Scheduler | `ResourceScheduler` | `ResourceSchedulerRef` | `@timelinekit/core/styles` |
|
|
21
|
+
| Event Calendar | `EventCalendar` | `EventCalendarRef` | `@timelinekit/core/styles` |
|
|
22
|
+
|
|
23
|
+
All types from `@timelinekit/core` are re-exported from this package for convenience.
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
### Gantt Chart
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { useRef, useEffect } from 'react';
|
|
31
|
+
import { GanttChart, GanttChartRef, Task, TaskLink } from '@timelinekit/react';
|
|
32
|
+
import '@timelinekit/core/styles';
|
|
33
|
+
|
|
34
|
+
function App() {
|
|
35
|
+
const ref = useRef<GanttChartRef>(null);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const gantt = ref.current!;
|
|
39
|
+
const taskA = gantt.list.addTask(new Task({ id: '1', name: 'Design', startTime: '2027-01-05', endTime: '2027-01-09' }));
|
|
40
|
+
const taskB = gantt.list.addTask(new Task({ id: '2', name: 'Development', startTime: '2027-01-12', endTime: '2027-01-23' }));
|
|
41
|
+
gantt.list.addLink(new TaskLink({ id: 'l1', from: taskA, to: taskB, type: 'finishToStart' }));
|
|
42
|
+
gantt.zoomToFit();
|
|
43
|
+
}, []);
|
|
44
|
+
|
|
45
|
+
return <GanttChart ref={ref} style={{ height: '600px' }} />;
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Resource Scheduler
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { useRef, useEffect } from 'react';
|
|
53
|
+
import { ResourceScheduler, ResourceSchedulerRef, SchedulerResource, SchedulerEvent } from '@timelinekit/react';
|
|
54
|
+
import '@timelinekit/core/styles';
|
|
55
|
+
|
|
56
|
+
function App() {
|
|
57
|
+
const ref = useRef<ResourceSchedulerRef>(null);
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
const scheduler = ref.current!;
|
|
61
|
+
const resource = scheduler.data.addResource(new SchedulerResource({ id: '1', name: 'Room A' }));
|
|
62
|
+
scheduler.data.addEvent(new SchedulerEvent({
|
|
63
|
+
id: 'e1',
|
|
64
|
+
resourceId: resource.id,
|
|
65
|
+
name: 'Meeting',
|
|
66
|
+
startTime: '2027-01-05T09:00',
|
|
67
|
+
endTime: '2027-01-05T10:30',
|
|
68
|
+
}));
|
|
69
|
+
}, []);
|
|
70
|
+
|
|
71
|
+
return <ResourceScheduler ref={ref} style={{ height: '600px' }} />;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Event Calendar
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import { useRef, useEffect } from 'react';
|
|
79
|
+
import { EventCalendar, EventCalendarRef, CalendarItem } from '@timelinekit/react';
|
|
80
|
+
import '@timelinekit/core/styles';
|
|
81
|
+
|
|
82
|
+
function App() {
|
|
83
|
+
const ref = useRef<EventCalendarRef>(null);
|
|
84
|
+
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
const calendar = ref.current!;
|
|
87
|
+
calendar.data.addItem(new CalendarItem({
|
|
88
|
+
id: '1',
|
|
89
|
+
name: 'Team Standup',
|
|
90
|
+
startTime: '2027-01-05T09:00',
|
|
91
|
+
endTime: '2027-01-05T09:30',
|
|
92
|
+
type: 'Meeting',
|
|
93
|
+
}));
|
|
94
|
+
}, []);
|
|
95
|
+
|
|
96
|
+
return <EventCalendar ref={ref} style={{ height: '600px' }} />;
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## API Access
|
|
101
|
+
|
|
102
|
+
Each component exposes its API through a ref:
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
const ref = useRef<GanttChartRef>(null);
|
|
106
|
+
|
|
107
|
+
ref.current.list.addTask(...);
|
|
108
|
+
ref.current.zoomIn();
|
|
109
|
+
ref.current.undo();
|
|
110
|
+
ref.current.exportToImage();
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Styling
|
|
114
|
+
|
|
115
|
+
Import the combined stylesheet for all components:
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
import '@timelinekit/core/styles';
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
To import only a specific component, use `@timelinekit/core/styles/gc`, `styles/rs`, or `styles/ec`.
|
|
122
|
+
SCSS sources are available via `@timelinekit/core/styles/scss`.
|
|
123
|
+
|
|
124
|
+
## Licensing
|
|
125
|
+
|
|
126
|
+
TimelineKit is free to use with a watermark. Purchase a license to remove it:
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
import { setLicense } from '@timelinekit/react';
|
|
130
|
+
|
|
131
|
+
setLicense('your-license-key');
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
See [pricing](https://timelinekit.com/pricing) for details.
|
|
135
|
+
|
|
136
|
+
## Resources
|
|
137
|
+
|
|
138
|
+
- [Documentation](https://timelinekit.com/docs)
|
|
139
|
+
- [Live Demos](https://timelinekit.com/gantt-chart/demo)
|
|
140
|
+
- [Examples](https://github.com/timelinekit/examples)
|
|
141
|
+
- [Support](mailto:support@timelinekit.com)
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
See [LICENSE](./LICENSE) for details.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { EventCalendarEngine, CalendarData, CalendarEntry, EventCalendarEvents, EventCalendarSettings } from '@timelinekit/core';
|
|
2
|
+
import type { ViewMode, EntryRenderFn, EntryTooltipFn, CalendarImageExportOptions, CalendarPdfExportOptions, CalendarIcsExportOptions, CalendarIcsImportOptions, CalendarIcsImportResult, CalendarCsvExportOptions, CalendarExcelExportOptions } from '@timelinekit/core';
|
|
3
|
+
export interface EventCalendarProps {
|
|
4
|
+
onReady?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export interface EventCalendarRef {
|
|
7
|
+
readonly data: CalendarData;
|
|
8
|
+
readonly events: EventCalendarEvents;
|
|
9
|
+
readonly settings: EventCalendarSettings;
|
|
10
|
+
readonly canUndo$: EventCalendarEngine['canUndo$'];
|
|
11
|
+
readonly canRedo$: EventCalendarEngine['canRedo$'];
|
|
12
|
+
viewMode: ViewMode;
|
|
13
|
+
currentDate: Date;
|
|
14
|
+
selectedEntries: CalendarEntry[];
|
|
15
|
+
selectedEntry: CalendarEntry | null;
|
|
16
|
+
canEdit: boolean;
|
|
17
|
+
sidebarVisible: boolean;
|
|
18
|
+
entryRendering: EntryRenderFn | null;
|
|
19
|
+
entryTooltip: EntryTooltipFn | null;
|
|
20
|
+
today(): void;
|
|
21
|
+
next(): void;
|
|
22
|
+
previous(): void;
|
|
23
|
+
goToDate(date: Date): void;
|
|
24
|
+
undo(): void;
|
|
25
|
+
redo(): void;
|
|
26
|
+
save(): string;
|
|
27
|
+
load(text: string): void;
|
|
28
|
+
copyEntries(entries?: CalendarEntry[]): Promise<void>;
|
|
29
|
+
cutEntries(entries?: CalendarEntry[]): Promise<void>;
|
|
30
|
+
pasteEntries(): Promise<void>;
|
|
31
|
+
exportToImage(options?: CalendarImageExportOptions): Promise<Blob>;
|
|
32
|
+
exportToPdf(options?: CalendarPdfExportOptions): Promise<Blob>;
|
|
33
|
+
exportToIcs(options?: CalendarIcsExportOptions): Blob;
|
|
34
|
+
exportToIcsText(options?: CalendarIcsExportOptions): string;
|
|
35
|
+
importFromIcs(text: string, options?: CalendarIcsImportOptions): CalendarIcsImportResult;
|
|
36
|
+
exportToCsv(options?: CalendarCsvExportOptions): string;
|
|
37
|
+
exportToExcel(options?: CalendarExcelExportOptions): Promise<Blob>;
|
|
38
|
+
}
|
|
39
|
+
export declare const EventCalendar: import("react").ForwardRefExoticComponent<EventCalendarProps & import("react").RefAttributes<EventCalendarRef>>;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { GanttChartEngine, TaskList, ResourceList, WorkingCalendar,
|
|
2
|
-
import type { Marker,
|
|
1
|
+
import { GanttChartEngine, TaskList, ResourceList, WorkingCalendar, GanttSheet, DateRange, GanttChartEvents, GanttChartSettings, Task } from '@timelinekit/core';
|
|
2
|
+
import type { Marker, GanttCsvExportOptions, GanttPdfExportOptions, GanttExcelExportOptions, TaskFilterFn, TasksPastedEventArgs, ColumnState, TimelineKitLocale } from '@timelinekit/core';
|
|
3
|
+
export interface GanttChartProps {
|
|
4
|
+
onReady?: () => void;
|
|
5
|
+
}
|
|
3
6
|
export interface GanttChartRef {
|
|
4
7
|
readonly list: TaskList;
|
|
5
8
|
readonly resources: ResourceList;
|
|
6
9
|
workingCalendar: WorkingCalendar;
|
|
7
10
|
canEdit: boolean;
|
|
11
|
+
autoZoomToFit: boolean;
|
|
8
12
|
showGridLines: boolean;
|
|
9
13
|
showCriticalPath: boolean;
|
|
10
14
|
showBaseline: boolean;
|
|
@@ -13,9 +17,10 @@ export interface GanttChartRef {
|
|
|
13
17
|
filter: TaskFilterFn | null;
|
|
14
18
|
readonly hasBaseline: boolean;
|
|
15
19
|
readonly selectedTasks: Task[];
|
|
16
|
-
|
|
20
|
+
projectTimeline: DateRange;
|
|
21
|
+
locale: TimelineKitLocale;
|
|
17
22
|
readonly settings: GanttChartSettings;
|
|
18
|
-
readonly sheet:
|
|
23
|
+
readonly sheet: GanttSheet;
|
|
19
24
|
readonly events: GanttChartEvents;
|
|
20
25
|
readonly canUndo$: GanttChartEngine['canUndo$'];
|
|
21
26
|
readonly canRedo$: GanttChartEngine['canRedo$'];
|
|
@@ -42,11 +47,11 @@ export interface GanttChartRef {
|
|
|
42
47
|
save(): string;
|
|
43
48
|
load(text: string): void;
|
|
44
49
|
exportToImage(): Promise<Blob>;
|
|
45
|
-
exportToCsv(options?:
|
|
46
|
-
exportToPdf(options?:
|
|
47
|
-
exportToExcel(options?:
|
|
50
|
+
exportToCsv(options?: GanttCsvExportOptions): string;
|
|
51
|
+
exportToPdf(options?: GanttPdfExportOptions): Promise<Blob>;
|
|
52
|
+
exportToExcel(options?: GanttExcelExportOptions): Promise<Blob>;
|
|
48
53
|
copy(): Promise<void>;
|
|
49
54
|
cut(): Promise<void>;
|
|
50
55
|
paste(): Promise<TasksPastedEventArgs | null>;
|
|
51
56
|
}
|
|
52
|
-
export declare const GanttChart: import("react").ForwardRefExoticComponent<import("react").RefAttributes<GanttChartRef>>;
|
|
57
|
+
export declare const GanttChart: import("react").ForwardRefExoticComponent<GanttChartProps & import("react").RefAttributes<GanttChartRef>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { GanttChart } from './ganttchart.component';
|
|
2
|
-
export type { GanttChartRef } from './ganttchart.component';
|
|
2
|
+
export type { GanttChartProps, GanttChartRef } from './ganttchart.component';
|
|
3
3
|
export { ResourceScheduler } from './resourcescheduler.component';
|
|
4
|
-
export type { ResourceSchedulerRef } from './resourcescheduler.component';
|
|
4
|
+
export type { ResourceSchedulerProps, ResourceSchedulerRef } from './resourcescheduler.component';
|
|
5
|
+
export { EventCalendar } from './eventcalendar.component';
|
|
6
|
+
export type { EventCalendarProps, EventCalendarRef } from './eventcalendar.component';
|
|
7
|
+
export * from '@timelinekit/core';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{forwardRef as r,useRef as t,
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{forwardRef as r,useRef as t,useLayoutEffect as n,useEffect as o,useImperativeHandle as c}from"react";import{GanttChartEngine as u,ResourceSchedulerEngine as s,EventCalendarEngine as a}from"@timelinekit/core";export*from"@timelinekit/core";const i=r(function({onReady:r},s){const a=t(null),i=t(null);return n(()=>(a.current&&!i.current&&(i.current=new u(a.current)),()=>{i.current?.destroy(),i.current=null}),[]),o(()=>{r?.()},[]),c(s,()=>({get list(){return i.current.list},get resources(){return i.current.resources},get workingCalendar(){return i.current.calendar$.getValue()},set workingCalendar(e){i.current.calendar$.next(e)},get canEdit(){return i.current.canEdit},set canEdit(e){i.current.canEdit=e},get autoZoomToFit(){return i.current.autoZoomToFit},set autoZoomToFit(e){i.current.autoZoomToFit=e},get showGridLines(){return i.current.showGridLines},set showGridLines(e){i.current.showGridLines=e},get showCriticalPath(){return i.current.showCriticalPath},set showCriticalPath(e){i.current.showCriticalPath=e},get showBaseline(){return i.current.showBaseline},set showBaseline(e){i.current.showBaseline=e},get showTodayLine(){return i.current.showTodayLine},set showTodayLine(e){i.current.showTodayLine=e},get markers(){return i.current.markers},set markers(e){i.current.markers=e},get filter(){return i.current.filter},set filter(e){i.current.filter=e},get hasBaseline(){return i.current.hasBaseline},get selectedTasks(){return i.current.selectedTasks},get projectTimeline(){return i.current.projectTimeline},set projectTimeline(e){i.current.projectTimeline=e},get locale(){return i.current.settings.locale},set locale(e){i.current.settings.locale=e},get settings(){return i.current.settings},get sheet(){return i.current.sheet},get events(){return i.current.events},get canUndo$(){return i.current.canUndo$},get canRedo$(){return i.current.canRedo$},zoomIn:()=>i.current.zoomIn(),zoomOut:()=>i.current.zoomOut(),indent:()=>i.current.indent(),outdent:()=>i.current.outdent(),moveUp:()=>i.current.moveUp(),moveDown:()=>i.current.moveDown(),goToProjectStart:()=>i.current.goToProjectStart(),scrollToDate:e=>i.current.scrollToDate(e),scrollToTask:e=>i.current.scrollToTask(e),zoomToFit:e=>i.current.zoomToFit(e),addMarker:e=>i.current.addMarker(e),removeMarker:e=>i.current.removeMarker(e),clearMarkers:()=>i.current.clearMarkers(),clearFilter:()=>i.current.clearFilter(),saveColumns:()=>i.current.saveColumns(),loadColumns:e=>i.current.loadColumns(e),undo:()=>i.current.undo(),redo:()=>i.current.redo(),saveBaseline:()=>i.current.saveBaseline(),clearBaseline:()=>i.current.clearBaseline(),save:()=>i.current.save(),load:e=>i.current.load(e),exportToImage:()=>i.current.exportToImage(),exportToCsv:e=>i.current.exportToCsv(e),exportToPdf:e=>i.current.exportToPdf(e),exportToExcel:e=>i.current.exportToExcel(e),copy:()=>i.current.copy(),cut:()=>i.current.cut(),paste:()=>i.current.paste()})),e("div",{ref:a,style:{width:"100%",height:"100%"}})}),l=r(function({onReady:r},u){const a=t(null),i=t(null);return n(()=>(a.current&&!i.current&&(i.current=new s(a.current)),()=>{i.current?.destroy(),i.current=null}),[]),o(()=>{r?.()},[]),c(u,()=>({get data(){return i.current.data},get workingCalendar(){return i.current.calendar$.getValue()},set workingCalendar(e){i.current.calendar$.next(e)},get canEdit(){return i.current.canEdit},set canEdit(e){i.current.canEdit=e},get autoZoomToFit(){return i.current.autoZoomToFit},set autoZoomToFit(e){i.current.autoZoomToFit=e},get showGridLines(){return i.current.showGridLines},set showGridLines(e){i.current.showGridLines=e},get showTodayLine(){return i.current.showTodayLine},set showTodayLine(e){i.current.showTodayLine=e},get markers(){return i.current.markers},set markers(e){i.current.markers=e},get filter(){return i.current.filter},set filter(e){i.current.filter=e},get eventRendering(){return i.current.eventRendering},set eventRendering(e){i.current.eventRendering=e},get eventTooltip(){return i.current.eventTooltip},set eventTooltip(e){i.current.eventTooltip=e},get projectTimeline(){return i.current.projectTimeline},set projectTimeline(e){i.current.projectTimeline=e},get selectedEvents(){return i.current.selectedEvents},set selectedEvents(e){i.current.selectedEvents=e},get selectedEvent(){return i.current.selectedEvent},set selectedEvent(e){i.current.selectedEvent=e},get selectedResources(){return i.current.selectedResources},get settings(){return i.current.settings},get sheet(){return i.current.sheet},get events(){return i.current.events},get canUndo$(){return i.current.canUndo$},get canRedo$(){return i.current.canRedo$},undo:()=>i.current.undo(),redo:()=>i.current.redo(),copy:()=>i.current.copy(),cut:()=>i.current.cut(),paste:()=>i.current.paste(),zoomIn:()=>i.current.zoomIn(),zoomOut:()=>i.current.zoomOut(),goToProjectStart:()=>i.current.goToProjectStart(),scrollToDate:e=>i.current.scrollToDate(e),scrollToResource:e=>i.current.scrollToResource(e),scrollToEvent:e=>i.current.scrollToEvent(e),zoomToFit:e=>i.current.zoomToFit(e),addMarker:e=>i.current.addMarker(e),removeMarker:e=>i.current.removeMarker(e),clearMarkers:()=>i.current.clearMarkers(),clearFilter:()=>i.current.clearFilter(),saveColumns:()=>i.current.saveColumns(),loadColumns:e=>i.current.loadColumns(e),sortResources:e=>i.current.sortResources(e),freezeResource:e=>i.current.freezeResource(e),unfreezeResource:e=>i.current.unfreezeResource(e),isResourceFrozen:e=>i.current.isResourceFrozen(e),exportToImage:()=>i.current.exportToImage(),exportToCsv:e=>i.current.exportToCsv(e),exportToExcel:e=>i.current.exportToExcel(e),exportToPdf:e=>i.current.exportToPdf(e),save:()=>i.current.save(),load:e=>i.current.load(e)})),e("div",{ref:a,style:{width:"100%",height:"100%"}})}),d=r(function({onReady:r},u){const s=t(null),i=t(null);return n(()=>(s.current&&!i.current&&(i.current=new a(s.current)),()=>{i.current?.destroy(),i.current=null}),[]),o(()=>{r?.()},[]),c(u,()=>({get data(){return i.current.data},get events(){return i.current.events},get settings(){return i.current.settings},get canUndo$(){return i.current.canUndo$},get canRedo$(){return i.current.canRedo$},get viewMode(){return i.current.viewMode},set viewMode(e){i.current.viewMode=e},get currentDate(){return i.current.currentDate},set currentDate(e){i.current.currentDate=e},get selectedEntries(){return i.current.selectedEntries},set selectedEntries(e){i.current.selectedEntries=e},get selectedEntry(){return i.current.selectedEntry},set selectedEntry(e){i.current.selectedEntry=e},get canEdit(){return i.current.canEdit},set canEdit(e){i.current.canEdit=e},get sidebarVisible(){return i.current.sidebarVisible},set sidebarVisible(e){i.current.sidebarVisible=e},get entryRendering(){return i.current.entryRendering},set entryRendering(e){i.current.entryRendering=e},get entryTooltip(){return i.current.entryTooltip},set entryTooltip(e){i.current.entryTooltip=e},today:()=>i.current.today(),next:()=>i.current.next(),previous:()=>i.current.previous(),goToDate:e=>i.current.goToDate(e),undo:()=>i.current.undo(),redo:()=>i.current.redo(),save:()=>i.current.save(),load:e=>i.current.load(e),copyEntries:e=>i.current.copyEntries(e),cutEntries:e=>i.current.cutEntries(e),pasteEntries:()=>i.current.pasteEntries(),exportToImage:e=>i.current.exportToImage(e),exportToPdf:e=>i.current.exportToPdf(e),exportToIcs:e=>i.current.exportToIcs(e),exportToIcsText:e=>i.current.exportToIcsText(e),importFromIcs:(e,r)=>i.current.importFromIcs(e,r),exportToCsv:e=>i.current.exportToCsv(e),exportToExcel:e=>i.current.exportToExcel(e)})),e("div",{ref:s,style:{width:"100%",height:"100%"}})});export{d as EventCalendar,i as GanttChart,l as ResourceScheduler};
|
|
@@ -1,28 +1,55 @@
|
|
|
1
|
-
import { SchedulerData, SchedulerResource, WorkingCalendar, SchedulerSheet, DateRange, ResourceSchedulerEvents, ResourceSchedulerSettings } from '@
|
|
2
|
-
import type { ColumnState } from '@
|
|
1
|
+
import { ResourceSchedulerEngine, SchedulerData, SchedulerResource, SchedulerEvent, WorkingCalendar, SchedulerSheet, DateRange, ResourceSchedulerEvents, ResourceSchedulerSettings } from '@timelinekit/core';
|
|
2
|
+
import type { Marker, ColumnState, SchedulerResourceFilterFn, SchedulerEventRenderFn, SchedulerEventTooltipFn, SchedulerCsvExportOptions, SchedulerExcelExportOptions, SchedulerPdfExportOptions, SchedulerEventsPastedEventArgs } from '@timelinekit/core';
|
|
3
|
+
export interface ResourceSchedulerProps {
|
|
4
|
+
onReady?: () => void;
|
|
5
|
+
}
|
|
3
6
|
export interface ResourceSchedulerRef {
|
|
4
7
|
readonly data: SchedulerData;
|
|
5
8
|
workingCalendar: WorkingCalendar;
|
|
6
9
|
canEdit: boolean;
|
|
10
|
+
autoZoomToFit: boolean;
|
|
7
11
|
showGridLines: boolean;
|
|
8
12
|
showTodayLine: boolean;
|
|
13
|
+
markers: Marker[];
|
|
14
|
+
filter: SchedulerResourceFilterFn | null;
|
|
15
|
+
eventRendering: SchedulerEventRenderFn | null;
|
|
16
|
+
eventTooltip: SchedulerEventTooltipFn | null;
|
|
9
17
|
projectTimeline: DateRange;
|
|
18
|
+
selectedEvents: SchedulerEvent[];
|
|
19
|
+
selectedEvent: SchedulerEvent | null;
|
|
10
20
|
readonly selectedResources: SchedulerResource[];
|
|
11
21
|
readonly settings: ResourceSchedulerSettings;
|
|
12
22
|
readonly sheet: SchedulerSheet;
|
|
13
23
|
readonly events: ResourceSchedulerEvents;
|
|
24
|
+
readonly canUndo$: ResourceSchedulerEngine['canUndo$'];
|
|
25
|
+
readonly canRedo$: ResourceSchedulerEngine['canRedo$'];
|
|
26
|
+
undo(): void;
|
|
27
|
+
redo(): void;
|
|
28
|
+
copy(): Promise<void>;
|
|
29
|
+
cut(): Promise<void>;
|
|
30
|
+
paste(): Promise<SchedulerEventsPastedEventArgs | null>;
|
|
14
31
|
zoomIn(): boolean;
|
|
15
32
|
zoomOut(): boolean;
|
|
16
33
|
goToProjectStart(): void;
|
|
17
34
|
scrollToDate(date: Date): void;
|
|
18
35
|
scrollToResource(resource: SchedulerResource): void;
|
|
19
|
-
|
|
36
|
+
scrollToEvent(event: SchedulerEvent): void;
|
|
37
|
+
zoomToFit(events?: SchedulerEvent[]): void;
|
|
38
|
+
addMarker(marker: Marker): void;
|
|
39
|
+
removeMarker(marker: Marker): void;
|
|
40
|
+
clearMarkers(): void;
|
|
41
|
+
clearFilter(): void;
|
|
42
|
+
saveColumns(): ColumnState[];
|
|
43
|
+
loadColumns(states: ColumnState[]): void;
|
|
44
|
+
sortResources(compareFn: (a: SchedulerResource, b: SchedulerResource) => number): void;
|
|
20
45
|
freezeResource(resource: SchedulerResource): void;
|
|
21
46
|
unfreezeResource(resource: SchedulerResource): void;
|
|
22
47
|
isResourceFrozen(resource: SchedulerResource): boolean;
|
|
48
|
+
exportToImage(): Promise<Blob>;
|
|
49
|
+
exportToCsv(options?: SchedulerCsvExportOptions): string;
|
|
50
|
+
exportToExcel(options?: SchedulerExcelExportOptions): Promise<Blob>;
|
|
51
|
+
exportToPdf(options?: SchedulerPdfExportOptions): Promise<Blob>;
|
|
23
52
|
save(): string;
|
|
24
53
|
load(text: string): void;
|
|
25
|
-
saveColumns(): ColumnState[];
|
|
26
|
-
loadColumns(states: ColumnState[]): void;
|
|
27
54
|
}
|
|
28
|
-
export declare const ResourceScheduler: import("react").ForwardRefExoticComponent<import("react").RefAttributes<ResourceSchedulerRef>>;
|
|
55
|
+
export declare const ResourceScheduler: import("react").ForwardRefExoticComponent<ResourceSchedulerProps & import("react").RefAttributes<ResourceSchedulerRef>>;
|
package/package.json
CHANGED
|
@@ -1,34 +1,38 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@timelinekit/react",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
|
-
"import": "./dist/index.js"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "rollup -c"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@timelinekit/react",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "rollup -c",
|
|
15
|
+
"test": "vitest run",
|
|
16
|
+
"test:watch": "vitest"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"react": ">=18.0.0",
|
|
20
|
+
"react-dom": ">=18.0.0",
|
|
21
|
+
"@timelinekit/core": "workspace:*"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@timelinekit/core": "workspace:*"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"react": "^19.1.0",
|
|
28
|
+
"react-dom": "^19.1.0",
|
|
29
|
+
"@types/react": "^19.1.0",
|
|
30
|
+
"vitest": "^4.0.8",
|
|
31
|
+
"jsdom": "^26.1.0"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"README.md",
|
|
36
|
+
"LICENSE"
|
|
37
|
+
]
|
|
38
|
+
}
|