@object-ui/types 0.3.1 → 2.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 (141) 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 +10 -0
  6. package/dist/app.d.ts.map +1 -1
  7. package/dist/blocks.d.ts +332 -0
  8. package/dist/blocks.d.ts.map +1 -0
  9. package/dist/blocks.js +8 -0
  10. package/dist/crud.d.ts +177 -3
  11. package/dist/crud.d.ts.map +1 -1
  12. package/dist/data-display.d.ts +35 -0
  13. package/dist/data-display.d.ts.map +1 -1
  14. package/dist/data-protocol.d.ts +1268 -0
  15. package/dist/data-protocol.d.ts.map +1 -0
  16. package/dist/data-protocol.js +8 -0
  17. package/dist/data.d.ts +74 -1
  18. package/dist/data.d.ts.map +1 -1
  19. package/dist/designer.d.ts +473 -0
  20. package/dist/designer.d.ts.map +1 -0
  21. package/dist/designer.js +8 -0
  22. package/dist/field-types.d.ts +353 -11
  23. package/dist/field-types.d.ts.map +1 -1
  24. package/dist/form.d.ts +35 -1
  25. package/dist/form.d.ts.map +1 -1
  26. package/dist/index.d.ts +58 -4
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +18 -0
  29. package/dist/layout.d.ts +63 -8
  30. package/dist/layout.d.ts.map +1 -1
  31. package/dist/mobile.d.ts +186 -0
  32. package/dist/mobile.d.ts.map +1 -0
  33. package/dist/mobile.js +8 -0
  34. package/dist/objectql.d.ts +337 -89
  35. package/dist/objectql.d.ts.map +1 -1
  36. package/dist/permissions.d.ts +150 -0
  37. package/dist/permissions.d.ts.map +1 -0
  38. package/dist/permissions.js +8 -0
  39. package/dist/plugin-scope.d.ts +194 -0
  40. package/dist/plugin-scope.d.ts.map +1 -0
  41. package/dist/plugin-scope.js +8 -0
  42. package/dist/reports.d.ts +336 -0
  43. package/dist/reports.d.ts.map +1 -0
  44. package/dist/reports.js +8 -0
  45. package/dist/tenant.d.ts +138 -0
  46. package/dist/tenant.d.ts.map +1 -0
  47. package/dist/tenant.js +8 -0
  48. package/dist/theme.d.ts +180 -0
  49. package/dist/theme.d.ts.map +1 -0
  50. package/dist/theme.js +8 -0
  51. package/dist/ui-action.d.ts +290 -0
  52. package/dist/ui-action.d.ts.map +1 -0
  53. package/dist/ui-action.js +8 -0
  54. package/dist/views.d.ts +427 -0
  55. package/dist/views.d.ts.map +1 -0
  56. package/dist/views.js +8 -0
  57. package/dist/widget.d.ts +181 -0
  58. package/dist/widget.d.ts.map +1 -0
  59. package/dist/widget.js +8 -0
  60. package/dist/workflow.d.ts +340 -0
  61. package/dist/workflow.d.ts.map +1 -0
  62. package/dist/workflow.js +8 -0
  63. package/dist/zod/app.zod.d.ts +120 -0
  64. package/dist/zod/app.zod.d.ts.map +1 -0
  65. package/dist/zod/app.zod.js +60 -0
  66. package/dist/zod/blocks.zod.d.ts +834 -0
  67. package/dist/zod/blocks.zod.d.ts.map +1 -0
  68. package/dist/zod/blocks.zod.js +145 -0
  69. package/dist/zod/complex.zod.d.ts +4 -4
  70. package/dist/zod/complex.zod.js +1 -1
  71. package/dist/zod/crud.zod.d.ts +598 -0
  72. package/dist/zod/crud.zod.d.ts.map +1 -0
  73. package/dist/zod/crud.zod.js +230 -0
  74. package/dist/zod/data-display.zod.js +1 -1
  75. package/dist/zod/disclosure.zod.js +1 -1
  76. package/dist/zod/feedback.zod.d.ts +10 -10
  77. package/dist/zod/feedback.zod.js +1 -1
  78. package/dist/zod/form.zod.d.ts +4 -4
  79. package/dist/zod/form.zod.js +1 -1
  80. package/dist/zod/index.zod.d.ts +2032 -30
  81. package/dist/zod/index.zod.d.ts.map +1 -1
  82. package/dist/zod/index.zod.js +96 -19
  83. package/dist/zod/layout.zod.d.ts +134 -2
  84. package/dist/zod/layout.zod.d.ts.map +1 -1
  85. package/dist/zod/layout.zod.js +35 -1
  86. package/dist/zod/navigation.zod.js +1 -1
  87. package/dist/zod/objectql.zod.d.ts +34 -18
  88. package/dist/zod/objectql.zod.d.ts.map +1 -1
  89. package/dist/zod/objectql.zod.js +9 -1
  90. package/dist/zod/overlay.zod.js +1 -1
  91. package/dist/zod/reports.zod.d.ts +1628 -0
  92. package/dist/zod/reports.zod.d.ts.map +1 -0
  93. package/dist/zod/reports.zod.js +152 -0
  94. package/dist/zod/theme.zod.d.ts +1292 -0
  95. package/dist/zod/theme.zod.d.ts.map +1 -0
  96. package/dist/zod/theme.zod.js +260 -0
  97. package/dist/zod/views.zod.d.ts +675 -0
  98. package/dist/zod/views.zod.d.ts.map +1 -0
  99. package/dist/zod/views.zod.js +159 -0
  100. package/package.json +3 -2
  101. package/src/__tests__/namespace-exports.test.ts +36 -0
  102. package/src/__tests__/phase2-schemas.test.ts +634 -0
  103. package/src/ai.ts +454 -0
  104. package/src/app.ts +12 -0
  105. package/src/blocks.ts +405 -0
  106. package/src/crud.ts +180 -3
  107. package/src/data-display.ts +31 -0
  108. package/src/data-protocol.ts +1679 -0
  109. package/src/data.ts +84 -1
  110. package/src/designer.ts +509 -0
  111. package/src/field-types.ts +392 -11
  112. package/src/form.ts +35 -1
  113. package/src/index.ts +426 -0
  114. package/src/layout.ts +66 -8
  115. package/src/mobile.ts +205 -0
  116. package/src/objectql.ts +412 -94
  117. package/src/permissions.ts +166 -0
  118. package/src/plugin-scope.ts +210 -0
  119. package/src/reports.ts +408 -0
  120. package/src/tenant.ts +153 -0
  121. package/src/theme.ts +238 -0
  122. package/src/ui-action.ts +415 -0
  123. package/src/views.ts +436 -0
  124. package/src/widget.ts +197 -0
  125. package/src/workflow.ts +409 -0
  126. package/src/zod/app.zod.ts +72 -0
  127. package/src/zod/blocks.zod.ts +170 -0
  128. package/src/zod/complex.zod.ts +1 -1
  129. package/src/zod/crud.zod.ts +259 -0
  130. package/src/zod/data-display.zod.ts +1 -1
  131. package/src/zod/disclosure.zod.ts +1 -1
  132. package/src/zod/feedback.zod.ts +1 -1
  133. package/src/zod/form.zod.ts +1 -1
  134. package/src/zod/index.zod.ts +178 -19
  135. package/src/zod/layout.zod.ts +39 -1
  136. package/src/zod/navigation.zod.ts +1 -1
  137. package/src/zod/objectql.zod.ts +9 -1
  138. package/src/zod/overlay.zod.ts +1 -1
  139. package/src/zod/reports.zod.ts +183 -0
  140. package/src/zod/theme.zod.ts +296 -0
  141. package/src/zod/views.zod.ts +182 -0
