@nice2dev/ui-forms 1.0.21 → 1.0.23

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/dist/index.d.ts CHANGED
@@ -1,5 +1,22 @@
1
1
  import { default as default_2 } from 'react';
2
+ import { ForwardRefExoticComponent } from 'react';
3
+ import { NiceBaseProps } from '@nice2dev/ui-core';
4
+ import { NiceComponentTutorial } from '@nice2dev/ui';
5
+ import { NiceComponentTutorial as NiceComponentTutorial_2 } from '@nice2dev/ui-core';
6
+ import { NiceConsoleTab } from '@nice2dev/ui';
7
+ import { NiceDataSourceDef } from '@nice2dev/ui';
8
+ import { NiceFormItem } from '@nice2dev/ui';
9
+ import { NiceHookBinding } from '@nice2dev/ui';
10
+ import { NiceLifecycleHandlerOption } from '@nice2dev/ui';
11
+ import { NiceLifecycleTrigger } from '@nice2dev/ui';
12
+ import { NiceLogEntry } from '@nice2dev/ui';
13
+ import { NiceRbacModel } from '@nice2dev/ui';
14
+ import { NiceRevision } from '@nice2dev/ui';
15
+ import { NiceScriptRunnerProps } from '@nice2dev/ui';
2
16
  import { NiceStandardProps } from '@nice2dev/ui';
17
+ import { NiceViewDefinition } from '@nice2dev/ui';
18
+ import { NiceWorkflowDefinition } from '@nice2dev/ui';
19
+ import { RefAttributes } from 'react';
3
20
 
