@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
package/src/blocks.ts
ADDED
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectUI
|
|
3
|
+
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @object-ui/types - Block Schema
|
|
11
|
+
*
|
|
12
|
+
* Defines reusable component blocks for composition and templating.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { BaseSchema, SchemaNode } from './base';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Block Variable Definition
|
|
19
|
+
*/
|
|
20
|
+
export interface BlockVariable {
|
|
21
|
+
/**
|
|
22
|
+
* Variable name
|
|
23
|
+
*/
|
|
24
|
+
name: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Display label
|
|
28
|
+
*/
|
|
29
|
+
label?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Variable type
|
|
33
|
+
*/
|
|
34
|
+
type?: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'component';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Default value
|
|
38
|
+
*/
|
|
39
|
+
defaultValue?: any;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Description/help text
|
|
43
|
+
*/
|
|
44
|
+
description?: string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Whether this variable is required
|
|
48
|
+
*/
|
|
49
|
+
required?: boolean;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Validation rules
|
|
53
|
+
*/
|
|
54
|
+
validation?: any;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Enum options (for string/number types)
|
|
58
|
+
*/
|
|
59
|
+
enum?: any[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Block Slot Definition
|
|
64
|
+
*/
|
|
65
|
+
export interface BlockSlot {
|
|
66
|
+
/**
|
|
67
|
+
* Slot name
|
|
68
|
+
*/
|
|
69
|
+
name: string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Display label
|
|
73
|
+
*/
|
|
74
|
+
label?: string;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Description
|
|
78
|
+
*/
|
|
79
|
+
description?: string;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Default content
|
|
83
|
+
*/
|
|
84
|
+
defaultContent?: SchemaNode | SchemaNode[];
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Allowed component types
|
|
88
|
+
*/
|
|
89
|
+
allowedTypes?: string[];
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Maximum number of children
|
|
93
|
+
*/
|
|
94
|
+
maxChildren?: number;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Whether this slot is required
|
|
98
|
+
*/
|
|
99
|
+
required?: boolean;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Block Metadata
|
|
104
|
+
*/
|
|
105
|
+
export interface BlockMetadata {
|
|
106
|
+
/**
|
|
107
|
+
* Block name/identifier
|
|
108
|
+
*/
|
|
109
|
+
name: string;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Display label
|
|
113
|
+
*/
|
|
114
|
+
label?: string;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Block description
|
|
118
|
+
*/
|
|
119
|
+
description?: string;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Block category
|
|
123
|
+
*/
|
|
124
|
+
category?: string;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Block icon
|
|
128
|
+
*/
|
|
129
|
+
icon?: string;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Block tags for search
|
|
133
|
+
*/
|
|
134
|
+
tags?: string[];
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Author/creator
|
|
138
|
+
*/
|
|
139
|
+
author?: string;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Version
|
|
143
|
+
*/
|
|
144
|
+
version?: string;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* License
|
|
148
|
+
*/
|
|
149
|
+
license?: string;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Repository URL
|
|
153
|
+
*/
|
|
154
|
+
repository?: string;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Preview image URL
|
|
158
|
+
*/
|
|
159
|
+
preview?: string;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Is this a premium/paid block
|
|
163
|
+
*/
|
|
164
|
+
premium?: boolean;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Block Schema - Reusable component block
|
|
169
|
+
*/
|
|
170
|
+
export interface BlockSchema extends BaseSchema {
|
|
171
|
+
type: 'block';
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Block metadata
|
|
175
|
+
*/
|
|
176
|
+
meta?: BlockMetadata;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Block variables/props
|
|
180
|
+
*/
|
|
181
|
+
variables?: BlockVariable[];
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Block slots for content injection
|
|
185
|
+
*/
|
|
186
|
+
slots?: BlockSlot[];
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Block template (component tree)
|
|
190
|
+
*/
|
|
191
|
+
template?: SchemaNode | SchemaNode[];
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Variable values (when using a block)
|
|
195
|
+
*/
|
|
196
|
+
values?: Record<string, any>;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Slot content (when using a block)
|
|
200
|
+
*/
|
|
201
|
+
slotContent?: Record<string, SchemaNode | SchemaNode[]>;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Block reference (for reusing saved blocks)
|
|
205
|
+
*/
|
|
206
|
+
blockRef?: string;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Enable edit mode
|
|
210
|
+
*/
|
|
211
|
+
editable?: boolean;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Block Library Item
|
|
216
|
+
*/
|
|
217
|
+
export interface BlockLibraryItem {
|
|
218
|
+
/**
|
|
219
|
+
* Unique identifier
|
|
220
|
+
*/
|
|
221
|
+
id: string;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Block metadata
|
|
225
|
+
*/
|
|
226
|
+
meta: BlockMetadata;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Block schema
|
|
230
|
+
*/
|
|
231
|
+
schema: BlockSchema;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Installation count
|
|
235
|
+
*/
|
|
236
|
+
installs?: number;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Rating (1-5)
|
|
240
|
+
*/
|
|
241
|
+
rating?: number;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Number of ratings
|
|
245
|
+
*/
|
|
246
|
+
ratingCount?: number;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Last updated timestamp
|
|
250
|
+
*/
|
|
251
|
+
updatedAt?: string;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Created timestamp
|
|
255
|
+
*/
|
|
256
|
+
createdAt?: string;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Block Library Schema - Browse and install blocks
|
|
261
|
+
*/
|
|
262
|
+
export interface BlockLibrarySchema extends BaseSchema {
|
|
263
|
+
type: 'block-library';
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Library API endpoint
|
|
267
|
+
*/
|
|
268
|
+
apiEndpoint?: string;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Filter by category
|
|
272
|
+
*/
|
|
273
|
+
category?: string;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Search query
|
|
277
|
+
*/
|
|
278
|
+
searchQuery?: string;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Filter by tags
|
|
282
|
+
*/
|
|
283
|
+
tags?: string[];
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Show premium blocks
|
|
287
|
+
*/
|
|
288
|
+
showPremium?: boolean;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Blocks to display
|
|
292
|
+
*/
|
|
293
|
+
blocks?: BlockLibraryItem[];
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Loading state
|
|
297
|
+
*/
|
|
298
|
+
loading?: boolean;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Install callback
|
|
302
|
+
*/
|
|
303
|
+
onInstall?: string;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Preview callback
|
|
307
|
+
*/
|
|
308
|
+
onPreview?: string;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Block Editor Schema - Edit/create blocks
|
|
313
|
+
*/
|
|
314
|
+
export interface BlockEditorSchema extends BaseSchema {
|
|
315
|
+
type: 'block-editor';
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Block being edited
|
|
319
|
+
*/
|
|
320
|
+
block?: BlockSchema;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Show variable editor
|
|
324
|
+
*/
|
|
325
|
+
showVariables?: boolean;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Show slot editor
|
|
329
|
+
*/
|
|
330
|
+
showSlots?: boolean;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Show template editor
|
|
334
|
+
*/
|
|
335
|
+
showTemplate?: boolean;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Show preview
|
|
339
|
+
*/
|
|
340
|
+
showPreview?: boolean;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Save callback
|
|
344
|
+
*/
|
|
345
|
+
onSave?: string;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Cancel callback
|
|
349
|
+
*/
|
|
350
|
+
onCancel?: string;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Block Instance Schema - Use a saved block
|
|
355
|
+
*/
|
|
356
|
+
export interface BlockInstanceSchema extends BaseSchema {
|
|
357
|
+
type: 'block-instance';
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Block reference ID
|
|
361
|
+
*/
|
|
362
|
+
blockId: string;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Block name (for local blocks)
|
|
366
|
+
*/
|
|
367
|
+
blockName?: string;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Variable values
|
|
371
|
+
*/
|
|
372
|
+
values?: Record<string, any>;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Slot content
|
|
376
|
+
*/
|
|
377
|
+
slotContent?: Record<string, SchemaNode | SchemaNode[]>;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Override styles
|
|
381
|
+
*/
|
|
382
|
+
overrideStyles?: boolean;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Component Schema Extension - For base component metadata
|
|
387
|
+
*/
|
|
388
|
+
export interface ComponentSchema extends BaseSchema {
|
|
389
|
+
type: 'component';
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Component name/identifier
|
|
393
|
+
*/
|
|
394
|
+
componentName?: string;
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Component props
|
|
398
|
+
*/
|
|
399
|
+
props?: Record<string, any>;
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Component children
|
|
403
|
+
*/
|
|
404
|
+
children?: SchemaNode | SchemaNode[];
|
|
405
|
+
}
|
package/src/complex.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
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 - Complex Component Schemas
|
|
3
11
|
*
|
|
@@ -9,6 +17,35 @@
|
|
|
9
17
|
|
|
10
18
|
import type { BaseSchema, SchemaNode } from './base';
|
|
11
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Dashboard Component Schema
|
|
22
|
+
* (Report / BI View)
|
|
23
|
+
*/
|
|
24
|
+
export interface DashboardSchema extends BaseSchema {
|
|
25
|
+
type: 'dashboard';
|
|
26
|
+
/**
|
|
27
|
+
* Layout Grid Configuration (e.g. 12 column grid)
|
|
28
|
+
*/
|
|
29
|
+
columns?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Widget gap
|
|
32
|
+
*/
|
|
33
|
+
gap?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Dashboard Widgets
|
|
36
|
+
*/
|
|
37
|
+
widgets: Array<{
|
|
38
|
+
/** Unique Widget ID */
|
|
39
|
+
id: string;
|
|
40
|
+
/** Widget Title */
|
|
41
|
+
title?: string;
|
|
42
|
+
/** Widget Component (Chart, Statistic, List, etc) */
|
|
43
|
+
component: SchemaNode;
|
|
44
|
+
/** Grid Position: x, y, w, h */
|
|
45
|
+
layout?: { x: number; y: number; w: number; h: number };
|
|
46
|
+
}>;
|
|
47
|
+
}
|
|
48
|
+
|
|
12
49
|
/**
|
|
13
50
|
* Kanban column
|
|
14
51
|
*/
|
|
@@ -454,6 +491,36 @@ export interface ChatbotSchema extends BaseSchema {
|
|
|
454
491
|
height?: string | number;
|
|
455
492
|
}
|
|
456
493
|
|
|
494
|
+
/**
|
|
495
|
+
* Dashboard Widget Layout
|
|
496
|
+
*/
|
|
497
|
+
export interface DashboardWidgetLayout {
|
|
498
|
+
x: number;
|
|
499
|
+
y: number;
|
|
500
|
+
w: number;
|
|
501
|
+
h: number;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Dashboard Widget
|
|
506
|
+
*/
|
|
507
|
+
export interface DashboardWidgetSchema {
|
|
508
|
+
id: string;
|
|
509
|
+
title?: string;
|
|
510
|
+
component: SchemaNode;
|
|
511
|
+
layout?: DashboardWidgetLayout;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Dashboard Schema
|
|
516
|
+
*/
|
|
517
|
+
export interface DashboardSchema extends BaseSchema {
|
|
518
|
+
type: 'dashboard';
|
|
519
|
+
columns?: number;
|
|
520
|
+
gap?: number;
|
|
521
|
+
widgets: DashboardWidgetSchema[];
|
|
522
|
+
}
|
|
523
|
+
|
|
457
524
|
/**
|
|
458
525
|
* Union type of all complex schemas
|
|
459
526
|
*/
|
|
@@ -462,4 +529,5 @@ export type ComplexSchema =
|
|
|
462
529
|
| CalendarViewSchema
|
|
463
530
|
| FilterBuilderSchema
|
|
464
531
|
| CarouselSchema
|
|
465
|
-
| ChatbotSchema
|
|
532
|
+
| ChatbotSchema
|
|
533
|
+
| DashboardSchema;
|
package/src/crud.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
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 - CRUD Component Schemas
|
|
3
11
|
*
|
|
@@ -12,8 +20,67 @@ import type { BaseSchema, SchemaNode } from './base';
|
|
|
12
20
|
import type { FormField } from './form';
|
|
13
21
|
import type { TableColumn } from './data-display';
|
|
14
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Action execution mode for chaining
|
|
25
|
+
*/
|
|
26
|
+
export type ActionExecutionMode = 'sequential' | 'parallel';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Action callback configuration
|
|
30
|
+
*/
|
|
31
|
+
export interface ActionCallback {
|
|
32
|
+
/**
|
|
33
|
+
* Callback type
|
|
34
|
+
*/
|
|
35
|
+
type: 'toast' | 'message' | 'redirect' | 'reload' | 'custom' | 'ajax' | 'dialog';
|
|
36
|
+
/**
|
|
37
|
+
* Message to display
|
|
38
|
+
*/
|
|
39
|
+
message?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Redirect URL
|
|
42
|
+
*/
|
|
43
|
+
url?: string;
|
|
44
|
+
/**
|
|
45
|
+
* API endpoint for ajax callback
|
|
46
|
+
*/
|
|
47
|
+
api?: string;
|
|
48
|
+
/**
|
|
49
|
+
* HTTP method for ajax callback
|
|
50
|
+
*/
|
|
51
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
52
|
+
/**
|
|
53
|
+
* Dialog schema to open
|
|
54
|
+
*/
|
|
55
|
+
dialog?: SchemaNode;
|
|
56
|
+
/**
|
|
57
|
+
* Custom callback handler expression
|
|
58
|
+
*/
|
|
59
|
+
handler?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Conditional action configuration
|
|
64
|
+
*/
|
|
65
|
+
export interface ActionCondition {
|
|
66
|
+
/**
|
|
67
|
+
* Condition expression
|
|
68
|
+
* @example "${data.status === 'active'}"
|
|
69
|
+
*/
|
|
70
|
+
expression: string;
|
|
71
|
+
/**
|
|
72
|
+
* Action to execute if condition is true
|
|
73
|
+
*/
|
|
74
|
+
then?: ActionSchema | ActionSchema[];
|
|
75
|
+
/**
|
|
76
|
+
* Action to execute if condition is false
|
|
77
|
+
*/
|
|
78
|
+
else?: ActionSchema | ActionSchema[];
|
|
79
|
+
}
|
|
80
|
+
|
|
15
81
|
/**
|
|
16
82
|
* Action button configuration for CRUD operations
|
|
83
|
+
* Enhanced with Phase 2 features: ajax, confirm, dialog, chaining, conditional execution
|
|
17
84
|
*/
|
|
18
85
|
export interface ActionSchema extends BaseSchema {
|
|
19
86
|
type: 'action';
|
|
@@ -40,10 +107,11 @@ export interface ActionSchema extends BaseSchema {
|
|
|
40
107
|
disabled?: boolean;
|
|
41
108
|
/**
|
|
42
109
|
* Action type
|
|
110
|
+
* Enhanced in Phase 2 with 'ajax', 'confirm', 'dialog'
|
|
43
111
|
*/
|
|
44
|
-
actionType?: 'button' | 'link' | 'dropdown';
|
|
112
|
+
actionType?: 'button' | 'link' | 'dropdown' | 'ajax' | 'confirm' | 'dialog';
|
|
45
113
|
/**
|
|
46
|
-
* API endpoint to call
|
|
114
|
+
* API endpoint to call (for ajax actions)
|
|
47
115
|
*/
|
|
48
116
|
api?: string;
|
|
49
117
|
/**
|
|
@@ -52,13 +120,93 @@ export interface ActionSchema extends BaseSchema {
|
|
|
52
120
|
*/
|
|
53
121
|
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
54
122
|
/**
|
|
55
|
-
*
|
|
123
|
+
* Request body/data
|
|
124
|
+
*/
|
|
125
|
+
data?: any;
|
|
126
|
+
/**
|
|
127
|
+
* Request headers
|
|
128
|
+
*/
|
|
129
|
+
headers?: Record<string, string>;
|
|
130
|
+
/**
|
|
131
|
+
* Confirmation dialog configuration (for confirm actions)
|
|
132
|
+
*/
|
|
133
|
+
confirm?: {
|
|
134
|
+
/**
|
|
135
|
+
* Confirmation title
|
|
136
|
+
*/
|
|
137
|
+
title?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Confirmation message
|
|
140
|
+
*/
|
|
141
|
+
message?: string;
|
|
142
|
+
/**
|
|
143
|
+
* Confirm button text
|
|
144
|
+
*/
|
|
145
|
+
confirmText?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Cancel button text
|
|
148
|
+
*/
|
|
149
|
+
cancelText?: string;
|
|
150
|
+
/**
|
|
151
|
+
* Confirm button variant
|
|
152
|
+
*/
|
|
153
|
+
confirmVariant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost';
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Legacy confirmation message (deprecated - use confirm object instead)
|
|
157
|
+
* @deprecated Use confirm.message instead
|
|
56
158
|
*/
|
|
57
159
|
confirmText?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Dialog configuration (for dialog actions)
|
|
162
|
+
*/
|
|
163
|
+
dialog?: {
|
|
164
|
+
/**
|
|
165
|
+
* Dialog title
|
|
166
|
+
*/
|
|
167
|
+
title?: string;
|
|
168
|
+
/**
|
|
169
|
+
* Dialog content
|
|
170
|
+
*/
|
|
171
|
+
content?: SchemaNode | SchemaNode[];
|
|
172
|
+
/**
|
|
173
|
+
* Dialog size
|
|
174
|
+
*/
|
|
175
|
+
size?: 'sm' | 'default' | 'lg' | 'xl' | 'full';
|
|
176
|
+
/**
|
|
177
|
+
* Dialog actions
|
|
178
|
+
*/
|
|
179
|
+
actions?: ActionSchema[];
|
|
180
|
+
};
|
|
58
181
|
/**
|
|
59
182
|
* Success message after execution
|
|
60
183
|
*/
|
|
61
184
|
successMessage?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Error message on failure
|
|
187
|
+
*/
|
|
188
|
+
errorMessage?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Success callback (Phase 2)
|
|
191
|
+
*/
|
|
192
|
+
onSuccess?: ActionCallback;
|
|
193
|
+
/**
|
|
194
|
+
* Failure callback (Phase 2)
|
|
195
|
+
*/
|
|
196
|
+
onFailure?: ActionCallback;
|
|
197
|
+
/**
|
|
198
|
+
* Action chaining - actions to execute after this one (Phase 2)
|
|
199
|
+
*/
|
|
200
|
+
chain?: ActionSchema[];
|
|
201
|
+
/**
|
|
202
|
+
* Chain execution mode
|
|
203
|
+
* @default 'sequential'
|
|
204
|
+
*/
|
|
205
|
+
chainMode?: ActionExecutionMode;
|
|
206
|
+
/**
|
|
207
|
+
* Conditional execution (Phase 2)
|
|
208
|
+
*/
|
|
209
|
+
condition?: ActionCondition;
|
|
62
210
|
/**
|
|
63
211
|
* Whether to reload data after action
|
|
64
212
|
* @default true
|
|
@@ -77,6 +225,40 @@ export interface ActionSchema extends BaseSchema {
|
|
|
77
225
|
* Redirect URL after success
|
|
78
226
|
*/
|
|
79
227
|
redirect?: string;
|
|
228
|
+
/**
|
|
229
|
+
* Action logging/tracking (Phase 2)
|
|
230
|
+
*/
|
|
231
|
+
tracking?: {
|
|
232
|
+
/**
|
|
233
|
+
* Enable tracking
|
|
234
|
+
*/
|
|
235
|
+
enabled?: boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Event name
|
|
238
|
+
*/
|
|
239
|
+
event?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Additional metadata
|
|
242
|
+
*/
|
|
243
|
+
metadata?: Record<string, any>;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Timeout in milliseconds
|
|
247
|
+
*/
|
|
248
|
+
timeout?: number;
|
|
249
|
+
/**
|
|
250
|
+
* Retry configuration
|
|
251
|
+
*/
|
|
252
|
+
retry?: {
|
|
253
|
+
/**
|
|
254
|
+
* Maximum retry attempts
|
|
255
|
+
*/
|
|
256
|
+
maxAttempts?: number;
|
|
257
|
+
/**
|
|
258
|
+
* Delay between retries (in ms)
|
|
259
|
+
*/
|
|
260
|
+
delay?: number;
|
|
261
|
+
};
|
|
80
262
|
}
|
|
81
263
|
|
|
82
264
|
/**
|