Skip to content

Commit 7c96bbe

Browse files
committed
Enhance App component with advanced grid features and update Contact type definition
1 parent 39f4f8b commit 7c96bbe

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

examples/msw-object-form/src/App.tsx

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,19 +144,42 @@ export function App() {
144144
schema={{
145145
type: 'object-grid',
146146
objectName: 'contact',
147-
filters: [],
147+
// Enable comprehensive features
148+
filterable: true,
148149
searchableFields: ['name', 'email', 'company'],
150+
sortable: true,
151+
resizable: true,
152+
pagination: {
153+
pageSize: 10
154+
},
155+
selection: {
156+
type: 'multiple'
157+
},
149158
columns: [
150-
{ field: 'name', label: 'Name', width: 200 },
159+
{ field: 'name', label: 'Name', width: 200, fixed: 'left' },
151160
{ field: 'email', label: 'Email', width: 220 },
152161
{ field: 'phone', label: 'Phone', width: 150 },
153162
{ field: 'company', label: 'Company', width: 180 },
154-
{ field: 'role', label: 'Role', width: 150 },
155-
{ field: 'status', label: 'Status' }
163+
{ field: 'position', label: 'Position', width: 150 },
164+
{ field: 'department', label: 'Department', width: 150 },
165+
{ field: 'priority', label: 'Priority', width: 100 },
166+
{ field: 'salary', label: 'Salary', width: 120 },
167+
{ field: 'commission_rate', label: 'Commission', width: 120 },
168+
{ field: 'birthdate', label: 'Birthdate', width: 120 },
169+
{ field: 'is_active', label: 'Active', width: 100 },
170+
{ field: 'last_contacted', label: 'Last Contacted', width: 180 },
171+
{ field: 'profile_url', label: 'LinkedIn', width: 200 },
156172
]
157173
}}
158174
dataSource={dataSource}
159175
onEdit={handleEdit}
176+
onRowSelect={(selected) => console.log('Selected rows:', selected)}
177+
onDelete={async (record) => {
178+
if (confirm(`Are you sure you want to delete ${record.name}?`)) {
179+
await dataSource?.delete('contact', record.id);
180+
setRefreshKey(k => k + 1);
181+
}
182+
}}
160183
className="h-full w-full"
161184
/>
162185
</div>

examples/msw-object-form/src/types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,14 @@ export interface Contact {
1212
notes?: string;
1313
is_active: boolean;
1414
priority: number;
15+
salary?: number;
16+
commission_rate?: number;
17+
birthdate?: string;
18+
last_contacted?: string;
19+
available_time?: string;
20+
profile_url?: string;
21+
department?: string;
22+
resume?: any;
23+
avatar?: any;
1524
created_at?: string;
1625
}

0 commit comments

Comments
 (0)