@object-ui/components 0.5.0 → 3.0.0
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/.turbo/turbo-build.log +12 -25
- package/CHANGELOG.md +32 -0
- package/dist/index.css +1 -1
- package/dist/index.js +23987 -22576
- package/dist/index.umd.cjs +30 -30
- package/dist/src/custom/action-param-dialog.d.ts +21 -0
- package/dist/src/custom/index.d.ts +4 -0
- package/dist/src/custom/navigation-overlay.d.ts +50 -0
- package/dist/src/custom/view-skeleton.d.ts +37 -0
- package/dist/src/custom/view-states.d.ts +33 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/renderers/action/action-button.d.ts +11 -0
- package/dist/src/renderers/action/action-group.d.ts +25 -0
- package/dist/src/renderers/action/action-icon.d.ts +10 -0
- package/dist/src/renderers/action/action-menu.d.ts +19 -0
- package/dist/src/renderers/action/index.d.ts +0 -0
- package/dist/src/renderers/action/resolve-icon.d.ts +6 -0
- package/package.json +20 -19
- package/src/__tests__/PageRendererRegions.test.tsx +664 -55
- package/src/__tests__/__snapshots__/snapshot-critical.test.tsx.snap +811 -0
- package/src/__tests__/__snapshots__/snapshot.test.tsx.snap +327 -0
- package/src/__tests__/accessibility.test.tsx +137 -0
- package/src/__tests__/api-consistency.test.tsx +596 -0
- package/src/__tests__/color-contrast.test.tsx +212 -0
- package/src/__tests__/compliance.test.tsx +72 -0
- package/src/__tests__/edge-cases.test.tsx +285 -0
- package/src/__tests__/navigation-overlay.test.tsx +273 -0
- package/src/__tests__/snapshot-critical.test.tsx +317 -0
- package/src/__tests__/snapshot.test.tsx +205 -0
- package/src/__tests__/view-compliance.test.tsx +153 -0
- package/src/__tests__/wcag-audit.test.tsx +493 -0
- package/src/custom/action-param-dialog.tsx +264 -0
- package/src/custom/index.ts +4 -0
- package/src/custom/navigation-overlay.tsx +296 -0
- package/src/custom/view-skeleton.tsx +243 -0
- package/src/custom/view-states.tsx +153 -0
- package/src/index.ts +1 -0
- package/src/renderers/action/action-button.tsx +147 -0
- package/src/renderers/action/action-group.tsx +270 -0
- package/src/renderers/action/action-icon.tsx +150 -0
- package/src/renderers/action/action-menu.tsx +203 -0
- package/src/renderers/action/index.ts +18 -0
- package/src/renderers/action/resolve-icon.ts +35 -0
- package/src/renderers/complex/__tests__/data-table-batch-editing.test.tsx +275 -0
- package/src/renderers/complex/__tests__/data-table-cell-renderer.test.tsx +120 -0
- package/src/renderers/complex/__tests__/data-table-editing.test.tsx +221 -0
- package/src/renderers/complex/data-table.tsx +269 -33
- package/src/renderers/complex/resizable.tsx +20 -17
- package/src/renderers/data-display/list.tsx +1 -1
- package/src/renderers/data-display/table.tsx +1 -1
- package/src/renderers/data-display/tree-view.tsx +2 -1
- package/src/renderers/form/form.tsx +33 -10
- package/src/renderers/index.ts +1 -0
- package/src/renderers/layout/aspect-ratio.tsx +1 -1
- package/src/renderers/layout/page.tsx +416 -52
- package/src/renderers/navigation/sidebar.tsx +6 -0
- package/src/renderers/placeholders.tsx +2 -2
- package/src/stories/MockedData.stories.tsx +87 -37
- package/src/stories-json/Accessibility.mdx +297 -0
- package/src/stories-json/EdgeCases.stories.tsx +160 -0
- package/src/stories-json/GettingStarted.mdx +89 -0
- package/src/stories-json/Introduction.mdx +127 -0
- package/src/stories-json/accordion.stories.tsx +1 -1
- package/src/stories-json/aggrid.stories.tsx +1 -1
- package/src/stories-json/alert.stories.tsx +1 -1
- package/src/stories-json/aspect-ratio.stories.tsx +1 -1
- package/src/stories-json/avatar.stories.tsx +1 -1
- package/src/stories-json/badge.stories.tsx +1 -1
- package/src/stories-json/breadcrumb.stories.tsx +1 -1
- package/src/stories-json/button-group.stories.tsx +1 -1
- package/src/stories-json/button.stories.tsx +1 -1
- package/src/stories-json/calendar.stories.tsx +1 -1
- package/src/stories-json/card.stories.tsx +1 -1
- package/src/stories-json/carousel.stories.tsx +1 -1
- package/src/stories-json/charts.stories.tsx +1 -1
- package/src/stories-json/chatbot.stories.tsx +1 -1
- package/src/stories-json/code-editor.stories.tsx +1 -1
- package/src/stories-json/collapsible.stories.tsx +1 -1
- package/src/stories-json/controls.stories.tsx +1 -1
- package/src/stories-json/crm-live-data.stories.tsx +154 -0
- package/src/stories-json/data-table.stories.tsx +80 -4
- package/src/stories-json/data_display_extras.stories.tsx +1 -1
- package/src/stories-json/date-picker.stories.tsx +1 -1
- package/src/stories-json/detail-view.stories.tsx +1 -1
- package/src/stories-json/dialog.stories.tsx +1 -1
- package/src/stories-json/feedback_extras.stories.tsx +1 -1
- package/src/stories-json/feedback_others.stories.tsx +1 -1
- package/src/stories-json/form-variants.stories.tsx +210 -0
- package/src/stories-json/form_advanced.stories.tsx +1 -1
- package/src/stories-json/form_extras.stories.tsx +1 -1
- package/src/stories-json/grid.stories.tsx +1 -1
- package/src/stories-json/icon.stories.tsx +1 -1
- package/src/stories-json/input.stories.tsx +1 -1
- package/src/stories-json/kanban.stories.tsx +1 -1
- package/src/stories-json/layout_extended.stories.tsx +1 -1
- package/src/stories-json/layout_flex.stories.tsx +1 -1
- package/src/stories-json/list-view.stories.tsx +1 -1
- package/src/stories-json/markdown.stories.tsx +1 -1
- package/src/stories-json/menus.stories.tsx +1 -1
- package/src/stories-json/metric-card.stories.tsx +1 -1
- package/src/stories-json/navigation-menu.stories.tsx +1 -1
- package/src/stories-json/object-aggrid-advanced.stories.tsx +389 -0
- package/src/stories-json/object-aggrid.stories.tsx +1 -1
- package/src/stories-json/object-form.stories.tsx +1 -1
- package/src/stories-json/object-gantt.stories.tsx +1 -1
- package/src/stories-json/object-grid.stories.tsx +159 -1
- package/src/stories-json/object-map.stories.tsx +1 -1
- package/src/stories-json/object-view.stories.tsx +1 -1
- package/src/stories-json/overlay_extras.stories.tsx +1 -1
- package/src/stories-json/overlay_others.stories.tsx +1 -1
- package/src/stories-json/resizable.stories.tsx +1 -1
- package/src/stories-json/select.stories.tsx +1 -1
- package/src/stories-json/separator.stories.tsx +1 -1
- package/src/stories-json/statistic.stories.tsx +1 -1
- package/src/stories-json/tabs.stories.tsx +1 -1
- package/src/stories-json/timeline.stories.tsx +1 -1
- package/src/stories-json/typography.stories.tsx +1 -1
- package/src/ui/slider.tsx +6 -2
- package/src/stories/Introduction.mdx +0 -34
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SchemaRenderer } from '../SchemaRenderer';
|
|
3
|
+
import type { BaseSchema } from '@object-ui/types';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Plugins/Data Views/Object AgGrid Advanced',
|
|
7
|
+
component: SchemaRenderer,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'padded',
|
|
10
|
+
},
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
argTypes: {
|
|
13
|
+
schema: { table: { disable: true } },
|
|
14
|
+
},
|
|
15
|
+
} satisfies Meta<any>;
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryObj<typeof meta>;
|
|
19
|
+
|
|
20
|
+
const renderStory = (args: any) => <SchemaRenderer schema={args as unknown as BaseSchema} />;
|
|
21
|
+
|
|
22
|
+
// Mock data source for demonstration
|
|
23
|
+
const createMockDataSource = (objectName: string, data: any[]) => {
|
|
24
|
+
const mockSchema = {
|
|
25
|
+
name: objectName,
|
|
26
|
+
label: objectName.charAt(0).toUpperCase() + objectName.slice(1),
|
|
27
|
+
fields: {} as any
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Infer fields from data
|
|
31
|
+
if (data.length > 0) {
|
|
32
|
+
const firstRow = data[0];
|
|
33
|
+
Object.keys(firstRow).forEach(key => {
|
|
34
|
+
let type = 'text';
|
|
35
|
+
const value = firstRow[key];
|
|
36
|
+
|
|
37
|
+
if (typeof value === 'number') type = 'number';
|
|
38
|
+
else if (typeof value === 'boolean') type = 'boolean';
|
|
39
|
+
else if (key.includes('email')) type = 'email';
|
|
40
|
+
else if (key.includes('phone')) type = 'phone';
|
|
41
|
+
else if (key.includes('url') || key.includes('website')) type = 'url';
|
|
42
|
+
else if (key.includes('date')) type = 'date';
|
|
43
|
+
else if (key.includes('price') || key.includes('cost') || key.includes('amount') || key.includes('salary')) type = 'currency';
|
|
44
|
+
else if (key.includes('percent') || key.includes('rate')) type = 'percent';
|
|
45
|
+
|
|
46
|
+
mockSchema.fields[key] = {
|
|
47
|
+
name: key,
|
|
48
|
+
label: key.charAt(0).toUpperCase() + key.slice(1).replace(/_/g, ' '),
|
|
49
|
+
type,
|
|
50
|
+
sortable: true,
|
|
51
|
+
filterable: true,
|
|
52
|
+
editable: key !== 'id' // All fields except ID are editable
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
find: async () => ({
|
|
59
|
+
data,
|
|
60
|
+
total: data.length,
|
|
61
|
+
page: 1,
|
|
62
|
+
pageSize: data.length,
|
|
63
|
+
hasMore: false
|
|
64
|
+
}),
|
|
65
|
+
getObjectSchema: async () => mockSchema
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// Sample data for advanced examples
|
|
70
|
+
const employeesData = [
|
|
71
|
+
{
|
|
72
|
+
id: '1',
|
|
73
|
+
name: 'Alice Johnson',
|
|
74
|
+
email: 'alice.j@company.com',
|
|
75
|
+
department: 'Engineering',
|
|
76
|
+
position: 'Senior Developer',
|
|
77
|
+
salary: 95000,
|
|
78
|
+
start_date: '2020-01-15',
|
|
79
|
+
status: 'Active'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: '2',
|
|
83
|
+
name: 'Bob Smith',
|
|
84
|
+
email: 'bob.s@company.com',
|
|
85
|
+
department: 'Marketing',
|
|
86
|
+
position: 'Marketing Manager',
|
|
87
|
+
salary: 72000,
|
|
88
|
+
start_date: '2021-03-20',
|
|
89
|
+
status: 'Active'
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: '3',
|
|
93
|
+
name: 'Carol Davis',
|
|
94
|
+
email: 'carol.d@company.com',
|
|
95
|
+
department: 'Sales',
|
|
96
|
+
position: 'Sales Representative',
|
|
97
|
+
salary: 68000,
|
|
98
|
+
start_date: '2021-06-10',
|
|
99
|
+
status: 'Active'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: '4',
|
|
103
|
+
name: 'David Wilson',
|
|
104
|
+
email: 'david.w@company.com',
|
|
105
|
+
department: 'Engineering',
|
|
106
|
+
position: 'Lead Engineer',
|
|
107
|
+
salary: 102000,
|
|
108
|
+
start_date: '2019-08-01',
|
|
109
|
+
status: 'Active'
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: '5',
|
|
113
|
+
name: 'Eve Brown',
|
|
114
|
+
email: 'eve.b@company.com',
|
|
115
|
+
department: 'HR',
|
|
116
|
+
position: 'HR Specialist',
|
|
117
|
+
salary: 65000,
|
|
118
|
+
start_date: '2022-02-14',
|
|
119
|
+
status: 'On Leave'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: '6',
|
|
123
|
+
name: 'Frank Miller',
|
|
124
|
+
email: 'frank.m@company.com',
|
|
125
|
+
department: 'Engineering',
|
|
126
|
+
position: 'Software Engineer',
|
|
127
|
+
salary: 88000,
|
|
128
|
+
start_date: '2021-11-03',
|
|
129
|
+
status: 'Active'
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: '7',
|
|
133
|
+
name: 'Grace Lee',
|
|
134
|
+
email: 'grace.l@company.com',
|
|
135
|
+
department: 'Marketing',
|
|
136
|
+
position: 'Content Writer',
|
|
137
|
+
salary: 58000,
|
|
138
|
+
start_date: '2022-05-22',
|
|
139
|
+
status: 'Active'
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
id: '8',
|
|
143
|
+
name: 'Henry Clark',
|
|
144
|
+
email: 'henry.c@company.com',
|
|
145
|
+
department: 'Sales',
|
|
146
|
+
position: 'Sales Manager',
|
|
147
|
+
salary: 85000,
|
|
148
|
+
start_date: '2020-09-15',
|
|
149
|
+
status: 'Active'
|
|
150
|
+
},
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
const ordersData = [
|
|
154
|
+
{
|
|
155
|
+
id: 'ORD-001',
|
|
156
|
+
customer: 'Acme Corp',
|
|
157
|
+
product: 'Enterprise License',
|
|
158
|
+
quantity: 10,
|
|
159
|
+
amount: 15750,
|
|
160
|
+
date: '2024-01-15',
|
|
161
|
+
status: 'Delivered'
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: 'ORD-002',
|
|
165
|
+
customer: 'TechStart Inc',
|
|
166
|
+
product: 'Professional Plan',
|
|
167
|
+
quantity: 5,
|
|
168
|
+
amount: 8500,
|
|
169
|
+
date: '2024-01-18',
|
|
170
|
+
status: 'Shipped'
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
id: 'ORD-003',
|
|
174
|
+
customer: 'Global Solutions',
|
|
175
|
+
product: 'Enterprise License',
|
|
176
|
+
quantity: 15,
|
|
177
|
+
amount: 22300,
|
|
178
|
+
date: '2024-01-20',
|
|
179
|
+
status: 'Processing'
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
id: 'ORD-004',
|
|
183
|
+
customer: 'Innovation Labs',
|
|
184
|
+
product: 'Professional Plan',
|
|
185
|
+
quantity: 8,
|
|
186
|
+
amount: 12100,
|
|
187
|
+
date: '2024-01-22',
|
|
188
|
+
status: 'Delivered'
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
id: 'ORD-005',
|
|
192
|
+
customer: 'Future Systems',
|
|
193
|
+
product: 'Starter Plan',
|
|
194
|
+
quantity: 20,
|
|
195
|
+
amount: 9800,
|
|
196
|
+
date: '2024-01-25',
|
|
197
|
+
status: 'Shipped'
|
|
198
|
+
},
|
|
199
|
+
];
|
|
200
|
+
|
|
201
|
+
// Advanced Stories
|
|
202
|
+
|
|
203
|
+
export const WithStatusBarAndAggregations: Story = {
|
|
204
|
+
render: renderStory,
|
|
205
|
+
name: 'Status Bar & Aggregations',
|
|
206
|
+
args: {
|
|
207
|
+
type: 'object-aggrid',
|
|
208
|
+
objectName: 'employees',
|
|
209
|
+
dataSource: createMockDataSource('employees', employeesData),
|
|
210
|
+
pagination: true,
|
|
211
|
+
pageSize: 10,
|
|
212
|
+
theme: 'quartz',
|
|
213
|
+
height: 550,
|
|
214
|
+
rowSelection: 'multiple',
|
|
215
|
+
statusBar: {
|
|
216
|
+
enabled: true,
|
|
217
|
+
aggregations: ['count', 'sum', 'avg', 'min', 'max']
|
|
218
|
+
},
|
|
219
|
+
columnConfig: {
|
|
220
|
+
resizable: true,
|
|
221
|
+
sortable: true,
|
|
222
|
+
filterable: true
|
|
223
|
+
}
|
|
224
|
+
} as any,
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export const WithContextMenu: Story = {
|
|
228
|
+
render: renderStory,
|
|
229
|
+
name: 'Context Menu',
|
|
230
|
+
args: {
|
|
231
|
+
type: 'object-aggrid',
|
|
232
|
+
objectName: 'employees',
|
|
233
|
+
dataSource: createMockDataSource('employees', employeesData),
|
|
234
|
+
pagination: true,
|
|
235
|
+
pageSize: 10,
|
|
236
|
+
theme: 'quartz',
|
|
237
|
+
height: 500,
|
|
238
|
+
contextMenu: {
|
|
239
|
+
enabled: true,
|
|
240
|
+
items: ['copy', 'copyWithHeaders', 'separator', 'export', 'autoSizeAll']
|
|
241
|
+
},
|
|
242
|
+
columnConfig: {
|
|
243
|
+
resizable: true,
|
|
244
|
+
sortable: true,
|
|
245
|
+
filterable: true
|
|
246
|
+
}
|
|
247
|
+
} as any,
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
export const InlineEditingWithSelection: Story = {
|
|
251
|
+
render: renderStory,
|
|
252
|
+
name: 'Inline Editing + Row Selection',
|
|
253
|
+
args: {
|
|
254
|
+
type: 'object-aggrid',
|
|
255
|
+
objectName: 'orders',
|
|
256
|
+
dataSource: createMockDataSource('orders', ordersData),
|
|
257
|
+
editable: true,
|
|
258
|
+
singleClickEdit: true,
|
|
259
|
+
pagination: true,
|
|
260
|
+
pageSize: 10,
|
|
261
|
+
theme: 'alpine',
|
|
262
|
+
height: 500,
|
|
263
|
+
rowSelection: 'multiple',
|
|
264
|
+
columnConfig: {
|
|
265
|
+
resizable: true,
|
|
266
|
+
sortable: true,
|
|
267
|
+
filterable: true
|
|
268
|
+
}
|
|
269
|
+
} as any,
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export const FullFeatured: Story = {
|
|
273
|
+
render: renderStory,
|
|
274
|
+
name: 'Full Featured (All Options)',
|
|
275
|
+
args: {
|
|
276
|
+
type: 'object-aggrid',
|
|
277
|
+
objectName: 'employees',
|
|
278
|
+
dataSource: createMockDataSource('employees', employeesData),
|
|
279
|
+
editable: true,
|
|
280
|
+
singleClickEdit: false,
|
|
281
|
+
pagination: true,
|
|
282
|
+
pageSize: 5,
|
|
283
|
+
theme: 'quartz',
|
|
284
|
+
height: 600,
|
|
285
|
+
rowSelection: 'multiple',
|
|
286
|
+
animateRows: true,
|
|
287
|
+
enableRangeSelection: true,
|
|
288
|
+
exportConfig: {
|
|
289
|
+
enabled: true,
|
|
290
|
+
fileName: 'employees.csv'
|
|
291
|
+
},
|
|
292
|
+
statusBar: {
|
|
293
|
+
enabled: true,
|
|
294
|
+
aggregations: ['count', 'sum', 'avg']
|
|
295
|
+
},
|
|
296
|
+
contextMenu: {
|
|
297
|
+
enabled: true,
|
|
298
|
+
items: ['copy', 'copyWithHeaders', 'separator', 'export', 'autoSizeAll']
|
|
299
|
+
},
|
|
300
|
+
columnConfig: {
|
|
301
|
+
resizable: true,
|
|
302
|
+
sortable: true,
|
|
303
|
+
filterable: true
|
|
304
|
+
}
|
|
305
|
+
} as any,
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
export const AlpineThemeFullFeatured: Story = {
|
|
309
|
+
render: renderStory,
|
|
310
|
+
name: 'Alpine Theme (Full Featured)',
|
|
311
|
+
args: {
|
|
312
|
+
type: 'object-aggrid',
|
|
313
|
+
objectName: 'orders',
|
|
314
|
+
dataSource: createMockDataSource('orders', ordersData),
|
|
315
|
+
editable: true,
|
|
316
|
+
singleClickEdit: true,
|
|
317
|
+
pagination: true,
|
|
318
|
+
pageSize: 5,
|
|
319
|
+
theme: 'alpine',
|
|
320
|
+
height: 550,
|
|
321
|
+
rowSelection: 'multiple',
|
|
322
|
+
exportConfig: {
|
|
323
|
+
enabled: true,
|
|
324
|
+
fileName: 'orders.csv'
|
|
325
|
+
},
|
|
326
|
+
statusBar: {
|
|
327
|
+
enabled: true,
|
|
328
|
+
aggregations: ['count', 'sum']
|
|
329
|
+
},
|
|
330
|
+
contextMenu: {
|
|
331
|
+
enabled: true,
|
|
332
|
+
items: ['copy', 'export', 'autoSizeAll']
|
|
333
|
+
},
|
|
334
|
+
columnConfig: {
|
|
335
|
+
resizable: true,
|
|
336
|
+
sortable: true,
|
|
337
|
+
filterable: true
|
|
338
|
+
}
|
|
339
|
+
} as any,
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
export const BalhamThemeWithExport: Story = {
|
|
343
|
+
render: renderStory,
|
|
344
|
+
name: 'Balham Theme + Export',
|
|
345
|
+
args: {
|
|
346
|
+
type: 'object-aggrid',
|
|
347
|
+
objectName: 'employees',
|
|
348
|
+
dataSource: createMockDataSource('employees', employeesData),
|
|
349
|
+
pagination: true,
|
|
350
|
+
pageSize: 10,
|
|
351
|
+
theme: 'balham',
|
|
352
|
+
height: 500,
|
|
353
|
+
rowSelection: 'multiple',
|
|
354
|
+
exportConfig: {
|
|
355
|
+
enabled: true,
|
|
356
|
+
fileName: 'employees-balham.csv',
|
|
357
|
+
onlySelected: true
|
|
358
|
+
},
|
|
359
|
+
columnConfig: {
|
|
360
|
+
resizable: true,
|
|
361
|
+
sortable: true,
|
|
362
|
+
filterable: true
|
|
363
|
+
}
|
|
364
|
+
} as any,
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
export const MaterialThemeWithStatusBar: Story = {
|
|
368
|
+
render: renderStory,
|
|
369
|
+
name: 'Material Theme + Status Bar',
|
|
370
|
+
args: {
|
|
371
|
+
type: 'object-aggrid',
|
|
372
|
+
objectName: 'orders',
|
|
373
|
+
dataSource: createMockDataSource('orders', ordersData),
|
|
374
|
+
pagination: true,
|
|
375
|
+
pageSize: 10,
|
|
376
|
+
theme: 'material',
|
|
377
|
+
height: 550,
|
|
378
|
+
rowSelection: 'multiple',
|
|
379
|
+
statusBar: {
|
|
380
|
+
enabled: true,
|
|
381
|
+
aggregations: ['count', 'sum', 'avg']
|
|
382
|
+
},
|
|
383
|
+
columnConfig: {
|
|
384
|
+
resizable: true,
|
|
385
|
+
sortable: true,
|
|
386
|
+
filterable: true
|
|
387
|
+
}
|
|
388
|
+
} as any,
|
|
389
|
+
};
|
|
@@ -4,7 +4,7 @@ import type { BaseSchema } from '@object-ui/types';
|
|
|
4
4
|
import { ObjectStackAdapter } from '@object-ui/data-objectstack';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Views/Object
|
|
7
|
+
title: 'Plugins/Data Views/Object AgGrid',
|
|
8
8
|
component: SchemaRenderer,
|
|
9
9
|
parameters: {
|
|
10
10
|
layout: 'padded',
|
|
@@ -4,7 +4,7 @@ import type { BaseSchema } from '@object-ui/types';
|
|
|
4
4
|
import { createStorybookDataSource } from '@storybook-config/datasource';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: '
|
|
7
|
+
title: 'Plugins/Forms/Object Form',
|
|
8
8
|
component: SchemaRenderer,
|
|
9
9
|
parameters: {
|
|
10
10
|
layout: 'centered',
|
|
@@ -4,7 +4,7 @@ import type { BaseSchema } from '@object-ui/types';
|
|
|
4
4
|
import { createStorybookDataSource } from '@storybook-config/datasource';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: '
|
|
7
|
+
title: 'Plugins/Scheduling/Gantt',
|
|
8
8
|
component: SchemaRenderer,
|
|
9
9
|
parameters: {
|
|
10
10
|
layout: 'padded',
|
|
@@ -4,7 +4,7 @@ import type { BaseSchema } from '@object-ui/types';
|
|
|
4
4
|
import { createStorybookDataSource } from '@storybook-config/datasource';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Views/Object Grid',
|
|
7
|
+
title: 'Plugins/Data Views/Object Grid',
|
|
8
8
|
component: SchemaRenderer,
|
|
9
9
|
parameters: {
|
|
10
10
|
layout: 'padded',
|
|
@@ -155,3 +155,161 @@ export const OpportunitiesGrid: Story = {
|
|
|
155
155
|
className: 'w-full'
|
|
156
156
|
} as any,
|
|
157
157
|
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Editable Grid - Simple Inline Cell Editing
|
|
161
|
+
*
|
|
162
|
+
* This story demonstrates basic inline editing capabilities:
|
|
163
|
+
* - Double-click or press Enter to edit a cell
|
|
164
|
+
* - Press Enter to save, Escape to cancel
|
|
165
|
+
* - ID column is read-only (editable: false)
|
|
166
|
+
* - Changes are immediately reported via onCellChange callback
|
|
167
|
+
*/
|
|
168
|
+
export const EditableGrid: Story = {
|
|
169
|
+
render: renderStory,
|
|
170
|
+
args: {
|
|
171
|
+
type: 'object-grid',
|
|
172
|
+
objectName: 'User',
|
|
173
|
+
columns: [
|
|
174
|
+
{ field: 'id', header: 'ID', width: 80, editable: false },
|
|
175
|
+
{ field: 'name', header: 'Name', sortable: true },
|
|
176
|
+
{ field: 'email', header: 'Email', sortable: true },
|
|
177
|
+
{ field: 'role', header: 'Role', sortable: true },
|
|
178
|
+
{ field: 'status', header: 'Status', sortable: true }
|
|
179
|
+
],
|
|
180
|
+
data: [
|
|
181
|
+
{ id: 1, name: 'John Doe', email: 'john@example.com', role: 'Admin', status: 'Active' },
|
|
182
|
+
{ id: 2, name: 'Jane Smith', email: 'jane@example.com', role: 'User', status: 'Active' },
|
|
183
|
+
{ id: 3, name: 'Bob Johnson', email: 'bob@example.com', role: 'User', status: 'Inactive' },
|
|
184
|
+
{ id: 4, name: 'Alice Williams', email: 'alice@example.com', role: 'User', status: 'Active' }
|
|
185
|
+
],
|
|
186
|
+
editable: true,
|
|
187
|
+
pagination: false,
|
|
188
|
+
className: 'w-full',
|
|
189
|
+
onCellChange: (rowIndex: number, columnKey: string, newValue: any, row: any) => {
|
|
190
|
+
console.log('Cell changed:', { rowIndex, columnKey, newValue, row });
|
|
191
|
+
alert(`✓ Cell updated immediately:\n${columnKey} = "${newValue}"`);
|
|
192
|
+
}
|
|
193
|
+
} as any,
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Batch Edit Grid - Multi-Row Editing with Batch Save
|
|
198
|
+
*
|
|
199
|
+
* **💡 How to use:**
|
|
200
|
+
* 1. Double-click any cell (except SKU) to start editing
|
|
201
|
+
* 2. Press Enter to confirm the edit (cell becomes highlighted in amber)
|
|
202
|
+
* 3. Edit more cells across different rows
|
|
203
|
+
* 4. Watch the toolbar appear showing "X rows modified" with Save/Cancel buttons
|
|
204
|
+
* 5. Row-level save buttons (✓) appear in the Actions column for edited rows
|
|
205
|
+
* 6. Click "Save All" to batch save, or click row save buttons individually
|
|
206
|
+
*
|
|
207
|
+
* **Features demonstrated:**
|
|
208
|
+
* - Edit multiple cells across multiple rows
|
|
209
|
+
* - Modified rows are highlighted with amber background
|
|
210
|
+
* - Modified cells shown in bold amber text
|
|
211
|
+
* - Row-level save/cancel buttons appear after editing
|
|
212
|
+
* - Batch save all changes at once using "Save All" button
|
|
213
|
+
* - Cancel changes per row or all at once
|
|
214
|
+
* - Toolbar shows count of modified rows
|
|
215
|
+
*/
|
|
216
|
+
export const BatchEditGrid: Story = {
|
|
217
|
+
render: renderStory,
|
|
218
|
+
args: {
|
|
219
|
+
type: 'object-grid',
|
|
220
|
+
objectName: 'Product',
|
|
221
|
+
columns: [
|
|
222
|
+
{ field: 'sku', header: 'SKU', width: 120, editable: false },
|
|
223
|
+
{ field: 'name', header: 'Product Name', sortable: true },
|
|
224
|
+
{ field: 'category', header: 'Category', sortable: true },
|
|
225
|
+
{ field: 'price', header: 'Price', sortable: true },
|
|
226
|
+
{ field: 'stock', header: 'Stock', sortable: true }
|
|
227
|
+
],
|
|
228
|
+
data: [
|
|
229
|
+
{ sku: 'PROD-001', name: 'Laptop', category: 'Electronics', price: '$1299.99', stock: 15 },
|
|
230
|
+
{ sku: 'PROD-002', name: 'Mouse', category: 'Electronics', price: '$29.99', stock: 120 },
|
|
231
|
+
{ sku: 'PROD-003', name: 'Keyboard', category: 'Accessories', price: '$79.99', stock: 45 },
|
|
232
|
+
{ sku: 'PROD-004', name: 'Monitor', category: 'Electronics', price: '$399.99', stock: 22 },
|
|
233
|
+
{ sku: 'PROD-005', name: 'USB Cable', category: 'Accessories', price: '$12.99', stock: 200 }
|
|
234
|
+
],
|
|
235
|
+
editable: true,
|
|
236
|
+
pagination: false,
|
|
237
|
+
rowActions: true,
|
|
238
|
+
className: 'w-full',
|
|
239
|
+
onRowSave: async (rowIndex: number, changes: Record<string, any>, row: any) => {
|
|
240
|
+
console.log('Saving row:', { rowIndex, changes, row });
|
|
241
|
+
// Simulate API call
|
|
242
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
243
|
+
const changeList = Object.entries(changes).map(([k, v]) => ` ${k}: "${v}"`).join('\n');
|
|
244
|
+
alert(`✓ Saved changes for "${row.name}":\n\n${changeList}`);
|
|
245
|
+
},
|
|
246
|
+
onBatchSave: async (allChanges: Array<{ rowIndex: number; changes: Record<string, any>; row: any }>) => {
|
|
247
|
+
console.log('Batch saving:', allChanges);
|
|
248
|
+
// Simulate API call
|
|
249
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
250
|
+
const summary = allChanges.map(c =>
|
|
251
|
+
`${c.row.name}: ${Object.keys(c.changes).join(', ')}`
|
|
252
|
+
).join('\n');
|
|
253
|
+
alert(`✓ Batch saved ${allChanges.length} rows:\n\n${summary}`);
|
|
254
|
+
}
|
|
255
|
+
} as any,
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Advanced Batch Editing - Real-World Inventory Management
|
|
260
|
+
*
|
|
261
|
+
* **💡 Instructions:**
|
|
262
|
+
* - Double-click any cell (except ID and SKU which are read-only)
|
|
263
|
+
* - Make edits across multiple rows and pages
|
|
264
|
+
* - Save buttons appear in Actions column after editing
|
|
265
|
+
* - Batch save toolbar appears when there are pending changes
|
|
266
|
+
*
|
|
267
|
+
* **Complete workflow demonstration:**
|
|
268
|
+
* - Large dataset with pagination
|
|
269
|
+
* - Multiple editable fields
|
|
270
|
+
* - Read-only columns (ID, SKU)
|
|
271
|
+
* - Both row-level and batch save operations
|
|
272
|
+
* - Search and filter capabilities
|
|
273
|
+
*/
|
|
274
|
+
export const AdvancedBatchEdit: Story = {
|
|
275
|
+
render: renderStory,
|
|
276
|
+
args: {
|
|
277
|
+
type: 'object-grid',
|
|
278
|
+
objectName: 'Inventory',
|
|
279
|
+
columns: [
|
|
280
|
+
{ field: 'id', header: 'ID', width: 60, editable: false },
|
|
281
|
+
{ field: 'sku', header: 'SKU', width: 100, editable: false },
|
|
282
|
+
{ field: 'name', header: 'Product Name', sortable: true },
|
|
283
|
+
{ field: 'category', header: 'Category', sortable: true },
|
|
284
|
+
{ field: 'price', header: 'Price ($)', sortable: true },
|
|
285
|
+
{ field: 'stock', header: 'Stock', sortable: true },
|
|
286
|
+
{ field: 'reorderLevel', header: 'Reorder At', sortable: true }
|
|
287
|
+
],
|
|
288
|
+
data: [
|
|
289
|
+
{ id: 1, sku: 'ELEC-001', name: 'Wireless Mouse', category: 'Electronics', price: '29.99', stock: 45, reorderLevel: 20 },
|
|
290
|
+
{ id: 2, sku: 'ELEC-002', name: 'USB Keyboard', category: 'Electronics', price: '49.99', stock: 32, reorderLevel: 15 },
|
|
291
|
+
{ id: 3, sku: 'FURN-001', name: 'Desk Lamp', category: 'Furniture', price: '34.99', stock: 18, reorderLevel: 10 },
|
|
292
|
+
{ id: 4, sku: 'ELEC-003', name: 'Webcam HD', category: 'Electronics', price: '79.99', stock: 12, reorderLevel: 10 },
|
|
293
|
+
{ id: 5, sku: 'ACC-001', name: 'HDMI Cable', category: 'Accessories', price: '15.99', stock: 150, reorderLevel: 50 },
|
|
294
|
+
{ id: 6, sku: 'FURN-002', name: 'Monitor Stand', category: 'Furniture', price: '45.99', stock: 28, reorderLevel: 12 },
|
|
295
|
+
{ id: 7, sku: 'ELEC-004', name: 'USB Hub', category: 'Electronics', price: '24.99', stock: 65, reorderLevel: 25 },
|
|
296
|
+
{ id: 8, sku: 'ACC-002', name: 'Mouse Pad', category: 'Accessories', price: '9.99', stock: 200, reorderLevel: 75 }
|
|
297
|
+
],
|
|
298
|
+
editable: true,
|
|
299
|
+
pagination: true,
|
|
300
|
+
pageSize: 5,
|
|
301
|
+
rowActions: true,
|
|
302
|
+
className: 'w-full',
|
|
303
|
+
onRowSave: async (rowIndex: number, changes: Record<string, any>, row: any) => {
|
|
304
|
+
console.log('Saving inventory row:', { rowIndex, changes, row });
|
|
305
|
+
await new Promise(resolve => setTimeout(resolve, 600));
|
|
306
|
+
alert(`✓ Updated inventory for "${row.name}"\n\nChanges:\n${JSON.stringify(changes, null, 2)}`);
|
|
307
|
+
},
|
|
308
|
+
onBatchSave: async (allChanges: Array<{ rowIndex: number; changes: Record<string, any>; row: any }>) => {
|
|
309
|
+
console.log('Batch updating inventory:', allChanges);
|
|
310
|
+
await new Promise(resolve => setTimeout(resolve, 1200));
|
|
311
|
+
alert(`✓ Batch updated ${allChanges.length} inventory items\n\nProcessed successfully!`);
|
|
312
|
+
}
|
|
313
|
+
} as any,
|
|
314
|
+
};
|
|
315
|
+
|
|
@@ -4,7 +4,7 @@ import type { BaseSchema } from '@object-ui/types';
|
|
|
4
4
|
import { createStorybookDataSource } from '@storybook-config/datasource';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: '
|
|
7
|
+
title: 'Plugins/Rich Content/Map',
|
|
8
8
|
component: SchemaRenderer,
|
|
9
9
|
parameters: {
|
|
10
10
|
layout: 'padded',
|
|
@@ -4,7 +4,7 @@ import type { BaseSchema } from '@object-ui/types';
|
|
|
4
4
|
import { createStorybookDataSource } from '@storybook-config/datasource';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Views/Object View',
|
|
7
|
+
title: 'Plugins/Data Views/Object View',
|
|
8
8
|
component: SchemaRenderer,
|
|
9
9
|
parameters: {
|
|
10
10
|
layout: 'padded',
|
|
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react';
|
|
|
2
2
|
import { SchemaRenderer } from '../SchemaRenderer';
|
|
3
3
|
|
|
4
4
|
const meta: Meta = {
|
|
5
|
-
title: '
|
|
5
|
+
title: 'Primitives/Overlay/Extras',
|
|
6
6
|
component: SchemaRenderer,
|
|
7
7
|
tags: ['autodocs'],
|
|
8
8
|
argTypes: {
|
|
@@ -3,7 +3,7 @@ import { SchemaRenderer } from '../SchemaRenderer';
|
|
|
3
3
|
import type { BaseSchema } from '@object-ui/types';
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
|
-
title: '
|
|
6
|
+
title: 'Primitives/Overlay/Others',
|
|
7
7
|
component: SchemaRenderer,
|
|
8
8
|
parameters: { layout: 'centered' },
|
|
9
9
|
tags: ['autodocs'],
|
|
@@ -3,7 +3,7 @@ import { SchemaRenderer } from '../SchemaRenderer';
|
|
|
3
3
|
import type { BaseSchema } from '@object-ui/types';
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
|
-
title: '
|
|
6
|
+
title: 'Primitives/Layout/Resizable',
|
|
7
7
|
component: SchemaRenderer,
|
|
8
8
|
parameters: { layout: 'centered' },
|
|
9
9
|
tags: ['autodocs'],
|
|
@@ -3,7 +3,7 @@ import { SchemaRenderer } from '../SchemaRenderer';
|
|
|
3
3
|
import type { BaseSchema } from '@object-ui/types';
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
|
-
title: '
|
|
6
|
+
title: 'Primitives/Data Entry/Select',
|
|
7
7
|
component: SchemaRenderer,
|
|
8
8
|
parameters: { layout: 'centered' },
|
|
9
9
|
tags: ['autodocs'],
|
|
@@ -3,7 +3,7 @@ import { SchemaRenderer } from '../SchemaRenderer';
|
|
|
3
3
|
import type { BaseSchema } from '@object-ui/types';
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
|
-
title: '
|
|
6
|
+
title: 'Primitives/General/Separator',
|
|
7
7
|
component: SchemaRenderer,
|
|
8
8
|
parameters: { layout: 'centered' },
|
|
9
9
|
tags: ['autodocs'],
|
|
@@ -3,7 +3,7 @@ import { SchemaRenderer } from '../SchemaRenderer';
|
|
|
3
3
|
import type { BaseSchema } from '@object-ui/types';
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
|
-
title: '
|
|
6
|
+
title: 'Primitives/Data Display/Statistic',
|
|
7
7
|
component: SchemaRenderer,
|
|
8
8
|
parameters: { layout: 'centered' },
|
|
9
9
|
tags: ['autodocs'],
|
|
@@ -3,7 +3,7 @@ import { SchemaRenderer } from '../SchemaRenderer';
|
|
|
3
3
|
import type { BaseSchema } from '@object-ui/types';
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
|
-
title: '
|
|
6
|
+
title: 'Primitives/Navigation/Tabs',
|
|
7
7
|
component: SchemaRenderer,
|
|
8
8
|
parameters: { layout: 'padded' },
|
|
9
9
|
tags: ['autodocs'],
|