@object-ui/types 0.3.0 → 0.5.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 (169) hide show
  1. package/README.md +19 -11
  2. package/dist/api-types.d.ts +7 -0
  3. package/dist/api-types.d.ts.map +1 -1
  4. package/dist/api-types.js +4 -6
  5. package/dist/app.d.ts +17 -0
  6. package/dist/app.d.ts.map +1 -1
  7. package/dist/app.js +4 -3
  8. package/dist/base.d.ts +7 -0
  9. package/dist/base.d.ts.map +1 -1
  10. package/dist/base.js +4 -6
  11. package/dist/blocks.d.ts +332 -0
  12. package/dist/blocks.d.ts.map +1 -0
  13. package/dist/blocks.js +8 -0
  14. package/dist/complex.d.ts +68 -1
  15. package/dist/complex.d.ts.map +1 -1
  16. package/dist/complex.js +4 -5
  17. package/dist/crud.d.ts +181 -3
  18. package/dist/crud.d.ts.map +1 -1
  19. package/dist/crud.js +4 -6
  20. package/dist/data-display.d.ts +54 -2
  21. package/dist/data-display.d.ts.map +1 -1
  22. package/dist/data-display.js +4 -5
  23. package/dist/data-protocol.d.ts +1268 -0
  24. package/dist/data-protocol.d.ts.map +1 -0
  25. package/dist/data-protocol.js +8 -0
  26. package/dist/data.d.ts +22 -1
  27. package/dist/data.d.ts.map +1 -1
  28. package/dist/data.js +4 -6
  29. package/dist/disclosure.d.ts +70 -1
  30. package/dist/disclosure.d.ts.map +1 -1
  31. package/dist/disclosure.js +4 -5
  32. package/dist/feedback.d.ts +68 -1
  33. package/dist/feedback.d.ts.map +1 -1
  34. package/dist/feedback.js +4 -5
  35. package/dist/field-types.d.ts +728 -0
  36. package/dist/field-types.d.ts.map +1 -0
  37. package/dist/field-types.js +8 -0
  38. package/dist/form.d.ts +123 -1
  39. package/dist/form.d.ts.map +1 -1
  40. package/dist/form.js +4 -5
  41. package/dist/index.d.ts +48 -13
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +4 -37
  44. package/dist/layout.d.ts +66 -16
  45. package/dist/layout.d.ts.map +1 -1
  46. package/dist/layout.js +4 -6
  47. package/dist/navigation.d.ts +102 -2
  48. package/dist/navigation.d.ts.map +1 -1
  49. package/dist/navigation.js +4 -5
  50. package/dist/objectql.d.ts +491 -54
  51. package/dist/objectql.d.ts.map +1 -1
  52. package/dist/objectql.js +4 -6
  53. package/dist/overlay.d.ts +31 -1
  54. package/dist/overlay.d.ts.map +1 -1
  55. package/dist/overlay.js +4 -5
  56. package/dist/plugin-scope.d.ts +194 -0
  57. package/dist/plugin-scope.d.ts.map +1 -0
  58. package/dist/plugin-scope.js +8 -0
  59. package/dist/registry.d.ts +7 -0
  60. package/dist/registry.d.ts.map +1 -1
  61. package/dist/registry.js +7 -0
  62. package/dist/reports.d.ts +336 -0
  63. package/dist/reports.d.ts.map +1 -0
  64. package/dist/reports.js +8 -0
  65. package/dist/theme.d.ts +289 -0
  66. package/dist/theme.d.ts.map +1 -0
  67. package/dist/theme.js +8 -0
  68. package/dist/ui-action.d.ts +175 -0
  69. package/dist/ui-action.d.ts.map +1 -0
  70. package/dist/ui-action.js +8 -0
  71. package/dist/views.d.ts +417 -0
  72. package/dist/views.d.ts.map +1 -0
  73. package/dist/views.js +8 -0
  74. package/dist/zod/app.zod.d.ts +120 -0
  75. package/dist/zod/app.zod.d.ts.map +1 -0
  76. package/dist/zod/app.zod.js +60 -0
  77. package/dist/zod/base.zod.d.ts +202 -0
  78. package/dist/zod/base.zod.d.ts.map +1 -0
  79. package/dist/zod/base.zod.js +198 -0
  80. package/dist/zod/blocks.zod.d.ts +834 -0
  81. package/dist/zod/blocks.zod.d.ts.map +1 -0
  82. package/dist/zod/blocks.zod.js +145 -0
  83. package/dist/zod/complex.zod.d.ts +742 -0
  84. package/dist/zod/complex.zod.d.ts.map +1 -0
  85. package/dist/zod/complex.zod.js +233 -0
  86. package/dist/zod/crud.zod.d.ts +598 -0
  87. package/dist/zod/crud.zod.d.ts.map +1 -0
  88. package/dist/zod/crud.zod.js +230 -0
  89. package/dist/zod/data-display.zod.d.ts +996 -0
  90. package/dist/zod/data-display.zod.d.ts.map +1 -0
  91. package/dist/zod/data-display.zod.js +266 -0
  92. package/dist/zod/disclosure.zod.d.ts +267 -0
  93. package/dist/zod/disclosure.zod.d.ts.map +1 -0
  94. package/dist/zod/disclosure.zod.js +84 -0
  95. package/dist/zod/feedback.zod.d.ts +538 -0
  96. package/dist/zod/feedback.zod.d.ts.map +1 -0
  97. package/dist/zod/feedback.zod.js +127 -0
  98. package/dist/zod/form.zod.d.ts +1308 -0
  99. package/dist/zod/form.zod.d.ts.map +1 -0
  100. package/dist/zod/form.zod.js +406 -0
  101. package/dist/zod/index.zod.d.ts +4985 -0
  102. package/dist/zod/index.zod.d.ts.map +1 -0
  103. package/dist/zod/index.zod.js +183 -0
  104. package/dist/zod/layout.zod.d.ts +1048 -0
  105. package/dist/zod/layout.zod.d.ts.map +1 -0
  106. package/dist/zod/layout.zod.js +241 -0
  107. package/dist/zod/navigation.zod.d.ts +486 -0
  108. package/dist/zod/navigation.zod.d.ts.map +1 -0
  109. package/dist/zod/navigation.zod.js +142 -0
  110. package/dist/zod/objectql.zod.d.ts +1261 -0
  111. package/dist/zod/objectql.zod.d.ts.map +1 -0
  112. package/dist/zod/objectql.zod.js +248 -0
  113. package/dist/zod/overlay.zod.d.ts +691 -0
  114. package/dist/zod/overlay.zod.d.ts.map +1 -0
  115. package/dist/zod/overlay.zod.js +179 -0
  116. package/dist/zod/reports.zod.d.ts +1628 -0
  117. package/dist/zod/reports.zod.d.ts.map +1 -0
  118. package/dist/zod/reports.zod.js +152 -0
  119. package/dist/zod/theme.zod.d.ts +611 -0
  120. package/dist/zod/theme.zod.d.ts.map +1 -0
  121. package/dist/zod/theme.zod.js +130 -0
  122. package/dist/zod/views.zod.d.ts +675 -0
  123. package/dist/zod/views.zod.d.ts.map +1 -0
  124. package/dist/zod/views.zod.js +159 -0
  125. package/package.json +9 -1
  126. package/src/__tests__/namespace-exports.test.ts +80 -0
  127. package/src/__tests__/phase2-schemas.test.ts +639 -0
  128. package/src/api-types.ts +8 -0
  129. package/src/app.ts +20 -0
  130. package/src/base.ts +8 -0
  131. package/src/blocks.ts +405 -0
  132. package/src/complex.ts +69 -1
  133. package/src/crud.ts +185 -3
  134. package/src/data-display.ts +60 -2
  135. package/src/data-protocol.ts +1679 -0
  136. package/src/data.ts +21 -1
  137. package/src/disclosure.ts +74 -1
  138. package/src/feedback.ts +76 -2
  139. package/src/field-types.ts +846 -0
  140. package/src/form.ts +131 -1
  141. package/src/index.ts +305 -8
  142. package/src/layout.ts +70 -15
  143. package/src/navigation.ts +109 -2
  144. package/src/objectql.ts +563 -59
  145. package/src/overlay.ts +35 -1
  146. package/src/plugin-scope.ts +210 -0
  147. package/src/registry.ts +8 -0
  148. package/src/reports.ts +408 -0
  149. package/src/theme.ts +351 -0
  150. package/src/ui-action.ts +276 -0
  151. package/src/views.ts +429 -0
  152. package/src/zod/README.md +329 -0
  153. package/src/zod/app.zod.ts +72 -0
  154. package/src/zod/base.zod.ts +229 -0
  155. package/src/zod/blocks.zod.ts +170 -0
  156. package/src/zod/complex.zod.ts +258 -0
  157. package/src/zod/crud.zod.ts +259 -0
  158. package/src/zod/data-display.zod.ts +290 -0
  159. package/src/zod/disclosure.zod.ts +92 -0
  160. package/src/zod/feedback.zod.ts +138 -0
  161. package/src/zod/form.zod.ts +434 -0
  162. package/src/zod/index.zod.ts +425 -0
  163. package/src/zod/layout.zod.ts +262 -0
  164. package/src/zod/navigation.zod.ts +159 -0
  165. package/src/zod/objectql.zod.ts +268 -0
  166. package/src/zod/overlay.zod.ts +196 -0
  167. package/src/zod/reports.zod.ts +183 -0
  168. package/src/zod/theme.zod.ts +155 -0
  169. package/src/zod/views.zod.ts +182 -0
