@moontra/moonui-pro 2.25.7 → 2.25.9

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 CHANGED
@@ -9,7 +9,7 @@ Premium React components for advanced web applications. MoonUI Pro extends the b
9
9
  ## ✨ What's Included
10
10
 
11
11
  ### 📊 **Data & Analytics**
12
- - **Advanced DataTable** - Virtualized tables with sorting, filtering, pagination, row selection
12
+ - **Advanced DataTable** - Enterprise-grade tables with quick filters, faceted filters, enum auto-detection, custom filter accessors, virtualization, sorting, pagination, row selection, and export functionality
13
13
  - **Charts Library** - Beautiful data visualizations with Recharts integration
14
14
  - **Dashboard Widgets** - KPI cards, metrics displays, and analytics components
15
15
  - **TreeView** - Hierarchical data display with drag & drop
@@ -158,20 +158,101 @@ import { DataTable, VirtualTable, TreeTable } from '@moontra/moonui-pro';
158
158
  // Advanced data table with all features
159
159
  <DataTable
160
160
  data={data}
161
- columns={columns}
161
+ columns={[
162
+ {
163
+ accessorKey: 'status',
164
+ header: 'Status',
165
+ cell: ({ row }) => <Badge>{row.getValue('status')}</Badge>,
166
+ meta: {
167
+ filterType: 'select',
168
+ filterOptions: ['Active', 'Pending', 'Completed'],
169
+ filterValueAccessor: (row) => row.status // Access raw data, not rendered Badge
170
+ }
171
+ },
172
+ {
173
+ accessorKey: 'name',
174
+ header: 'Name'
175
+ }
176
+ ]}
177
+ quickFilters={[
178
+ {
179
+ column: 'status',
180
+ label: 'Status',
181
+ options: 'auto', // Auto-detect from data
182
+ showCounts: true // Show count for each option
183
+ },
184
+ {
185
+ column: 'department',
186
+ label: 'Department',
187
+ multi: true // Multi-select
188
+ }
189
+ ]}
190
+ facetedFilters={['category', 'tags']} // Checkbox filters with counts
162
191
  features={{
163
192
  sorting: true,
164
193
  filtering: true,
165
194
  pagination: true,
166
195
  rowSelection: true,
167
196
  columnResizing: true,
168
- virtualScrolling: true
197
+ virtualScrolling: true,
198
+ export: ['csv', 'excel', 'json']
169
199
  }}
170
200
  onRowClick={handleRowClick}
171
201
  onSelectionChange={handleSelection}
172
202
  />
173
203
  ```
174
204
 
205
+ #### New Filter Features (v2.25.8+)
206
+
207
+ **Quick Filters** - Dropdown filters for common filter scenarios:
208
+ ```jsx
209
+ // Quick filter with auto-detection
210
+ <DataTable
211
+ quickFilters={[
212
+ {
213
+ column: 'status',
214
+ options: 'auto', // Automatically detects unique values from data
215
+ showCounts: true // Shows count next to each option
216
+ }
217
+ ]}
218
+ />
219
+ ```
220
+
221
+ **Faceted Filters** - Advanced checkbox filters with search:
222
+ ```jsx
223
+ // Faceted filters for categories
224
+ <DataTable
225
+ facetedFilters={['category', 'brand', 'tags']}
226
+ columns={[
227
+ {
228
+ accessorKey: 'category',
229
+ meta: {
230
+ filterType: 'select',
231
+ filterOptions: ['Electronics', 'Clothing', 'Books'] // Predefined options
232
+ }
233
+ }
234
+ ]}
235
+ />
236
+ ```
237
+
238
+ **Filter Value Accessor** - Handle custom rendered cells:
239
+ ```jsx
240
+ // Filter by raw data instead of rendered content
241
+ columns={[
242
+ {
243
+ accessorKey: 'status',
244
+ cell: ({ row }) => (
245
+ <Badge variant={getVariant(row.original.status)}>
246
+ {formatStatus(row.original.status)}
247
+ </Badge>
248
+ ),
249
+ meta: {
250
+ filterValueAccessor: (row) => row.status // Access raw status value
251
+ }
252
+ }
253
+ ]}
254
+ ```
255
+
175
256
  ### Charts & Visualizations
176
257
  ```jsx
