-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathreact-blocks.contract.json
More file actions
590 lines (590 loc) · 18.6 KB
/
Copy pathreact-blocks.contract.json
File metadata and controls
590 lines (590 loc) · 18.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
{
"version": 2,
"adr": "ADR-0081",
"source": "GENERATED from packages/spec/src/ui/react-blocks.ts — data props from the spec zod schemas, binding/controlled/callback from the React overlay.",
"note": "Props each component accepts in kind:'react' page source. Reference blocks by their PascalCase tag. kind: data=declarative config (from the spec schema) · binding=connects to data · controlled=React state · callback=React function. Layout = plain HTML+Tailwind; these blocks are for DATA. Live data: const adapter = useAdapter(); adapter.find/findOne/create/update.",
"blocks": [
{
"tag": "ObjectForm",
"schemaType": "object-form",
"summary": "Server-connected create/edit/view form for one object. Config props come from the spec FormView schema; bind + wire it with the React props below.",
"specSchema": true,
"props": [
{
"name": "objectName",
"type": "string",
"kind": "binding",
"required": true,
"description": "The object this block binds to (server-connected)."
},
{
"name": "formType",
"type": "'simple' | 'tabbed' | 'wizard' | 'split' | 'drawer' | 'modal'",
"kind": "binding",
"required": false,
"description": "Form presentation; drawer/modal render the form in a built-in overlay (use drawerSide/drawerWidth/modalSize)."
},
{
"name": "fields",
"type": "string[]",
"kind": "binding",
"required": false,
"description": "Limit/order the fields shown (defaults to the object form fields)."
},
{
"name": "initialValues",
"type": "Record<string, any>",
"kind": "binding",
"required": false,
"description": "Prefill values in create mode."
},
{
"name": "mode",
"type": "'create' | 'edit' | 'view'",
"kind": "controlled",
"required": false,
"description": "Create a new record, or edit/view an existing one — drive from React state."
},
{
"name": "recordId",
"type": "string | number",
"kind": "controlled",
"required": false,
"description": "Which record to load (edit/view). The hook for master/detail."
},
{
"name": "onSuccess",
"type": "(record) => void",
"kind": "callback",
"required": false,
"description": "Called after a successful save with the saved record (e.g. close a panel + reload)."
},
{
"name": "onError",
"type": "(error: Error) => void",
"kind": "callback",
"required": false,
"description": "Called when the save fails."
},
{
"name": "onCancel",
"type": "() => void",
"kind": "callback",
"required": false,
"description": "Called when the user cancels."
},
{
"name": "submitHandler",
"type": "(values) => any | Promise<any>",
"kind": "callback",
"required": false,
"description": "Custom persistence instead of the default create/update."
},
{
"name": "layout",
"type": "'vertical' | 'horizontal' | 'inline' | 'grid'",
"kind": "data",
"required": false,
"description": "Field layout direction"
},
{
"name": "columns",
"type": "integer",
"kind": "data",
"required": false,
"description": "Number of columns for the form body"
},
{
"name": "tabPosition",
"type": "'top' | 'bottom' | 'left' | 'right'",
"kind": "data",
"required": false,
"description": "Tab strip position (tabbed forms)"
},
{
"name": "drawerSide",
"type": "'top' | 'bottom' | 'left' | 'right'",
"kind": "data",
"required": false,
"description": "Drawer side (drawer forms)"
},
{
"name": "drawerWidth",
"type": "string",
"kind": "data",
"required": false,
"description": "Drawer width, e.g. \"480px\" (drawer forms)"
},
{
"name": "modalSize",
"type": "'sm' | 'default' | 'lg' | 'xl' | 'full'",
"kind": "data",
"required": false,
"description": "Modal size (modal forms)"
},
{
"name": "splitDirection",
"type": "'horizontal' | 'vertical'",
"kind": "data",
"required": false,
"description": "Split orientation (split forms)"
},
{
"name": "sections",
"type": "object[]",
"kind": "data",
"required": false,
"description": ""
},
{
"name": "subforms",
"type": "object[]",
"kind": "data",
"required": false,
"description": "Inline master-detail child collections"
},
{
"name": "submitBehavior",
"type": "object",
"kind": "data",
"required": false,
"description": "Post-submit behavior"
}
]
},
{
"tag": "ListView",
"schemaType": "list-view",
"summary": "Server-connected object table with toolbar and switchable visualizations (grid/kanban/calendar/gantt/…). Config props come from the spec ListView schema.",
"specSchema": true,
"props": [
{
"name": "objectName",
"type": "string",
"kind": "binding",
"required": true,
"description": "The object this block binds to (server-connected)."
},
{
"name": "viewType",
"type": "'grid' | 'kanban' | 'gallery' | 'calendar' | 'timeline' | 'gantt' | 'map'",
"kind": "binding",
"required": false,
"description": "Which visualization to render (default grid). How you get a kanban/calendar/gantt of the object."
},
{
"name": "navigation",
"type": "{ mode: 'page' | 'drawer' | 'modal' | 'split' | 'none' }",
"kind": "binding",
"required": false,
"description": "What a row click does. Use { mode: \"none\" } when you handle clicks via onRowClick."
},
{
"name": "fields",
"type": "string[]",
"kind": "binding",
"required": false,
"description": "Limit/order the columns shown (defaults to the object list fields)."
},
{
"name": "options",
"type": "Record<string, any>",
"kind": "binding",
"required": false,
"description": "View-type-specific options bag (kanban/calendar/gantt extras); prefer the typed spec props where they exist."
},
{
"name": "filters",
"type": "FilterArray e.g. ['status','=','active']",
"kind": "controlled",
"required": false,
"description": "ObjectQL base filter; drive from React state for tabbed/searched lists. ([field, op, value]; ops =, !=, >, <, contains, in; compound: [\"and\", […], […]])."
},
{
"name": "onRowClick",
"type": "(record) => void",
"kind": "callback",
"required": false,
"description": "Called with the clicked row's record — the hook for master/detail."
},
{
"name": "onNavigate",
"type": "(recordId, action: 'view' | 'edit') => void",
"kind": "callback",
"required": false,
"description": "Called for page-level navigation."
},
{
"name": "columns",
"type": "string[] | object[]",
"kind": "data",
"required": true,
"description": "Fields to display as columns"
},
{
"name": "sort",
"type": "string | object[]",
"kind": "data",
"required": false,
"description": ""
},
{
"name": "searchableFields",
"type": "string[]",
"kind": "data",
"required": false,
"description": "Fields enabled for search"
},
{
"name": "userFilters",
"type": "object",
"kind": "data",
"required": false,
"description": "End-user quick-filter bar: dropdown/toggle fields or tab presets. Omit to let the renderer derive filters from select/boolean fields"
},
{
"name": "pagination",
"type": "object",
"kind": "data",
"required": false,
"description": "Pagination configuration"
},
{
"name": "grouping",
"type": "object",
"kind": "data",
"required": false,
"description": "Group records by one or more fields"
},
{
"name": "rowHeight",
"type": "'compact' | 'short' | 'medium' | 'tall' | 'extra_tall'",
"kind": "data",
"required": false,
"description": "Row height / density setting"
},
{
"name": "selection",
"type": "object",
"kind": "data",
"required": false,
"description": "Row selection configuration"
},
{
"name": "rowActions",
"type": "string[]",
"kind": "data",
"required": false,
"description": "Actions available for individual row items"
},
{
"name": "inlineEdit",
"type": "boolean",
"kind": "data",
"required": false,
"description": "Allow inline editing of records directly in the list view"
}
]
},
{
"tag": "ObjectChart",
"schemaType": "object-chart",
"summary": "Chart over an object’s aggregated data. Config props come from the spec Chart config schema.",
"specSchema": true,
"props": [
{
"name": "objectName",
"type": "string",
"kind": "binding",
"required": true,
"description": "The object this block binds to (server-connected)."
},
{
"name": "aggregate",
"type": "{ field, function, groupBy }",
"kind": "binding",
"required": false,
"description": "Aggregation: function (sum/avg/count) over field, grouped by groupBy."
},
{
"name": "data",
"type": "any[]",
"kind": "binding",
"required": false,
"description": "Static/precomputed data to chart directly instead of binding via objectName + aggregate."
},
{
"name": "filter",
"type": "FilterArray",
"kind": "controlled",
"required": false,
"description": "ObjectQL filter scoping the data; drive from React state."
},
{
"name": "showLegend",
"type": "boolean",
"kind": "data",
"required": true,
"description": "Display legend"
},
{
"name": "title",
"type": "string",
"kind": "data",
"required": false,
"description": "Chart title"
},
{
"name": "series",
"type": "object[]",
"kind": "data",
"required": false,
"description": "Defined series configuration"
},
{
"name": "xAxis",
"type": "object",
"kind": "data",
"required": false,
"description": "X-Axis configuration"
},
{
"name": "yAxis",
"type": "object[]",
"kind": "data",
"required": false,
"description": "Y-Axis configuration (support dual axis)"
},
{
"name": "colors",
"type": "string[] | object",
"kind": "data",
"required": false,
"description": "Color palette (string[]) or value→color map ({ value: color })"
}
]
},
{
"tag": "RecordDetails",
"schemaType": "record:details",
"summary": "Field-detail panel for the bound record. Config props from the spec RecordDetails schema.",
"specSchema": true,
"props": [
{
"name": "objectName",
"type": "string",
"kind": "binding",
"required": false,
"description": "The record’s object."
},
{
"name": "recordId",
"type": "string | number",
"kind": "controlled",
"required": false,
"description": "The record to show."
},
{
"name": "columns",
"type": "'1' | '2' | '3' | '4'",
"kind": "data",
"required": true,
"description": "Number of columns for field layout (1-4)"
},
{
"name": "layout",
"type": "'auto' | 'custom'",
"kind": "data",
"required": true,
"description": "Layout mode: auto uses object compactLayout, custom uses explicit sections"
},
{
"name": "sections",
"type": "string[]",
"kind": "data",
"required": false,
"description": "Section IDs to show (required when layout is \"custom\")"
},
{
"name": "fields",
"type": "string[]",
"kind": "data",
"required": false,
"description": "Explicit field list to display (optional, overrides compactLayout)"
}
]
},
{
"tag": "RecordHighlights",
"schemaType": "record:highlights",
"summary": "Highlights panel — a strip of key fields. Config props from the spec RecordHighlights schema.",
"specSchema": true,
"props": [
{
"name": "objectName",
"type": "string",
"kind": "binding",
"required": false,
"description": "The record’s object."
},
{
"name": "recordId",
"type": "string | number",
"kind": "controlled",
"required": false,
"description": "The record to summarize."
},
{
"name": "fields",
"type": "string | object[]",
"kind": "data",
"required": true,
"description": "Key fields to highlight (1-7 fields max, typically displayed as prominent cards). Each item may be a bare field name or {name, label?, icon?, type?} for inline…"
},
{
"name": "layout",
"type": "'horizontal' | 'vertical'",
"kind": "data",
"required": true,
"description": "Layout orientation for highlight fields"
}
]
},
{
"tag": "RecordRelatedList",
"schemaType": "record:related_list",
"summary": "Related child records via a lookup. Config props from the spec RecordRelatedList schema.",
"specSchema": true,
"props": [
{
"name": "objectName",
"type": "string",
"kind": "binding",
"required": false,
"description": "The parent object."
},
{
"name": "recordId",
"type": "string | number",
"kind": "controlled",
"required": false,
"description": "The parent record."
},
{
"name": "relationshipField",
"type": "string",
"kind": "data",
"required": true,
"description": "Field on related object that points to this record (e.g., \"account_id\")"
},
{
"name": "columns",
"type": "string[]",
"kind": "data",
"required": true,
"description": "Fields to display in the related list"
},
{
"name": "limit",
"type": "integer",
"kind": "data",
"required": true,
"description": "Number of records to display initially"
},
{
"name": "showViewAll",
"type": "boolean",
"kind": "data",
"required": true,
"description": "Show \"View All\" link to see all related records"
},
{
"name": "sort",
"type": "string | object[]",
"kind": "data",
"required": false,
"description": "Sort order for related records"
},
{
"name": "filter",
"type": "object[]",
"kind": "data",
"required": false,
"description": "Additional filter criteria for related records"
},
{
"name": "title",
"type": "string",
"kind": "data",
"required": false,
"description": "Custom title for the related list"
},
{
"name": "actions",
"type": "string[]",
"kind": "data",
"required": false,
"description": "Action IDs available for related records"
},
{
"name": "add",
"type": "object",
"kind": "data",
"required": false,
"description": "Add-existing-via-picker config (generic m2m/junction assignment)."
}
]
},
{
"tag": "RecordPath",
"schemaType": "record:path",
"summary": "Stage/progress bar driven by a status field. Config props from the spec RecordPath schema.",
"specSchema": true,
"props": [
{
"name": "objectName",
"type": "string",
"kind": "binding",
"required": false,
"description": "The record’s object."
},
{
"name": "recordId",
"type": "string | number",
"kind": "controlled",
"required": false,
"description": "The record whose stage to show."
},
{
"name": "statusField",
"type": "string",
"kind": "data",
"required": true,
"description": "Field name representing the current status/stage"
},
{
"name": "stages",
"type": "object[]",
"kind": "data",
"required": false,
"description": "Explicit stage definitions (if not using field metadata)"
}
]
},
{
"tag": "Block",
"schemaType": "(any)",
"summary": "Escape hatch — render any registered component by type. <Block type=\"object-kanban\" objectName=\"task\" /> etc.",
"specSchema": false,
"props": [
{
"name": "type",
"type": "string",
"kind": "binding",
"required": true,
"description": "The registered component type to render."
}
]
}
]
}