package/src/objectql.ts CHANGED
@@ -22,119 +22,80 @@ import type { BaseSchema } from './base';
22
22
  import type { TableColumn } from './data-display';
23
23
  import type { FormField } from './form';
24
24
 
25
+ // ============================================================================
26
+ // Spec-Canonical Types — imported from @objectstack/spec/ui
27
+ // Rule: "Never Redefine Types. ALWAYS import them."
28
+ // ============================================================================
29
+
25
30
  /**
26
31
  * HTTP Method for API requests
32
+ * Canonical definition from @objectstack/spec/ui.
27
33
  */
28
- export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
34
+ export type { HttpMethod } from '@objectstack/spec/ui';
29
35
 
30
36
  /**
31
37
  * HTTP Request Configuration for API Provider
32
- * Aligned with @objectstack/spec HttpRequestSchema
38
+ * Canonical definition from @objectstack/spec/ui.
33
39
  */
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
- }
40
+ export type { HttpRequest } from '@objectstack/spec/ui';
46
41
 
47
42
  /**
48
43
  * View Data Source Configuration
49
- * Aligned with @objectstack/spec ViewDataSchema
50
- *
44
+ * Canonical definition from @objectstack/spec/ui.
45
+ *
51
46
  * Supports three modes:
52
47
  * 1. 'object': Standard Protocol - Auto-connects to ObjectStack Metadata and Data APIs
53
48
  * 2. 'api': Custom API - Explicitly provided API URLs
54
49
  * 3. 'value': Static Data - Hardcoded data array
55
50
  */
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
- };
51
+ export type { ViewData } from '@objectstack/spec/ui';
74
52
 
