@idealyst/mcp-server 1.2.124 → 1.2.125
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/dist/{chunk-EALTHXKT.js → chunk-PLKNERFG.js} +14 -5
- package/dist/chunk-PLKNERFG.js.map +1 -0
- package/dist/index.cjs +13 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/tools/index.cjs +13 -4
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +1 -1
- package/examples/components/Table.examples.tsx +236 -0
- package/package.json +5 -5
- package/dist/chunk-EALTHXKT.js.map +0 -1
package/dist/tools/index.js
CHANGED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual TableProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Table, View, Text, Badge, Icon, type TableColumn } from '@idealyst/components';
|
|
10
|
+
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// Example 1: Basic Table
|
|
13
|
+
// ============================================================================
|
|
14
|
+
|
|
15
|
+
interface User {
|
|
16
|
+
name: string;
|
|
17
|
+
role: string;
|
|
18
|
+
status: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const users: User[] = [
|
|
22
|
+
{ name: 'Alice', role: 'Admin', status: 'Active' },
|
|
23
|
+
{ name: 'Bob', role: 'Editor', status: 'Inactive' },
|
|
24
|
+
{ name: 'Carol', role: 'Viewer', status: 'Active' },
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
export function BasicTable() {
|
|
28
|
+
const columns: TableColumn<User>[] = [
|
|
29
|
+
{ key: 'name', title: 'Name', dataIndex: 'name' },
|
|
30
|
+
{ key: 'role', title: 'Role', dataIndex: 'role' },
|
|
31
|
+
{ key: 'status', title: 'Status', dataIndex: 'status' },
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
return <Table columns={columns} data={users} />;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ============================================================================
|
|
38
|
+
// Example 2: Custom Cell Rendering
|
|
39
|
+
// ============================================================================
|
|
40
|
+
|
|
41
|
+
export function CustomCellRendering() {
|
|
42
|
+
const columns: TableColumn<User>[] = [
|
|
43
|
+
{ key: 'name', title: 'Name', dataIndex: 'name' },
|
|
44
|
+
{ key: 'role', title: 'Role', dataIndex: 'role' },
|
|
45
|
+
{
|
|
46
|
+
key: 'status',
|
|
47
|
+
title: 'Status',
|
|
48
|
+
dataIndex: 'status',
|
|
49
|
+
render: (value: string) => (
|
|
50
|
+
<Badge intent={value === 'Active' ? 'success' : 'danger'}>
|
|
51
|
+
{value}
|
|
52
|
+
</Badge>
|
|
53
|
+
),
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
return <Table columns={columns} data={users} />;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// ============================================================================
|
|
61
|
+
// Example 3: Custom Column Titles (ReactNode)
|
|
62
|
+
// ============================================================================
|
|
63
|
+
|
|
64
|
+
export function CustomColumnTitles() {
|
|
65
|
+
const columns: TableColumn<User>[] = [
|
|
66
|
+
{
|
|
67
|
+
key: 'name',
|
|
68
|
+
title: (
|
|
69
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 4 }}>
|
|
70
|
+
<Icon name="account" size="sm" />
|
|
71
|
+
<Text weight="semibold">Name</Text>
|
|
72
|
+
</View>
|
|
73
|
+
),
|
|
74
|
+
dataIndex: 'name',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
key: 'role',
|
|
78
|
+
title: (
|
|
79
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 4 }}>
|
|
80
|
+
<Icon name="shield" size="sm" />
|
|
81
|
+
<Text weight="semibold">Role</Text>
|
|
82
|
+
</View>
|
|
83
|
+
),
|
|
84
|
+
dataIndex: 'role',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
key: 'status',
|
|
88
|
+
title: (
|
|
89
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 4 }}>
|
|
90
|
+
<Icon name="circle" size="sm" />
|
|
91
|
+
<Text weight="semibold">Status</Text>
|
|
92
|
+
</View>
|
|
93
|
+
),
|
|
94
|
+
dataIndex: 'status',
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
return <Table columns={columns} data={users} />;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ============================================================================
|
|
102
|
+
// Example 4: Footer with Static Content
|
|
103
|
+
// ============================================================================
|
|
104
|
+
|
|
105
|
+
interface Product {
|
|
106
|
+
name: string;
|
|
107
|
+
quantity: number;
|
|
108
|
+
price: number;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const products: Product[] = [
|
|
112
|
+
{ name: 'Widget A', quantity: 10, price: 29.99 },
|
|
113
|
+
{ name: 'Widget B', quantity: 5, price: 49.99 },
|
|
114
|
+
{ name: 'Widget C', quantity: 20, price: 9.99 },
|
|
115
|
+
];
|
|
116
|
+
|
|
117
|
+
export function FooterStatic() {
|
|
118
|
+
const columns: TableColumn<Product>[] = [
|
|
119
|
+
{ key: 'name', title: 'Product', dataIndex: 'name', footer: 'Total' },
|
|
120
|
+
{
|
|
121
|
+
key: 'quantity',
|
|
122
|
+
title: 'Qty',
|
|
123
|
+
dataIndex: 'quantity',
|
|
124
|
+
align: 'right',
|
|
125
|
+
footer: (data) => {
|
|
126
|
+
const total = data.reduce((sum, row) => sum + row.quantity, 0);
|
|
127
|
+
return <Text weight="bold">{String(total)}</Text>;
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
key: 'price',
|
|
132
|
+
title: 'Price',
|
|
133
|
+
dataIndex: 'price',
|
|
134
|
+
align: 'right',
|
|
135
|
+
render: (value: number) => `$${value.toFixed(2)}`,
|
|
136
|
+
footer: (data) => {
|
|
137
|
+
const total = data.reduce((sum, row) => sum + row.price * row.quantity, 0);
|
|
138
|
+
return <Text weight="bold">${total.toFixed(2)}</Text>;
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
];
|
|
142
|
+
|
|
143
|
+
return <Table columns={columns} data={products} type="bordered" />;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// ============================================================================
|
|
147
|
+
// Example 5: Footer with Computed Callback
|
|
148
|
+
// ============================================================================
|
|
149
|
+
|
|
150
|
+
export function FooterComputed() {
|
|
151
|
+
const columns: TableColumn<Product>[] = [
|
|
152
|
+
{ key: 'name', title: 'Item', dataIndex: 'name', footer: `${products.length} items` },
|
|
153
|
+
{
|
|
154
|
+
key: 'quantity',
|
|
155
|
+
title: 'Stock',
|
|
156
|
+
dataIndex: 'quantity',
|
|
157
|
+
align: 'right',
|
|
158
|
+
footer: (data) => {
|
|
159
|
+
const avg = data.reduce((sum, r) => sum + r.quantity, 0) / data.length;
|
|
160
|
+
return `Avg: ${avg.toFixed(1)}`;
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
key: 'price',
|
|
165
|
+
title: 'Unit Price',
|
|
166
|
+
dataIndex: 'price',
|
|
167
|
+
align: 'right',
|
|
168
|
+
render: (value: number) => `$${value.toFixed(2)}`,
|
|
169
|
+
footer: (data) => {
|
|
170
|
+
const avg = data.reduce((sum, r) => sum + r.price, 0) / data.length;
|
|
171
|
+
return `Avg: $${avg.toFixed(2)}`;
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
];
|
|
175
|
+
|
|
176
|
+
return <Table columns={columns} data={products} type="striped" />;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// ============================================================================
|
|
180
|
+
// Example 6: Table Variants
|
|
181
|
+
// ============================================================================
|
|
182
|
+
|
|
183
|
+
export function TableVariants() {
|
|
184
|
+
const columns: TableColumn<User>[] = [
|
|
185
|
+
{ key: 'name', title: 'Name', dataIndex: 'name' },
|
|
186
|
+
{ key: 'role', title: 'Role', dataIndex: 'role' },
|
|
187
|
+
];
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<View gap="lg">
|
|
191
|
+
<Table columns={columns} data={users} type="standard" />
|
|
192
|
+
<Table columns={columns} data={users} type="bordered" />
|
|
193
|
+
<Table columns={columns} data={users} type="striped" />
|
|
194
|
+
</View>
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// ============================================================================
|
|
199
|
+
// Example 7: Clickable Rows
|
|
200
|
+
// ============================================================================
|
|
201
|
+
|
|
202
|
+
export function ClickableRows() {
|
|
203
|
+
const columns: TableColumn<User>[] = [
|
|
204
|
+
{ key: 'name', title: 'Name', dataIndex: 'name' },
|
|
205
|
+
{ key: 'role', title: 'Role', dataIndex: 'role' },
|
|
206
|
+
{ key: 'status', title: 'Status', dataIndex: 'status' },
|
|
207
|
+
];
|
|
208
|
+
|
|
209
|
+
return (
|
|
210
|
+
<Table
|
|
211
|
+
columns={columns}
|
|
212
|
+
data={users}
|
|
213
|
+
onRowPress={(row, index) => console.log('Pressed row', index, row)}
|
|
214
|
+
/>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// ============================================================================
|
|
219
|
+
// Example 8: Column Alignment
|
|
220
|
+
// ============================================================================
|
|
221
|
+
|
|
222
|
+
export function ColumnAlignment() {
|
|
223
|
+
const columns: TableColumn<Product>[] = [
|
|
224
|
+
{ key: 'name', title: 'Product', dataIndex: 'name', align: 'left' },
|
|
225
|
+
{ key: 'quantity', title: 'Qty', dataIndex: 'quantity', align: 'center' },
|
|
226
|
+
{
|
|
227
|
+
key: 'price',
|
|
228
|
+
title: 'Price',
|
|
229
|
+
dataIndex: 'price',
|
|
230
|
+
align: 'right',
|
|
231
|
+
render: (value: number) => `$${value.toFixed(2)}`,
|
|
232
|
+
},
|
|
233
|
+
];
|
|
234
|
+
|
|
235
|
+
return <Table columns={columns} data={products} type="bordered" />;
|
|
236
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idealyst/mcp-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.125",
|
|
4
4
|
"description": "MCP server providing documentation and examples for the Idealyst framework",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
"author": "Idealyst",
|
|
56
56
|
"license": "MIT",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@idealyst/components": "^1.2.
|
|
59
|
-
"@idealyst/navigation": "^1.2.
|
|
60
|
-
"@idealyst/theme": "^1.2.
|
|
58
|
+
"@idealyst/components": "^1.2.125",
|
|
59
|
+
"@idealyst/navigation": "^1.2.125",
|
|
60
|
+
"@idealyst/theme": "^1.2.125",
|
|
61
61
|
"@modelcontextprotocol/sdk": "^1.0.4"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@idealyst/tooling": "^1.2.
|
|
64
|
+
"@idealyst/tooling": "^1.2.125",
|
|
65
65
|
"@types/better-sqlite3": "^7.6.12",
|
|
66
66
|
"@types/node": "^20.0.0",
|
|
67
67
|
"@types/react": "^19.1.0",
|