@object-ui/types 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.
Files changed (127) hide show
  1. package/README.md +1 -1
  2. package/dist/ai.d.ts +376 -0
  3. package/dist/ai.d.ts.map +1 -0
  4. package/dist/ai.js +8 -0
  5. package/dist/app.d.ts +2 -2
  6. package/dist/complex.d.ts +2 -0
  7. package/dist/complex.d.ts.map +1 -1
  8. package/dist/crud.d.ts +3 -0
  9. package/dist/crud.d.ts.map +1 -1
  10. package/dist/data-display.d.ts +40 -0
  11. package/dist/data-display.d.ts.map +1 -1
  12. package/dist/data-protocol.d.ts +19 -19
  13. package/dist/data.d.ts +77 -0
  14. package/dist/data.d.ts.map +1 -1
  15. package/dist/designer.d.ts +473 -0
  16. package/dist/designer.d.ts.map +1 -0
  17. package/dist/designer.js +8 -0
  18. package/dist/form.d.ts +35 -1
  19. package/dist/form.d.ts.map +1 -1
  20. package/dist/index.d.ts +46 -8
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +18 -0
  23. package/dist/layout.d.ts +63 -8
  24. package/dist/layout.d.ts.map +1 -1
  25. package/dist/mobile.d.ts +186 -0
  26. package/dist/mobile.d.ts.map +1 -0
  27. package/dist/mobile.js +8 -0
  28. package/dist/objectql.d.ts +341 -88
  29. package/dist/objectql.d.ts.map +1 -1
  30. package/dist/permissions.d.ts +150 -0
  31. package/dist/permissions.d.ts.map +1 -0
  32. package/dist/permissions.js +8 -0
  33. package/dist/tenant.d.ts +138 -0
  34. package/dist/tenant.d.ts.map +1 -0
  35. package/dist/tenant.js +8 -0
  36. package/dist/theme.d.ts +115 -224
  37. package/dist/theme.d.ts.map +1 -1
  38. package/dist/ui-action.d.ts +126 -11
  39. package/dist/ui-action.d.ts.map +1 -1
  40. package/dist/views.d.ts +20 -0
  41. package/dist/views.d.ts.map +1 -1
  42. package/dist/widget.d.ts +181 -0
  43. package/dist/widget.d.ts.map +1 -0
  44. package/dist/widget.js +8 -0
  45. package/dist/workflow.d.ts +340 -0
  46. package/dist/workflow.d.ts.map +1 -0
  47. package/dist/workflow.js +8 -0
  48. package/dist/zod/blocks.zod.d.ts +2 -2
  49. package/dist/zod/blocks.zod.d.ts.map +1 -1
  50. package/dist/zod/blocks.zod.js +1 -1
  51. package/dist/zod/complex.zod.d.ts +6 -6
  52. package/dist/zod/complex.zod.d.ts.map +1 -1
  53. package/dist/zod/complex.zod.js +1 -1
  54. package/dist/zod/crud.zod.d.ts +5 -5
  55. package/dist/zod/data-display.zod.d.ts +2 -2
  56. package/dist/zod/data-display.zod.d.ts.map +1 -1
  57. package/dist/zod/data-display.zod.js +1 -1
  58. package/dist/zod/disclosure.zod.d.ts +2 -2
  59. package/dist/zod/disclosure.zod.d.ts.map +1 -1
  60. package/dist/zod/disclosure.zod.js +1 -1
  61. package/dist/zod/feedback.zod.d.ts +12 -12
  62. package/dist/zod/feedback.zod.d.ts.map +1 -1
  63. package/dist/zod/feedback.zod.js +1 -1
  64. package/dist/zod/form.zod.d.ts +6 -6
  65. package/dist/zod/form.zod.d.ts.map +1 -1
  66. package/dist/zod/form.zod.js +1 -1
  67. package/dist/zod/index.zod.d.ts +337 -146
  68. package/dist/zod/index.zod.d.ts.map +1 -1
  69. package/dist/zod/index.zod.js +4 -4
  70. package/dist/zod/layout.zod.d.ts +134 -2
  71. package/dist/zod/layout.zod.d.ts.map +1 -1
  72. package/dist/zod/layout.zod.js +35 -1
  73. package/dist/zod/navigation.zod.d.ts +2 -2
  74. package/dist/zod/navigation.zod.d.ts.map +1 -1
  75. package/dist/zod/navigation.zod.js +1 -1
  76. package/dist/zod/objectql.zod.d.ts +32 -16
  77. package/dist/zod/objectql.zod.d.ts.map +1 -1
  78. package/dist/zod/objectql.zod.js +8 -0
  79. package/dist/zod/overlay.zod.d.ts +2 -2
  80. package/dist/zod/overlay.zod.d.ts.map +1 -1
  81. package/dist/zod/overlay.zod.js +1 -1
  82. package/dist/zod/reports.zod.d.ts +19 -19
  83. package/dist/zod/reports.zod.d.ts.map +1 -1
  84. package/dist/zod/reports.zod.js +1 -1
  85. package/dist/zod/theme.zod.d.ts +948 -267
  86. package/dist/zod/theme.zod.d.ts.map +1 -1
  87. package/dist/zod/theme.zod.js +175 -45
  88. package/dist/zod/views.zod.d.ts +22 -22
  89. package/dist/zod/views.zod.d.ts.map +1 -1
  90. package/dist/zod/views.zod.js +1 -1
  91. package/package.json +3 -2
  92. package/src/__tests__/namespace-exports.test.ts +23 -68
  93. package/src/__tests__/phase2-schemas.test.ts +8 -13
  94. package/src/ai.ts +454 -0
  95. package/src/app.ts +2 -2
  96. package/src/complex.ts +2 -0
  97. package/src/crud.ts +3 -0
  98. package/src/data-display.ts +36 -0
  99. package/src/data-protocol.ts +19 -19
  100. package/src/data.ts +91 -0
  101. package/src/designer.ts +509 -0
  102. package/src/form.ts +35 -1
  103. package/src/index.ts +397 -8
  104. package/src/layout.ts +66 -8
  105. package/src/mobile.ts +205 -0
  106. package/src/objectql.ts +419 -93
  107. package/src/permissions.ts +166 -0
  108. package/src/tenant.ts +153 -0
  109. package/src/theme.ts +147 -260
  110. package/src/ui-action.ts +166 -27
  111. package/src/views.ts +17 -0
  112. package/src/widget.ts +197 -0
  113. package/src/workflow.ts +409 -0
  114. package/src/zod/blocks.zod.ts +1 -1
  115. package/src/zod/complex.zod.ts +1 -1
  116. package/src/zod/data-display.zod.ts +1 -1
  117. package/src/zod/disclosure.zod.ts +1 -1
  118. package/src/zod/feedback.zod.ts +1 -1
  119. package/src/zod/form.zod.ts +1 -1
  120. package/src/zod/index.zod.ts +14 -3
  121. package/src/zod/layout.zod.ts +39 -1
  122. package/src/zod/navigation.zod.ts +1 -1
  123. package/src/zod/objectql.zod.ts +8 -0
  124. package/src/zod/overlay.zod.ts +1 -1
  125. package/src/zod/reports.zod.ts +1 -1
  126. package/src/zod/theme.zod.ts +189 -48
  127. package/src/zod/views.zod.ts +1 -1