75
53
  /**
76
54
  * List Column Configuration
77
- * Enhanced version aligned with @objectstack/spec ListColumnSchema
55
+ * Canonical definition from @objectstack/spec/ui.
78
56
  */
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
- }
57
+ export type { ListColumn } from '@objectstack/spec/ui';
99
58
 
100
59
  /**
101
60
  * Selection Configuration
102
- * Aligned with @objectstack/spec SelectionConfigSchema
61
+ * Canonical definition from @objectstack/spec/ui.
103
62
  */
104
- export interface SelectionConfig {
105
- /** Selection mode */
106
- type?: 'none' | 'single' | 'multiple';
107
- }
63
+ export type { SelectionConfig } from '@objectstack/spec/ui';
108
64
 
109
65
  /**
110
66
  * Pagination Configuration
111
- * Aligned with @objectstack/spec PaginationConfigSchema
67
+ * Canonical definition from @objectstack/spec/ui.
112
68
  */
113
- export interface PaginationConfig {
114
- /** Number of records per page (default: 25) */
115
- pageSize?: number;
116
- /** Available page size options */
117
- pageSizeOptions?: number[];
118
- }
69
+ export type { PaginationConfig } from '@objectstack/spec/ui';
70
+
71
+ // Import spec types for local use in interfaces below
72
+ import type {
73
+ HttpMethod,
74
+ HttpRequest,
75
+ ViewData,
76
+ ListColumn,
77
+ SelectionConfig,
78
+ PaginationConfig,
79
+ } from '@objectstack/spec/ui';
119
80
 
120
81
  /**
121
82
  * Kanban Configuration
122
- * Aligned with @objectstack/spec KanbanConfigSchema
83
+ * Canonical definition from @objectstack/spec/ui (KanbanConfigSchema).
123
84
  */
124
- export interface KanbanConfig {
85
+ export type KanbanConfig = {
125
86
  /** Field to group columns by (usually status/select) */
126
87
  groupByField: string;
127
88
  /** Field to sum at top of column (e.g. amount) */
128
89
  summarizeField?: string;
129
90
  /** Fields to show on cards */
130
91
  columns: string[];
131
- }
92
+ };
132
93
 
133
94
  /**
134
95
  * Calendar Configuration
135
- * Aligned with @objectstack/spec CalendarConfigSchema
96
+ * Canonical definition from @objectstack/spec/ui (CalendarConfigSchema).
136
97
  */