package/src/objectql.ts CHANGED
@@ -1,9 +1,19 @@
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
+
1
9
  /**
2
10
  * @object-ui/types - ObjectQL Component Schemas
3
11
  *
4
12
  * Type definitions for ObjectQL-specific components.
5
13
  * These schemas enable building ObjectQL-aware interfaces directly from object metadata.
6
14
  *
15
+ * Now aligned with @objectstack/spec view.zod schema for better interoperability.
16
+ *
7
17
  * @module objectql
8
18
  * @packageDocumentation
9
19
  */
@@ -13,42 +23,346 @@ import type { TableColumn } from './data-display';
13
23
  import type { FormField } from './form';
14
24
 
15
25
  /**
16
- * ObjectTable Schema
17
- * A specialized table component that automatically fetches and displays data from ObjectQL objects.
18
- * It reads the object schema from ObjectQL and generates columns automatically.
26
+ * HTTP Method for API requests
27
+ */
28
+ export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
29
+
30
+ /**
31
+ * HTTP Request Configuration for API Provider
32
+ * Aligned with @objectstack/spec HttpRequestSchema
33
+ */
34
+ export interface HttpRequest {
35
+ /** API endpoint URL */
36
+ url: string;
37
+ /** HTTP method (default: GET) */
38
+ method?: HttpMethod;
39
+ /** Custom HTTP headers */
40
+ headers?: Record<string, string>;
41
+ /** Query parameters */
42
+ params?: Record<string, unknown>;
43
+ /** Request body for POST/PUT/PATCH - supports JSON objects, strings, FormData, or Blob */
44
+ body?: Record<string, unknown> | string | FormData | Blob;
45
+ }
46
+
47
+ /**
48
+ * View Data Source Configuration
49
+ * Aligned with @objectstack/spec ViewDataSchema
50
+ *
51
+ * Supports three modes:
52
+ * 1. 'object': Standard Protocol - Auto-connects to ObjectStack Metadata and Data APIs
53
+ * 2. 'api': Custom API - Explicitly provided API URLs
54
+ * 3. 'value': Static Data - Hardcoded data array
19
55
  */
