|
8 | 8 |
|
9 | 9 | import React, { useState } from 'react'; |
10 | 10 | import { Card, CardContent, CardHeader, CardTitle, CardDescription, Button, Input, Label, Tabs, TabsContent, TabsList, TabsTrigger } from '@object-ui/components'; |
11 | | -import type { ReportBuilderSchema, ReportSchema, ReportField, ReportFilter, ReportGroupBy, ReportSection } from '@object-ui/types'; |
| 11 | +import type { ReportBuilderSchema, ReportSchema, ReportField, ReportFilter, ReportGroupBy, ReportSection, DataSource } from '@object-ui/types'; |
12 | 12 | import { Plus, Trash2, Save, X, Settings, Filter, Layers, Calendar } from 'lucide-react'; |
13 | 13 | import { ReportViewer } from './ReportViewer'; |
14 | 14 | import { ScheduleConfig } from './ScheduleConfig'; |
@@ -51,7 +51,7 @@ export const ReportBuilder: React.FC<ReportBuilderProps> = ({ schema }) => { |
51 | 51 | const handleAddField = () => { |
52 | 52 | if (availableFields.length > 0 && selectedFields.length < availableFields.length) { |
53 | 53 | const nextField = availableFields.find( |
54 | | - f => !selectedFields.some(sf => sf.name === f.name) |
| 54 | + (f: ReportField) => !selectedFields.some(sf => sf.name === f.name) |
55 | 55 | ); |
56 | 56 | if (nextField) { |
57 | 57 | const newFields = [...selectedFields, nextField]; |
@@ -226,7 +226,7 @@ export const ReportBuilder: React.FC<ReportBuilderProps> = ({ schema }) => { |
226 | 226 | <Label>Data Source</Label> |
227 | 227 | <select className="w-full border rounded-md p-2"> |
228 | 228 | <option value="">Select a data source</option> |
229 | | - {dataSources.map((_ds, idx) => ( |
| 229 | + {dataSources.map((_ds: DataSource, idx: number) => ( |
230 | 230 | <option key={idx} value={idx}> |
231 | 231 | Data Source {idx + 1} |
232 | 232 | </option> |
@@ -364,7 +364,7 @@ export const ReportBuilder: React.FC<ReportBuilderProps> = ({ schema }) => { |
364 | 364 | value={filter.field} |
365 | 365 | onChange={(e) => handleFilterChange(index, { ...filter, field: e.target.value })} |
366 | 366 | > |
367 | | - {availableFields.map((f, i) => ( |
| 367 | + {availableFields.map((f: ReportField, i: number) => ( |
368 | 368 | <option key={i} value={f.name}>{f.label || f.name}</option> |
369 | 369 | ))} |
370 | 370 | </select> |
@@ -432,7 +432,7 @@ export const ReportBuilder: React.FC<ReportBuilderProps> = ({ schema }) => { |
432 | 432 | value={group.field} |
433 | 433 | onChange={(e) => handleGroupByChange(index, { ...group, field: e.target.value })} |
434 | 434 | > |
435 | | - {availableFields.map((f, i) => ( |
| 435 | + {availableFields.map((f: ReportField, i: number) => ( |
436 | 436 | <option key={i} value={f.name}>{f.label || f.name}</option> |
437 | 437 | ))} |
438 | 438 | </select> |
@@ -557,7 +557,7 @@ export const ReportBuilder: React.FC<ReportBuilderProps> = ({ schema }) => { |
557 | 557 | })} |
558 | 558 | > |
559 | 559 | <option value="">Select Field...</option> |
560 | | - {availableFields.map(f => ( |
| 560 | + {availableFields.map((f: ReportField) => ( |
561 | 561 | <option key={f.name} value={f.name}>{f.label || f.name}</option> |
562 | 562 | ))} |
563 | 563 | {/* Use mock fields if no available fields provided */} |
|
0 commit comments