ساخت گزارش (ReportComposer)
Composer برای ساخت بولتن — root + ReportSection + BulletinViewer (نسخهی پرینت-friendly)
معرفی
ReportComposer یک container برای ساخت گزارش/بولتن است: کاربر میتواند بخشها (sections) را روشن/خاموش، collapse، یا drag-reorder کند. ReportSection building block هر بخش است. BulletinViewer همان داده در نمای read-only پرینت-friendly برای صفحهی نهایی export.
چه زمانی استفاده کنیم:
- صفحهی Bulletin Editor که analyst بخشها را تنظیم میکند
- صفحهی Bulletin Output / Print View برای ذخیرهی PDF
- داشبوردهای drag-and-drop سفارشی-سازی (با wiring native HTML5 DnD یا react-dnd)
چه زمانی استفاده نکنیم:
- صفحات داشبورد فاقد ساختار Section → از Card و گرید معمولی استفاده کنید
- بخشهای آماده مثل sentiment + flow →
ReportSectionخام نزنید، از section templates استفاده کنید
بولتن هفتگی — هفته ۱۴
گزارش روند نظرات و توزیع گرایش مخاطبان
خلاصه اجرایی
ترکیب گرایش مخاطب
زمین بازی
با تغییر تنظیمات زیر، چیدمان گزارش را بهصورت زنده مشاهده کنید.
بولتن هفتگی — هفته ۱۴
گزارش روند نظرات و توزیع جریانها
خلاصه اجرایی
ترکیب گرایش مخاطب
استفاده
import {
ReportComposer,
ReportSection,
BulletinViewer,
} from '@parto-system-design/ui'
// Editor mode
<ReportComposer
title="بولتن هفتگی — هفته ۱۴"
description="گزارش نظرات منتشره، ۷ تا ۱۳ خرداد"
headerActions={<Button>ذخیره</Button>}
>
<ReportSection
title="خلاصه اجرایی"
enabled={summaryOn}
onEnabledChange={setSummaryOn}
collapsed={summaryCollapsed}
onCollapsedChange={setSummaryCollapsed}
>
<p>...</p>
</ReportSection>
</ReportComposer>
// Print/output mode
<BulletinViewer
title="بولتن هفتگی — هفته ۱۴"
author="تیم تحلیل"
publishedAt="۱۴ خرداد ۱۴۰۵"
meta={[{ label: 'نسخه', value: '۱.۰' }]}
headerActions={<Button>چاپ</Button>}
>
<section>...</section>
</BulletinViewer>ساختار
ReportComposer فقط wrapper سرتیتر است. ReportSection چندین slot دارد:
enabled+onEnabledChange→ Switch master togglecollapsed+onCollapsedChange→ chevron collapsedraggable+onDragHandlePointerDown→ drag handle (consumer DnD wires)onSettingsClick→ دکمهی تنظیمات (popover خود را بسازید)headerActions→ slot دکمههای اضافی
BulletinViewer در print mode headerActions را hide میکند (print:hidden)، content column عرض ثابت max-w-3xl دارد، و sectionها break-inside-avoid میگیرند تا روی هیچ صفحهای نصف نشوند.
راهنمای استفاده
بکنید
- برای drag-reorder از
onDragHandlePointerDownاستفاده کنید + state خود را در parent مدیریت کنید (یا react-dnd integrate کنید) - Viewer + Composer را در دو route مجزا بگذارید:/report/[id]/editو/report/[id]- برای print، content را در یک<main>باBulletinViewerبپوشانید — print CSS خودکار اعمال میشود
نکنید
- sectionهای آماده مثل sentiment/flow را خام نزنید — report-sections ۶ template آماده دارد - drag-handle را disable نکنید مگر در حالت preview-only — انتظار analyst این است که هرلحظه drag کند
کامپوننتهای مرتبط
- 6 template آماده → Report Section Templates
- برای انتخاب template از یک palette → از
CommandPaletteاستفاده کنید - برای lifecycle ساخت bulletin async →
JobWizard+ ReportComposer در آخرین step
جدول ویژگیها
ReportComposer
ReportSection
BulletinViewer
دسترسیپذیری
ReportComposerوBulletinViewerهر دو بهصورت landmark<section>رندر میشوند؛titleبه یک heading معنادار تبدیل میشود تا screen reader ساختار سند را بفهمد.ReportSectionچندین کنترل keyboard-accessible دارد:Switchenable (Space toggle)،Buttoncollapse (Enter/Space)، drag handle (pointerdown — consumer مسئول focus management هنگام drag است).- درگ-اند-دراپ شورتکات keyboard ندارد بهصورت native — اگر reorder حساس به a11y میخواهید، یک «انتقال به بالا/پایین» جایگزین در
headerActionsقرار دهید (recommended pattern). - در
BulletinViewerحالت چاپ (@media print)، header actions مخفی میشوند، sectionهاbreak-inside-avoidمیگیرند، و contrast text بالا حفظ میشود تا خروجی PDF خوانا باشد. aria-expandedروی collapse trigger وaria-pressedروی Switch enable بهصورت خودکار ست میشوند.