20
- export interface ObjectTableSchema extends BaseSchema {
21
- type: 'object-table';
56
+ export type ViewData =
57
+ | {
58
+ provider: 'object';
59
+ /** Target object name */
60
+ object: string;
61
+ }
62
+ | {
63
+ provider: 'api';
64
+ /** Configuration for fetching data */
65
+ read?: HttpRequest;
66
+ /** Configuration for submitting data (for forms/editable tables) */
67
+ write?: HttpRequest;
68
+ }
69
+ | {
70
+ provider: 'value';
71
+ /** Static data array */
72
+ items: unknown[];
73
+ };
74
+
75
+ /**
76
+ * List Column Configuration
77
+ * Enhanced version aligned with @objectstack/spec ListColumnSchema
78
+ */
79
+ export interface ListColumn {
80
+ /** Field name (snake_case) */
81
+ field: string;
82
+ /** Display label override */
83
+ label?: string;
84
+ /** Column width in pixels */
85
+ width?: number;
86
+ /** Text alignment */
87
+ align?: 'left' | 'center' | 'right';
88
+ /** Hide column by default */
89
+ hidden?: boolean;
90
+ /** Allow sorting by this column */
91
+ sortable?: boolean;
92
+ /** Allow resizing this column */
93
+ resizable?: boolean;
94
+ /** Allow text wrapping */
95
+ wrap?: boolean;
96
+ /** Renderer type override (e.g., "currency", "date") */
97
+ type?: string;
98
+ }
99
+
100
+ /**
101
+ * Selection Configuration
102
+ * Aligned with @objectstack/spec SelectionConfigSchema
103
+ */
104
+ export interface SelectionConfig {
105
+ /** Selection mode */
106
+ type?: 'none' | 'single' | 'multiple';
107
+ }
108
+
109
+ /**
110
+ * Pagination Configuration
111
+ * Aligned with @objectstack/spec PaginationConfigSchema
112
+ */
113
+ export interface PaginationConfig {
114
+ /** Number of records per page (default: 25) */
115
+ pageSize?: number;
116
+ /** Available page size options */
117
+ pageSizeOptions?: number[];
118
+ }
119
+
120
+ /**
121
+ * Kanban Configuration
122
+ * Aligned with @objectstack/spec KanbanConfigSchema
123
+ */
124
+ export interface KanbanConfig {
125
+ /** Field to group columns by (usually status/select) */
126
+ groupByField: string;
127
+ /** Field to sum at top of column (e.g. amount) */
128
+ summarizeField?: string;
129
+ /** Fields to show on cards */
130
+ columns: string[];
131
+ }
132
+
133
+ /**
134
+ * Calendar Configuration
135
+ * Aligned with @objectstack/spec CalendarConfigSchema
136
+ */
137
+ export interface CalendarConfig {
138
+ /** Start date field */
139
+ startDateField: string;
140
+ /** End date field */
141
+ endDateField?: string;
142
+ /** Title field */
143
+ titleField: string;
144
+ /** Color field */
145
+ colorField?: string;
146
+ }
147
+
148
+ /**
149
+ * Gantt Configuration
150
+ * Aligned with @objectstack/spec GanttConfigSchema
151
+ */
152
+ export interface GanttConfig {
153
+ /** Start date field */
154
+ startDateField: string;
155
+ /** End date field */
156
+ endDateField: string;
157
+ /** Title field */
158
+ titleField: string;
159
+ /** Progress field (0-100) */
160
+ progressField?: string;
161
+ /** Dependencies field */
162
+ dependenciesField?: string;
163
+ /** Color field */
164
+ colorField?: string;
165
+ }
166
+
167
+ /**
168
+ * Sort Configuration
169
+ */
170
+ export interface SortConfig {
171
+ /** Field to sort by */
172
+ field: string;
173
+ /** Sort order */
174
+ order: 'asc' | 'desc';
175
+ }
176
+
177
+ /**
178
+ * ObjectGrid Schema
179
+ * A specialized grid component that automatically fetches and displays data from ObjectQL objects.
180
+ * Implements the grid view type from @objectstack/spec view.zod ListView schema.
181
+ *
182
+ * Features:
183
+ * - Traditional table/grid with CRUD operations
184
+ * - Search, filters, pagination
185
+ * - Column resizing, sorting
186
+ * - Row selection
187
+ * - Inline editing support
188
+ */
189
+ export interface ObjectGridSchema extends BaseSchema {
190
+ type: 'object-grid';
191
+
192
+ /**
193
+ * Internal name for the view
194
+ */
195
+ name?: string;
196
+
197
+ /**
198
+ * Display label override
199
+ */
200
+ label?: string;
22
201
 
23
202
  /**
24
203
  * ObjectQL object name (e.g., 'users', 'accounts', 'contacts')
204
+ * Used when data provider is 'object' or not specified
25
205
  */
26
206
  objectName: string;
27
207
 
28
208
  /**
29
- * Optional title for the table
209
+ * Data Source Configuration
210
+ * Aligned with @objectstack/spec ViewDataSchema
211
+ * If not provided, defaults to { provider: 'object', object: objectName }
30
212
  */
31
- title?: string;
213
+ data?: ViewData;
32
214
 
33
215
  /**
34
- * Optional description
216
+ * Columns Configuration
217
+ * Can be either:
218
+ * - Array of field names (simple): ['name', 'email', 'status']
219
+ * - Array of ListColumn objects (enhanced): [{ field: 'name', label: 'Full Name', width: 200 }]
35
220
  */
36
- description?: string;
221
+ columns?: string[] | ListColumn[];
222
+
223
+ /**
224
+ * Filter criteria (JSON Rules format)
225
+ * Array-based filter configuration
226
+ */
227
+ filter?: any[];
228
+
229
+ /**
230
+ * Sort Configuration
231
+ * Can be either:
232
+ * - Legacy string format: "name desc"
233
+ * - Array of sort configs: [{ field: 'name', order: 'desc' }]
234
+ */
235
+ sort?: string | SortConfig[];
236
+
237
+ /**
238
+ * Fields enabled for search
239
+ * Defines which fields are searchable when using the search box
240
+ */
241
+ searchableFields?: string[];
242
+
243
+ /**
244
+ * Enable column resizing
245
+ * Allows users to drag column borders to resize
246
+ */
247
+ resizable?: boolean;
248
+
249
+ /**
250
+ * Enable column reordering
251
+ * Allows users to drag columns to reorder
252
+ */
253
+ reorderableColumns?: boolean;
37
254
 
38
255
  /**
39
- * Field names to display as columns
40
- * If not specified, uses all visible fields from object schema
256
+ * Striped row styling
257
+ * Alternating row background colors
258
+ */
259
+ striped?: boolean;
260
+
261
+ /**
262
+ * Show borders
263
+ * Display borders around cells
264
+ */
265
+ bordered?: boolean;
266
+
267
+ /**
268
+ * Row Selection Configuration
269
+ * Aligned with @objectstack/spec SelectionConfigSchema
270
+ */
271
+ selection?: SelectionConfig;
272
+
273
+ /**
274
+ * Pagination Configuration
275
+ * Aligned with @objectstack/spec PaginationConfigSchema
276
+ */
277
+ pagination?: PaginationConfig;
278
+
279
+ /**
280
+ * Custom CSS class
281
+ */
282
+ className?: string;
283
+
284
+ // ===== LEGACY FIELDS (for backward compatibility) =====
285
+ // These fields are deprecated but maintained for backward compatibility
286
+ // They will be mapped to the new structure internally
287
+
288
+ /**
289
+ * @deprecated Use columns instead
290
+ * Legacy field names to display
41
291
  */
42
292
  fields?: string[];
43
293
 
44
294
  /**
45
- * Custom column configurations
46
- * Overrides auto-generated columns for specific fields
295
+ * @deprecated Use data with provider: 'value' instead
296
+ * Legacy inline data support
297
+ */
298
+ staticData?: any[];
299
+
300
+ /**
301
+ * @deprecated Use selection.type instead
302
+ * Legacy selection mode
303
+ */
304
+ selectable?: boolean | 'single' | 'multiple';
305
+
306
+ /**
307
+ * @deprecated Use pagination.pageSize instead
308
+ * Legacy page size
309
+ */
310
+ pageSize?: number;
311
+
312
+ /**
313
+ * @deprecated Use searchableFields instead
314
+ * Legacy search toggle
315
+ */
316
+ showSearch?: boolean;
317
+
318
+ /**
319
+ * @deprecated Use filter property instead
320
+ * Legacy filters toggle
321
+ */
322
+ showFilters?: boolean;
323
+
324
+ /**
325
+ * @deprecated Use pagination config instead
326
+ * Legacy pagination toggle
327
+ */
328
+ showPagination?: boolean;
329
+
330
+ /**
331
+ * @deprecated Use sort instead
332
+ * Legacy sort configuration
333
+ */
334
+ defaultSort?: {
335
+ field: string;
336
+ order: 'asc' | 'desc';
337
+ };
338
+
339
+ /**
340
+ * @deprecated Use filter instead
341
+ * Legacy default filters
342
+ */
343
+ defaultFilters?: Record<string, any>;
344
+
345
+ /**
346
+ * @deprecated Moved to top-level resizable
347
+ * Legacy resizable columns flag
47
348
  */
48
- columns?: TableColumn[];
349
+ resizableColumns?: boolean;
350
+
351
+ /**
352
+ * @deprecated Use label instead
353
+ * Legacy title field
354
+ */
355
+ title?: string;
356
+
357
+ /**
358
+ * @deprecated No direct replacement (consider using label with additional context)
359
+ * Legacy description field
360
+ */
361
+ description?: string;
49
362
 
50
363
  /**
51
364
  * Enable/disable built-in operations
365
+ * NOTE: This is ObjectUI-specific and not part of @objectstack/spec
52
366
  */
53
367
  operations?: {
54
368
  /**
@@ -89,62 +403,40 @@ export interface ObjectTableSchema extends BaseSchema {
89
403
  };
90
404
 
91
405
  /**
92
- * Default filters to apply
93
- */
94
- defaultFilters?: Record<string, any>;
95
-
96
- /**
97
- * Default sort configuration
406
+ * Custom row actions
407
+ * NOTE: This is ObjectUI-specific and not part of @objectstack/spec
98
408
  */
99
- defaultSort?: {
100
- field: string;
101
- order: 'asc' | 'desc';
102
- };
409
+ rowActions?: string[];
103
410
 
104
411
  /**
105
- * Page size
106
- * @default 10
412
+ * Custom batch actions
413
+ * NOTE: This is ObjectUI-specific and not part of @objectstack/spec
107
414
  */
108
- pageSize?: number;
415
+ batchActions?: string[];
109
416
 
110
417
  /**
111
- * Enable row selection
418
+ * Enable inline cell editing (Grid mode)
419
+ * When true, cells become editable on double-click or Enter key
420
+ * NOTE: This is ObjectUI-specific and not part of @objectstack/spec
112
421
  * @default false
113
422
  */
114
- selectable?: boolean | 'single' | 'multiple';
115
-
116
- /**
117
- * Show search box
118
- * @default true
119
- */
120
- showSearch?: boolean;
423
+ editable?: boolean;
121
424
 
122
425
  /**
123
- * Show filters
124
- * @default true
426
+ * Enable keyboard navigation (Grid mode)
427
+ * Arrow keys, Tab, Enter for cell navigation
428
+ * NOTE: This is ObjectUI-specific and not part of @objectstack/spec
429
+ * @default true when editable is true
125
430
  */
126
- showFilters?: boolean;
431
+ keyboardNavigation?: boolean;
127
432
 
128
433
  /**
129
- * Show pagination
130
- * @default true
434
+ * Number of columns to freeze (left-pin)
435
+ * Useful for keeping certain columns visible while scrolling
436
+ * NOTE: This is ObjectUI-specific and not part of @objectstack/spec
437
+ * @default 0
131
438
  */
132
- showPagination?: boolean;
133
-
134
- /**
135
- * Custom row actions
136
- */
137
- rowActions?: string[];
138
-
139
- /**
140
- * Custom batch actions
141
- */
142
- batchActions?: string[];
143
-
144
- /**
145
- * Custom CSS class
146
- */
147
- className?: string;
439
+ frozenColumns?: number;
148
440
  }
149
441
 
150
442
  /**
@@ -188,10 +480,18 @@ export interface ObjectFormSchema extends BaseSchema {
188
480
 
189
481
  /**
190
482
  * Custom field configurations
191
- * Overrides auto-generated fields for specific fields
483
+ * Overrides auto-generated fields for specific fields.
484
+ * When used with inline field definitions (without dataSource), this becomes the primary field source.
192
485
  */
193
486
  customFields?: FormField[];
194
487
 
488
+ /**
489
+ * Inline initial data for demo/static forms
490
+ * When provided along with customFields (or inline field definitions), the form can work without a data source.
491
+ * Useful for documentation examples and prototyping.
492
+ */
493
+ initialData?: Record<string, any>;
494
+
195
495
  /**
196
496
  * Field groups for organized layout
197
497
  */
@@ -293,9 +593,213 @@ export interface ObjectFormSchema extends BaseSchema {
293
593
  className?: string;
294
594
  }
295
595
 
596
+ /**
597
+ * ObjectView Schema
598
+ * A complete object management interface combining ObjectTable and ObjectForm.
599
+ * Provides list view with search, filters, and integrated create/edit dialogs.
600
+ */
601
+ export interface ObjectViewSchema extends BaseSchema {
602
+ type: 'object-view';
603
+
604
+ /**
605
+ * ObjectQL object name (e.g., 'users', 'accounts', 'contacts')
606
+ */
607
+ objectName: string;
608
+
609
+ /**
610
+ * Optional title for the view
611
+ */
612
+ title?: string;
613
+
614
+ /**
615
+ * Optional description
616
+ */
617
+ description?: string;
618
+
619
+ /**
620
+ * Layout mode for create/edit operations
621
+ * - drawer: Side drawer (default, recommended for forms)
622
+ * - modal: Center modal dialog
623
+ * - page: Navigate to separate page (requires onNavigate handler)
624
+ * @default 'drawer'
625
+ */
626
+ layout?: 'drawer' | 'modal' | 'page';
627
+
628
+ /**
629
+ * Table/Grid configuration
630
+ * Inherits from ObjectGridSchema
631
+ */
632
+ table?: Partial<Omit<ObjectGridSchema, 'type' | 'objectName'>>;
633
+
634
+ /**
635
+ * Form configuration
636
+ * Inherits from ObjectFormSchema
637
+ */
638
+ form?: Partial<Omit<ObjectFormSchema, 'type' | 'objectName' | 'mode'>>;
639
+
640
+ /**
641
+ * Show search box
642
+ * @default true
643
+ */
644
+ showSearch?: boolean;
645
+
646
+ /**
647
+ * Show filters
648
+ * @default true
649
+ */
650
+ showFilters?: boolean;
651
+
652
+ /**
653
+ * Show create button
654
+ * @default true
655
+ */
656
+ showCreate?: boolean;
657
+
658
+ /**
659
+ * Show refresh button
660
+ * @default true
661
+ */
662
+ showRefresh?: boolean;
663
+
664
+ /**
665
+ * Enable/disable built-in operations
666
+ */
667
+ operations?: {
668
+ create?: boolean;
669
+ read?: boolean;
670
+ update?: boolean;
671
+ delete?: boolean;
672
+ };
673
+
674
+ /**
675
+ * Callback when navigating to detail page (page layout mode)
676
+ */
677
+ onNavigate?: (recordId: string | number, mode: 'view' | 'edit') => void;
678
+
679
+ /**
680
+ * Custom CSS class
681
+ */
682
+ className?: string;
683
+ }
684
+
685
+ /**
686
+ * Generic View Definition
687
+ * Aligned with @objectstack/spec View/ListView
688
+ * Defines the data requirement, not just the visual component.
689
+ */
690
+ export interface ListViewSchema extends BaseSchema {
691
+ type: 'list-view';
692
+
693
+ /** Object Name */
694
+ objectName: string;
695
+
696
+ /** View Type (grid, kanban, etc) */
697
+ viewType?: 'grid' | 'kanban' | 'gallery' | 'calendar' | 'timeline' | 'gantt' | 'map';
698
+
699
+ /** Fields to fetch/display */
700
+ fields?: string[];
701
+
702
+ /** Filter conditions */
703
+ filters?: Array<any[] | string>; // placeholder for FilterCondition
704
+
705
+ /** Sort order */
706
+ sort?: Array<{ field: string; order: 'asc' | 'desc' }>;
707
+
708
+ /** Visual Component overrides */
709
+ options?: Record<string, any>;
710
+ }
711
+
712
+ /**
713
+ * Object Map Component Schema
714
+ */
715
+ export interface ObjectMapSchema extends BaseSchema {
716
+ type: 'object-map';
717
+ /** ObjectQL object name */
718
+ objectName: string;
719
+ /** Field containing location data (or lat/long pair) */
720
+ locationField?: string;
721
+ /** Field for marker title */
722
+ titleField?: string;
723
+ }
724
+
725
+ /**
726
+ * Object Gantt Component Schema
727
+ */
728
+ export interface ObjectGanttSchema extends BaseSchema {
729
+ type: 'object-gantt';
730
+ /** ObjectQL object name */
731
+ objectName: string;
732
+ /** Field for task start date */
733
+ startDateField?: string;
734
+ /** Field for task end date */
735
+ endDateField?: string;
736
+ /** Field for task title/name */
737
+ titleField?: string;
738
+ /** Field for task dependencies */
739
+ dependencyField?: string;
740
+ /** Field for progress (0-100) */
741
+ progressField?: string;
742
+ }
743
+
744
+ /**
745
+ * Object Calendar Component Schema
746
+ */
747
+ export interface ObjectCalendarSchema extends BaseSchema {
748
+ type: 'object-calendar';
749
+ /** ObjectQL object name */
750
+ objectName: string;
751
+ /** Field for event start */
752
+ startDateField?: string;
753
+ /** Field for event end */
754
+ endDateField?: string;
755
+ /** Field for event title */
756
+ titleField?: string;
757
+ /** Default view mode */
758
+ defaultView?: 'month' | 'week' | 'day' | 'agenda';
759
+ }
760
+
761
+ /**
762
+ * Object Kanban Component Schema
763
+ */
764
+ export interface ObjectKanbanSchema extends BaseSchema {
765
+ type: 'object-kanban';
766
+ /** ObjectQL object name */
767
+ objectName: string;
768
+ /** Field to group columns by (e.g. status) */
769
+ groupField: string;
770
+ /** Field for card title */
771
+ titleField?: string;
772
+ /** Fields to display on card */
773
+ cardFields?: string[];
774
+ }
775
+
776
+ /**
777
+ * Object Chart Component Schema
778
+ */
779
+ export interface ObjectChartSchema extends BaseSchema {
780
+ type: 'object-chart';
781
+ /** ObjectQL object name */
782
+ objectName: string;
783
+ /** Chart type */
784
+ chartType: 'bar' | 'line' | 'pie' | 'area' | 'scatter';
785
+ /** Field for X axis (categories) */
786
+ xAxisField: string;
787
+ /** Fields for Y axis (values) */
788
+ yAxisFields?: string[];
789
+ /** Aggregation function */
790
+ aggregation?: 'cardinality' | 'sum' | 'avg' | 'min' | 'max';
791
+ }
792
+
296
793
  /**
297
794
  * Union type of all ObjectQL component schemas
298
795
  */
299
796
  export type ObjectQLComponentSchema =
300
- | ObjectTableSchema
301
- | ObjectFormSchema;
797
+ | ObjectGridSchema
798
+ | ObjectFormSchema
799
+ | ObjectViewSchema
800
+ | ObjectMapSchema
801
+ | ObjectGanttSchema
802
+ | ObjectCalendarSchema
803
+ | ObjectKanbanSchema
804
+ | ObjectChartSchema
805
+ | ListViewSchema;