سلهای جدول داده (DataTableCells)
مجموعه renderer سبک برای استفاده در کلون cell: ستون DataTable — Sparkline / Trend / Status / Sentiment / Flow / Progress / StatDelta.
معرفی
DataTable v2 با cell renderer های زیر میتواند inline charts و badges در ستونها داشته باشد. هر renderer یک wrapper نازک روی کامپوننتهای موجود DS است که برای استفاده در سلول جدول بهینه شده — اندازه ثابت، بدون margin/padding خارجی، typography یکدست.
هفت cell renderer:
SparklineCell— sparkline + مقدار اختیاری (مثل۳٫۲٪)TrendCell— arrow up/down/flat با مقدار absolute (پشتیبانی ازinvertبرای متریک معکوس)StatusPulseCell— StatusBadge با نقطه pulse برای ردیف فشردهSentimentCell— SentimentDistribution در عرض ثابت (پیشفرض ۸۰px)FlowCell— FlowDistribution در عرض ثابت (پیشفرض ۹۶px)ProgressCell— Progress bar افقی + مقدار٪StatDeltaCell— مقدار اصلی + delta arrow کنار هم
| پیج | تعامل | رشد | وضعیت | احساسات | ثبات |
|---|---|---|---|---|---|
| @page_alpha | ۳٪ | +۱۲٪ | پایین | مثبتخنثیمنفی | |
| @page_beta | ۱٪ | -۸٪ | هشدار | مثبتخنثیمنفی | |
| @page_gamma | ۴٪ | +۵٪ | بحرانی | حامیان حکومتمنتقدان داخلیمخالفان خارجی | ۹۲٪+۳٪ |
زمین بازی
با تغییر تنظیمات زیر، پیشنمایش زنده را مشاهده کنید.
زمین بازی
تنظیمات
ظاهر
80
محتوا
کد این نمونه بهصورت خودکار قابل تولید نیست — برای کد آمادهی copy/paste به بخش «استفاده» در بالای صفحه مراجعه کنید.
استفاده
'use client'
import {
DataTable,
SparklineCell,
TrendCell,
StatusPulseCell,
SentimentCell,
ProgressCell,
} from '@parto-system-design/ui'
;<DataTable
columns={[
{ id: 'name', header: 'نام', cell: (r) => r.name },
{
id: 'engagement',
header: 'تعامل',
cell: (r) => <SparklineCell data={r.history} value={r.eRate} suffix="٪" />,
},
{
id: 'growth',
header: 'رشد',
cell: (r) => <TrendCell value={r.growthDelta} suffix="٪" />,
},
{
id: 'status',
header: 'وضعیت',
cell: (r) => <StatusPulseCell status={r.status} label={r.statusLabel} />,
},
{
id: 'sentiment',
header: 'احساسات',
cell: (r) => <SentimentCell data={r.sentimentBreakdown} />,
},
{
id: 'progress',
header: 'پیشرفت',
cell: (r) => <ProgressCell value={r.progressPct} variant="success" />,
},
]}
data={rows}
/>راهنمای استفاده
بکنید
- این سلولها را داخل
cell()ستون DataTable برگردانید — هیچ کدام margin/padding خارجی ندارند - برای متریکهای inverted (مثل bounce rate) ازinvert={true}درTrendCellاستفاده کنید — رنگبندی برعکس میشود - دادهی sparkline را به ۵-۱۰ نقطه محدود کنید — جزئیات بیشتر در سلول قابل خواندن نیست
نکنید
- این سلولها را خارج از DataTable استفاده نکنید — برای layout سلولی tuned شدهاند - در یک ستون چند نوع cell متفاوت ترکیب نکنید — sort/align/density سازگار نیست - دادهی خام بزرگ (۱۰۰+ نقطه) را به sparkline ندهید — performance افت میکند
SparklineCell
<SparklineCell
data={[1.2, 1.5, 1.8, 2.1, 2.4]}
value={2.4}
suffix="٪"
variant="area" // یا 'line' (پیشفرض) یا 'bars'
width={64} // px
height={18} // px
/>TrendCell
<TrendCell value={12} suffix="٪" /> // ↑ ۱۲٪ (سبز)
<TrendCell value={-8} suffix="٪" /> // ↓ ۸٪ (قرمز)
<TrendCell value={-3} invert suffix="٪" /> // ↓ ۳٪ → سبز (چون نرخ خطا کمتر = بهتر)
<TrendCell value={0} /> // ━ خنثیStatusPulseCell
<StatusPulseCell status="critical" label="بحرانی" />
<StatusPulseCell status="middle" /> // فقط dot، بدون label
<StatusPulseCell status="low" label="پایین" />SentimentCell / FlowCell
<SentimentCell
data={{ positive: 50, negative: 20, neutral: 30 }}
variant="stacked" // یا 'bars' یا 'compact'
width={80}
/>
<FlowCell
data={{ 'pro-gov': 45, 'internal-critic': 25, 'external-opponent': 20, grey: 10 }}
variant="stacked"
width={96}
/>ProgressCell
<ProgressCell value={67} /> // پیشفرض primary
<ProgressCell value={92} variant="success" />
<ProgressCell value={42} variant="warning" />
<ProgressCell value={67} showValue={false} /> // فقط بار، بدون متنStatDeltaCell
<StatDeltaCell value={1240} delta={12} valueSuffix="K" deltaSuffix="٪" />
// نمایش: ۱٬۲۴۰K ↑ ۱۲٪
<StatDeltaCell value={500} />
// نمایش: ۵۰۰ (بدون delta)
<StatDeltaCell value={45} delta={-8} invertDelta />
// نمایش: ۴۵ ↑ ۸ (سبز چون invert)Props
SparklineCell
TrendCell
ProgressCell
StatDeltaCell
دسترسیپذیری
- هر cell یک
data-slot="<name>-cell"دارد — برای CSS/telemetry. - متن مقدار همیشه با اعداد محلی فرمت میشود.
- TrendCell جهت را با آیکون + رنگ منتقل میکند، نه فقط رنگ.
- StatusPulseCell با StatusBadge animated —
prefers-reduced-motionرعایت میشود.
کامپوننتهای مرتبط
- DataTable — جدول اصلی که این cellها در آن استفاده میشوند
- Sparkline — sparkline standalone
- TrendIndicator — trend indicator standalone
- StatusBadge — status badge standalone
- SentimentDistribution — distribution مستقل
- Progress — bar پیشرفت standalone