Bỏ qua, đến nội dung

@digiforce-nc/plugin-calendar

Plugin hiển thị dữ liệu collection dưới dạng lịch (Calendar View) - hỗ trợ chế độ xem ngày/tuần/tháng, sự kiện lặp lại (cron), và tích hợp lịch âm dương.

Plugin này làm gì?

Calendar block biến collection có trường ngày thành giao diện lịch trực quan. Mỗi bản ghi trở thành một sự kiện trên lịch, có thể xem theo ngày, tuần hoặc tháng. Plugin hỗ trợ sự kiện lặp lại qua cron expression, loại trừ ngày cụ thể, và hiển thị lịch âm (lunar calendar).

Ba nhiệm vụ chính

#Nhiệm vụChi tiết
1Hiển thị lịchChế độ xem ngày/tuần/tháng với react-big-calendar
2Sự kiện lặp lạiCron expression cho repeat, loại trừ ngày cụ thể
3Tương tác sự kiệnTạo/sửa event từ popup, kéo thả thay đổi ngày

Kiến trúc

Tổng quan

Plugin có server stub (đăng ký plugin) và client phong phú. Dữ liệu calendar đọc từ collection API, cron repeat xử lý client-side.

TầngVai tròThành phần
Client UIRender lịch, popup tạo/sửa eventCalendarV2, CalendarBlockProvider
ServerStub - đăng ký pluginServer class rỗng
Collection APICung cấp dữ liệu eventCollection có date field

Calendar template collection

Plugin hoạt động tốt nhất với collection sử dụng calendar template - bổ sung các field cron và exclude cho sự kiện lặp:

FieldKiểuMô tả
cronstringCron expression cho sự kiện lặp lại
excludeJSONMảng ngày bị loại trừ khỏi lịch lặp

Luồng hiển thị lịch

Tính năng

Tính năngMô tả
Day viewXem lịch theo ngày, timeline chi tiết
Week viewXem lịch theo tuần, 7 cột
Month viewXem lịch theo tháng, tổng quan
Cron repeatSự kiện lặp lại theo cron expression
Exclude datesLoại trừ ngày cụ thể khỏi lịch lặp
Event popupPopup tạo/sửa event khi click
Color fieldTô màu event theo field (status, category)
Title fieldCấu hình field hiển thị làm tiêu đề event
Lunar calendarHiển thị ngày âm lịch (solarlunar-es)
Association calendarCalendar block cho association data
Drag rescheduleKéo event để thay đổi ngày/giờ
Cron editorUI editor cho cron expression (react-js-cron)

Thành phần client

Thành phầnMô tả
CalendarBlockWidgetWidget chính đăng ký Calendar block
CalendarBlockProviderProvider quản lý state: view mode, date range, events
CalendarV2Component lịch chính bọc react-big-calendar
CalendarToolbarToolbar: chuyển view mode, navigation ngày
CalendarEventPopupPopup tạo/sửa event
CronEditorUI component chỉnh sửa cron expression
CalendarBlockInitializerĐăng ký vào menu "Add block"
CalendarDesignerDesigner: cấu hình title/start/end/color fields

Cấu hình block

SettingMô tảMặc định
Title fieldField hiển thị làm tiêu đề eventtitle
Start date fieldField ngày bắt đầustartDate hoặc createdAt
End date fieldField ngày kết thúcendDate
Color fieldField xác định màu eventKhông có
Default viewChế độ xem mặc địnhMonth
Show lunarHiển thị ngày âm lịchfalse

Dependencies

PackageVai trò
@digiforce-nc/clientClient framework (peer)
@digiforce-nc/serverServer framework (peer)
react-big-calendarThư viện lịch React chính
dayjsThư viện xử lý ngày tháng
cron-parserParse cron expression cho event lặp
react-js-cronUI component chỉnh sửa cron
solarlunar-esChuyển đổi dương lịch ↔ âm lịch

Mục lục chi tiết