Skip to content

Commit 45ba397

Browse files
Copilothuangyiirene
andcommitted
Fix code review issues: add missing type annotations, fix property names, remove duplicate types and type assertions
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
1 parent 8058f2f commit 45ba397

9 files changed

Lines changed: 8 additions & 73 deletions

File tree

packages/components/src/renderers/complex/data-table.tsx

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -39,71 +39,6 @@ import {
3939

4040
type SortDirection = 'asc' | 'desc' | null;
4141

42-
/**
43-
* Column configuration for the data table.
44-
* @interface Column
45-
*/
46-
interface Column {
47-
/** Display name of the column */
48-
header: string;
49-
/** Key to access the data field in each row object */
50-
accessorKey: string;
51-
/** Optional CSS classes for the column header */
52-
className?: string;
53-
/** Optional CSS classes for the column cells */
54-
cellClassName?: string;
55-
/** Width of the column (e.g., '80px' or 80) */
56-
width?: string | number;
57-
/** Whether sorting is enabled for this column (default: true) */
58-
sortable?: boolean;
59-
/** Whether filtering is enabled for this column (default: true) */
60-
filterable?: boolean;
61-
/** Whether column resizing is enabled (default: true) */
62-
resizable?: boolean;
63-
}
64-
65-
/**
66-
* Schema definition for the enterprise data table component.
67-
* Supports sorting, pagination, search, row selection, CSV export, and row actions.
68-
* @interface DataTableSchema
69-
*/
70-
interface DataTableSchema {
71-
/** Optional caption text displayed above the table */
72-
caption?: string;
73-
/** Array of column definitions */
74-
columns: Column[];
75-
/** Array of data objects to display. Each object should have an 'id' field for stable row identification */
76-
data: any[];
77-
/** Enable/disable pagination (default: true) */
78-
pagination?: boolean;
79-
/** Number of rows per page (default: 10) */
80-
pageSize?: number;
81-
/** Enable/disable search across all columns (default: true) */
82-
searchable?: boolean;
83-
/** Enable/disable row selection with checkboxes (default: false) */
84-
selectable?: boolean;
85-
/** Enable/disable column sorting (default: true) */
86-
sortable?: boolean;
87-
/** Enable/disable CSV export button (default: false) */
88-
exportable?: boolean;
89-
/** Show/hide edit and delete action buttons for each row (default: false) */
90-
rowActions?: boolean;
91-
/** Enable/disable column resizing by dragging (default: true) */
92-
resizableColumns?: boolean;
93-
/** Enable/disable column reordering by dragging (default: true) */
94-
reorderableColumns?: boolean;
95-
/** Callback function triggered when the edit button is clicked */
96-
onRowEdit?: (row: any) => void;
97-
/** Callback function triggered when the delete button is clicked */
98-
onRowDelete?: (row: any) => void;
99-
/** Callback function triggered when row selection changes, receives array of selected rows */
100-
onSelectionChange?: (selectedRows: any[]) => void;
101-
/** Callback function triggered when columns are reordered */
102-
onColumnsReorder?: (columns: Column[]) => void;
103-
/** Optional CSS classes for the table container */
104-
className?: string;
105-
}
106-
10742
/**
10843
* Enterprise-level data table component with Airtable-like features.
10944
*

packages/components/src/renderers/complex/table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414

1515
// A simple data-driven table
1616
ComponentRegistry.register('table',
17-
({ schema, className, ...props }) => (
17+
({ schema, className, ...props }: { schema: TableSchema; className?: string; [key: string]: any }) => (
1818
<Table className={className} {...props}>
1919
{schema.caption && <TableCaption>{schema.caption}</TableCaption>}
2020
<TableHeader>

packages/components/src/renderers/complex/timeline.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function formatDate(dateString: string, format?: string): string {
7979

8080
ComponentRegistry.register(
8181
'timeline',
82-
({ schema, className, ...props }) => {
82+
({ schema, className, ...props }: { schema: TimelineSchema; className?: string; [key: string]: any }) => {
8383
const {
8484
variant = 'vertical',
8585
items = [],

packages/components/src/renderers/disclosure/accordion.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { renderChildren } from '../../lib/utils';
1010

1111
ComponentRegistry.register('accordion',
1212
({ schema, className, ...props }: { schema: AccordionSchema; className?: string; [key: string]: any }) => (
13-
<Accordion type={schema.type || 'single'} collapsible={schema.collapsible} className={className} {...props}>
13+
<Accordion type={schema.accordionType || 'single'} collapsible={schema.collapsible} className={className} {...props}>
1414
{schema.items?.map((item, index: number) => (
1515
<AccordionItem key={item.value || index} value={item.value || `item-${index}`}>
1616
<AccordionTrigger>{item.title}</AccordionTrigger>

packages/components/src/renderers/form/calendar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ComponentRegistry.register('calendar',
88
mode={schema.mode || "single"}
99
selected={schema.value || schema.defaultValue}
1010
className={className}
11-
{...props as any}
11+
{...props}
1212
/>
1313
),
1414
{

packages/components/src/renderers/form/toggle.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ComponentRegistry.register('toggle',
1212
aria-label={schema.ariaLabel}
1313
{...props}
1414
>
15-
{schema.label || renderChildren(schema.body || schema.children)}
15+
{schema.label || renderChildren(schema.children)}
1616
</Toggle>
1717
),
1818
{

packages/components/src/renderers/navigation/sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ ComponentRegistry.register('sidebar-provider',
3737
);
3838

3939
ComponentRegistry.register('sidebar',
40-
({ schema, ...props }) => (
40+
({ schema, ...props }: { schema: SidebarSchema; [key: string]: any }) => (
4141
<Sidebar {...props}>{renderChildren(schema.body)}</Sidebar>
4242
),
4343
{

packages/components/src/renderers/overlay/context-menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const renderContextMenuItems = (items: any[]) => {
4343
};
4444

4545
ComponentRegistry.register('context-menu',
46-
({ schema, className, ...props }) => (
46+
({ schema, className, ...props }: { schema: ContextMenuSchema; className?: string; [key: string]: any }) => (
4747
<ContextMenu modal={schema.modal} {...props}>
4848
<ContextMenuTrigger asChild>
4949
{/* Usually a Right Click area */}

packages/components/src/renderers/overlay/dropdown-menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const renderMenuItems = (items: any[]) => {
4444
};
4545

4646
ComponentRegistry.register('dropdown-menu',
47-
({ schema, className, ...props }) => (
47+
({ schema, className, ...props }: { schema: DropdownMenuSchema; className?: string; [key: string]: any }) => (
4848
<DropdownMenu modal={schema.modal} defaultOpen={schema.defaultOpen} {...props}>
4949
<DropdownMenuTrigger asChild>
5050
{renderChildren(schema.trigger)}

0 commit comments

Comments
 (0)