package/src/data.ts CHANGED
@@ -113,6 +113,26 @@ export interface QueryResult<T = any> {
113
113
  metadata?: Record<string, any>;
114
114
  }
115
115
 
116
+ /**
117
+ * Result of a file upload operation.
118
+ */
119
+ export interface FileUploadResult {
120
+ /** Server-assigned unique ID for the uploaded file */
121
+ id: string;
122
+ /** Original filename */
123
+ filename: string;
124
+ /** MIME type of the uploaded file */
125
+ mimeType: string;
126
+ /** File size in bytes */
127
+ size: number;
128
+ /** Public URL to access the file */
129
+ url: string;
130
+ /** Thumbnail URL (for images) */
131
+ thumbnailUrl?: string;
132
+ /** Additional server-side metadata */
133
+ metadata?: Record<string, unknown>;
134
+ }
135
+
116
136
  /**
117
137
  * Universal data source interface.
118
138
  * This is the core abstraction that makes Object UI backend-agnostic.
@@ -205,6 +225,77 @@ export interface DataSource<T = any> {
205
225
  * @returns Promise resolving to the object schema
206
226
  */
207
227
  getObjectSchema(objectName: string): Promise<any>;
228
+
229
+ /**
230
+ * Get a view definition for an object.
231
+ * Used by view components to render server-defined UI configurations.
232
+ * Optional — implementations may return null to fall back to static config.
233
+ *
234
+ * @param objectName - Object name
235
+ * @param viewId - View identifier (e.g., 'all', 'active', 'my_records')
236
+ * @returns Promise resolving to the view definition or null
237
+ */
238
+ getView?(objectName: string, viewId: string): Promise<any | null>;
239
+
240
+ /**
241
+ * Get an application definition by name or ID.
242
+ * Used by app shells to render server-defined navigation, branding, and layout.
243
+ * Optional — implementations may return null to fall back to static config.
244
+ *
245
+ * @param appId - Application identifier
246
+ * @returns Promise resolving to the app definition or null
247
+ */
248
+ getApp?(appId: string): Promise<any | null>;
249
+
250
+ /**
251
+ * Get a page definition by name or ID.
252
+ * Used by page renderers to fetch server-defined page layouts.
253
+ * Optional — implementations may return null to fall back to static config.
254
+ *
255
+ * @param pageId - Page identifier (e.g., 'home', 'settings', 'onboarding')
256
+ * @returns Promise resolving to the page definition or null
257
+ */
258
+ getPage?(pageId: string): Promise<any | null>;
259
+
260
+ /**
261
+ * Upload a single file to a resource.
262
+ * Optional — only supported by data sources with file storage integration.
263
+ *
264
+ * @param resource - Resource name
265
+ * @param file - File or Blob to upload
266
+ * @param options - Upload options (recordId, fieldName, metadata)
267
+ * @returns Promise resolving to the upload result
268
+ */
269
+ uploadFile?(
270
+ resource: string,
271
+ file: File | Blob,
272
+ options?: {
273
+ recordId?: string;
274
+ fieldName?: string;
275
+ metadata?: Record<string, unknown>;
276
+ onProgress?: (percent: number) => void;
277
+ },
278
+ ): Promise<FileUploadResult>;
279
+
280
+ /**
281
+ * Upload multiple files to a resource.
282
+ * Optional — only supported by data sources with file storage integration.
283
+ *
284
+ * @param resource - Resource name
285
+ * @param files - Array of Files or Blobs to upload
286
+ * @param options - Upload options
287
+ * @returns Promise resolving to array of upload results
288
+ */
289
+ uploadFiles?(
290
+ resource: string,
291
+ files: (File | Blob)[],
292
+ options?: {
293
+ recordId?: string;
294
+ fieldName?: string;
295
+ metadata?: Record<string, unknown>;
296
+ onProgress?: (percent: number) => void;
297
+ },
298
+ ): Promise<FileUploadResult[]>;
208
299
  }
