@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.
- package/README.md +19 -11
- package/dist/api-types.d.ts +7 -0
- package/dist/api-types.d.ts.map +1 -1
- package/dist/api-types.js +4 -6
- package/dist/app.d.ts +17 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +4 -3
- package/dist/base.d.ts +7 -0
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +4 -6
- package/dist/blocks.d.ts +332 -0
- package/dist/blocks.d.ts.map +1 -0
- package/dist/blocks.js +8 -0
- package/dist/complex.d.ts +68 -1
- package/dist/complex.d.ts.map +1 -1
- package/dist/complex.js +4 -5
- package/dist/crud.d.ts +181 -3
- package/dist/crud.d.ts.map +1 -1
- package/dist/crud.js +4 -6
- package/dist/data-display.d.ts +54 -2
- package/dist/data-display.d.ts.map +1 -1
- package/dist/data-display.js +4 -5
- package/dist/data-protocol.d.ts +1268 -0
- package/dist/data-protocol.d.ts.map +1 -0
- package/dist/data-protocol.js +8 -0
- package/dist/data.d.ts +22 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +4 -6
- package/dist/disclosure.d.ts +70 -1
- package/dist/disclosure.d.ts.map +1 -1
- package/dist/disclosure.js +4 -5
- package/dist/feedback.d.ts +68 -1
- package/dist/feedback.d.ts.map +1 -1
- package/dist/feedback.js +4 -5
- package/dist/field-types.d.ts +728 -0
- package/dist/field-types.d.ts.map +1 -0
- package/dist/field-types.js +8 -0
- package/dist/form.d.ts +123 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +4 -5
- package/dist/index.d.ts +48 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -37
- package/dist/layout.d.ts +66 -16
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +4 -6
- package/dist/navigation.d.ts +102 -2
- package/dist/navigation.d.ts.map +1 -1
- package/dist/navigation.js +4 -5
- package/dist/objectql.d.ts +491 -54
- package/dist/objectql.d.ts.map +1 -1
- package/dist/objectql.js +4 -6
- package/dist/overlay.d.ts +31 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +4 -5
- package/dist/plugin-scope.d.ts +194 -0
- package/dist/plugin-scope.d.ts.map +1 -0
- package/dist/plugin-scope.js +8 -0
- package/dist/registry.d.ts +7 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +7 -0
- package/dist/reports.d.ts +336 -0
- package/dist/reports.d.ts.map +1 -0
- package/dist/reports.js +8 -0
- package/dist/theme.d.ts +289 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +8 -0
- package/dist/ui-action.d.ts +175 -0
- package/dist/ui-action.d.ts.map +1 -0
- package/dist/ui-action.js +8 -0
- package/dist/views.d.ts +417 -0
- package/dist/views.d.ts.map +1 -0
- package/dist/views.js +8 -0
- package/dist/zod/app.zod.d.ts +120 -0
- package/dist/zod/app.zod.d.ts.map +1 -0
- package/dist/zod/app.zod.js +60 -0
- package/dist/zod/base.zod.d.ts +202 -0
- package/dist/zod/base.zod.d.ts.map +1 -0
- package/dist/zod/base.zod.js +198 -0
- package/dist/zod/blocks.zod.d.ts +834 -0
- package/dist/zod/blocks.zod.d.ts.map +1 -0
- package/dist/zod/blocks.zod.js +145 -0
- package/dist/zod/complex.zod.d.ts +742 -0
- package/dist/zod/complex.zod.d.ts.map +1 -0
- package/dist/zod/complex.zod.js +233 -0
- package/dist/zod/crud.zod.d.ts +598 -0
- package/dist/zod/crud.zod.d.ts.map +1 -0
- package/dist/zod/crud.zod.js +230 -0
- package/dist/zod/data-display.zod.d.ts +996 -0
- package/dist/zod/data-display.zod.d.ts.map +1 -0
- package/dist/zod/data-display.zod.js +266 -0
- package/dist/zod/disclosure.zod.d.ts +267 -0
- package/dist/zod/disclosure.zod.d.ts.map +1 -0
- package/dist/zod/disclosure.zod.js +84 -0
- package/dist/zod/feedback.zod.d.ts +538 -0
- package/dist/zod/feedback.zod.d.ts.map +1 -0
- package/dist/zod/feedback.zod.js +127 -0
- package/dist/zod/form.zod.d.ts +1308 -0
- package/dist/zod/form.zod.d.ts.map +1 -0
- package/dist/zod/form.zod.js +406 -0
- package/dist/zod/index.zod.d.ts +4985 -0
- package/dist/zod/index.zod.d.ts.map +1 -0
- package/dist/zod/index.zod.js +183 -0
- package/dist/zod/layout.zod.d.ts +1048 -0
- package/dist/zod/layout.zod.d.ts.map +1 -0
- package/dist/zod/layout.zod.js +241 -0
- package/dist/zod/navigation.zod.d.ts +486 -0
- package/dist/zod/navigation.zod.d.ts.map +1 -0
- package/dist/zod/navigation.zod.js +142 -0
- package/dist/zod/objectql.zod.d.ts +1261 -0
- package/dist/zod/objectql.zod.d.ts.map +1 -0
- package/dist/zod/objectql.zod.js +248 -0
- package/dist/zod/overlay.zod.d.ts +691 -0
- package/dist/zod/overlay.zod.d.ts.map +1 -0
- package/dist/zod/overlay.zod.js +179 -0
- package/dist/zod/reports.zod.d.ts +1628 -0
- package/dist/zod/reports.zod.d.ts.map +1 -0
- package/dist/zod/reports.zod.js +152 -0
- package/dist/zod/theme.zod.d.ts +611 -0
- package/dist/zod/theme.zod.d.ts.map +1 -0
- package/dist/zod/theme.zod.js +130 -0
- package/dist/zod/views.zod.d.ts +675 -0
- package/dist/zod/views.zod.d.ts.map +1 -0
- package/dist/zod/views.zod.js +159 -0
- package/package.json +9 -1
- package/src/__tests__/namespace-exports.test.ts +80 -0
- package/src/__tests__/phase2-schemas.test.ts +639 -0
- package/src/api-types.ts +8 -0
- package/src/app.ts +20 -0
- package/src/base.ts +8 -0
- package/src/blocks.ts +405 -0
- package/src/complex.ts +69 -1
- package/src/crud.ts +185 -3
- package/src/data-display.ts +60 -2
- package/src/data-protocol.ts +1679 -0
- package/src/data.ts +21 -1
- package/src/disclosure.ts +74 -1
- package/src/feedback.ts +76 -2
- package/src/field-types.ts +846 -0
- package/src/form.ts +131 -1
- package/src/index.ts +305 -8
- package/src/layout.ts +70 -15
- package/src/navigation.ts +109 -2
- package/src/objectql.ts +563 -59
- package/src/overlay.ts +35 -1
- package/src/plugin-scope.ts +210 -0
- package/src/registry.ts +8 -0
- package/src/reports.ts +408 -0
- package/src/theme.ts +351 -0
- package/src/ui-action.ts +276 -0
- package/src/views.ts +429 -0
- package/src/zod/README.md +329 -0
- package/src/zod/app.zod.ts +72 -0
- package/src/zod/base.zod.ts +229 -0
- package/src/zod/blocks.zod.ts +170 -0
- package/src/zod/complex.zod.ts +258 -0
- package/src/zod/crud.zod.ts +259 -0
- package/src/zod/data-display.zod.ts +290 -0
- package/src/zod/disclosure.zod.ts +92 -0
- package/src/zod/feedback.zod.ts +138 -0
- package/src/zod/form.zod.ts +434 -0
- package/src/zod/index.zod.ts +425 -0
- package/src/zod/layout.zod.ts +262 -0
- package/src/zod/navigation.zod.ts +159 -0
- package/src/zod/objectql.zod.ts +268 -0
- package/src/zod/overlay.zod.ts +196 -0
- package/src/zod/reports.zod.ts +183 -0
- package/src/zod/theme.zod.ts +155 -0
- package/src/zod/views.zod.ts +182 -0
|
@@ -0,0 +1,230 @@
|
|
|
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
|
+
* @object-ui/types/zod - CRUD Component Zod Validators
|
|
10
|
+
*
|
|
11
|
+
* Zod validation schemas for CRUD operations.
|
|
12
|
+
* Following @objectstack/spec UI specification format.
|
|
13
|
+
*
|
|
14
|
+
* Enhanced in Phase 2 with ajax, confirm, dialog actions, chaining, and conditional execution.
|
|
15
|
+
*
|
|
16
|
+
* @module zod/crud
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
19
|
+
import { z } from 'zod';
|
|
20
|
+
import { BaseSchema, SchemaNodeSchema } from './base.zod.js';
|
|
21
|
+
/**
|
|
22
|
+
* Action Execution Mode Schema
|
|
23
|
+
*/
|
|
24
|
+
export const ActionExecutionModeSchema = z.enum(['sequential', 'parallel']).describe('Action execution mode for chaining');
|
|
25
|
+
/**
|
|
26
|
+
* Action Callback Schema
|
|
27
|
+
*/
|
|
28
|
+
export const ActionCallbackSchema = z.object({
|
|
29
|
+
type: z.enum(['toast', 'message', 'redirect', 'reload', 'custom', 'ajax', 'dialog']).describe('Callback type'),
|
|
30
|
+
message: z.string().optional().describe('Message to display'),
|
|
31
|
+
url: z.string().optional().describe('Redirect URL'),
|
|
32
|
+
api: z.string().optional().describe('API endpoint for ajax callback'),
|
|
33
|
+
method: z.enum(['GET', 'POST', 'PUT', 'DELETE', 'PATCH']).optional().describe('HTTP method for ajax callback'),
|
|
34
|
+
dialog: SchemaNodeSchema.optional().describe('Dialog schema to open'),
|
|
35
|
+
handler: z.string().optional().describe('Custom callback handler expression'),
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Action Condition Schema
|
|
39
|
+
*/
|
|
40
|
+
export const ActionConditionSchema = z.lazy(() => z.object({
|
|
41
|
+
expression: z.string().describe('Condition expression'),
|
|
42
|
+
then: z.union([ActionSchema, z.array(ActionSchema)]).optional().describe('Action to execute if condition is true'),
|
|
43
|
+
else: z.union([ActionSchema, z.array(ActionSchema)]).optional().describe('Action to execute if condition is false'),
|
|
44
|
+
}));
|
|
45
|
+
/**
|
|
46
|
+
* Action Schema - Enhanced with Phase 2 features
|
|
47
|
+
*/
|
|
48
|
+
export const ActionSchema = z.lazy(() => BaseSchema.extend({
|
|
49
|
+
type: z.literal('action'),
|
|
50
|
+
label: z.string().describe('Action label'),
|
|
51
|
+
level: z.enum(['primary', 'secondary', 'success', 'warning', 'danger', 'info', 'default']).optional().default('default').describe('Action type/level'),
|
|
52
|
+
icon: z.string().optional().describe('Icon to display (lucide-react icon name)'),
|
|
53
|
+
variant: z.enum(['default', 'outline', 'ghost', 'link']).optional().describe('Action variant'),
|
|
54
|
+
disabled: z.boolean().optional().describe('Whether action is disabled'),
|
|
55
|
+
actionType: z.enum(['button', 'link', 'dropdown', 'ajax', 'confirm', 'dialog']).optional().describe('Action type'),
|
|
56
|
+
api: z.string().optional().describe('API endpoint to call (for ajax actions)'),
|
|
57
|
+
method: z.enum(['GET', 'POST', 'PUT', 'DELETE', 'PATCH']).optional().default('POST').describe('HTTP method'),
|
|
58
|
+
data: z.any().optional().describe('Request body/data'),
|
|
59
|
+
headers: z.record(z.string(), z.string()).optional().describe('Request headers'),
|
|
60
|
+
confirm: z.object({
|
|
61
|
+
title: z.string().optional().describe('Confirmation title'),
|
|
62
|
+
message: z.string().optional().describe('Confirmation message'),
|
|
63
|
+
confirmText: z.string().optional().describe('Confirm button text'),
|
|
64
|
+
cancelText: z.string().optional().describe('Cancel button text'),
|
|
65
|
+
confirmVariant: z.enum(['default', 'destructive', 'outline', 'secondary', 'ghost']).optional().describe('Confirm button variant'),
|
|
66
|
+
}).optional().describe('Confirmation dialog configuration (for confirm actions)'),
|
|
67
|
+
confirmText: z.string().optional().describe('Legacy confirmation message (deprecated - use confirm object instead)'),
|
|
68
|
+
dialog: z.object({
|
|
69
|
+
title: z.string().optional().describe('Dialog title'),
|
|
70
|
+
content: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Dialog content'),
|
|
71
|
+
size: z.enum(['sm', 'default', 'lg', 'xl', 'full']).optional().describe('Dialog size'),
|
|
72
|
+
actions: z.array(ActionSchema).optional().describe('Dialog actions'),
|
|
73
|
+
}).optional().describe('Dialog configuration (for dialog actions)'),
|
|
74
|
+
successMessage: z.string().optional().describe('Success message after execution'),
|
|
75
|
+
errorMessage: z.string().optional().describe('Error message on failure'),
|
|
76
|
+
onSuccess: ActionCallbackSchema.optional().describe('Success callback'),
|
|
77
|
+
onFailure: ActionCallbackSchema.optional().describe('Failure callback'),
|
|
78
|
+
chain: z.array(ActionSchema).optional().describe('Action chaining - actions to execute after this one'),
|
|
79
|
+
chainMode: ActionExecutionModeSchema.optional().default('sequential').describe('Chain execution mode'),
|
|
80
|
+
condition: ActionConditionSchema.optional().describe('Conditional execution'),
|
|
81
|
+
reload: z.boolean().optional().default(true).describe('Whether to reload data after action'),
|
|
82
|
+
close: z.boolean().optional().default(true).describe('Whether to close dialog/modal after action'),
|
|
83
|
+
onClick: z.any().optional().describe('Custom click handler'),
|
|
84
|
+
redirect: z.string().optional().describe('Redirect URL after success'),
|
|
85
|
+
tracking: z.object({
|
|
86
|
+
enabled: z.boolean().optional().describe('Enable tracking'),
|
|
87
|
+
event: z.string().optional().describe('Event name'),
|
|
88
|
+
metadata: z.record(z.string(), z.any()).optional().describe('Additional metadata'),
|
|
89
|
+
}).optional().describe('Action logging/tracking'),
|
|
90
|
+
timeout: z.number().optional().describe('Timeout in milliseconds'),
|
|
91
|
+
retry: z.object({
|
|
92
|
+
maxAttempts: z.number().optional().describe('Maximum retry attempts'),
|
|
93
|
+
delay: z.number().optional().describe('Delay between retries (in ms)'),
|
|
94
|
+
}).optional().describe('Retry configuration'),
|
|
95
|
+
}));
|
|
96
|
+
/**
|
|
97
|
+
* CRUD Operation Schema
|
|
98
|
+
*/
|
|
99
|
+
export const CRUDOperationSchema = z.object({
|
|
100
|
+
type: z.enum(['create', 'read', 'update', 'delete', 'export', 'import', 'custom']).describe('Operation type'),
|
|
101
|
+
label: z.string().optional().describe('Operation label'),
|
|
102
|
+
icon: z.string().optional().describe('Operation icon'),
|
|
103
|
+
enabled: z.boolean().optional().default(true).describe('Whether operation is enabled'),
|
|
104
|
+
api: z.string().optional().describe('API endpoint for this operation'),
|
|
105
|
+
method: z.enum(['GET', 'POST', 'PUT', 'DELETE', 'PATCH']).optional().describe('HTTP method'),
|
|
106
|
+
confirmText: z.string().optional().describe('Confirmation message'),
|
|
107
|
+
successMessage: z.string().optional().describe('Success message'),
|
|
108
|
+
visibleOn: z.string().optional().describe('Visibility condition'),
|
|
109
|
+
disabledOn: z.string().optional().describe('Disabled condition'),
|
|
110
|
+
});
|
|
111
|
+
/**
|
|
112
|
+
* CRUD Filter Schema
|
|
113
|
+
*/
|
|
114
|
+
export const CRUDFilterSchema = z.object({
|
|
115
|
+
name: z.string().describe('Filter name (field name)'),
|
|
116
|
+
label: z.string().optional().describe('Filter label'),
|
|
117
|
+
type: z.enum(['input', 'select', 'date-picker', 'date-range', 'number-range']).optional().describe('Filter type'),
|
|
118
|
+
operator: z.enum(['equals', 'contains', 'startsWith', 'endsWith', 'gt', 'gte', 'lt', 'lte', 'between', 'in']).optional().default('equals').describe('Filter operator'),
|
|
119
|
+
options: z.array(z.object({ label: z.string(), value: z.union([z.string(), z.number()]) })).optional().describe('Options for select filter'),
|
|
120
|
+
placeholder: z.string().optional().describe('Placeholder text'),
|
|
121
|
+
defaultValue: z.any().optional().describe('Default value'),
|
|
122
|
+
});
|
|
123
|
+
/**
|
|
124
|
+
* CRUD Toolbar Schema
|
|
125
|
+
*/
|
|
126
|
+
export const CRUDToolbarSchema = z.object({
|
|
127
|
+
showCreate: z.boolean().optional().default(true).describe('Show create button'),
|
|
128
|
+
showRefresh: z.boolean().optional().default(true).describe('Show refresh button'),
|
|
129
|
+
showExport: z.boolean().optional().default(false).describe('Show export button'),
|
|
130
|
+
showImport: z.boolean().optional().default(false).describe('Show import button'),
|
|
131
|
+
showFilter: z.boolean().optional().default(true).describe('Show filter toggle'),
|
|
132
|
+
showSearch: z.boolean().optional().default(true).describe('Show search box'),
|
|
133
|
+
actions: z.array(ActionSchema).optional().describe('Custom actions'),
|
|
134
|
+
});
|
|
135
|
+
/**
|
|
136
|
+
* CRUD Pagination Schema
|
|
137
|
+
*/
|
|
138
|
+
export const CRUDPaginationSchema = z.object({
|
|
139
|
+
enabled: z.boolean().optional().default(true).describe('Whether pagination is enabled'),
|
|
140
|
+
pageSize: z.number().optional().default(10).describe('Default page size'),
|
|
141
|
+
pageSizeOptions: z.array(z.number()).optional().default([10, 20, 50, 100]).describe('Page size options'),
|
|
142
|
+
showTotal: z.boolean().optional().default(true).describe('Show total count'),
|
|
143
|
+
showSizeChanger: z.boolean().optional().default(true).describe('Show page size selector'),
|
|
144
|
+
});
|
|
145
|
+
/**
|
|
146
|
+
* CRUD Schema
|
|
147
|
+
*/
|
|
148
|
+
export const CRUDSchema = BaseSchema.extend({
|
|
149
|
+
type: z.literal('crud'),
|
|
150
|
+
title: z.string().optional().describe('CRUD title'),
|
|
151
|
+
resource: z.string().optional().describe('Resource name (singular)'),
|
|
152
|
+
api: z.string().optional().describe('API endpoint for list/search'),
|
|
153
|
+
columns: z.array(z.any()).describe('Table columns configuration'),
|
|
154
|
+
fields: z.array(z.any()).optional().describe('Form fields for create/edit'),
|
|
155
|
+
operations: z.record(z.string(), z.union([z.boolean(), CRUDOperationSchema])).optional().describe('Enabled operations'),
|
|
156
|
+
toolbar: CRUDToolbarSchema.optional().describe('Toolbar configuration'),
|
|
157
|
+
filters: z.array(CRUDFilterSchema).optional().describe('Filter configuration'),
|
|
158
|
+
pagination: CRUDPaginationSchema.optional().describe('Pagination configuration'),
|
|
159
|
+
defaultSort: z.string().optional().describe('Default sort field'),
|
|
160
|
+
defaultSortOrder: z.enum(['asc', 'desc']).optional().default('asc').describe('Default sort order'),
|
|
161
|
+
selectable: z.union([z.boolean(), z.enum(['single', 'multiple'])]).optional().describe('Row selection mode'),
|
|
162
|
+
batchActions: z.array(ActionSchema).optional().describe('Batch actions for selected rows'),
|
|
163
|
+
rowActions: z.array(ActionSchema).optional().describe('Row actions (displayed in each row)'),
|
|
164
|
+
emptyState: SchemaNodeSchema.optional().describe('Custom empty state'),
|
|
165
|
+
loading: z.boolean().optional().default(true).describe('Whether to show loading state'),
|
|
166
|
+
loadingComponent: SchemaNodeSchema.optional().describe('Custom loading component'),
|
|
167
|
+
mode: z.enum(['table', 'grid', 'list', 'kanban']).optional().default('table').describe('Table layout mode'),
|
|
168
|
+
gridColumns: z.number().optional().default(3).describe('Grid columns (for grid mode)'),
|
|
169
|
+
cardTemplate: SchemaNodeSchema.optional().describe('Card template (for grid/list mode)'),
|
|
170
|
+
kanbanColumns: z.array(z.object({
|
|
171
|
+
id: z.string(),
|
|
172
|
+
title: z.string(),
|
|
173
|
+
color: z.string().optional(),
|
|
174
|
+
})).optional().describe('Kanban columns (for kanban mode)'),
|
|
175
|
+
kanbanGroupField: z.string().optional().describe('Kanban group field'),
|
|
176
|
+
});
|
|
177
|
+
/**
|
|
178
|
+
* Detail Schema
|
|
179
|
+
*/
|
|
180
|
+
export const DetailSchema = BaseSchema.extend({
|
|
181
|
+
type: z.literal('detail'),
|
|
182
|
+
title: z.string().optional().describe('Detail title'),
|
|
183
|
+
api: z.string().optional().describe('API endpoint to fetch detail data'),
|
|
184
|
+
resourceId: z.union([z.string(), z.number()]).optional().describe('Resource ID to display'),
|
|
185
|
+
groups: z.array(z.object({
|
|
186
|
+
title: z.string().optional(),
|
|
187
|
+
description: z.string().optional(),
|
|
188
|
+
fields: z.array(z.object({
|
|
189
|
+
name: z.string(),
|
|
190
|
+
label: z.string().optional(),
|
|
191
|
+
type: z.enum(['text', 'image', 'link', 'badge', 'date', 'datetime', 'json', 'html', 'custom']).optional(),
|
|
192
|
+
format: z.string().optional(),
|
|
193
|
+
render: SchemaNodeSchema.optional(),
|
|
194
|
+
})),
|
|
195
|
+
})).optional().describe('Field groups for organized display'),
|
|
196
|
+
actions: z.array(ActionSchema).optional().describe('Actions available in detail view'),
|
|
197
|
+
tabs: z.array(z.object({
|
|
198
|
+
key: z.string(),
|
|
199
|
+
label: z.string(),
|
|
200
|
+
content: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]),
|
|
201
|
+
})).optional().describe('Tabs for additional content'),
|
|
202
|
+
showBack: z.boolean().optional().default(true).describe('Show back button'),
|
|
203
|
+
onBack: z.any().optional().describe('Custom back action'),
|
|
204
|
+
loading: z.boolean().optional().default(true).describe('Whether to show loading state'),
|
|
205
|
+
});
|
|
206
|
+
/**
|
|
207
|
+
* CRUD Dialog Schema
|
|
208
|
+
*/
|
|
209
|
+
export const CRUDDialogSchema = BaseSchema.extend({
|
|
210
|
+
type: z.literal('crud-dialog'),
|
|
211
|
+
title: z.string().optional().describe('Dialog title'),
|
|
212
|
+
description: z.string().optional().describe('Dialog description'),
|
|
213
|
+
content: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Dialog content'),
|
|
214
|
+
size: z.enum(['sm', 'default', 'lg', 'xl', 'full']).optional().default('default').describe('Dialog size'),
|
|
215
|
+
actions: z.array(ActionSchema).optional().describe('Dialog actions/buttons'),
|
|
216
|
+
open: z.boolean().optional().describe('Whether dialog is open'),
|
|
217
|
+
onClose: z.any().optional().describe('Close handler'),
|
|
218
|
+
closeOnOutsideClick: z.boolean().optional().default(true).describe('Whether clicking outside closes dialog'),
|
|
219
|
+
closeOnEscape: z.boolean().optional().default(true).describe('Whether pressing Escape closes dialog'),
|
|
220
|
+
showClose: z.boolean().optional().default(true).describe('Show close button'),
|
|
221
|
+
});
|
|
222
|
+
/**
|
|
223
|
+
* Union of all CRUD schemas
|
|
224
|
+
*/
|
|
225
|
+
export const CRUDComponentSchema = z.union([
|
|
226
|
+
ActionSchema,
|
|
227
|
+
CRUDSchema,
|
|
228
|
+
DetailSchema,
|
|
229
|
+
CRUDDialogSchema,
|
|
230
|
+
]);
|