@dayflow/core 1.0.0 → 1.0.1
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.ja.md +148 -0
- package/README.md +2 -0
- package/README.zh.md +148 -0
- package/dist/components/common/ViewHeader.d.ts +9 -1
- package/dist/components/monthView/WeekComponent.d.ts +2 -0
- package/dist/hooks/useCalendarDrop.d.ts +20 -0
- package/dist/hooks/virtualScroll/useVirtualScroll.d.ts +9 -9
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/utils/themeUtils.d.ts +8 -0
- package/dist/views/YearView.d.ts +2 -0
- package/package.json +1 -1
package/README.ja.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# DayFlow
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [中文](README.zh.md) | **日本語**
|
|
4
|
+
|
|
5
|
+
DayFlow は、ドラッグ&ドロップ・複数ビュー・プラグインアーキテクチャを備えた柔軟で高機能な React 向けカレンダーコンポーネントライブラリです。
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@dayflow/core)
|
|
8
|
+
[](https://github.com/dayflow-js/dayflow/pulls)
|
|
9
|
+
[](https://github.com/dayflow-js/dayflow/blob/main/LICENSE)
|
|
10
|
+
[](https://discord.gg/jc37N4xw)
|
|
11
|
+
|
|
12
|
+
## 🗓️ 主な特長
|
|
13
|
+
|
|
14
|
+
### ✨ 月/週/日など多彩なビュー
|
|
15
|
+
|
|
16
|
+
| 月ビュー | 週ビュー |
|
|
17
|
+
| -------------------------------------- | -------------------------------------- |
|
|
18
|
+
|  |  |
|
|
19
|
+
|
|
20
|
+
| 日ビュー | イベントスタック |
|
|
21
|
+
| -------------------------------------- | -------------------------------------- |
|
|
22
|
+
|  |  |
|
|
23
|
+
|
|
24
|
+
### 🤩 デフォルトの詳細パネル(複数のカスタム構成を用意)
|
|
25
|
+
|
|
26
|
+
| ポップアップ詳細 | ダイアログ詳細 |
|
|
27
|
+
| ------------------------------------- | ------------------------------------- |
|
|
28
|
+
|  |  |
|
|
29
|
+
|
|
30
|
+
### 🎯 スムーズなドラッグ&リサイズ
|
|
31
|
+
|
|
32
|
+
https://github.com/user-attachments/assets/726a5232-35a8-4fe3-8e7b-4de07c455353
|
|
33
|
+
|
|
34
|
+
https://github.com/user-attachments/assets/957317e5-02d8-4419-a74b-62b7d191e347
|
|
35
|
+
|
|
36
|
+
> ⚡ さらに多くの機能を体験したい場合は [ライブデモ](https://dayflow-js.github.io/dayflow/) をご覧ください。
|
|
37
|
+
|
|
38
|
+
## ✨ コア機能
|
|
39
|
+
|
|
40
|
+
- 🗓️ **複数ビュー**:日/週/月/年ビューをサポート
|
|
41
|
+
- 🎨 **高いカスタマイズ性**:Tailwind CSS によるテーマ拡張
|
|
42
|
+
- 📱 **レスポンシブ対応**:デスクトップ/タブレット/モバイルに最適化
|
|
43
|
+
- 🔌 **プラグインアーキテクチャ**:拡張しやすい設計
|
|
44
|
+
- 🎯 **ドラッグ&ドロップ**:直感的なイベント操作
|
|
45
|
+
- ⚡ **TypeScript サポート**:完全な型定義
|
|
46
|
+
- 🎨 **イベント管理**:作成/更新/削除/分類を簡単に
|
|
47
|
+
- 🔄 **バーチャルスクロール**:大量データでも軽快
|
|
48
|
+
- 🎭 **カスタムレンダラー**:イベント表示と挙動を自由に拡張
|
|
49
|
+
|
|
50
|
+
## 🚀 追加機能
|
|
51
|
+
|
|
52
|
+
### 📅 高度なカレンダー機能
|
|
53
|
+
|
|
54
|
+
- **マルチデイイベント**:複数日にまたがるイベント表示
|
|
55
|
+
- **終日イベント**:専用ヘッダー領域を用意
|
|
56
|
+
- **イベントスタック**:重複イベントをスマートに配置
|
|
57
|
+
- **サイドバー**:カレンダー管理用サイドバーを内蔵
|
|
58
|
+
|
|
59
|
+
### 🎨 カスタマイズ & テーマ
|
|
60
|
+
|
|
61
|
+
- **カスタムイベントレンダラー**:UI を完全にコントロール
|
|
62
|
+
- **カラーコーディング**:複数カレンダーと色分けに対応
|
|
63
|
+
- **詳細パネル**:ダイアログ/ポップアップ/カスタムパネル
|
|
64
|
+
- **ヘッダーのカスタマイズ**:`ViewHeader` で表示切替を制御
|
|
65
|
+
- **ドラッグインジケーター**:イベントタイプごとにカスタム指標
|
|
66
|
+
|
|
67
|
+
### 🎯 インタラクション
|
|
68
|
+
|
|
69
|
+
- **イベントコールバック**:`onEventCreate` / `onEventUpdate` / `onEventDelete`
|
|
70
|
+
- **クリックイベント**:イベントクリックにリアクション
|
|
71
|
+
- **ドラッグ&リサイズ**:移動と長さ調整をスムーズに
|
|
72
|
+
- **カラーピッカー**:組み込みの色選択 UI
|
|
73
|
+
|
|
74
|
+
### ⚡ パフォーマンス & DX
|
|
75
|
+
|
|
76
|
+
- **バーチャルスクロール**:月/年ビューの大量イベントでも高速
|
|
77
|
+
- **TypeScript First**:すべての API に型定義
|
|
78
|
+
- **プラグインシステム**:イベント/ドラッグプラグインで拡張
|
|
79
|
+
- **Temporal API**:モダンな Temporal で日時を管理
|
|
80
|
+
|
|
81
|
+
## 📦 インストール
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm install @dayflow/core lucide-react
|
|
85
|
+
# または
|
|
86
|
+
yarn add @dayflow/core lucide-react
|
|
87
|
+
# または
|
|
88
|
+
pnpm add @dayflow/core lucide-react
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Peer Dependencies
|
|
92
|
+
|
|
93
|
+
- `react` >= 18.0.0
|
|
94
|
+
- `react-dom` >= 18.0.0
|
|
95
|
+
- `lucide-react` >= 0.400.0
|
|
96
|
+
|
|
97
|
+
## 🚀 クイックスタート
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
import { useCalendarApp, DayFlowCalendar } from '@dayflow/core';
|
|
101
|
+
import { createMonthView, createWeekView, createDayView } from '@dayflow/core';
|
|
102
|
+
import '@dayflow/core/dist/styles.css';
|
|
103
|
+
|
|
104
|
+
function App() {
|
|
105
|
+
const calendar = useCalendarApp({
|
|
106
|
+
views: [createMonthView(), createWeekView(), createDayView()],
|
|
107
|
+
initialDate: new Date(),
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
return <DayFlowCalendar calendar={calendar} />;
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
> 📖 **[完全なドキュメントを見る →](https://dayflow-js.github.io/dayflow/)**
|
|
115
|
+
|
|
116
|
+
## 🎯 ユースケース
|
|
117
|
+
|
|
118
|
+
DayFlow は以下の用途に最適です:
|
|
119
|
+
|
|
120
|
+
- 📅 **スケジューリングアプリ**:スタッフシフト、予約管理、授業予定
|
|
121
|
+
- 🎫 **イベント管理**:会議、イベントカレンダー、フェスティバル
|
|
122
|
+
- 🏢 **プロジェクト管理**:タイムライン表示、タスクスケジューリング
|
|
123
|
+
- 💼 **ビジネス**:会議室やリソースの予約、可用性管理
|
|
124
|
+
|
|
125
|
+
## 🌟 ハイライト
|
|
126
|
+
|
|
127
|
+
- ✅ **TypeScript 対応**
|
|
128
|
+
- ✅ **ドラッグ&ドロップ**
|
|
129
|
+
- ✅ **バーチャルスクロール**
|
|
130
|
+
- ✅ **プラグインシステム**
|
|
131
|
+
- ✅ **最新の React Hooks (18+)**
|
|
132
|
+
- ✅ **Tailwind CSS による簡単スタイリング**
|
|
133
|
+
|
|
134
|
+
## 🤝 コントリビューション
|
|
135
|
+
|
|
136
|
+
Pull Request 大歓迎です。ぜひ貢献してください。
|
|
137
|
+
|
|
138
|
+
## 🐛 バグ報告
|
|
139
|
+
|
|
140
|
+
問題を見つけた場合は [GitHub Issues](https://github.com/dayflow-js/dayflow/issues) へ。
|
|
141
|
+
|
|
142
|
+
## 📮 サポート
|
|
143
|
+
|
|
144
|
+
質問があれば GitHub で Issue を立てるか Discord に参加してください。
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
Jayce Li が ❤️ を込めて開発しました。
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# DayFlow
|
|
2
2
|
|
|
3
|
+
**English** | [中文](README.zh.md) | [日本語](README.ja.md)
|
|
4
|
+
|
|
3
5
|
A flexible and feature-rich calendar component library for React applications with drag-and-drop support, multiple views, and plugin architecture.
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/@dayflow/core)
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# DayFlow
|
|
2
|
+
|
|
3
|
+
[English](README.md) | **中文** | [日本語](README.ja.md)
|
|
4
|
+
|
|
5
|
+
一个灵活且功能丰富的 React 日历组件库,内置拖拽、多个视图类型以及插件化架构。
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@dayflow/core)
|
|
8
|
+
[](https://github.com/dayflow-js/dayflow/pulls)
|
|
9
|
+
[](https://github.com/dayflow-js/dayflow/blob/main/LICENSE)
|
|
10
|
+
[](https://discord.gg/jc37N4xw)
|
|
11
|
+
|
|
12
|
+
## 🗓️ 功能亮点
|
|
13
|
+
|
|
14
|
+
### ✨ 月/周/日等多种视图
|
|
15
|
+
|
|
16
|
+
| 月视图 | 周视图 |
|
|
17
|
+
| --------------------------------------- | -------------------------------------- |
|
|
18
|
+
|  |  |
|
|
19
|
+
|
|
20
|
+
| 日视图 | 事件堆叠层级 |
|
|
21
|
+
| -------------------------------------- | -------------------------------------- |
|
|
22
|
+
|  |  |
|
|
23
|
+
|
|
24
|
+
### 🤩 默认详情面板(也可替换为多个自定义方案)
|
|
25
|
+
|
|
26
|
+
| 弹出层详情 | 对话框详情 |
|
|
27
|
+
| ------------------------------------ | ------------------------------------ |
|
|
28
|
+
|  |  |
|
|
29
|
+
|
|
30
|
+
### 🎯 事件拖拽/缩放顺滑
|
|
31
|
+
|
|
32
|
+
https://github.com/user-attachments/assets/726a5232-35a8-4fe3-8e7b-4de07c455353
|
|
33
|
+
|
|
34
|
+
https://github.com/user-attachments/assets/957317e5-02d8-4419-a74b-62b7d191e347
|
|
35
|
+
|
|
36
|
+
> ⚡ 想要更多交互体验,请访问我们的 [在线 Demo](https://dayflow-js.github.io/dayflow/)。
|
|
37
|
+
|
|
38
|
+
## ✨ 核心特性
|
|
39
|
+
|
|
40
|
+
- 🗓️ **多视图**:日/周/月/年视图自由切换
|
|
41
|
+
- 🎨 **高度自定义**:基于 Tailwind CSS,易于主题扩展
|
|
42
|
+
- 📱 **响应式设计**:桌面、平板、移动端一致体验
|
|
43
|
+
- 🔌 **插件架构**:通过插件拓展业务能力
|
|
44
|
+
- 🎯 **拖拽支持**:事件拖拽与缩放体验流畅
|
|
45
|
+
- ⚡ **TypeScript**:提供完整类型提示
|
|
46
|
+
- 🎨 **事件管理**:创建、更新、删除、分类事件
|
|
47
|
+
- 🔄 **虚拟滚动**:大数据场景依旧流畅
|
|
48
|
+
- 🎭 **自定义渲染**:自定义事件外观与行为
|
|
49
|
+
|
|
50
|
+
## 🚀 进阶能力
|
|
51
|
+
|
|
52
|
+
### 📅 高级日历能力
|
|
53
|
+
|
|
54
|
+
- **跨天事件**:自然衔接的多日事件渲染
|
|
55
|
+
- **全天区域**:专属全天事件栏
|
|
56
|
+
- **事件堆叠**:智能调度堆叠层级
|
|
57
|
+
- **侧边栏**:自带日历管理侧栏
|
|
58
|
+
|
|
59
|
+
### 🎨 自定义与主题
|
|
60
|
+
|
|
61
|
+
- **自定义事件渲染器**:完全掌控 UI
|
|
62
|
+
- **颜色编码**:内置多类型日历与颜色
|
|
63
|
+
- **详情面板模式**:对话框、弹层或自定义面板
|
|
64
|
+
- **可定制头部**:`ViewHeader` 提供按钮/标签/下拉等模式
|
|
65
|
+
- **拖拽指示器**:为不同事件展示不同拖拽提示
|
|
66
|
+
|
|
67
|
+
### 🎯 交互体验
|
|
68
|
+
|
|
69
|
+
- **事件回调**:`onEventCreate`、`onEventUpdate`、`onEventDelete`
|
|
70
|
+
- **点击事件**:随时获取事件点击反馈
|
|
71
|
+
- **拖拽缩放**:移动与调整长度一气呵成
|
|
72
|
+
- **颜色选择器**:内置颜色选择 UI
|
|
73
|
+
|
|
74
|
+
### ⚡ 性能与 DX
|
|
75
|
+
|
|
76
|
+
- **虚拟滚动**:月份/年视图的大量事件仍高性能
|
|
77
|
+
- **TypeScript First**:所有 API 提供类型定义
|
|
78
|
+
- **插件体系**:事件插件与拖拽插件可扩展
|
|
79
|
+
- **Temporal API**:使用 Modern Temporal 处理时间
|
|
80
|
+
|
|
81
|
+
## 📦 安装
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm install @dayflow/core lucide-react
|
|
85
|
+
# 或
|
|
86
|
+
yarn add @dayflow/core lucide-react
|
|
87
|
+
# 或
|
|
88
|
+
pnpm add @dayflow/core lucide-react
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Peer Dependencies
|
|
92
|
+
|
|
93
|
+
- `react` >= 18.0.0
|
|
94
|
+
- `react-dom` >= 18.0.0
|
|
95
|
+
- `lucide-react` >= 0.400.0
|
|
96
|
+
|
|
97
|
+
## 🚀 快速上手
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
import { useCalendarApp, DayFlowCalendar } from '@dayflow/core';
|
|
101
|
+
import { createMonthView, createWeekView, createDayView } from '@dayflow/core';
|
|
102
|
+
import '@dayflow/core/dist/styles.css';
|
|
103
|
+
|
|
104
|
+
function App() {
|
|
105
|
+
const calendar = useCalendarApp({
|
|
106
|
+
views: [createMonthView(), createWeekView(), createDayView()],
|
|
107
|
+
initialDate: new Date(),
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
return <DayFlowCalendar calendar={calendar} />;
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
> 📖 **[查看完整文档 →](https://dayflow-js.github.io/dayflow/)**
|
|
115
|
+
|
|
116
|
+
## 🎯 适用场景
|
|
117
|
+
|
|
118
|
+
DayFlow 适合用于:
|
|
119
|
+
|
|
120
|
+
- 📅 **排班与预约**:员工排班、预约管理、课程表
|
|
121
|
+
- 🎫 **活动管理**:会议日程、活动日历、展会安排
|
|
122
|
+
- 🏢 **项目排期**:任务规划、时间线视图
|
|
123
|
+
- 💼 **企业应用**:会议室、资源预约、可用性管理
|
|
124
|
+
|
|
125
|
+
## 🌟 亮点总结
|
|
126
|
+
|
|
127
|
+
- ✅ **TypeScript 支持**
|
|
128
|
+
- ✅ **拖拽缩放**
|
|
129
|
+
- ✅ **虚拟滚动**
|
|
130
|
+
- ✅ **插件体系**
|
|
131
|
+
- ✅ **React 18+ Hooks 架构**
|
|
132
|
+
- ✅ **Tailwind CSS 友好**
|
|
133
|
+
|
|
134
|
+
## 🤝 贡献指南
|
|
135
|
+
|
|
136
|
+
欢迎通过 Pull Request 的方式贡献代码与文档。
|
|
137
|
+
|
|
138
|
+
## 🐛 问题反馈
|
|
139
|
+
|
|
140
|
+
若发现问题,请前往 [GitHub Issues](https://github.com/dayflow-js/dayflow/issues)。
|
|
141
|
+
|
|
142
|
+
## 📮 支持
|
|
143
|
+
|
|
144
|
+
如需交流,请在 GitHub 提 issue 或加入 Discord。
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
由 Jayce Li 倾情打造 ❤️
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CalendarApp } from '@/types';
|
|
3
|
-
export type ViewHeaderType = 'day' | 'week' | 'month';
|
|
3
|
+
export type ViewHeaderType = 'day' | 'week' | 'month' | 'year';
|
|
4
4
|
export type ViewSwitcherMode = 'buttons' | 'select';
|
|
5
5
|
interface ViewHeaderProps {
|
|
6
6
|
calendar: CalendarApp;
|
|
@@ -22,6 +22,14 @@ interface ViewHeaderProps {
|
|
|
22
22
|
showTodayBox?: boolean;
|
|
23
23
|
/** ViewSwitcher mode (default: 'select') */
|
|
24
24
|
switcherMode?: ViewSwitcherMode;
|
|
25
|
+
/** Sticky year for Year view (optional, only for Year view) */
|
|
26
|
+
stickyYear?: number | null;
|
|
27
|
+
/** Push-away offset for sticky year (in pixels) */
|
|
28
|
+
stickyYearOffset?: number;
|
|
29
|
+
/** Next year that's pushing the sticky year (optional, only for Year view) */
|
|
30
|
+
nextYear?: number | null;
|
|
31
|
+
/** Offset for the next year coming from below (in pixels) */
|
|
32
|
+
nextYearOffset?: number;
|
|
25
33
|
}
|
|
26
34
|
declare const ViewHeader: React.FC<ViewHeaderProps>;
|
|
27
35
|
export default ViewHeader;
|
|
@@ -41,6 +41,8 @@ interface WeekComponentProps {
|
|
|
41
41
|
onDetailPanelToggle?: (eventId: string | null) => void;
|
|
42
42
|
customDetailPanelContent?: EventDetailContentRenderer;
|
|
43
43
|
customEventDetailDialog?: EventDetailDialogRenderer;
|
|
44
|
+
onCalendarDrop?: (e: React.DragEvent, dropDate: Date, dropHour?: number, isAllDay?: boolean) => Event | null;
|
|
45
|
+
onCalendarDragOver?: (e: React.DragEvent) => void;
|
|
44
46
|
}
|
|
45
47
|
declare const WeekComponent: React.NamedExoticComponent<WeekComponentProps>;
|
|
46
48
|
export default WeekComponent;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CalendarApp } from '@/core';
|
|
2
|
+
import { Event, CalendarColors } from '@/types';
|
|
3
|
+
export interface CalendarDropData {
|
|
4
|
+
calendarId: string;
|
|
5
|
+
calendarName: string;
|
|
6
|
+
calendarColors: CalendarColors;
|
|
7
|
+
calendarIcon?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CalendarDropOptions {
|
|
10
|
+
app: CalendarApp;
|
|
11
|
+
onEventCreated?: (event: Event) => void;
|
|
12
|
+
}
|
|
13
|
+
export interface CalendarDropReturn {
|
|
14
|
+
handleDrop: (e: React.DragEvent, dropDate: Date, dropHour?: number, isAllDay?: boolean) => Event | null;
|
|
15
|
+
handleDragOver: (e: React.DragEvent) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Hook to handle dropping calendar from sidebar to create events
|
|
19
|
+
*/
|
|
20
|
+
export declare function useCalendarDrop(options: CalendarDropOptions): CalendarDropReturn;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { UseVirtualScrollProps, UseVirtualScrollReturn } from '@/types';
|
|
2
2
|
export declare const VIRTUAL_SCROLL_CONFIG: {
|
|
3
|
-
readonly OVERSCAN:
|
|
4
|
-
readonly BUFFER_SIZE:
|
|
5
|
-
readonly MIN_YEAR:
|
|
6
|
-
readonly MAX_YEAR:
|
|
7
|
-
readonly SCROLL_THROTTLE:
|
|
3
|
+
readonly OVERSCAN: 1;
|
|
4
|
+
readonly BUFFER_SIZE: 30;
|
|
5
|
+
readonly MIN_YEAR: 1970;
|
|
6
|
+
readonly MAX_YEAR: 2100;
|
|
7
|
+
readonly SCROLL_THROTTLE: 16;
|
|
8
8
|
readonly SCROLL_DEBOUNCE: 150;
|
|
9
|
-
readonly CACHE_CLEANUP_THRESHOLD:
|
|
10
|
-
readonly MOBILE_YEAR_HEIGHT:
|
|
11
|
-
readonly TABLET_YEAR_HEIGHT:
|
|
12
|
-
readonly YEAR_HEIGHT:
|
|
9
|
+
readonly CACHE_CLEANUP_THRESHOLD: 50;
|
|
10
|
+
readonly MOBILE_YEAR_HEIGHT: 1200;
|
|
11
|
+
readonly TABLET_YEAR_HEIGHT: 850;
|
|
12
|
+
readonly YEAR_HEIGHT: 680;
|
|
13
13
|
};
|
|
14
14
|
export declare class VirtualScrollPerformance {
|
|
15
15
|
private static metrics;
|