177
258
  import { LineChart, BarChart, PieChart, ScatterChart } from '@moontra/moonui-pro';
@@ -349,6 +430,22 @@ import { ResponsiveDataTable } from '@moontra/moonui-pro';
349
430
  />
350
431
  ```
351
432
 
433
+ ## 📦 Version History
434
+
435
+ ### v2.25.8 (Latest)
436
+ - ✨ **New:** Quick Filters - Dropdown filters with auto-detection and counts
437
+ - ✨ **New:** Faceted Filters - Advanced checkbox filters with search
438
+ - ✨ **New:** Filter Value Accessor - Custom accessors for filtered data
439
+ - ✨ **New:** Enum/Select filter support in filter drawer
440
+ - 🐛 **Fixed:** Filter drawer z-index and stacking issues
441
+ - 🐛 **Fixed:** Sorting behavior (single-column, three-state)
442
+
443
+ ### v2.25.0
444
+ - 🚀 DataTable performance improvements
445
+ - ✨ Export functionality (CSV, Excel, JSON)
446
+ - ✨ Bulk actions support
447
+ - 🎨 Improved dark mode styling
448
+
352
449
  ## 🔐 License & Security
353
450
 
354
451
  ### License Validation
package/dist/index.d.ts CHANGED
@@ -3137,6 +3137,14 @@ interface BulkAction<T = any> {
3137
3137
  */
3138
3138
  type ExportFormat = 'csv' | 'json' | 'xlsx';
3139
3139
 
3140
+ interface QuickFilterOption {
3141
+ column: string;
3142
+ label?: string;
3143
+ options?: string[] | "auto";
3144
+ multi?: boolean;
3145
+ showCounts?: boolean;
3146
+ }
3147
+
3140
3148
  interface FilterCondition {
3141
3149
  column: string;
3142
3150
  operator: FilterOperator;
@@ -3157,6 +3165,7 @@ interface DataTableProps<TData, TValue> {
3157
3165
  selectable?: boolean;
3158
3166
  pagination?: boolean;
3159
3167
  pageSize?: number;
3168
+ pageSizeOptions?: number[];
3160
3169
  className?: string;
3161
3170
  onRowSelect?: (rows: TData[]) => void;
3162
3171
  onExport?: (data: TData[]) => void;
@@ -3170,6 +3179,8 @@ interface DataTableProps<TData, TValue> {
3170
3179
  expandedRows?: Set<string>;
3171
3180
  onRowExpandChange?: (expandedRows: Set<string>) => void;
3172
3181
  bulkActions?: BulkAction<TData>[];
3182
+ quickFilters?: QuickFilterOption[];
3183
+ facetedFilters?: string[];
3173
3184
  enableSorting?: boolean;
3174
3185
  enableFiltering?: boolean;
3175
3186
  enablePagination?: boolean;
@@ -3213,7 +3224,7 @@ interface DataTableProps<TData, TValue> {
3213
3224
  filterButton?: string;
3214
3225
  };
3215
3226
  }
3216
- declare function DataTable<TData, TValue>({ columns: originalColumns, data, searchable, filterable, exportable, selectable, pagination, pageSize, className, onRowSelect, onExport, enableExpandable, renderSubComponent, expandedRows: controlledExpandedRows, onRowExpandChange, bulkActions, features, theme, texts, enableSorting, enableFiltering, enablePagination, enableColumnVisibility, enableRowSelection, filterPlaceholder, defaultPageSize, manualPagination, pageCount, onPaginationChange, onSortingChange, onColumnFiltersChange, state: externalState, }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
3227
+ declare function DataTable<TData, TValue>({ columns: originalColumns, data, searchable, filterable, exportable, selectable, pagination, pageSize, pageSizeOptions, className, onRowSelect, onExport, enableExpandable, renderSubComponent, expandedRows: controlledExpandedRows, onRowExpandChange, bulkActions, quickFilters, facetedFilters, features, theme, texts, enableSorting, enableFiltering, enablePagination, enableColumnVisibility, enableRowSelection, filterPlaceholder, defaultPageSize, manualPagination, pageCount, onPaginationChange, onSortingChange, onColumnFiltersChange, state: externalState, }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
3217
3228
  /**
3218
3229
  * Helper function to create an expandable column
3219
3230
  * @param expandedRows - Set of expanded row IDs