@wakastellar/ui 2.0.0 → 2.1.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.md +71 -8
- package/dist/cli/commands/add.d.ts +7 -0
- package/dist/cli/commands/init.d.ts +6 -0
- package/dist/cli/commands/list.d.ts +5 -0
- package/dist/cli/commands/search.d.ts +1 -0
- package/dist/cli/index.cjs +6014 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/utils/config.d.ts +29 -0
- package/dist/cli/utils/logger.d.ts +20 -0
- package/dist/cli/utils/registry.d.ts +23 -0
- package/package.json +14 -3
- package/src/blocks/activity-timeline/index.tsx +586 -0
- package/src/blocks/calendar-view/index.tsx +756 -0
- package/src/blocks/chat/index.tsx +1018 -0
- package/src/blocks/chat/widget.tsx +504 -0
- package/src/blocks/dashboard/index.tsx +522 -0
- package/src/blocks/empty-states/index.tsx +452 -0
- package/src/blocks/error-pages/index.tsx +426 -0
- package/src/blocks/faq/index.tsx +479 -0
- package/src/blocks/file-manager/index.tsx +890 -0
- package/src/blocks/footer/index.tsx +133 -0
- package/src/blocks/header/index.tsx +357 -0
- package/src/blocks/headtab/index.tsx +139 -0
- package/src/blocks/i18n-editor/index.tsx +1016 -0
- package/src/blocks/index.ts +80 -0
- package/src/blocks/kanban-board/index.tsx +779 -0
- package/src/blocks/landing/index.tsx +677 -0
- package/src/blocks/language-selector/index.tsx +88 -0
- package/src/blocks/layout/index.tsx +159 -0
- package/src/blocks/login/index.tsx +339 -0
- package/src/blocks/login/types.ts +131 -0
- package/src/blocks/pricing/index.tsx +564 -0
- package/src/blocks/profile/index.tsx +746 -0
- package/src/blocks/settings/index.tsx +558 -0
- package/src/blocks/sidebar/index.tsx +713 -0
- package/src/blocks/theme-creator-block/index.tsx +835 -0
- package/src/blocks/user-management/index.tsx +1037 -0
- package/src/blocks/wizard/index.tsx +719 -0
- package/src/components/DataTable/DataTable.tsx +406 -0
- package/src/components/DataTable/DataTableAdvanced.tsx +720 -0
- package/src/components/DataTable/DataTableBody.tsx +216 -0
- package/src/components/DataTable/DataTableCell.tsx +172 -0
- package/src/components/DataTable/DataTableColumnResizer.tsx +62 -0
- package/src/components/DataTable/DataTableConflictResolver.tsx +478 -0
- package/src/components/DataTable/DataTableContextMenu.tsx +219 -0
- package/src/components/DataTable/DataTableEditCell.tsx +279 -0
- package/src/components/DataTable/DataTableFilterBuilder.tsx +519 -0
- package/src/components/DataTable/DataTableFilters.tsx +535 -0
- package/src/components/DataTable/DataTableGrouping.tsx +147 -0
- package/src/components/DataTable/DataTableHeader.tsx +172 -0
- package/src/components/DataTable/DataTablePagination.tsx +125 -0
- package/src/components/DataTable/DataTableSelection.tsx +269 -0
- package/src/components/DataTable/DataTableSyncStatus.tsx +281 -0
- package/src/components/DataTable/DataTableToolbar.tsx +262 -0
- package/src/components/DataTable/README.md +446 -0
- package/src/components/DataTable/__tests__/DataTableAdvanced.test.tsx +426 -0
- package/src/components/DataTable/__tests__/DataTableEdit.test.tsx +329 -0
- package/src/components/DataTable/__tests__/useDataTableAdvanced.test.ts +455 -0
- package/src/components/DataTable/examples/EditExample.tsx +166 -0
- package/src/components/DataTable/formatters/index.ts +335 -0
- package/src/components/DataTable/hooks/__tests__/useDataTableEdit.test.ts +239 -0
- package/src/components/DataTable/hooks/useDataTable.ts +145 -0
- package/src/components/DataTable/hooks/useDataTableAdvanced.ts +342 -0
- package/src/components/DataTable/hooks/useDataTableAdvancedFilters.ts +637 -0
- package/src/components/DataTable/hooks/useDataTableColumnTemplates.ts +186 -0
- package/src/components/DataTable/hooks/useDataTableEdit.ts +167 -0
- package/src/components/DataTable/hooks/useDataTableExport.ts +227 -0
- package/src/components/DataTable/hooks/useDataTableImport.ts +216 -0
- package/src/components/DataTable/hooks/useDataTableOffline.ts +481 -0
- package/src/components/DataTable/hooks/useDataTableTheme.ts +213 -0
- package/src/components/DataTable/hooks/useDataTableVirtualization.ts +99 -0
- package/src/components/DataTable/hooks/useTableLayout.ts +85 -0
- package/src/components/DataTable/index.ts +81 -0
- package/src/components/DataTable/services/IndexedDBService.ts +504 -0
- package/src/components/DataTable/templates/index.tsx +803 -0
- package/src/components/DataTable/types.ts +504 -0
- package/src/components/DataTable/utils.ts +164 -0
- package/src/components/DataTable/workers/exportWorker.ts +213 -0
- package/src/components/accordion/index.tsx +61 -0
- package/src/components/alert/index.tsx +61 -0
- package/src/components/alert-dialog/index.tsx +146 -0
- package/src/components/aspect-ratio/index.tsx +12 -0
- package/src/components/avatar/index.tsx +54 -0
- package/src/components/badge/Badge.stories.tsx +64 -0
- package/src/components/badge/index.tsx +38 -0
- package/src/components/button/Button.stories.tsx +173 -0
- package/src/components/button/index.tsx +56 -0
- package/src/components/calendar/index.tsx +73 -0
- package/src/components/card/index.tsx +78 -0
- package/src/components/checkbox/index.tsx +34 -0
- package/src/components/code/index.tsx +229 -0
- package/src/components/collapsible/index.tsx +16 -0
- package/src/components/command/index.tsx +162 -0
- package/src/components/context-menu/index.tsx +204 -0
- package/src/components/dialog/index.tsx +126 -0
- package/src/components/dropdown-menu/index.tsx +204 -0
- package/src/components/error-boundary/ErrorBoundary.tsx +281 -0
- package/src/components/error-boundary/index.ts +7 -0
- package/src/components/form/index.tsx +183 -0
- package/src/components/hover-card/index.tsx +33 -0
- package/src/components/index.ts +368 -0
- package/src/components/input/Input.stories.tsx +100 -0
- package/src/components/input/index.tsx +27 -0
- package/src/components/input-otp/index.tsx +277 -0
- package/src/components/label/index.tsx +30 -0
- package/src/components/language-selector/index.tsx +341 -0
- package/src/components/menubar/index.tsx +240 -0
- package/src/components/navigation-menu/index.tsx +134 -0
- package/src/components/popover/index.tsx +35 -0
- package/src/components/progress/index.tsx +32 -0
- package/src/components/radio-group/index.tsx +48 -0
- package/src/components/scroll-area/index.tsx +52 -0
- package/src/components/select/index.tsx +164 -0
- package/src/components/separator/index.tsx +35 -0
- package/src/components/sheet/index.tsx +147 -0
- package/src/components/skeleton/index.tsx +22 -0
- package/src/components/slider/index.tsx +32 -0
- package/src/components/switch/index.tsx +33 -0
- package/src/components/table/index.tsx +117 -0
- package/src/components/tabs/index.tsx +59 -0
- package/src/components/textarea/index.tsx +30 -0
- package/src/components/theme-selector/index.tsx +327 -0
- package/src/components/toast/index.tsx +133 -0
- package/src/components/toaster/index.tsx +34 -0
- package/src/components/toggle/index.tsx +49 -0
- package/src/components/tooltip/index.tsx +34 -0
- package/src/components/typography/index.tsx +276 -0
- package/src/components/waka-3d-pie-chart/index.tsx +486 -0
- package/src/components/waka-achievement-unlock/index.tsx +716 -0
- package/src/components/waka-activity-feed/index.tsx +686 -0
- package/src/components/waka-address-autocomplete/index.tsx +1202 -0
- package/src/components/waka-admincrumb/index.tsx +349 -0
- package/src/components/waka-alert-stack/index.tsx +827 -0
- package/src/components/waka-allocation-matrix/index.tsx +1278 -0
- package/src/components/waka-approval-chain/index.tsx +766 -0
- package/src/components/waka-audit-log/index.tsx +1475 -0
- package/src/components/waka-autocomplete/index.tsx +358 -0
- package/src/components/waka-badge-showcase/index.tsx +704 -0
- package/src/components/waka-barcode/index.tsx +260 -0
- package/src/components/waka-biometric-prompt/index.tsx +765 -0
- package/src/components/waka-bottom-sheet/index.tsx +495 -0
- package/src/components/waka-breadcrumb/index.tsx +376 -0
- package/src/components/waka-breadcrumb-path/index.tsx +513 -0
- package/src/components/waka-budget-burn/index.tsx +1234 -0
- package/src/components/waka-capacity-planner/index.tsx +1107 -0
- package/src/components/waka-carousel/index.tsx +893 -0
- package/src/components/waka-cart-summary/index.tsx +1055 -0
- package/src/components/waka-challenge-timer/index.tsx +1044 -0
- package/src/components/waka-charts/WakaAreaChart.tsx +251 -0
- package/src/components/waka-charts/WakaBarChart.tsx +222 -0
- package/src/components/waka-charts/WakaChart.tsx +124 -0
- package/src/components/waka-charts/WakaLineChart.tsx +219 -0
- package/src/components/waka-charts/WakaMiniChart.tsx +133 -0
- package/src/components/waka-charts/WakaPieChart.tsx +214 -0
- package/src/components/waka-charts/WakaSparkline.tsx +229 -0
- package/src/components/waka-charts/dataTableHelpers.ts +109 -0
- package/src/components/waka-charts/hooks/useChartTheme.ts +123 -0
- package/src/components/waka-charts/hooks/useRechartsLoader.ts +234 -0
- package/src/components/waka-charts/index.ts +90 -0
- package/src/components/waka-charts/types.ts +330 -0
- package/src/components/waka-chat-bubble/index.tsx +1060 -0
- package/src/components/waka-checklist/index.tsx +1067 -0
- package/src/components/waka-checkout-stepper/index.tsx +976 -0
- package/src/components/waka-cohort-table/index.tsx +1011 -0
- package/src/components/waka-color-picker/index.tsx +447 -0
- package/src/components/waka-combo-counter/index.tsx +864 -0
- package/src/components/waka-combobox/index.tsx +497 -0
- package/src/components/waka-command-bar/index.tsx +403 -0
- package/src/components/waka-compare-period/index.tsx +1230 -0
- package/src/components/waka-connection-matrix/index.tsx +1053 -0
- package/src/components/waka-contribution-graph/index.tsx +552 -0
- package/src/components/waka-cost-breakdown/index.tsx +1065 -0
- package/src/components/waka-coupon-input/index.tsx +592 -0
- package/src/components/waka-credit-card-input/index.tsx +982 -0
- package/src/components/waka-daily-reward/index.tsx +762 -0
- package/src/components/waka-date-range-picker/index.tsx +378 -0
- package/src/components/waka-datetime-picker/index.tsx +793 -0
- package/src/components/waka-datetime-picker.form-integration/index.tsx +402 -0
- package/src/components/waka-deployment-lane/index.tsx +673 -0
- package/src/components/waka-device-trust/index.tsx +1259 -0
- package/src/components/waka-dock/index.tsx +285 -0
- package/src/components/waka-drawer/index.tsx +319 -0
- package/src/components/waka-empty-state/index.tsx +545 -0
- package/src/components/waka-error-shake/index.tsx +398 -0
- package/src/components/waka-feature-announcement/index.tsx +991 -0
- package/src/components/waka-file-upload/index.tsx +437 -0
- package/src/components/waka-floating-nav/index.tsx +413 -0
- package/src/components/waka-flow-diagram/index.tsx +508 -0
- package/src/components/waka-funnel-chart/index.tsx +823 -0
- package/src/components/waka-glow-card/index.tsx +246 -0
- package/src/components/waka-goal-progress/index.tsx +1025 -0
- package/src/components/waka-haptic-button/index.tsx +388 -0
- package/src/components/waka-health-pulse/index.tsx +451 -0
- package/src/components/waka-heatmap/index.tsx +1026 -0
- package/src/components/waka-hotspot/index.tsx +682 -0
- package/src/components/waka-image/index.tsx +373 -0
- package/src/components/waka-incident-timeline/index.tsx +686 -0
- package/src/components/waka-invoice-preview/index.tsx +829 -0
- package/src/components/waka-kanban/index.tsx +646 -0
- package/src/components/waka-kpi-dashboard/index.tsx +755 -0
- package/src/components/waka-leaderboard/index.tsx +746 -0
- package/src/components/waka-level-progress/index.tsx +665 -0
- package/src/components/waka-liquid-button/index.tsx +520 -0
- package/src/components/waka-loading-orbit/index.tsx +478 -0
- package/src/components/waka-loot-box/index.tsx +1091 -0
- package/src/components/waka-magic-link/index.tsx +321 -0
- package/src/components/waka-magnetic-button/index.tsx +567 -0
- package/src/components/waka-mention-input/index.tsx +953 -0
- package/src/components/waka-metric-sparkline/index.tsx +627 -0
- package/src/components/waka-milestone-road/index.tsx +1064 -0
- package/src/components/waka-modal/index.tsx +374 -0
- package/src/components/waka-morph-button/index.tsx +495 -0
- package/src/components/waka-network-topology/index.tsx +801 -0
- package/src/components/waka-notifications/index.tsx +414 -0
- package/src/components/waka-number-input/index.tsx +373 -0
- package/src/components/waka-orbital-menu/index.tsx +445 -0
- package/src/components/waka-order-tracker/index.tsx +1041 -0
- package/src/components/waka-pagination/index.tsx +393 -0
- package/src/components/waka-password-strength/index.tsx +824 -0
- package/src/components/waka-payment-method-picker/index.tsx +715 -0
- package/src/components/waka-permission-matrix/index.tsx +1302 -0
- package/src/components/waka-phone-input/index.tsx +801 -0
- package/src/components/waka-pipeline-view/index.tsx +604 -0
- package/src/components/waka-player-card/index.tsx +691 -0
- package/src/components/waka-points-popup/index.tsx +366 -0
- package/src/components/waka-power-up/index.tsx +1155 -0
- package/src/components/waka-presence-indicator/index.tsx +1181 -0
- package/src/components/waka-pricing-table/index.tsx +755 -0
- package/src/components/waka-product-card/index.tsx +786 -0
- package/src/components/waka-progress-onboarding/index.tsx +878 -0
- package/src/components/waka-pull-to-refresh/index.tsx +451 -0
- package/src/components/waka-qrcode/index.tsx +232 -0
- package/src/components/waka-quest-card/index.tsx +1275 -0
- package/src/components/waka-quota-bar/index.tsx +693 -0
- package/src/components/waka-radar-score/index.tsx +512 -0
- package/src/components/waka-rank-badge/index.tsx +813 -0
- package/src/components/waka-rating-input/index.tsx +560 -0
- package/src/components/waka-reaction-picker/index.tsx +1062 -0
- package/src/components/waka-region-map/index.tsx +730 -0
- package/src/components/waka-resource-gauge/index.tsx +654 -0
- package/src/components/waka-resource-pool/index.tsx +1035 -0
- package/src/components/waka-rich-text-editor/index.tsx +594 -0
- package/src/components/waka-rollback-slider/index.tsx +891 -0
- package/src/components/waka-sankey-diagram/index.tsx +1032 -0
- package/src/components/waka-schedule-picker/index.tsx +1060 -0
- package/src/components/waka-scratch-card/index.tsx +914 -0
- package/src/components/waka-season-pass/index.tsx +886 -0
- package/src/components/waka-security-score/index.tsx +1126 -0
- package/src/components/waka-segmented-control/index.tsx +238 -0
- package/src/components/waka-server-rack/index.tsx +764 -0
- package/src/components/waka-session-manager/index.tsx +815 -0
- package/src/components/waka-signature-pad/index.tsx +744 -0
- package/src/components/waka-skeleton-wave/index.tsx +454 -0
- package/src/components/waka-skill-tree/index.tsx +1031 -0
- package/src/components/waka-sla-tracker/index.tsx +798 -0
- package/src/components/waka-slider-range/index.tsx +765 -0
- package/src/components/waka-spin-wheel/index.tsx +671 -0
- package/src/components/waka-spinner/index.tsx +284 -0
- package/src/components/waka-spotlight/index.tsx +410 -0
- package/src/components/waka-stat/index.tsx +428 -0
- package/src/components/waka-stats-hexagon/index.tsx +824 -0
- package/src/components/waka-status-matrix/index.tsx +565 -0
- package/src/components/waka-stepper/index.tsx +489 -0
- package/src/components/waka-streak-counter/index.tsx +334 -0
- package/src/components/waka-success-explosion/index.tsx +453 -0
- package/src/components/waka-swipe-card/index.tsx +574 -0
- package/src/components/waka-tabs-morph/index.tsx +509 -0
- package/src/components/waka-tag-input/index.tsx +877 -0
- package/src/components/waka-team-banner/index.tsx +1183 -0
- package/src/components/waka-terminal-output/index.tsx +836 -0
- package/src/components/waka-theme-creator/index.tsx +762 -0
- package/src/components/waka-theme-manager/index.tsx +654 -0
- package/src/components/waka-thread-view/index.tsx +874 -0
- package/src/components/waka-tilt-card/index.tsx +250 -0
- package/src/components/waka-time-picker/index.tsx +479 -0
- package/src/components/waka-timeline/index.tsx +385 -0
- package/src/components/waka-tooltip-tour/index.tsx +855 -0
- package/src/components/waka-tour-guide/index.tsx +920 -0
- package/src/components/waka-tournament-bracket/index.tsx +1276 -0
- package/src/components/waka-tree/index.tsx +557 -0
- package/src/components/waka-treemap-chart/index.tsx +1031 -0
- package/src/components/waka-two-factor-setup/index.tsx +995 -0
- package/src/components/waka-typewriter/index.tsx +566 -0
- package/src/components/waka-typing-indicator/index.tsx +649 -0
- package/src/components/waka-versus-card/index.tsx +1026 -0
- package/src/components/waka-video/index.tsx +557 -0
- package/src/components/waka-video-call/index.tsx +1087 -0
- package/src/components/waka-virtual-list/index.tsx +327 -0
- package/src/components/waka-voice-message/index.tsx +1019 -0
- package/src/components/waka-welcome-modal/index.tsx +790 -0
- package/src/components/waka-xp-bar/index.tsx +799 -0
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
# 📊 DataTable
|
|
2
|
+
|
|
3
|
+
Composant de table de données ultra-complet basé sur **TanStack Table v8**, totalement configurable et typé.
|
|
4
|
+
|
|
5
|
+
## ✨ Fonctionnalités
|
|
6
|
+
|
|
7
|
+
- ✅ **Tri multi-colonnes** (client & serveur)
|
|
8
|
+
- ✅ **Filtrage global et par colonne**
|
|
9
|
+
- ✅ **Pagination** (client & serveur)
|
|
10
|
+
- ✅ **Sélection multiple** avec checkbox
|
|
11
|
+
- ✅ **Export** (CSV, JSON)
|
|
12
|
+
- ✅ **Import** (CSV)
|
|
13
|
+
- ✅ **Layouts multiples** (standard, card, compact, split, infinite)
|
|
14
|
+
- ✅ **Variants visuels** (bordered, minimal, striped, glass)
|
|
15
|
+
- ✅ **Densité ajustable** (comfortable, compact)
|
|
16
|
+
- ✅ **Toolbar personnalisable** avec actions
|
|
17
|
+
- ✅ **Virtualisation** pour grandes données
|
|
18
|
+
- ✅ **Thème clair/sombre** via TweakCN
|
|
19
|
+
- ✅ **i18n** complet
|
|
20
|
+
- ✅ **Responsive** (mobile-first)
|
|
21
|
+
- ✅ **Accessibilité** (a11y)
|
|
22
|
+
- ✅ **TypeScript** 100%
|
|
23
|
+
|
|
24
|
+
## 📦 Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pnpm add @wakastart/ui @tanstack/react-table
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 🚀 Utilisation de base
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { DataTable } from "@wakastart/ui"
|
|
34
|
+
import { ColumnDef } from "@tanstack/react-table"
|
|
35
|
+
|
|
36
|
+
interface User {
|
|
37
|
+
id: string
|
|
38
|
+
name: string
|
|
39
|
+
email: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const columns: ColumnDef<User>[] = [
|
|
43
|
+
{
|
|
44
|
+
accessorKey: "name",
|
|
45
|
+
header: "Name",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
accessorKey: "email",
|
|
49
|
+
header: "Email",
|
|
50
|
+
},
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
const data: User[] = [
|
|
54
|
+
{ id: "1", name: "John", email: "john@example.com" },
|
|
55
|
+
{ id: "2", name: "Jane", email: "jane@example.com" },
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
function MyTable() {
|
|
59
|
+
return <DataTable data={data} columns={columns} />
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 🎨 Exemples avancés
|
|
64
|
+
|
|
65
|
+
### Table avec sélection et actions
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
<DataTable
|
|
69
|
+
data={users}
|
|
70
|
+
columns={columns}
|
|
71
|
+
selection
|
|
72
|
+
toolbar={{
|
|
73
|
+
showSearch: true,
|
|
74
|
+
actions: [
|
|
75
|
+
{
|
|
76
|
+
id: "delete",
|
|
77
|
+
label: "Delete",
|
|
78
|
+
icon: <Trash />,
|
|
79
|
+
onClick: (selectedRows) => console.log(selectedRows),
|
|
80
|
+
requiresSelection: true,
|
|
81
|
+
variant: "destructive",
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
}}
|
|
85
|
+
onSelectionChange={(selectedRows) => console.log(selectedRows)}
|
|
86
|
+
/>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Pagination serveur
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
<DataTable
|
|
93
|
+
data={users}
|
|
94
|
+
columns={columns}
|
|
95
|
+
pagination={{
|
|
96
|
+
mode: "server",
|
|
97
|
+
currentPage: 0,
|
|
98
|
+
totalItems: 1000,
|
|
99
|
+
pageSize: 10,
|
|
100
|
+
onPageChange: (page) => fetchPage(page),
|
|
101
|
+
onPageSizeChange: (size) => setPageSize(size),
|
|
102
|
+
}}
|
|
103
|
+
/>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Export et Import
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
<DataTable
|
|
110
|
+
data={users}
|
|
111
|
+
columns={columns}
|
|
112
|
+
enableExport
|
|
113
|
+
enableImport
|
|
114
|
+
/>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Layouts alternatifs
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
<DataTable
|
|
121
|
+
data={users}
|
|
122
|
+
columns={columns}
|
|
123
|
+
layout="card" // ou "compact", "split", "infinite"
|
|
124
|
+
variant="glass" // ou "bordered", "minimal", "striped"
|
|
125
|
+
density="compact" // ou "comfortable"
|
|
126
|
+
/>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Header sticky
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
<DataTable
|
|
133
|
+
data={users}
|
|
134
|
+
columns={columns}
|
|
135
|
+
headerSticky
|
|
136
|
+
virtualizationHeight={600}
|
|
137
|
+
/>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Filtres avancés avec autocomplete
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
<DataTable
|
|
144
|
+
data={users}
|
|
145
|
+
columns={columns}
|
|
146
|
+
filterPosition="right" // ou "left", "top", "bottom", "modal"
|
|
147
|
+
filters={[
|
|
148
|
+
{
|
|
149
|
+
id: "name-filter",
|
|
150
|
+
label: "Nom",
|
|
151
|
+
type: "text",
|
|
152
|
+
column: "name",
|
|
153
|
+
placeholder: "Rechercher par nom...",
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: "role-filter",
|
|
157
|
+
label: "Rôle",
|
|
158
|
+
type: "multiselect",
|
|
159
|
+
column: "role",
|
|
160
|
+
placeholder: "Sélectionner des rôles...",
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
id: "status-filter",
|
|
164
|
+
label: "Statut",
|
|
165
|
+
type: "select",
|
|
166
|
+
column: "status",
|
|
167
|
+
options: [
|
|
168
|
+
{ label: "Actif", value: "active" },
|
|
169
|
+
{ label: "Inactif", value: "inactive" },
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
id: "date-filter",
|
|
174
|
+
label: "Date de création",
|
|
175
|
+
type: "date",
|
|
176
|
+
column: "createdAt",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
id: "age-filter",
|
|
180
|
+
label: "Âge",
|
|
181
|
+
type: "range",
|
|
182
|
+
column: "age",
|
|
183
|
+
},
|
|
184
|
+
]}
|
|
185
|
+
onFiltersChange={(activeFilters) => console.log(activeFilters)}
|
|
186
|
+
/>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Caractéristiques des filtres** :
|
|
190
|
+
- 🎯 **Bouton compact** : S'ouvre dans un panneau au clic (ne prend pas de place)
|
|
191
|
+
- 🔍 **Autocomplete intelligent** : Suggestions automatiques basées sur les données de la colonne
|
|
192
|
+
- 📝 **Types multiples** : text, select, multiselect, date, range
|
|
193
|
+
- 📍 **Positions flexibles** :
|
|
194
|
+
- `top`/`bottom` : Popover compact (400px)
|
|
195
|
+
- `left`/`right` : Sheet latéral (400-540px)
|
|
196
|
+
- `modal` : Popover modal
|
|
197
|
+
- ✅ **Gestion des filtres actifs** : Affichage et suppression facile des filtres appliqués
|
|
198
|
+
- 🔧 **Opérateurs multiples** : contains, equals, startsWith, endsWith, in, notIn, between, etc.
|
|
199
|
+
|
|
200
|
+
## 📚 Props
|
|
201
|
+
|
|
202
|
+
### DataTableProps<TData>
|
|
203
|
+
|
|
204
|
+
| Prop | Type | Default | Description |
|
|
205
|
+
|------|------|---------|-------------|
|
|
206
|
+
| `data` | `TData[]` | **required** | Données à afficher |
|
|
207
|
+
| `columns` | `ColumnDef<TData>[]` | **required** | Définition des colonnes |
|
|
208
|
+
| `layout` | `DataTableLayout` | `"standard"` | Layout d'affichage |
|
|
209
|
+
| `variant` | `DataTableVariant` | `"bordered"` | Variant visuel |
|
|
210
|
+
| `density` | `DataTableDensity` | `"comfortable"` | Densité d'affichage |
|
|
211
|
+
| `selection` | `boolean` | `false` | Activer la sélection |
|
|
212
|
+
| `pagination` | `PaginationConfig` | `undefined` | Configuration pagination |
|
|
213
|
+
| `toolbar` | `ToolbarConfig` | `undefined` | Configuration toolbar |
|
|
214
|
+
| `filters` | `FilterConfig[]` | `undefined` | Configuration filtres |
|
|
215
|
+
| `filterPosition` | `FilterPosition` | `"top"` | Position des filtres |
|
|
216
|
+
| `loading` | `boolean` | `false` | État de chargement |
|
|
217
|
+
| `error` | `string \| null` | `null` | Message d'erreur |
|
|
218
|
+
| `emptyState` | `ReactNode` | `undefined` | État vide personnalisé |
|
|
219
|
+
| `headerSticky` | `boolean` | `false` | Header fixe |
|
|
220
|
+
| `enableExport` | `boolean \| ExportConfig` | `false` | Activer l'export |
|
|
221
|
+
| `enableImport` | `boolean \| ImportConfig` | `false` | Activer l'import |
|
|
222
|
+
| `enableVirtualization` | `boolean` | `false` | Activer virtualisation |
|
|
223
|
+
| `onRowClick` | `(row: TData) => void` | `undefined` | Callback clic ligne |
|
|
224
|
+
| `onSelectionChange` | `(rows: TData[]) => void` | `undefined` | Callback sélection |
|
|
225
|
+
| `className` | `string` | `undefined` | Classe CSS |
|
|
226
|
+
| `tableId` | `string` | `undefined` | ID pour persistance |
|
|
227
|
+
|
|
228
|
+
### PaginationConfig
|
|
229
|
+
|
|
230
|
+
```ts
|
|
231
|
+
interface PaginationConfig {
|
|
232
|
+
mode?: "client" | "server"
|
|
233
|
+
pageSize?: number
|
|
234
|
+
pageSizeOptions?: number[]
|
|
235
|
+
currentPage?: number
|
|
236
|
+
totalItems?: number
|
|
237
|
+
onPageChange?: (page: number) => void
|
|
238
|
+
onPageSizeChange?: (size: number) => void
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### ToolbarConfig
|
|
243
|
+
|
|
244
|
+
```ts
|
|
245
|
+
interface ToolbarConfig {
|
|
246
|
+
actions?: TableAction[]
|
|
247
|
+
showSearch?: boolean
|
|
248
|
+
showColumnToggle?: boolean
|
|
249
|
+
showDensity?: boolean
|
|
250
|
+
showRefresh?: boolean
|
|
251
|
+
onRefresh?: () => void
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### TableAction
|
|
256
|
+
|
|
257
|
+
```ts
|
|
258
|
+
interface TableAction {
|
|
259
|
+
id: string
|
|
260
|
+
label: string
|
|
261
|
+
icon?: ReactNode
|
|
262
|
+
onClick: (selectedRows: TData[]) => void
|
|
263
|
+
requiresSelection?: boolean
|
|
264
|
+
variant?: "default" | "destructive" | "outline" | "ghost"
|
|
265
|
+
disabled?: boolean
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### FilterConfig
|
|
270
|
+
|
|
271
|
+
```ts
|
|
272
|
+
interface FilterConfig {
|
|
273
|
+
id: string
|
|
274
|
+
label: string
|
|
275
|
+
type: "text" | "select" | "multiselect" | "date" | "range"
|
|
276
|
+
column?: string
|
|
277
|
+
placeholder?: string
|
|
278
|
+
defaultValue?: any
|
|
279
|
+
options?: Array<{ label: string; value: string | number }>
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Types de filtres** :
|
|
284
|
+
- `text` : Champ texte avec autocomplete basé sur les valeurs de la colonne
|
|
285
|
+
- `select` : Liste déroulante simple
|
|
286
|
+
- `multiselect` : Sélection multiple avec checkboxes
|
|
287
|
+
- `date` : Sélecteur de date
|
|
288
|
+
- `range` : Plage numérique (min/max)
|
|
289
|
+
|
|
290
|
+
## 🎛️ Hooks
|
|
291
|
+
|
|
292
|
+
### useDataTable
|
|
293
|
+
|
|
294
|
+
Hook principal pour gérer la logique du DataTable.
|
|
295
|
+
|
|
296
|
+
```tsx
|
|
297
|
+
const {
|
|
298
|
+
table,
|
|
299
|
+
sorting,
|
|
300
|
+
setSorting,
|
|
301
|
+
columnFilters,
|
|
302
|
+
setColumnFilters,
|
|
303
|
+
globalFilter,
|
|
304
|
+
setGlobalFilter,
|
|
305
|
+
selectedRows,
|
|
306
|
+
resetFilters,
|
|
307
|
+
exportData,
|
|
308
|
+
} = useDataTable({
|
|
309
|
+
data,
|
|
310
|
+
columns,
|
|
311
|
+
pagination,
|
|
312
|
+
tableId,
|
|
313
|
+
})
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### useTableLayout
|
|
317
|
+
|
|
318
|
+
Hook pour gérer le layout et la densité.
|
|
319
|
+
|
|
320
|
+
```tsx
|
|
321
|
+
const {
|
|
322
|
+
layout,
|
|
323
|
+
setLayout,
|
|
324
|
+
density,
|
|
325
|
+
setDensity,
|
|
326
|
+
toggleLayout,
|
|
327
|
+
toggleDensity,
|
|
328
|
+
isMobile,
|
|
329
|
+
densityClasses,
|
|
330
|
+
} = useTableLayout("standard", "comfortable")
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
## 🌍 Internationalisation
|
|
334
|
+
|
|
335
|
+
Le composant supporte l'i18n via `react-i18next`. Toutes les clés sont sous le namespace `datatable` :
|
|
336
|
+
|
|
337
|
+
```json
|
|
338
|
+
{
|
|
339
|
+
"datatable": {
|
|
340
|
+
"loading": "Chargement...",
|
|
341
|
+
"noData": "Aucune donnée",
|
|
342
|
+
"selectAll": "Tout sélectionner",
|
|
343
|
+
"pagination": {
|
|
344
|
+
"showing": "Affichage",
|
|
345
|
+
"to": "à",
|
|
346
|
+
"of": "sur",
|
|
347
|
+
"results": "résultats",
|
|
348
|
+
"rowsPerPage": "Lignes par page"
|
|
349
|
+
},
|
|
350
|
+
"toolbar": {
|
|
351
|
+
"search": "Rechercher...",
|
|
352
|
+
"selected": "sélectionnés",
|
|
353
|
+
"clear": "Effacer",
|
|
354
|
+
"export": "Exporter",
|
|
355
|
+
"columns": "Colonnes"
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
## 🎨 Personnalisation
|
|
362
|
+
|
|
363
|
+
### Styles personnalisés
|
|
364
|
+
|
|
365
|
+
```tsx
|
|
366
|
+
<DataTable
|
|
367
|
+
data={data}
|
|
368
|
+
columns={columns}
|
|
369
|
+
className="custom-table"
|
|
370
|
+
/>
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Variant personnalisé
|
|
374
|
+
|
|
375
|
+
Le composant utilise Tailwind CSS. Vous pouvez personnaliser via les variants :
|
|
376
|
+
|
|
377
|
+
- `bordered` : bordures et coins arrondis
|
|
378
|
+
- `minimal` : sans bordures
|
|
379
|
+
- `striped` : lignes alternées
|
|
380
|
+
- `glass` : effet glassmorphism
|
|
381
|
+
|
|
382
|
+
## 🔧 Utilitaires
|
|
383
|
+
|
|
384
|
+
### Export
|
|
385
|
+
|
|
386
|
+
```ts
|
|
387
|
+
import { exportToCSV, exportToJSON } from "@wakastart/ui"
|
|
388
|
+
|
|
389
|
+
exportToCSV(data, "users.csv")
|
|
390
|
+
exportToJSON(data, "users.json")
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
### Import
|
|
394
|
+
|
|
395
|
+
```ts
|
|
396
|
+
import { parseCSV } from "@wakastart/ui"
|
|
397
|
+
|
|
398
|
+
const data = await parseCSV(file)
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### Persistance
|
|
402
|
+
|
|
403
|
+
```ts
|
|
404
|
+
import { saveTableState, loadTableState } from "@wakastart/ui"
|
|
405
|
+
|
|
406
|
+
saveTableState("my-table", state)
|
|
407
|
+
const state = loadTableState("my-table")
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
## 🧪 Tests
|
|
411
|
+
|
|
412
|
+
```tsx
|
|
413
|
+
import { render, screen } from "@testing-library/react"
|
|
414
|
+
import { DataTable } from "@wakastart/ui"
|
|
415
|
+
|
|
416
|
+
test("renders table with data", () => {
|
|
417
|
+
render(<DataTable data={testData} columns={testColumns} />)
|
|
418
|
+
expect(screen.getByText("John")).toBeInTheDocument()
|
|
419
|
+
})
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
## 📖 Documentation complète
|
|
423
|
+
|
|
424
|
+
- [TanStack Table](https://tanstack.com/table/v8)
|
|
425
|
+
- [WakaStart UI](https://ui.wakastart.com)
|
|
426
|
+
- [Exemples de démo](/demo/app/datatable)
|
|
427
|
+
|
|
428
|
+
## 📝 Changelog
|
|
429
|
+
|
|
430
|
+
### v1.0.0 (2024-10-15)
|
|
431
|
+
|
|
432
|
+
- 🎉 Initial release
|
|
433
|
+
- ✨ Support complet de TanStack Table v8
|
|
434
|
+
- 🎨 Layouts multiples
|
|
435
|
+
- 🌍 i18n complet
|
|
436
|
+
- 📊 Export/Import
|
|
437
|
+
- 🎯 TypeScript strict
|
|
438
|
+
|
|
439
|
+
## 🤝 Contribution
|
|
440
|
+
|
|
441
|
+
Contributions bienvenues ! Voir [CONTRIBUTING.md](../../../CONTRIBUTING.md)
|
|
442
|
+
|
|
443
|
+
## 📄 License
|
|
444
|
+
|
|
445
|
+
MIT © WakaStart
|
|
446
|
+
|