137
- export interface CalendarConfig {
98
+ export type CalendarConfig = {
138
99
  /** Start date field */
139
100
  startDateField: string;
140
101
  /** End date field */
@@ -143,13 +104,13 @@ export interface CalendarConfig {
143
104
  titleField: string;
144
105
  /** Color field */
145
106
  colorField?: string;
146
- }
107
+ };
147
108
 
148
109
  /**
149
110
  * Gantt Configuration
150
- * Aligned with @objectstack/spec GanttConfigSchema
111
+ * Canonical definition from @objectstack/spec/ui (GanttConfigSchema).
151
112
  */
152
- export interface GanttConfig {
113
+ export type GanttConfig = {
153
114
  /** Start date field */
154
115
  startDateField: string;
155
116
  /** End date field */
@@ -160,7 +121,9 @@ export interface GanttConfig {
160
121
  progressField?: string;
161
122
  /** Dependencies field */
162
123
  dependenciesField?: string;
163
- }
124
+ /** Color field */
125
+ colorField?: string;
126
+ };
164
127
 
165
128
  /**
166
129
  * Sort Configuration
@@ -243,6 +206,12 @@ export interface ObjectGridSchema extends BaseSchema {
243
206
  * Allows users to drag column borders to resize
244
207
  */
245
208
  resizable?: boolean;
209
+
210
+ /**
211
+ * Enable column reordering
212
+ * Allows users to drag columns to reorder
213
+ */
214
+ reorderableColumns?: boolean;
246
215
 
247
216
  /**
248
217
  * Striped row styling
@@ -429,16 +398,96 @@ export interface ObjectGridSchema extends BaseSchema {
429
398
  * @default 0
430
399
  */
431
400
  frozenColumns?: number;
401
+
402
+ /**
403
+ * Navigation configuration for row click behavior.
404
+ * Controls how record detail is displayed when a row is clicked.
405
+ * Aligned with @objectstack/spec ListView.navigation.
406
+ */
407
+ navigation?: ViewNavigationConfig;
408
+
409
+ /**
410
+ * Callback for page-level navigation (used by 'page' mode).
411
+ * Called with recordId and action ('view' | 'edit').
412
+ */
413
+ onNavigate?: (recordId: string | number, action?: string) => void;
414
+ }
415
+
416
+ /**
417
+ * Form Section Configuration
418
+ * Aligns with @objectstack/spec FormSection
419
+ */
420
+ export interface ObjectFormSection {
421
+ /**
422
+ * Section identifier
423
+ */
424
+ name?: string;
425
+
426
+ /**
427
+ * Section label
428
+ */
429
+ label?: string;
430
+
431
+ /**
432
+ * Section description
433
+ */
434
+ description?: string;
435
+
436
+ /**
437
+ * Whether the section can be collapsed
438
+ * @default false
439
+ */
440
+ collapsible?: boolean;
441
+
442
+ /**
443
+ * Whether the section is initially collapsed
444
+ * @default false
445
+ */
446
+ collapsed?: boolean;
447
+
448
+ /**
449
+ * Number of columns for field layout
450
+ * @default 1
451
+ */
452
+ columns?: 1 | 2 | 3 | 4;
453
+
454
+ /**
455
+ * Field names or inline field configurations for this section
456
+ */
457
+ fields: (string | FormField)[];
432
458
  }
433
459
 
434
460
  /**
435
461
  * ObjectForm Schema
436
462
  * A smart form component that generates forms from ObjectQL object schemas.
437
463
  * It automatically creates form fields based on object metadata.
464
+ *
465
+ * Supports multiple form variants aligned with @objectstack/spec FormView:
466
+ * - `simple` – Flat field list (default)
467
+ * - `tabbed` – Fields organized in tabs
468
+ * - `wizard` – Multi-step form with navigation
469
+ * - `split` – Side-by-side panels (reserved)
470
+ * - `drawer` – Slide-out form panel (reserved)
471
+ * - `modal` – Dialog-based form (reserved)
438
472
  */
439
473
  export interface ObjectFormSchema extends BaseSchema {
440
474
  type: 'object-form';
441
475
 
476
+ /**
477
+ * Form variant type.
478
+ * Aligns with @objectstack/spec FormView.type
479
+ *
480
+ * - `simple` – Standard flat form (default)
481
+ * - `tabbed` – Sections as tabs
482
+ * - `wizard` – Multi-step wizard with progress indicator
483
+ * - `split` – Side-by-side panel layout (reserved)
484
+ * - `drawer` – Slide-out form (reserved)
485
+ * - `modal` – Dialog form (reserved)
486
+ *
487
+ * @default 'simple'
488
+ */
489
+ formType?: 'simple' | 'tabbed' | 'wizard' | 'split' | 'drawer' | 'modal';
490
+
442
491
  /**
443
492
  * ObjectQL object name (e.g., 'users', 'accounts', 'contacts')
444
493
  */
@@ -485,7 +534,14 @@ export interface ObjectFormSchema extends BaseSchema {
485
534
  initialData?: Record<string, any>;
486
535
 
487
536
  /**
488
- * Field groups for organized layout
537
+ * Form sections for organized layout.
538
+ * Used by tabbed/wizard/simple forms to group fields.
539
+ * Aligns with @objectstack/spec FormView.sections
540
+ */
541
+ sections?: ObjectFormSection[];
542
+
543
+ /**
544
+ * Field groups for organized layout (legacy, prefer sections)
489
545
  */
490
546
  groups?: Array<{
491
547
  title?: string;
@@ -504,27 +560,56 @@ export interface ObjectFormSchema extends BaseSchema {
504
560
  * - `inline` – compact inline layout, typically used in toolbars
505
561
  * - `grid` – **experimental** grid layout
506
562
  *
507
- * Note: As of the current implementation, the underlying form renderer does not yet
508
- * support a native `grid` layout and will internally treat `layout: "grid"` as
509
- * `layout: "vertical"`. This value is exposed in the schema for forward compatibility,
510
- * and behavior may change once grid support is implemented.
511
- *
512
563
  * @default 'vertical'
513
564
  */
514
565
  layout?: 'vertical' | 'horizontal' | 'inline' | 'grid';
515
566
 
516
567
  /**
517
568
  * Grid columns (for grid layout).
518
- *
519
- * Intended number of columns when using a `grid` layout. Current renderers that do
520
- * not implement true grid support may ignore this value and fall back to a vertical
521
- * layout. When grid layout is supported, this value should control how many form
522
- * fields are placed per row.
523
- *
524
569
  * @default 2
525
570
  */
526
571
  columns?: number;
527
572
 
573
+ /**
574
+ * Default active tab (section name). Only used when formType is 'tabbed'.
575
+ */
576
+ defaultTab?: string;
577
+
578
+ /**
579
+ * Tab position. Only used when formType is 'tabbed'.
580
+ * @default 'top'
581
+ */
582
+ tabPosition?: 'top' | 'bottom' | 'left' | 'right';
583
+
584
+ /**
585
+ * Allow skipping steps. Only used when formType is 'wizard'.
586
+ * @default false
587
+ */
588
+ allowSkip?: boolean;
589
+
590
+ /**
591
+ * Show step indicator. Only used when formType is 'wizard'.
592
+ * @default true
593
+ */
594
+ showStepIndicator?: boolean;
595
+
596
+ /**
597
+ * Text for Next button. Only used when formType is 'wizard'.
598
+ * @default 'Next'
599
+ */
600
+ nextText?: string;
601
+
602
+ /**
603
+ * Text for Previous button. Only used when formType is 'wizard'.
604
+ * @default 'Back'
605
+ */
606
+ prevText?: string;
607
+
608
+ /**
609
+ * Called when wizard step changes. Only used when formType is 'wizard'.
610
+ */
611
+ onStepChange?: (step: number) => void;
612
+
528
613
  /**
529
614
  * Show submit button
530
615
  * @default true
@@ -583,6 +668,66 @@ export interface ObjectFormSchema extends BaseSchema {
583
668
  * Custom CSS class
584
669
  */
585
670
  className?: string;
671
+
672
+ // ─── Split Form Props ──────────────────────────────────
673
+
674
+ /**
675
+ * Split panel direction. Only used when formType is 'split'.
676
+ * @default 'horizontal'
677
+ */
678
+ splitDirection?: 'horizontal' | 'vertical';
679
+
680
+ /**
681
+ * Size of the left/top panel in the split layout (percentage 1-99).
682
+ * Only used when formType is 'split'.
683
+ * @default 50
684
+ */
685
+ splitSize?: number;
686
+
687
+ /**
688
+ * Whether the split panels can be resized. Only used when formType is 'split'.
689
+ * @default true
690
+ */
691
+ splitResizable?: boolean;
692
+
693
+ // ─── Drawer Form Props ─────────────────────────────────
694
+
695
+ /**
696
+ * Whether the drawer is open. Only used when formType is 'drawer'.
697
+ * @default true
698
+ */
699
+ open?: boolean;
700
+
701
+ /**
702
+ * Callback when open state changes. Only used when formType is 'drawer'.
703
+ */
704
+ onOpenChange?: (open: boolean) => void;
705
+
706
+ /**
707
+ * Drawer slide-in side. Only used when formType is 'drawer'.
708
+ * @default 'right'
709
+ */
710
+ drawerSide?: 'top' | 'bottom' | 'left' | 'right';
711
+
712
+ /**
713
+ * Drawer width (CSS value). Only used when formType is 'drawer'.
714
+ * @default '50%'
715
+ */
716
+ drawerWidth?: string;
717
+
718
+ // ─── Modal Form Props ──────────────────────────────────
719
+
720
+ /**
721
+ * Modal dialog size. Only used when formType is 'modal'.
722
+ * @default 'default'
723
+ */
724
+ modalSize?: 'sm' | 'default' | 'lg' | 'xl' | 'full';
725
+
726
+ /**
727
+ * Whether to show a close button in the modal header. Only used when formType is 'modal'.
728
+ * @default true
729
+ */
730
+ modalCloseButton?: boolean;
586
731
  }
587
732
 
588
733
  /**
@@ -617,6 +762,29 @@ export interface ObjectViewSchema extends BaseSchema {
617
762
  */
618
763
  layout?: 'drawer' | 'modal' | 'page';
619
764
 
765
+ /**
766
+ * Default list view type
767
+ * @default 'grid'
768
+ */
769
+ defaultViewType?: 'grid' | 'kanban' | 'gallery' | 'calendar' | 'timeline' | 'gantt' | 'map';
770
+
771
+ /**
772
+ * Named list views (e.g., "All Records", "My Records", "Active").
773
+ * Aligned with @objectstack/spec View.listViews.
774
+ */
775
+ listViews?: Record<string, NamedListView>;
776
+
777
+ /**
778
+ * Default named list view to display
779
+ */
780
+ defaultListView?: string;
781
+
782
+ /**
783
+ * Navigation config for row/item click behavior.
784
+ * Aligned with @objectstack/spec ListView.navigation.
785
+ */
786
+ navigation?: ViewNavigationConfig;
787
+
620
788
  /**
621
789
  * Table/Grid configuration
622
790
  * Inherits from ObjectGridSchema
@@ -629,6 +797,16 @@ export interface ObjectViewSchema extends BaseSchema {
629
797
  */
630
798
  form?: Partial<Omit<ObjectFormSchema, 'type' | 'objectName' | 'mode'>>;
631
799
 
800
+ /**
801
+ * Fields that support text search
802
+ */
803
+ searchableFields?: string[];
804
+
805
+ /**
806
+ * Fields available for the filter UI
807
+ */
808
+ filterableFields?: string[];
809
+
632
810
  /**
633
811
  * Show search box
634
812
  * @default true
@@ -653,6 +831,13 @@ export interface ObjectViewSchema extends BaseSchema {
653
831
  */
654
832
  showRefresh?: boolean;
655
833
 
834
+ /**
835
+ * Show view switcher (for multi-view)
836
+ * When false (default), view type is fixed at creation in ViewDesigner
837
+ * @default false
838
+ */
839
+ showViewSwitcher?: boolean;
840
+
656
841
  /**
657
842
  * Enable/disable built-in operations
658
843
  */
@@ -674,30 +859,163 @@ export interface ObjectViewSchema extends BaseSchema {
674
859
  className?: string;
675
860
  }
676
861
 
862
+ /**
863
+ * Named List View Definition
864
+ * Used in ObjectViewSchema.listViews for named views (e.g., "All", "My Records").
865
+ */
866
+ export interface NamedListView {
867
+ /** View display label */
868
+ label: string;
869
+
870
+ /** View type (grid, kanban, etc.) */
871
+ type?: 'grid' | 'kanban' | 'gallery' | 'calendar' | 'timeline' | 'gantt' | 'map';
872
+
873
+ /** Columns/fields to display */
874
+ columns?: string[];
875
+
876
+ /** Filter conditions */
877
+ filter?: any[];
878
+
879
+ /** Sort configuration */
880
+ sort?: Array<{ field: string; order: 'asc' | 'desc' }>;
881
+
882
+ /** Type-specific options (kanban groupField, calendar startDateField, etc.) */
883
+ options?: Record<string, any>;
884
+ }
885
+
886
+ /**
887
+ * Navigation configuration for row/item click behavior.
888
+ * Aligned with @objectstack/spec ListView.navigation.
889
+ */
890
+ export interface ViewNavigationConfig {
891
+ /**
892
+ * How to open the target view on interaction
893
+ * - page: Full page navigation
894
+ * - drawer: Slide-out panel
895
+ * - modal: Dialog overlay
896
+ * - split: Side-by-side panel
897
+ * - popover: Hover/click preview card
898
+ * - new_window: Open in new browser tab
899
+ * - none: No navigation on click
900
+ * @default 'page'
901
+ */
902
+ mode: 'page' | 'drawer' | 'modal' | 'split' | 'popover' | 'new_window' | 'none';
903
+
904
+ /** Target view/form config name */
905
+ view?: string;
906
+
907
+ /** Prevent default navigation behavior */
908
+ preventNavigation?: boolean;
909
+
910
+ /** Open in new tab (for page/new_window modes) */
911
+ openNewTab?: boolean;
912
+
913
+ /** Width for drawer/modal/split modes (e.g., '600px', '50%') */
914
+ width?: string | number;
915
+ }
916
+
677
917
  /**
678
918
  * Generic View Definition
679
- * Aligned with @objectstack/spec View/ListView
919
+ * Aligned with @objectstack/spec View/ListView.
680
920
  * Defines the data requirement, not just the visual component.
681
921
  */
682
922
  export interface ListViewSchema extends BaseSchema {
683
923
  type: 'list-view';
684
924
 
925
+ /** View name identifier */
926
+ name?: string;
927
+
928
+ /** View display label */
929
+ label?: string;
930
+
685
931
  /** Object Name */
686
932
  objectName: string;
687
933
 
688
- /** View Type (grid, kanban, etc) */
689
- viewType?: 'grid' | 'kanban' | 'calendar' | 'gantt' | 'map' | 'chart';
934
+ /** View Type (grid, kanban, etc.) @default 'grid' */
935
+ viewType?: 'grid' | 'kanban' | 'gallery' | 'calendar' | 'timeline' | 'gantt' | 'map';
690
936
 
691
- /** Fields to fetch/display */
937
+ /** Columns definition (string field names or full column config) */
938
+ columns?: string[] | Array<{
939
+ field: string;
940
+ label?: string;
941
+ width?: number | string;
942
+ align?: 'left' | 'center' | 'right';
943
+ hidden?: boolean;
944
+ sortable?: boolean;
945
+ resizable?: boolean;
946
+ wrap?: boolean;
947
+ type?: string;
948
+ link?: boolean;
949
+ action?: string;
950
+ }>;
951
+
952
+ /** Fields to fetch/display (alias for simple string[] columns) */
692
953
  fields?: string[];
693
954
 
694
955
  /** Filter conditions */
695
- filters?: Array<any[] | string>; // placeholder for FilterCondition
956
+ filters?: Array<any[] | string>;
696
957
 
697
958
  /** Sort order */
698
959
  sort?: Array<{ field: string; order: 'asc' | 'desc' }>;
699
960
 
700
- /** Visual Component overrides */
961
+ /** Fields that support text search */
962
+ searchableFields?: string[];
963
+
964
+ /** Fields available for filter UI */
965
+ filterableFields?: string[];
966
+
967
+ /** Row selection mode */
968
+ selection?: { type: 'none' | 'single' | 'multiple' };
969
+
970
+ /** Pagination configuration */
971
+ pagination?: { pageSize: number; pageSizeOptions?: number[] };
972
+
973
+ /** Allow column resizing @default false */
974
+ resizable?: boolean;
975
+
976
+ /** Show alternating row colors @default false */
977
+ striped?: boolean;
978
+
979
+ /** Show cell borders @default false */
980
+ bordered?: boolean;
981
+
982
+ /** Navigation config for row click behavior */
983
+ navigation?: ViewNavigationConfig;
984
+
985
+ /**
986
+ * Callback for page-level navigation (used by 'page' mode).
987
+ * Called with recordId and action ('view' | 'edit').
988
+ */
989
+ onNavigate?: (recordId: string | number, action?: string) => void;
990
+
991
+ /** Kanban-specific configuration */
992
+ kanban?: {
993
+ groupField: string;
994
+ titleField?: string;
995
+ cardFields?: string[];
996
+ [key: string]: any;
997
+ };
998
+
999
+ /** Calendar-specific configuration */
1000
+ calendar?: {
1001
+ startDateField: string;
1002
+ endDateField?: string;
1003
+ titleField?: string;
1004
+ defaultView?: 'month' | 'week' | 'day' | 'agenda';
1005
+ [key: string]: any;
1006
+ };
1007
+
1008
+ /** Gantt-specific configuration */
1009
+ gantt?: {
1010
+ startDateField: string;
1011
+ endDateField: string;
1012
+ titleField?: string;
1013
+ progressField?: string;
1014
+ dependenciesField?: string;
1015
+ [key: string]: any;
1016
+ };
1017
+
1018
+ /** Visual Component overrides (legacy, prefer typed configs above) */
701
1019
  options?: Record<string, any>;
702
1020
  }
703
1021