4
21
  declare interface AIGeneratedField {
5
22
  label: string;
@@ -11,186 +28,24 @@ declare interface AIGeneratedField {
11
28
  helpText?: string;
12
29
  }
13
30
 
14
- declare interface BarcodeConfig {
15
- formats: ('ean13' | 'ean8' | 'code128' | 'code39' | 'qr' | 'datamatrix' | 'pdf417')[];
16
- autoFill?: {
17
- field: string;
18
- property: string;
19
- }[];
20
- enableCamera?: boolean;
21
- enableManualEntry?: boolean;
22
- }
23
-
24
- declare interface CalculationConfig {
25
- expression: string;
26
- dependencies: string[];
27
- format?: 'number' | 'currency' | 'percentage' | 'date';
28
- precision?: number;
29
- currencyCode?: string;
30
- }
31
-
32
- declare interface DataBindingConfig {
33
- entityType: string;
34
- fieldPath: string;
35
- direction: 'read' | 'write' | 'both';
36
- transform?: string;
37
- defaultFromEntity?: boolean;
38
- }
39
-
40
- declare interface FieldI18n {
41
- label?: Record<string, string>;
42
- placeholder?: Record<string, string>;
43
- helpText?: Record<string, string>;
44
- options?: Record<string, {
45
- value: string;
46
- label: string;
47
- }[]>;
48
- }
49
-
50
- declare interface FormDesignerContextValue {
51
- schema: FormDesignerSchema;
52
- selectedFieldId: string | null;
53
- selectedTabId: string | null;
54
- locale: string;
55
- setSchema: (schema: FormDesignerSchema) => void;
56
- selectField: (fieldId: string | null) => void;
57
- selectTab: (tabId: string | null) => void;
58
- addField: (containerId: string, field: FormDesignerField, index?: number) => void;
59
- updateField: (fieldId: string, updates: Partial<FormDesignerField>) => void;
60
- removeField: (fieldId: string) => void;
61
- moveField: (fieldId: string, toContainerId: string, toIndex: number) => void;
62
- duplicateField: (fieldId: string) => void;
63
- addTab: (tab: FormDesignerTab, index?: number) => void;
64
- updateTab: (tabId: string, updates: Partial<FormDesignerTab>) => void;
65
- removeTab: (tabId: string) => void;
66
- setLocale: (locale: string) => void;
67
- loadTemplate: (template: FormTemplate) => void;
68
- saveAsTemplate: (name: string, category: string) => FormTemplate;
69
- }
70
-
71
- declare interface FormDesignerField {
72
- id: string;
73
- type: FormDesignerFieldType;
74
- name: string;
75
- label?: string;
76
- placeholder?: string;
77
- helpText?: string;
78
- defaultValue?: unknown;
79
- options?: FormFieldOption_2[];
80
- validations?: FormFieldValidation_2[];
81
- conditions?: FormFieldCondition_2[];
82
- colSpan?: number;
83
- rowSpan?: number;
84
- className?: string;
85
- style?: default_2.CSSProperties;
86
- disabled?: boolean;
87
- readonly?: boolean;
88
- hidden?: boolean;
89
- lookup?: LookupConfig;
90
- calculation?: CalculationConfig;
91
- barcode?: BarcodeConfig;
92
- dataBinding?: DataBindingConfig;
93
- i18n?: FieldI18n;
94
- children?: FormDesignerField[];
95
- props?: Record<string, unknown>;
96
- }
97
-
98
- declare type FormDesignerFieldType = 'text' | 'textarea' | 'number' | 'email' | 'password' | 'phone' | 'url' | 'date' | 'datetime' | 'time' | 'dateRange' | 'select' | 'multiselect' | 'checkbox' | 'toggle' | 'radio' | 'slider' | 'rating' | 'richtext' | 'markdown' | 'code' | 'file' | 'image' | 'signature' | 'lookup' | 'calculated' | 'barcode' | 'qrcode' | 'currency' | 'percentage' | 'section' | 'tab' | 'divider' | 'spacer' | 'heading' | 'paragraph' | 'repeater' | 'table' | 'address' | 'geolocation';
99
-
100
- declare interface FormDesignerSchema {
101
- version: string;
102
- id: string;
103
- title?: string;
104
- description?: string;
105
- entityType?: string;
106
- layout: {
107
- type: 'flat' | 'tabs' | 'wizard' | 'accordion';
108
- columns: 1 | 2 | 3 | 4;
109
- labelPosition: 'top' | 'left' | 'floating';
110
- size: 'sm' | 'md' | 'lg';
111
- gap: 'sm' | 'md' | 'lg';
112
- };
113
- sections?: FormDesignerSection[];
114
- tabs?: FormDesignerTab[];
115
- submit?: {
116
- label: string;
117
- labelKey?: string;
118
- style?: 'primary' | 'secondary' | 'success';
119
- position?: 'left' | 'center' | 'right';
120
- showCancel?: boolean;
121
- cancelLabel?: string;
122
- cancelLabelKey?: string;
123
- };
124
- computedFields?: {
125
- name: string;
126
- expression: string;
127
- dependencies: string[];
128
- }[];
129
- validations?: {
130
- type: 'crossField';
131
- expression: string;
132
- message: string;
133
- messageKey?: string;
134
- }[];
135
- defaultLocale?: string;
136
- supportedLocales?: string[];
137
- i18n?: {
138
- title?: Record<string, string>;
139
- description?: Record<string, string>;
140
- };
141
- meta?: {
142
- createdAt?: string;
143
- updatedAt?: string;
144
- author?: string;
145
- tags?: string[];
146
- };
147
- }
148
-
149
- declare interface FormDesignerSection {
150
- id: string;
151
- title?: string;
152
- description?: string;
153
- collapsible?: boolean;
154
- defaultCollapsed?: boolean;
155
- columns?: 1 | 2 | 3 | 4;
156
- fields: FormDesignerField[];
157
- i18n?: {
158
- title?: Record<string, string>;
159
- description?: Record<string, string>;
160
- };
161
- }
162
-
163
- declare interface FormDesignerTab {
164
- id: string;
165
- title: string;
166
- icon?: string;
167
- disabled?: boolean;
168
- badge?: string | number;
169
- fields: FormDesignerField[];
170
- i18n?: {
171
- title?: Record<string, string>;
172
- };
173
- }
174
-
175
31
  /**
176
- * Conditional visibility rule
32
+ * Identity helper that infers the precise `schema` type from a section literal,
33
+ * so consumers can write a plain JSON-Schema object without `as JsonSchema`
34
+ * assertions. `const general = defineManifestSection({ id, title, schema: {…} });`
177
35
  */
178
- declare interface FormFieldCondition {
36
+ export declare function defineManifestSection<TSchema extends JsonSchema>(section: NiceManifestSection<TSchema>): NiceManifestSection<TSchema>;
37
+
38
+ /** Convert a FormSchema into NiceForm items (for `NiceForm`). */
39
+ export declare function formBuilderSchemaToNiceFormItems(schema: FormSchema): NiceFormItem[];
40
+
41
+ /** Conditional visibility rule. */
42
+ export declare interface FormFieldCondition {
179
43
  field: string;
180
44
  operator: 'equals' | 'notEquals' | 'contains' | 'greaterThan' | 'lessThan' | 'isEmpty' | 'isNotEmpty';
181
45
  value?: any;
182
46
  }
183
47
 
184
- declare interface FormFieldCondition_2 {
185
- field: string;
186
- operator: 'equals' | 'notEquals' | 'contains' | 'startsWith' | 'endsWith' | 'greaterThan' | 'lessThan' | 'isEmpty' | 'isNotEmpty' | 'in' | 'notIn';
187
- value?: unknown;
188
- logicalOperator?: 'and' | 'or';
189
- }
190
-
191
- /**
192
- * Form field definition
193
- */
48
+ /** Form field definition. */
194
49
  export declare interface FormFieldDefinition {
195
50
  /** Unique field ID */
196
51
  id: string;
@@ -230,10 +85,8 @@ export declare interface FormFieldDefinition {
230
85
  children?: FormFieldDefinition[];
231
86
  }
232
87
 
233
- /**
234
- * Option for select/radio fields
235
- */
236
- declare interface FormFieldOption {
88
+ /** Option for select/radio fields. */
89
+ export declare interface FormFieldOption {
237
90
  value: string | number;
238
91
  label: string;
239
92
  disabled?: boolean;
@@ -241,37 +94,23 @@ declare interface FormFieldOption {
241
94
  id?: string;
242
95
  }
243
96
 
244
- declare interface FormFieldOption_2 {
245
- value: string | number;
246
- label: string;
247
- disabled?: boolean;
248
- icon?: string;
249
- }
250
-
251
97
  /**
252
- * Available field types
98
+ * Convert the repo's own {@link FormFieldDefinition}[] model into NiceForm items.
99
+ * Layout-only field types (heading/paragraph/divider/spacer/section/image) are skipped.
253
100
  */
101
+ export declare function formFieldsToFormItems(fields: FormFieldDefinition[], options?: JsonSchemaToFormItemsOptions): NiceFormItem[];
102
+
103
+ /** Available field types. */
254
104
  export declare type FormFieldType = 'text' | 'textarea' | 'number' | 'email' | 'password' | 'phone' | 'url' | 'date' | 'datetime' | 'time' | 'select' | 'multiselect' | 'checkbox' | 'toggle' | 'radio' | 'slider' | 'rating' | 'color' | 'file' | 'signature' | 'richtext' | 'markdown' | 'code' | 'heading' | 'paragraph' | 'divider' | 'spacer' | 'image' | 'section';
255
105
 
256
- /**
257
- * Validation rule
258
- */
259
- declare interface FormFieldValidation {
106
+ /** Validation rule. */
107
+ export declare interface FormFieldValidation {
260
108
  type: 'required' | 'minLength' | 'maxLength' | 'min' | 'max' | 'pattern' | 'email' | 'url' | 'custom';
261
109
  value?: string | number | boolean;
262
110
  message?: string;
263
111
  }
264
112
 
265
- declare interface FormFieldValidation_2 {
266
- type: 'required' | 'minLength' | 'maxLength' | 'min' | 'max' | 'pattern' | 'email' | 'url' | 'custom' | 'unique';
267
- value?: string | number | boolean;
268
- message?: string;
269
- errorMessageKey?: string;
270
- }
271
-
272
- /**
273
- * Complete form schema
274
- */
113
+ /** Complete form schema. */
275
114
  export declare interface FormSchema {
276
115
  /** Schema version */
277
116
  version: string;
@@ -310,9 +149,7 @@ export declare interface FormSchema {
310
149
  */
311
150
  export declare function formSchemaToJsonSchema(form: FormSchema): JsonSchema;
312
151
 
313
- /**
314
- * Form section definition
315
- */
152
+ /** Form section definition. */
316
153
  export declare interface FormSectionDefinition {
317
154
  id: string;
318
155
  title?: string;
@@ -323,17 +160,6 @@ export declare interface FormSectionDefinition {
323
160
  fields: FormFieldDefinition[];
324
161
  }
325
162
 
326
- declare interface FormTemplate {
327
- id: string;
328
- name: string;
329
- description?: string;
330
- category: string;
331
- schema: FormDesignerSchema;
332
- thumbnail?: string;
333
- createdAt?: string;
334
- updatedAt?: string;
335
- }
336
-
337
163
  export declare interface JsonSchema {
338
164
  $schema?: string;
339
165
  $id?: string;
@@ -354,28 +180,73 @@ export declare interface JsonSchema {
354
180
  additionalProperties?: boolean;
355
181
  }
356
182
 
357
- declare interface LookupConfig {
358
- entityType: string;
359
- displayField: string;
360
- valueField: string;
361
- searchFields?: string[];
362
- filterExpression?: string;
363
- sortField?: string;
364
- sortDirection?: 'asc' | 'desc';
365
- pageSize?: number;
366
- fetchUrl?: string;
367
- dependsOn?: string[];
368
- cascadeFields?: {
369
- source: string;
370
- target: string;
371
- }[];
183
+ /**
184
+ * Convert a Draft-07 JSON Schema (object schema) into NiceForm items.
185
+ * Only top-level `properties` become fields; complex props use a JSON sub-editor.
186
+ */
187
+ export declare function jsonSchemaToFormItems(schema: JsonSchema, options?: JsonSchemaToFormItemsOptions): NiceFormItem[];
188
+
189
+ export declare interface JsonSchemaToFormItemsOptions {
190
+ /** Per-field overrides merged onto the generated item (label, type, colSpan, render, …). */
191
+ uiSchema?: Record<string, Partial<NiceFormItem>>;
192
+ /**
193
+ * Renderer for `array`-of-`object` properties. Injected (rather than imported)
194
+ * to avoid an import cycle with `NiceArrayField`. When omitted, such props fall
195
+ * back to a raw-JSON sub-editor.
196
+ */
197
+ renderArrayField?: (value: Array<Record<string, unknown>>, onChange: (rows: Array<Record<string, unknown>>) => void, itemSchema: JsonSchema, label?: string) => default_2.ReactNode;
198
+ /** Optional renderer for nested `object` properties (defaults to a JSON sub-editor). */
199
+ renderObjectField?: (value: Record<string, unknown>, onChange: (v: Record<string, unknown>) => void, schema: JsonSchema, label?: string) => default_2.ReactNode;
372
200
  }
373
201
 
374
- export declare function NiceFormBuilder({ initialSchema, fields, onChange, onExport, onPreview, className, style, }: NiceFormBuilderProps): JSX.Element;
202
+ export declare const NiceArrayField: ForwardRefExoticComponent<NiceArrayFieldProps & RefAttributes<HTMLDivElement>>;
203
+
204
+ export declare interface NiceArrayFieldProps {
205
+ /** The array being edited (controlled). */
206
+ value: Array<Record<string, unknown>>;
207
+ /** Change callback with the full updated array. */
208
+ onChange: (rows: Array<Record<string, unknown>>) => void;
209
+ /** JSON Schema of a single item (object schema with `properties`). */
210
+ itemSchema: JsonSchema;
211
+ /** Label shown in the add/edit dialog title. */
212
+ title?: string;
213
+ /** Render read-only (no add / edit / delete). */
214
+ readOnly?: boolean;
215
+ /** Columns to surface in the grid (field names). Defaults to all item properties. */
216
+ columns?: string[];
217
+ className?: string;
218
+ style?: React.CSSProperties;
219
+ 'data-testid'?: string;
220
+ }
221
+
222
+ export declare type NiceEntity = Record<string, unknown>;
223
+
224
+ export declare const NiceEntityEditor: ForwardRefExoticComponent<NiceEntityEditorProps & RefAttributes<HTMLDivElement>>;
225
+
226
+ export declare interface NiceEntityEditorProps extends NiceStandardProps {
227
+ /** Entities being edited (controlled). */
228
+ value: NiceEntity[];
229
+ /** Change callback with the full updated array. */
230
+ onChange: (entities: NiceEntity[]) => void;
231
+ /** JSON Schema for entity metadata (name, table, flags …). Defaults to the OmniVerk shape. */
232
+ entityMetaSchema?: JsonSchema;
233
+ /** JSON Schema for a single field. Defaults to the OmniVerk ModuleEntityField shape. */
234
+ fieldSchema?: JsonSchema;
235
+ /** Property holding the entity's fields. Default `'fields'`. */
236
+ fieldsKey?: string;
237
+ /** Property used as the entity label in the list. Default `'name'`. */
238
+ nameKey?: string;
239
+ /** Optional ER preview slot (e.g. NiceDatabaseSchemaViewer from @nice2dev/ui-diagrams). */
240
+ renderErPreview?: (entities: NiceEntity[]) => React.ReactNode;
241
+ /** Render read-only. */
242
+ readOnly?: boolean;
243
+ /** Optional guided tour. `true` = built-in; array/object = custom steps. Shows a "?" button. */
244
+ tutorial?: NiceComponentTutorial;
245
+ }
375
246
 
376
247
  export declare const NiceFormBuilderAI: default_2.ForwardRefExoticComponent<NiceFormBuilderAIProps & default_2.RefAttributes<NiceFormBuilderAIRef>>;
377
248
 
378
- export declare interface NiceFormBuilderAIProps extends Omit<NiceFormBuilderProps, 'ref' | 'onChange' | 'initialSchema'> {
249
+ export declare interface NiceFormBuilderAIProps {
379
250
  /** Enable AI features (requires NiceAIProvider) */
380
251
  enableAI?: boolean;
381
252
  /** AI model to use */
@@ -412,80 +283,213 @@ declare interface NiceFormBuilderAIRef {
412
283
  clearFields: () => void;
413
284
  }
414
285
 
415
- export declare interface NiceFormBuilderProps {
416
- /** Initial form schema */
417
- initialSchema?: FormSchema;
418
- /** Convenience flat list of fields — wrapped into a default schema if `initialSchema` is omitted. */
419
- fields?: Array<Partial<FormFieldDefinition> & {
286
+ export declare const NiceI18nEditor: ForwardRefExoticComponent<NiceI18nEditorProps & RefAttributes<HTMLDivElement>>;
287
+
288
+ export declare interface NiceI18nEditorProps extends NiceBaseProps {
289
+ /** `{ [locale]: { [key]: value } }` (controlled). */
290
+ value: NiceI18nValue;
291
+ /** Change callback with the full updated map. */
292
+ onChange: (value: NiceI18nValue) => void;
293
+ /** Locale columns to show. Defaults to the locales present in `value`. */
294
+ locales?: string[];
295
+ /** Allow adding/removing locales. Default `true`. */
296
+ allowEditLocales?: boolean;
297
+ /** Allow adding/removing/renaming keys. Default `true`. */
298
+ allowEditKeys?: boolean;
299
+ /** Highlight empty cells as missing translations. Default `true`. */
300
+ highlightMissing?: boolean;
301
+ /** Render read-only. */
302
+ readOnly?: boolean;
303
+ /** Optional guided tour. `true` = built-in; array/object = custom steps. Shows a "?" button. */
304
+ tutorial?: NiceComponentTutorial_2;
305
+ }
306
+
307
+ export declare type NiceI18nValue = Record<string, Record<string, string>>;
308
+
309
+ export declare const NiceManifestEditor: ForwardRefExoticComponent<NiceManifestEditorProps & RefAttributes<HTMLDivElement>>;
310
+
311
+ export declare interface NiceManifestEditorProps extends NiceStandardProps {
312
+ /** The manifest object being edited (controlled). */
313
+ value: Record<string, unknown>;
314
+ /** Section descriptors — each renders a NiceSchemaForm over the manifest. */
315
+ sections: NiceManifestSection[];
316
+ /** Change callback with the full updated manifest. */
317
+ onChange: (manifest: Record<string, unknown>) => void;
318
+ /** Offer a Form ⇄ JSON toggle in each section. Default `true`. */
319
+ jsonView?: boolean;
320
+ /** When provided, adds a "Scripts" tab hosting a NiceScriptRunner. */
321
+ scriptRunner?: NiceScriptRunnerProps;
322
+ /** Lifecycle triggers — when provided, adds a "Lifecycle" tab. */
323
+ triggers?: NiceLifecycleTrigger[];
324
+ /** Current hook bindings. */
325
+ bindings?: NiceHookBinding[];
326
+ /** Handlers offered in the lifecycle binding picker. */
327
+ handlers?: NiceLifecycleHandlerOption[];
328
+ /** Bindings change callback. */
329
+ onBindingsChange?: (bindings: NiceHookBinding[]) => void;
330
+ /** Revisions — when provided, adds a "History" tab. */
331
+ revisions?: NiceRevision[];
332
+ /** Rollback callback for the history tab. */
333
+ onRollback?: (id: string) => void;
334
+ /** Lazy content resolver for the history diff. */
335
+ loadContent?: (id: string) => Promise<string>;
336
+ /** Logs for the bottom dock — when provided, a NiceLogConsole is shown. */
337
+ logs?: NiceLogEntry[];
338
+ /** Clear-logs callback. */
339
+ onClearLogs?: () => void;
340
+ /** Extra tabs appended after the built-in ones (e.g. payment / webhook panels). */
341
+ extraTabs?: NiceConsoleTab[];
342
+ /** Manifest-level validation surfaced in the status bar. */
343
+ validate?: (manifest: Record<string, unknown>) => NiceSchemaFormError[];
344
+ /** Console theme. Default `'light'`. */
345
+ theme?: 'dark' | 'light';
346
+ /** Editor height. Default `560`. */
347
+ height?: number | string;
348
+ /** Optional guided tour. `true` = built-in; array/object = custom steps. Shows a "?" button. */
349
+ tutorial?: NiceComponentTutorial;
350
+ }
351
+
352
+ /**
353
+ * One editable manifest section, described by a JSON Schema or field model.
354
+ *
355
+ * Generic over `TSchema` so a literal JSON-Schema object keeps its precise type
356
+ * (use {@link defineManifestSection} for inference) — no `as JsonSchema` casts on
357
+ * nested `properties`. Defaults to `JsonSchema`, so `NiceManifestSection` and
358
+ * `NiceManifestSection[]` keep working unchanged.
359
+ */
360
+ export declare interface NiceManifestSection<TSchema extends JsonSchema = JsonSchema> {
361
+ id: string;
362
+ title: string;
363
+ icon?: React.ReactNode;
364
+ /** JSON Schema describing this section's fields (subset of the manifest). */
365
+ schema?: TSchema;
366
+ /** Or the repo's field-descriptor model. */
367
+ fields?: FormFieldDefinition[];
368
+ /** Per-field UI overrides forwarded to NiceSchemaForm. */
369
+ uiSchema?: Record<string, Partial<NiceFormItem>>;
370
+ }
371
+
372
+ /** Pluggable persistence — implement over a filesystem, API, or in-memory store. */
373
+ export declare interface NiceModuleDataProvider {
374
+ listModules(): Promise<NiceModuleSummary[]>;
375
+ loadModule(id: string): Promise<NiceModuleFiles>;
376
+ saveModule(id: string, files: NiceModuleFiles): Promise<void>;
377
+ createModule?(input: {
420
378
  id: string;
421
- type: string;
422
- label?: string;
423
- }>;
424
- /** Called when schema changes */
425
- onChange?: (schema: FormSchema) => void;
426
- /** Called when export is requested */
427
- onExport?: (schema: FormSchema) => void;
428
- /** Called when preview is requested */
429
- onPreview?: (schema: FormSchema) => void;
430
- /** Custom class */
431
- className?: string;
432
- /** Style */
433
- style?: default_2.CSSProperties;
379
+ name?: string;
380
+ }): Promise<NiceModuleSummary>;
381
+ }
382
+
383
+ export declare const NiceModuleEditor: ForwardRefExoticComponent<NiceModuleEditorProps & RefAttributes<HTMLDivElement>>;
384
+
385
+ export declare interface NiceModuleEditorProps extends NiceStandardProps {
386
+ /** Persistence adapter. */
387
+ dataProvider: NiceModuleDataProvider;
388
+ /** Manifest sections (schema-driven). Provide the real target schema (e.g. OmniVerk). */
389
+ manifestSections: NiceManifestSection[];
390
+ /** Entity-editor configuration (schemas, ER preview slot). */
391
+ entityConfig?: NiceModuleEntityConfig;
392
+ /** Locales offered in the i18n editor. */
393
+ locales?: string[];
394
+ /** Extra module-level validation, merged with manifest-section schema validation. */
395
+ validate?: (files: NiceModuleFiles) => NiceSchemaFormError[];
396
+ /** Wires a Scripts tab (NiceScriptRunner). */
397
+ scriptRunner?: NiceScriptRunnerProps;
398
+ /** Wires a Lifecycle tab. */
399
+ triggers?: NiceLifecycleTrigger[];
400
+ bindings?: NiceHookBinding[];
401
+ handlers?: NiceLifecycleHandlerOption[];
402
+ onBindingsChange?: (bindings: NiceHookBinding[]) => void;
403
+ /** Wires a History tab. */
404
+ revisions?: NiceRevision[];
405
+ onRollback?: (id: string) => void;
406
+ loadContent?: (id: string) => Promise<string>;
407
+ /** Console theme. Default `'light'`. */
408
+ theme?: 'dark' | 'light';
409
+ /** Editor height. Default `640`. */
410
+ height?: number | string;
411
+ /** Optional guided tour. `true` = built-in tour; array/object = custom steps. Shows a "?" button. */
412
+ tutorial?: NiceComponentTutorial;
413
+ }
414
+
415
+ export declare interface NiceModuleEntityConfig {
416
+ entityMetaSchema?: JsonSchema;
417
+ fieldSchema?: JsonSchema;
418
+ fieldsKey?: string;
419
+ nameKey?: string;
420
+ renderErPreview?: (entities: NiceEntity[]) => React.ReactNode;
434
421
  }
435
422
 
436
- export declare const NiceFormDesigner: default_2.FC<NiceFormDesignerProps>;
423
+ /** The editable files of one module. */
424
+ export declare interface NiceModuleFiles {
425
+ manifest: Record<string, unknown>;
426
+ entities?: NiceEntity[];
427
+ i18n?: NiceI18nValue;
428
+ /** The module's views (`*.view.json`) — unified `NiceViewDefinition` standard. */
429
+ views?: NiceViewDefinition[];
430
+ /** The module's workflows (`*.workflow.json`). */
431
+ workflows?: NiceWorkflowDefinition[];
432
+ /** The module's data sources (no-SQL query definitions). */
433
+ dataSources?: NiceDataSourceDef[];
434
+ /** The module's RBAC model (roles + per-resource access). */
435
+ rbac?: NiceRbacModel;
436
+ /** Any extra parts the adapter wants to round-trip untouched. */
437
+ extra?: Record<string, unknown>;
438
+ }
439
+
440
+ /** A module entry shown in the browser. */
441
+ export declare interface NiceModuleSummary {
442
+ id: string;
443
+ name?: string;
444
+ category?: string;
445
+ description?: string;
446
+ }
447
+
448
+ export declare const NiceSchemaForm: ForwardRefExoticComponent<NiceSchemaFormProps & RefAttributes<HTMLDivElement>>;
449
+
450
+ /** A single validation problem produced by {@link validateAgainstJsonSchema}. */
451
+ export declare interface NiceSchemaFormError {
452
+ field: string;
453
+ message: string;
454
+ }
437
455
 
438
- export declare interface NiceFormDesignerProps extends NiceStandardProps {
439
- /** Initial form schema */
440
- schema?: FormDesignerSchema;
441
- /** Called when schema changes */
442
- onChange?: (schema: FormDesignerSchema) => void;
443
- /** Read-only mode */
456
+ export declare interface NiceSchemaFormProps extends NiceStandardProps {
457
+ /** Draft-07 JSON Schema (object schema). Provide this OR `fields`. */
458
+ schema?: JsonSchema;
459
+ /** The repo's own field-descriptor model. Provide this OR `schema`. */
460
+ fields?: FormFieldDefinition[];
461
+ /** Per-field UI overrides merged onto generated items (label, type, colSpan, render, …). */
462
+ uiSchema?: Record<string, Partial<NiceFormItem>>;
463
+ /** The value being edited (controlled). */
464
+ value: Record<string, unknown>;
465
+ /** Change callback with the full updated value. */
466
+ onChange: (value: Record<string, unknown>) => void;
467
+ /** Called whenever validation runs, with the current errors. */
468
+ onValidate?: (errors: NiceSchemaFormError[]) => void;
469
+ /** Offer a Form ⇄ JSON view toggle. Default `false`. */
470
+ showJsonView?: boolean;
471
+ /** Number of layout columns. Default `1`. */
472
+ columns?: number;
473
+ /** Label placement. Default `'top'`. */
474
+ labelPosition?: 'top' | 'left';
475
+ /** Render read-only. */
444
476
  readOnly?: boolean;
445
- /** Current locale for preview */
446
- locale?: string;
447
- /** Available locales */
448
- locales?: {
449
- code: string;
450
- name: string;
451
- }[];
452
- /** Show palette */
453
- showPalette?: boolean;
454
- /** Show properties panel */
455
- showProperties?: boolean;
456
- /** Show preview toggle */
457
- showPreview?: boolean;
458
- /** Show toolbar */
459
- showToolbar?: boolean;
460
- /** Available entity types for data binding */
461
- entityTypes?: {
462
- name: string;
463
- fields: {
464
- name: string;
465
- type: string;
466
- label: string;
467
- }[];
468
- }[];
469
- /** Form templates */
470
- templates?: FormTemplate[];
471
- /** Called to save as template */
472
- onSaveTemplate?: (template: FormTemplate) => void;
473
- /** Called to load template */
474
- onLoadTemplate?: (templateId: string) => FormTemplate | null;
475
- /** Enable validation */
476
- enableValidation?: boolean;
477
+ /** Validate on every change and show inline errors. Default `true`. */
478
+ liveValidation?: boolean;
479
+ /** Optional guided tour. `true` = built-in; array/object = custom steps. Shows a "?" button. */
480
+ tutorial?: NiceComponentTutorial;
477
481
  }
478
482
 
479
- /**
480
- * Convert form schema to NiceForm items
481
- */
483
+ /** Convert a FormSchema into DevExtreme-style form items. */
482
484
  export declare function schemaToFormItems(schema: FormSchema): any[];
483
485
 
484
- export declare function useFormDesigner(): FormDesignerContextValue;
485
-
486
486
  /**
487
- * Validate form schema
487
+ * Validate a value object against a (subset of) Draft-07 JSON Schema.
488
+ * Covers required, type, enum, minLength/maxLength, minimum/maximum and pattern.
488
489
  */
490
+ export declare function validateAgainstJsonSchema(value: Record<string, unknown>, schema: JsonSchema): NiceSchemaFormError[];
491
+
492
+ /** Validate a FormSchema; returns `{ valid, errors }`. */
489
493
  export declare function validateFormSchema(schema: FormSchema): {
490
494
  valid: boolean;
491
495
  errors: string[];