@object-ui/types 0.5.0 → 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.
- package/README.md +1 -1
- package/dist/ai.d.ts +376 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +8 -0
- package/dist/app.d.ts +2 -2
- package/dist/crud.d.ts +3 -0
- package/dist/crud.d.ts.map +1 -1
- package/dist/data-display.d.ts +35 -0
- package/dist/data-display.d.ts.map +1 -1
- package/dist/data-protocol.d.ts +19 -19
- package/dist/data.d.ts +68 -0
- package/dist/data.d.ts.map +1 -1
- package/dist/designer.d.ts +473 -0
- package/dist/designer.d.ts.map +1 -0
- package/dist/designer.js +8 -0
- package/dist/form.d.ts +35 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/index.d.ts +35 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -0
- package/dist/layout.d.ts +63 -8
- package/dist/layout.d.ts.map +1 -1
- package/dist/mobile.d.ts +186 -0
- package/dist/mobile.d.ts.map +1 -0
- package/dist/mobile.js +8 -0
- package/dist/objectql.d.ts +329 -88
- package/dist/objectql.d.ts.map +1 -1
- package/dist/permissions.d.ts +150 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +8 -0
- package/dist/tenant.d.ts +138 -0
- package/dist/tenant.d.ts.map +1 -0
- package/dist/tenant.js +8 -0
- package/dist/theme.d.ts +115 -224
- package/dist/theme.d.ts.map +1 -1
- package/dist/ui-action.d.ts +126 -11
- package/dist/ui-action.d.ts.map +1 -1
- package/dist/views.d.ts +10 -0
- package/dist/views.d.ts.map +1 -1
- package/dist/widget.d.ts +181 -0
- package/dist/widget.d.ts.map +1 -0
- package/dist/widget.js +8 -0
- package/dist/workflow.d.ts +340 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +8 -0
- package/dist/zod/complex.zod.d.ts +4 -4
- package/dist/zod/crud.zod.d.ts +5 -5
- package/dist/zod/feedback.zod.d.ts +10 -10
- package/dist/zod/form.zod.d.ts +4 -4
- package/dist/zod/index.zod.d.ts +323 -132
- package/dist/zod/index.zod.d.ts.map +1 -1
- package/dist/zod/index.zod.js +4 -4
- package/dist/zod/layout.zod.d.ts +132 -0
- package/dist/zod/layout.zod.d.ts.map +1 -1
- package/dist/zod/layout.zod.js +34 -0
- package/dist/zod/objectql.zod.d.ts +32 -16
- package/dist/zod/objectql.zod.d.ts.map +1 -1
- package/dist/zod/objectql.zod.js +8 -0
- package/dist/zod/reports.zod.d.ts +17 -17
- package/dist/zod/theme.zod.d.ts +947 -266
- package/dist/zod/theme.zod.d.ts.map +1 -1
- package/dist/zod/theme.zod.js +175 -45
- package/dist/zod/views.zod.d.ts +20 -20
- package/package.json +3 -2
- package/src/__tests__/namespace-exports.test.ts +24 -68
- package/src/__tests__/phase2-schemas.test.ts +8 -13
- package/src/ai.ts +454 -0
- package/src/app.ts +2 -2
- package/src/crud.ts +3 -0
- package/src/data-display.ts +31 -0
- package/src/data-protocol.ts +19 -19
- package/src/data.ts +81 -0
- package/src/designer.ts +509 -0
- package/src/form.ts +35 -1
- package/src/index.ts +220 -8
- package/src/layout.ts +66 -8
- package/src/mobile.ts +205 -0
- package/src/objectql.ts +403 -93
- package/src/permissions.ts +166 -0
- package/src/tenant.ts +153 -0
- package/src/theme.ts +147 -260
- package/src/ui-action.ts +166 -27
- package/src/views.ts +7 -0
- package/src/widget.ts +197 -0
- package/src/workflow.ts +409 -0
- package/src/zod/index.zod.ts +14 -3
- package/src/zod/layout.zod.ts +38 -0
- package/src/zod/objectql.zod.ts +8 -0
- package/src/zod/theme.zod.ts +189 -48
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
|
|
34
|
+
export type { HttpMethod } from '@objectstack/spec/ui';
|
|
29
35
|
|
|
30
36
|
/**
|
|
31
37
|
* HTTP Request Configuration for API Provider
|
|
32
|
-
*
|
|
38
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
33
39
|
*/
|
|
34
|
-
export
|
|
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
|
-
*
|
|
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
|
-
*
|
|
55
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
78
56
|
*/
|
|
79
|
-
export
|
|
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
|
-
*
|
|
61
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
103
62
|
*/
|
|
104
|
-
export
|
|
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
|
-
*
|
|
67
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
112
68
|
*/
|
|
113
|
-
export
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
*
|
|
83
|
+
* Canonical definition from @objectstack/spec/ui (KanbanConfigSchema).
|
|
123
84
|
*/
|
|
124
|
-
export
|
|
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
|
-
*
|
|
96
|
+
* Canonical definition from @objectstack/spec/ui (CalendarConfigSchema).
|
|
136
97
|
*/
|
|
137
|
-
export
|
|
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
|
-
*
|
|
111
|
+
* Canonical definition from @objectstack/spec/ui (GanttConfigSchema).
|
|
151
112
|
*/
|
|
152
|
-
export
|
|
113
|
+
export type GanttConfig = {
|
|
153
114
|
/** Start date field */
|
|
154
115
|
startDateField: string;
|
|
155
116
|
/** End date field */
|
|
@@ -162,7 +123,7 @@ export interface GanttConfig {
|
|
|
162
123
|
dependenciesField?: string;
|
|
163
124
|
/** Color field */
|
|
164
125
|
colorField?: string;
|
|
165
|
-
}
|
|
126
|
+
};
|
|
166
127
|
|
|
167
128
|
/**
|
|
168
129
|
* Sort Configuration
|
|
@@ -437,16 +398,96 @@ export interface ObjectGridSchema extends BaseSchema {
|
|
|
437
398
|
* @default 0
|
|
438
399
|
*/
|
|
439
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)[];
|
|
440
458
|
}
|
|
441
459
|
|
|
442
460
|
/**
|
|
443
461
|
* ObjectForm Schema
|
|
444
462
|
* A smart form component that generates forms from ObjectQL object schemas.
|
|
445
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)
|
|
446
472
|
*/
|
|
447
473
|
export interface ObjectFormSchema extends BaseSchema {
|
|
448
474
|
type: 'object-form';
|
|
449
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
|
+
|
|
450
491
|
/**
|
|
451
492
|
* ObjectQL object name (e.g., 'users', 'accounts', 'contacts')
|
|
452
493
|
*/
|
|
@@ -493,7 +534,14 @@ export interface ObjectFormSchema extends BaseSchema {
|
|
|
493
534
|
initialData?: Record<string, any>;
|
|
494
535
|
|
|
495
536
|
/**
|
|
496
|
-
*
|
|
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)
|
|
497
545
|
*/
|
|
498
546
|
groups?: Array<{
|
|
499
547
|
title?: string;
|
|
@@ -512,27 +560,56 @@ export interface ObjectFormSchema extends BaseSchema {
|
|
|
512
560
|
* - `inline` – compact inline layout, typically used in toolbars
|
|
513
561
|
* - `grid` – **experimental** grid layout
|
|
514
562
|
*
|
|
515
|
-
* Note: As of the current implementation, the underlying form renderer does not yet
|
|
516
|
-
* support a native `grid` layout and will internally treat `layout: "grid"` as
|
|
517
|
-
* `layout: "vertical"`. This value is exposed in the schema for forward compatibility,
|
|
518
|
-
* and behavior may change once grid support is implemented.
|
|
519
|
-
*
|
|
520
563
|
* @default 'vertical'
|
|
521
564
|
*/
|
|
522
565
|
layout?: 'vertical' | 'horizontal' | 'inline' | 'grid';
|
|
523
566
|
|
|
524
567
|
/**
|
|
525
568
|
* Grid columns (for grid layout).
|
|
526
|
-
*
|
|
527
|
-
* Intended number of columns when using a `grid` layout. Current renderers that do
|
|
528
|
-
* not implement true grid support may ignore this value and fall back to a vertical
|
|
529
|
-
* layout. When grid layout is supported, this value should control how many form
|
|
530
|
-
* fields are placed per row.
|
|
531
|
-
*
|
|
532
569
|
* @default 2
|
|
533
570
|
*/
|
|
534
571
|
columns?: number;
|
|
535
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
|
+
|
|
536
613
|
/**
|
|
537
614
|
* Show submit button
|
|
538
615
|
* @default true
|
|
@@ -591,6 +668,66 @@ export interface ObjectFormSchema extends BaseSchema {
|
|
|
591
668
|
* Custom CSS class
|
|
592
669
|
*/
|
|
593
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;
|
|
594
731
|
}
|
|
595
732
|
|
|
596
733
|
/**
|
|
@@ -625,6 +762,29 @@ export interface ObjectViewSchema extends BaseSchema {
|
|
|
625
762
|
*/
|
|
626
763
|
layout?: 'drawer' | 'modal' | 'page';
|
|
627
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
|
+
|
|
628
788
|
/**
|
|
629
789
|
* Table/Grid configuration
|
|
630
790
|
* Inherits from ObjectGridSchema
|
|
@@ -637,6 +797,16 @@ export interface ObjectViewSchema extends BaseSchema {
|
|
|
637
797
|
*/
|
|
638
798
|
form?: Partial<Omit<ObjectFormSchema, 'type' | 'objectName' | 'mode'>>;
|
|
639
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
|
+
|
|
640
810
|
/**
|
|
641
811
|
* Show search box
|
|
642
812
|
* @default true
|
|
@@ -661,6 +831,13 @@ export interface ObjectViewSchema extends BaseSchema {
|
|
|
661
831
|
*/
|
|
662
832
|
showRefresh?: boolean;
|
|
663
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
|
+
|
|
664
841
|
/**
|
|
665
842
|
* Enable/disable built-in operations
|
|
666
843
|
*/
|
|
@@ -682,30 +859,163 @@ export interface ObjectViewSchema extends BaseSchema {
|
|
|
682
859
|
className?: string;
|
|
683
860
|
}
|
|
684
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
|
+
|
|
685
917
|
/**
|
|
686
918
|
* Generic View Definition
|
|
687
|
-
* Aligned with @objectstack/spec View/ListView
|
|
919
|
+
* Aligned with @objectstack/spec View/ListView.
|
|
688
920
|
* Defines the data requirement, not just the visual component.
|
|
689
921
|
*/
|
|
690
922
|
export interface ListViewSchema extends BaseSchema {
|
|
691
923
|
type: 'list-view';
|
|
692
924
|
|
|
925
|
+
/** View name identifier */
|
|
926
|
+
name?: string;
|
|
927
|
+
|
|
928
|
+
/** View display label */
|
|
929
|
+
label?: string;
|
|
930
|
+
|
|
693
931
|
/** Object Name */
|
|
694
932
|
objectName: string;
|
|
695
933
|
|
|
696
|
-
/** View Type (grid, kanban, etc) */
|
|
934
|
+
/** View Type (grid, kanban, etc.) @default 'grid' */
|
|
697
935
|
viewType?: 'grid' | 'kanban' | 'gallery' | 'calendar' | 'timeline' | 'gantt' | 'map';
|
|
698
936
|
|
|
699
|
-
/**
|
|
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) */
|
|
700
953
|
fields?: string[];
|
|
701
954
|
|
|
702
955
|
/** Filter conditions */
|
|
703
|
-
filters?: Array<any[] | string>;
|
|
956
|
+
filters?: Array<any[] | string>;
|
|
704
957
|
|
|
705
958
|
/** Sort order */
|
|
706
959
|
sort?: Array<{ field: string; order: 'asc' | 'desc' }>;
|
|
707
960
|
|
|
708
|
-
/**
|
|
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) */
|
|
709
1019
|
options?: Record<string, any>;
|
|
710
1020
|
}
|
|
711
1021
|
|