209
300
 
210
301
  /**
@@ -0,0 +1,509 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ /**
10
+ * @object-ui/types - Visual Designer Types
11
+ *
12
+ * Type definitions for the visual designer system including page designer,
13
+ * data model designer, process designer, report designer,
14
+ * and multi-user collaborative editing.
15
+ *
16
+ * @module designer
17
+ * @packageDocumentation
18
+ */
19
+
20
+ import type { BaseSchema } from './base';
21
+
22
+ // ============================================================================
23
+ // Page Designer (Drag-and-Drop)
24
+ // ============================================================================
25
+
26
+ /** Drag-and-drop item position */
27
+ export interface DesignerPosition {
28
+ /** X coordinate (pixels or grid units) */
29
+ x: number;
30
+ /** Y coordinate (pixels or grid units) */
31
+ y: number;
32
+ /** Width */
33
+ width: number | string;
34
+ /** Height */
35
+ height: number | string;
36
+ }
37
+
38
+ /** Designer canvas configuration */
39
+ export interface DesignerCanvasConfig {
40
+ /** Canvas width */
41
+ width: number;
42
+ /** Canvas height */
43
+ height: number;
44
+ /** Grid snap size */
45
+ gridSize?: number;
46
+ /** Whether to show grid */
47
+ showGrid?: boolean;
48
+ /** Whether to enable snap-to-grid */
49
+ snapToGrid?: boolean;
50
+ /** Zoom level (1.0 = 100%) */
51
+ zoom?: number;
52
+ /** Background color */
53
+ backgroundColor?: string;
54
+ }
55
+
56
+ /** Page designer component on canvas */
57
+ export interface DesignerComponent {
58
+ /** Unique component ID */
59
+ id: string;
60
+ /** Component type */
61
+ type: string;
62
+ /** Display label */
63
+ label?: string;
64
+ /** Position on canvas */
65
+ position: DesignerPosition;
66
+ /** Component properties */
67
+ props: Record<string, unknown>;
68
+ /** Child components */
69
+ children?: DesignerComponent[];
70
+ /** Parent component ID */
71
+ parentId?: string;
72
+ /** Lock state */
73
+ locked?: boolean;
74
+ /** Visibility */
75
+ visible?: boolean;
76
+ /** Z-index for layering */
77
+ zIndex?: number;
78
+ }
79
+
80
+ /** Page designer schema */
81
+ export interface PageDesignerSchema extends BaseSchema {
82
+ type: 'page-designer';
83
+ /** Canvas configuration */
84
+ canvas: DesignerCanvasConfig;
85
+ /** Components on the canvas */
86
+ components: DesignerComponent[];
87
+ /** Available component palette */
88
+ palette?: DesignerPaletteCategory[];
89
+ /** Property editor configuration */
90
+ propertyEditor?: boolean;
91
+ /** Component tree visibility */
92
+ showComponentTree?: boolean;
93
+ /** Undo/redo support */
94
+ undoRedo?: boolean;
95
+ /** Read-only mode */
96
+ readOnly?: boolean;
97
+ }
98
+
99
+ /** Component palette category */
100
+ export interface DesignerPaletteCategory {
101
+ /** Category name */
102
+ name: string;
103
+ /** Category label */
104
+ label: string;
105
+ /** Category icon */
106
+ icon?: string;
107
+ /** Available components */
108
+ items: DesignerPaletteItem[];
109
+ }
110
+
111
+ /** Palette item for drag-and-drop */
112
+ export interface DesignerPaletteItem {
113
+ /** Component type */
114
+ type: string;
115
+ /** Display label */
116
+ label: string;
117
+ /** Icon */
118
+ icon?: string;
119
+ /** Default properties */
120
+ defaultProps?: Record<string, unknown>;
121
+ /** Default size */
122
+ defaultSize?: { width: number | string; height: number | string };
123
+ /** Preview image URL */
124
+ preview?: string;
125
+ }
126
+
127
+ // ============================================================================
128
+ // Data Model Designer (ER Diagrams)
129
+ // ============================================================================
130
+
131
+ /** Data model entity (table/object) */
132
+ export interface DataModelEntity {
133
+ /** Entity identifier */
134
+ id: string;
135
+ /** Entity name */
136
+ name: string;
137
+ /** Display label */
138
+ label: string;
139
+ /** Entity fields */
140
+ fields: DataModelField[];
141
+ /** Position on canvas */
142
+ position: { x: number; y: number };
143
+ /** Entity color */
144
+ color?: string;
145
+ /** Entity description */
146
+ description?: string;
147
+ }
148
+
149
+ /** Data model field definition */
150
+ export interface DataModelField {
151
+ /** Field name */
152
+ name: string;
153
+ /** Display label */
154
+ label?: string;
155
+ /** Field data type */
156
+ type: string;
157
+ /** Whether this is a primary key */
158
+ primaryKey?: boolean;
159
+ /** Whether this field is required */
160
+ required?: boolean;
161
+ /** Whether this field is unique */
162
+ unique?: boolean;
163
+ /** Default value */
164
+ defaultValue?: unknown;
165
+ /** Field description */
166
+ description?: string;
167
+ }
168
+
169
+ /** Relationship between entities */
170
+ export interface DataModelRelationship {
171
+ /** Relationship identifier */
172
+ id: string;
173
+ /** Source entity ID */
174
+ sourceEntity: string;
175
+ /** Source field */
176
+ sourceField: string;
177
+ /** Target entity ID */
178
+ targetEntity: string;
179
+ /** Target field */
180
+ targetField: string;
181
+ /** Relationship type */
182
+ type: 'one-to-one' | 'one-to-many' | 'many-to-many';
183
+ /** Relationship label */
184
+ label?: string;
185
+ /** Cascade behavior on delete */
186
+ onDelete?: 'cascade' | 'set-null' | 'restrict' | 'no-action';
187
+ /** Cascade behavior on update */
188
+ onUpdate?: 'cascade' | 'set-null' | 'restrict' | 'no-action';
189
+ }
190
+
191
+ /** Data model designer schema */
192
+ export interface DataModelDesignerSchema extends BaseSchema {
193
+ type: 'data-model-designer';
194
+ /** Entities in the model */
195
+ entities: DataModelEntity[];
196
+ /** Relationships between entities */
197
+ relationships: DataModelRelationship[];
198
+ /** Canvas configuration */
199
+ canvas?: DesignerCanvasConfig;
200
+ /** Show relationship labels */
201
+ showRelationshipLabels?: boolean;
202
+ /** Auto-layout enabled */
203
+ autoLayout?: boolean;
204
+ /** Read-only mode */
205
+ readOnly?: boolean;
206
+ }
207
+
208
+ // ============================================================================
209
+ // Process Designer (BPMN 2.0)
210
+ // ============================================================================
211
+
212
+ /** BPMN node types */
213
+ export type BPMNNodeType =
214
+ | 'start-event'
215
+ | 'end-event'
216
+ | 'task'
217
+ | 'user-task'
218
+ | 'service-task'
219
+ | 'script-task'
220
+ | 'send-task'
221
+ | 'receive-task'
222
+ | 'manual-task'
223
+ | 'business-rule-task'
224
+ | 'sub-process'
225
+ | 'call-activity'
226
+ | 'exclusive-gateway'
227
+ | 'parallel-gateway'
228
+ | 'inclusive-gateway'
229
+ | 'event-based-gateway'
230
+ | 'intermediate-catch-event'
231
+ | 'intermediate-throw-event'
232
+ | 'boundary-event'
233
+ | 'timer-event'
234
+ | 'message-event'
235
+ | 'signal-event'
236
+ | 'error-event'
237
+ | 'compensation-event';
238
+
239
+ /** BPMN process node */
240
+ export interface BPMNNode {
241
+ /** Node identifier */
242
+ id: string;
243
+ /** Node type */
244
+ type: BPMNNodeType;
245
+ /** Display label */
246
+ label: string;
247
+ /** Position on canvas */
248
+ position: { x: number; y: number };
249
+ /** Node properties */
250
+ properties?: Record<string, unknown>;
251
+ /** Assigned user/role (for user tasks) */
252
+ assignee?: string;
253
+ /** Due date expression */
254
+ dueDate?: string;
255
+ /** Script content (for script tasks) */
256
+ script?: string;
257
+ /** Service endpoint (for service tasks) */
258
+ serviceEndpoint?: string;
259
+ /** Description */
260
+ description?: string;
261
+ }
262
+
263
+ /** BPMN sequence flow (edge) */
264
+ export interface BPMNEdge {
265
+ /** Edge identifier */
266
+ id: string;
267
+ /** Source node ID */
268
+ source: string;
269
+ /** Target node ID */
270
+ target: string;
271
+ /** Condition expression (for conditional flows) */
272
+ condition?: string;
273
+ /** Edge label */
274
+ label?: string;
275
+ /** Whether this is the default flow */
276
+ isDefault?: boolean;
277
+ }
278
+
279
+ /** BPMN lane */
280
+ export interface BPMNLane {
281
+ /** Lane identifier */
282
+ id: string;
283
+ /** Lane label */
284
+ label: string;
285
+ /** Associated role or department */
286
+ role?: string;
287
+ /** Nodes in this lane */
288
+ nodeIds: string[];
289
+ }
290
+
291
+ /** Process designer schema */
292
+ export interface ProcessDesignerSchema extends BaseSchema {
293
+ type: 'process-designer';
294
+ /** Process name */
295
+ processName: string;
296
+ /** Process version */
297
+ version?: string;
298
+ /** BPMN nodes */
299
+ nodes: BPMNNode[];
300
+ /** BPMN edges/flows */
301
+ edges: BPMNEdge[];
302
+ /** Swim lanes */
303
+ lanes?: BPMNLane[];
304
+ /** Canvas configuration */
305
+ canvas?: DesignerCanvasConfig;
306
+ /** Process variables */
307
+ variables?: Array<{ name: string; type: string; defaultValue?: unknown }>;
308
+ /** Show minimap */
309
+ showMinimap?: boolean;
310
+ /** Show toolbar */
311
+ showToolbar?: boolean;
312
+ /** Read-only mode */
313
+ readOnly?: boolean;
314
+ }
315
+
316
+ // ============================================================================
317
+ // Report Designer
318
+ // ============================================================================
319
+
320
+ /** Report designer section type */
321
+ export type ReportSectionType = 'header' | 'detail' | 'footer' | 'group-header' | 'group-footer' | 'page-header' | 'page-footer';
322
+
323
+ /** Report designer element */
324
+ export interface ReportDesignerElement {
325
+ /** Element identifier */
326
+ id: string;
327
+ /** Element type */
328
+ type: 'text' | 'field' | 'image' | 'chart' | 'table' | 'barcode' | 'line' | 'rectangle' | 'expression';
329
+ /** Position within section */
330
+ position: DesignerPosition;
331
+ /** Element properties */
332
+ properties: Record<string, unknown>;
333
+ /** Data binding expression */
334
+ dataBinding?: string;
335
+ /** Formatting options */
336
+ format?: {
337
+ fontFamily?: string;
338
+ fontSize?: number;
339
+ fontWeight?: 'normal' | 'bold';
340
+ fontStyle?: 'normal' | 'italic';
341
+ color?: string;
342
+ backgroundColor?: string;
343
+ alignment?: 'left' | 'center' | 'right';
344
+ verticalAlignment?: 'top' | 'middle' | 'bottom';
345
+ border?: string;
346
+ padding?: string;
347
+ numberFormat?: string;
348
+ dateFormat?: string;
349
+ };
350
+ }
351
+
352
+ /** Report designer section */
353
+ export interface ReportDesignerSection {
354
+ /** Section type */
355
+ type: ReportSectionType;
356
+ /** Section height */
357
+ height: number;
358
+ /** Elements in this section */
359
+ elements: ReportDesignerElement[];
360
+ /** Group field (for group headers/footers) */
361
+ groupField?: string;
362
+ /** Whether section repeats */
363
+ repeat?: boolean;
364
+ /** Page break before */
365
+ pageBreakBefore?: boolean;
366
+ }
367
+
368
+ /** Report designer schema */
369
+ export interface ReportDesignerSchema extends BaseSchema {
370
+ type: 'report-designer';
371
+ /** Report name */
372
+ reportName: string;
373
+ /** Data source object */
374
+ objectName: string;
375
+ /** Page size */
376
+ pageSize?: 'A4' | 'A3' | 'Letter' | 'Legal' | 'Tabloid';
377
+ /** Page orientation */
378
+ orientation?: 'portrait' | 'landscape';
379
+ /** Page margins */
380
+ margins?: { top: number; right: number; bottom: number; left: number };
381
+ /** Report sections */
382
+ sections: ReportDesignerSection[];
383
+ /** Report parameters */
384
+ parameters?: Array<{ name: string; type: string; label: string; defaultValue?: unknown }>;
385
+ /** Show designer toolbar */
386
+ showToolbar?: boolean;
387
+ /** Show property panel */
388
+ showPropertyPanel?: boolean;
389
+ /** Preview mode */
390
+ previewMode?: boolean;
391
+ /** Read-only mode */
392
+ readOnly?: boolean;
393
+ }
394
+
395
+ // ============================================================================
396
+ // View Designer (List View Layout Editor)
397
+ // ============================================================================
398
+
399
+ /** Column configuration for the view designer */
400
+ export interface ViewDesignerColumn {
401
+ /** Field name */
402
+ field: string;
403
+ /** Display label */
404
+ label?: string;
405
+ /** Column width */
406
+ width?: number | string;
407
+ /** Whether column is visible */
408
+ visible?: boolean;
409
+ /** Sort direction */
410
+ sortDirection?: 'asc' | 'desc';
411
+ /** Column order index */
412
+ order?: number;
413
+ }
414
+
415
+ /** View designer schema */
416
+ export interface ViewDesignerSchema extends BaseSchema {
417
+ type: 'view-designer';
418
+ /** Object name this view is for */
419
+ objectName: string;
420
+ /** View identifier (for editing existing views) */
421
+ viewId?: string;
422
+ /** View display label */
423
+ viewLabel?: string;
424
+ /** View type */
425
+ viewType?: 'grid' | 'kanban' | 'gallery' | 'calendar' | 'timeline' | 'gantt' | 'map';
426
+ /** Columns / fields to display */
427
+ columns?: ViewDesignerColumn[];
428
+ /** Filter conditions */
429
+ filters?: Array<{ field: string; operator: string; value: any }>;
430
+ /** Sort configuration */
431
+ sort?: Array<{ field: string; direction: 'asc' | 'desc' }>;
432
+ /** Available fields from the object schema */
433
+ availableFields?: Array<{ name: string; label: string; type: string }>;
434
+ /** Type-specific options */
435
+ options?: Record<string, any>;
436
+ /** Read-only mode */
437
+ readOnly?: boolean;
438
+ /** Callback when view config changes */
439
+ onChange?: string;
440
+ /** Callback when view is saved */
441
+ onSave?: string;
442
+ /** Callback when cancelled */
443
+ onCancel?: string;
444
+ }
445
+
446
+ // ============================================================================
447
+ // Multi-User Collaborative Editing
448
+ // ============================================================================
449
+
450
+ /** Collaboration user presence */
451
+ export interface CollaborationPresence {
452
+ /** User identifier */
453
+ userId: string;
454
+ /** User display name */
455
+ userName: string;
456
+ /** User avatar URL */
457
+ avatar?: string;
458
+ /** User cursor color */
459
+ color: string;
460
+ /** Current selection/cursor position */
461
+ cursor?: {
462
+ elementId?: string;
463
+ position?: { x: number; y: number };
464
+ };
465
+ /** User status */
466
+ status: 'active' | 'idle' | 'away';
467
+ /** Last activity timestamp */
468
+ lastActivity: string;
469
+ }
470
+
471
+ /** Collaboration operation for conflict resolution */
472
+ export interface CollaborationOperation {
473
+ /** Operation ID */
474
+ id: string;
475
+ /** User who performed the operation */
476
+ userId: string;
477
+ /** Operation type */
478
+ type: 'insert' | 'update' | 'delete' | 'move' | 'resize';
479
+ /** Target element ID */
480
+ elementId: string;
481
+ /** Operation data */
482
+ data: Record<string, unknown>;
483
+ /** Timestamp */
484
+ timestamp: string;
485
+ /** Operation version for OT */
486
+ version: number;
487
+ }
488
+
489
+ /** Collaborative editing configuration */
490
+ export interface CollaborationConfig {
491
+ /** Enable real-time collaboration */
492
+ enabled: boolean;
493
+ /** WebSocket server URL */
494
+ serverUrl?: string;
495
+ /** Room/document identifier */
496
+ roomId?: string;
497
+ /** Maximum concurrent users */
498
+ maxUsers?: number;
499
+ /** Show user cursors */
500
+ showCursors?: boolean;
501
+ /** Show user presence list */
502
+ showPresence?: boolean;
503
+ /** Conflict resolution strategy */
504
+ conflictResolution?: 'last-write-wins' | 'operational-transform' | 'crdt';
505
+ /** Auto-save interval in milliseconds */
506
+ autoSaveInterval?: number;
507
+ /** Version history enabled */
508
+ versionHistory?: boolean;
509
+ }
package/src/form.ts CHANGED
@@ -818,12 +818,46 @@ export interface FormField {
818
818
  * Conditional rendering
819
819
  */
820
820
  condition?: FieldCondition;
821
+ /**
822
+ * Custom widget/component name override.
823
+ * Aligns with @objectstack/spec FormField.widget.
824
+ * When set, the form renderer uses this widget type instead of auto-detecting.
825
+ * @example 'rich-text', 'code-editor', 'rating'
826
+ */
827
+ widget?: string;
828
+ /**
829
+ * Parent field name for cascading/dependent fields.
830
+ * Aligns with @objectstack/spec FormField.dependsOn.
831
+ * When the parent field value changes, this field is re-evaluated.
832
+ * @example 'country' (field 'state' dependsOn 'country')
833
+ */
834
+ dependsOn?: string;
835
+ /**
836
+ * Visibility condition expression.
837
+ * Aligns with @objectstack/spec FormField.visibleOn.
838
+ * When evaluated to false, the field is hidden.
839
+ * @example "${data.role === 'admin'}"
840
+ */
841
+ visibleOn?: string;
842
+ /**
843
+ * Whether the field is hidden.
844
+ * Aligns with @objectstack/spec FormField.hidden.
845
+ * @default false
846
+ */
847
+ hidden?: boolean;
848
+ /**
849
+ * Whether the field is read-only.
850
+ * Aligns with @objectstack/spec FormField.readonly.
851
+ * @default false
852
+ */
853
+ readonly?: boolean;
821
854
  /**
822
855
  * Additional field-specific props
823
856
  */
824
857
  [key: string]: any;
825
858
  /**
826
- * Column span for grid layouts
859
+ * Column span for grid layouts (1-4).
860
+ * Aligns with @objectstack/spec FormField.colSpan.
827
861
  * @default 1
828
862
  */
829
863
  colSpan?: number;