@nice2dev/ui-forms 1.0.20 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/NicePinCodeInput-3WugpLHi-CTyDHOeZ.cjs +419 -0
  2. package/dist/NicePinCodeInput-3WugpLHi-D5Vvnmzl.js +11037 -0
  3. package/dist/NicePinCodeInput-DDK6qqFW-BLZLxqrK.js +11037 -0
  4. package/dist/NicePinCodeInput-DDK6qqFW-Cfaplf1K.cjs +419 -0
  5. package/dist/NicePinCodeInput-DdXTdocN-4kd-wzjS.cjs +419 -0
  6. package/dist/NicePinCodeInput-DdXTdocN-B0gPW-cM.js +11037 -0
  7. package/dist/NiceSavedQueryPanel-Dryck7pv-D7TNDKOP.cjs +596 -0
  8. package/dist/NiceSavedQueryPanel-Dryck7pv-sJJxy7m_.js +6745 -0
  9. package/dist/NiceSavedQueryPanel-DtgcsEls-CsL2rpj-.cjs +596 -0
  10. package/dist/NiceSavedQueryPanel-DtgcsEls-rhi_OgS_.js +6745 -0
  11. package/dist/NiceSavedQueryPanel-z29D7N_A-D8tnSKo-.cjs +596 -0
  12. package/dist/NiceSavedQueryPanel-z29D7N_A-K3YHc_8w.js +6745 -0
  13. package/dist/charts-8Bqzj1TE-DQgq7NRB.js +3880 -0
  14. package/dist/charts-8Bqzj1TE-kxYozvdM.cjs +546 -0
  15. package/dist/charts-CLbJ4Zjq-CLC7wIJJ.cjs +546 -0
  16. package/dist/charts-CLbJ4Zjq-DVTOmEgg.js +3880 -0
  17. package/dist/charts-ClxW-i5q-DoJYE4HW.cjs +546 -0
  18. package/dist/charts-ClxW-i5q-Dw-2ffUs.js +3880 -0
  19. package/dist/index-7ZNfGfEK.js +22561 -0
  20. package/dist/index-B-WxtREy-h2zc1DNu.cjs +4504 -0
  21. package/dist/index-B-WxtREy-pXs9d_Xc.js +41393 -0
  22. package/dist/index-BMQ-F0zE-CGrCifaz.cjs +4504 -0
  23. package/dist/index-BMQ-F0zE-CTvr4Txe.js +41586 -0
  24. package/dist/index-ByDRtfrm-CmMM9LcZ.js +41407 -0
  25. package/dist/index-ByDRtfrm-lw-6968-.cjs +4504 -0
  26. package/dist/index-ChNAl7-x.cjs +404 -0
  27. package/dist/index-DDNMHIfH.cjs +404 -0
  28. package/dist/index-DLdxrnF6.cjs +404 -0
  29. package/dist/index-IT5Wo3RG.js +22559 -0
  30. package/dist/index-Uxu6da8j.js +22571 -0
  31. package/dist/index.cjs +7335 -1
  32. package/dist/index.d.ts +292 -1
  33. package/dist/index.mjs +93244 -8
  34. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,19 @@
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 { NiceFormItem } from '@nice2dev/ui';
8
+ import { NiceHookBinding } from '@nice2dev/ui';
9
+ import { NiceLifecycleHandlerOption } from '@nice2dev/ui';
10
+ import { NiceLifecycleTrigger } from '@nice2dev/ui';
11
+ import { NiceLogEntry } from '@nice2dev/ui';
12
+ import { NiceRevision } from '@nice2dev/ui';
13
+ import { NiceScriptRunnerProps } from '@nice2dev/ui';
2
14
  import { NiceStandardProps } from '@nice2dev/ui';
15
+ import { NiceViewDefinitionV2 } from '@nice2dev/ui';
16
+ import { RefAttributes } from 'react';
3
17
 
4
18
  declare interface AIGeneratedField {
5
19
  label: string;
@@ -248,6 +262,12 @@ declare interface FormFieldOption_2 {
248
262
  icon?: string;
249
263
  }
250
264
 
265
+ /**
266
+ * Convert the repo's own {@link FormFieldDefinition}[] model into NiceForm items.
267
+ * Layout-only field types (heading/paragraph/divider/spacer/section/image) are skipped.
268
+ */
269
+ export declare function formFieldsToFormItems(fields: FormFieldDefinition[], options?: JsonSchemaToFormItemsOptions): NiceFormItem[];
270
+
251
271
  /**
252
272
  * Available field types
253
273
  */
@@ -310,6 +330,16 @@ export declare interface FormSchema {
310
330
  */
311
331
  export declare function formSchemaToJsonSchema(form: FormSchema): JsonSchema;
312
332
 
333
+ /** Convert a {@link FormSchema} to a {@link NiceViewDefinitionV2} (form kind). */
334
+ export declare function formSchemaToV2(schema: FormSchema, options?: FormSchemaToV2Options): NiceViewDefinitionV2;
335
+
336
+ export declare interface FormSchemaToV2Options {
337
+ /** Data source key the fields bind to. Default `'record'`. */
338
+ source?: string;
339
+ /** V2 grid column count. Default `12`. */
340
+ columns?: number;
341
+ }
342
+
313
343
  /**
314
344
  * Form section definition
315
345
  */
@@ -354,6 +384,25 @@ export declare interface JsonSchema {
354
384
  additionalProperties?: boolean;
355
385
  }
356
386
 
387
+ /**
388
+ * Convert a Draft-07 JSON Schema (object schema) into NiceForm items.
389
+ * Only top-level `properties` become fields; complex props use a JSON sub-editor.
390
+ */
391
+ export declare function jsonSchemaToFormItems(schema: JsonSchema, options?: JsonSchemaToFormItemsOptions): NiceFormItem[];
392
+
393
+ export declare interface JsonSchemaToFormItemsOptions {
394
+ /** Per-field overrides merged onto the generated item (label, type, colSpan, render, …). */
395
+ uiSchema?: Record<string, Partial<NiceFormItem>>;
396
+ /**
397
+ * Renderer for `array`-of-`object` properties. Injected (rather than imported)
398
+ * to avoid an import cycle with `NiceArrayField`. When omitted, such props fall
399
+ * back to a raw-JSON sub-editor.
400
+ */
401
+ renderArrayField?: (value: Array<Record<string, unknown>>, onChange: (rows: Array<Record<string, unknown>>) => void, itemSchema: JsonSchema, label?: string) => default_2.ReactNode;
402
+ /** Optional renderer for nested `object` properties (defaults to a JSON sub-editor). */
403
+ renderObjectField?: (value: Record<string, unknown>, onChange: (v: Record<string, unknown>) => void, schema: JsonSchema, label?: string) => default_2.ReactNode;
404
+ }
405
+
357
406
  declare interface LookupConfig {
358
407
  entityType: string;
359
408
  displayField: string;
@@ -371,7 +420,52 @@ declare interface LookupConfig {
371
420
  }[];
372
421
  }
373
422
 
374
- export declare function NiceFormBuilder({ initialSchema, fields, onChange, onExport, onPreview, className, style, }: NiceFormBuilderProps): JSX.Element;
423
+ export declare const NiceArrayField: ForwardRefExoticComponent<NiceArrayFieldProps & RefAttributes<HTMLDivElement>>;
424
+
425
+ export declare interface NiceArrayFieldProps {
426
+ /** The array being edited (controlled). */
427
+ value: Array<Record<string, unknown>>;
428
+ /** Change callback with the full updated array. */
429
+ onChange: (rows: Array<Record<string, unknown>>) => void;
430
+ /** JSON Schema of a single item (object schema with `properties`). */
431
+ itemSchema: JsonSchema;
432
+ /** Label shown in the add/edit dialog title. */
433
+ title?: string;
434
+ /** Render read-only (no add / edit / delete). */
435
+ readOnly?: boolean;
436
+ /** Columns to surface in the grid (field names). Defaults to all item properties. */
437
+ columns?: string[];
438
+ className?: string;
439
+ style?: React.CSSProperties;
440
+ 'data-testid'?: string;
441
+ }
442
+
443
+ export declare type NiceEntity = Record<string, unknown>;
444
+
445
+ export declare const NiceEntityEditor: ForwardRefExoticComponent<NiceEntityEditorProps & RefAttributes<HTMLDivElement>>;
446
+
447
+ export declare interface NiceEntityEditorProps extends NiceStandardProps {
448
+ /** Entities being edited (controlled). */
449
+ value: NiceEntity[];
450
+ /** Change callback with the full updated array. */
451
+ onChange: (entities: NiceEntity[]) => void;
452
+ /** JSON Schema for entity metadata (name, table, flags …). Defaults to the OmniVerk shape. */
453
+ entityMetaSchema?: JsonSchema;
454
+ /** JSON Schema for a single field. Defaults to the OmniVerk ModuleEntityField shape. */
455
+ fieldSchema?: JsonSchema;
456
+ /** Property holding the entity's fields. Default `'fields'`. */
457
+ fieldsKey?: string;
458
+ /** Property used as the entity label in the list. Default `'name'`. */
459
+ nameKey?: string;
460
+ /** Optional ER preview slot (e.g. NiceDatabaseSchemaViewer from @nice2dev/ui-diagrams). */
461
+ renderErPreview?: (entities: NiceEntity[]) => React.ReactNode;
462
+ /** Render read-only. */
463
+ readOnly?: boolean;
464
+ /** Optional guided tour. `true` = built-in; array/object = custom steps. Shows a "?" button. */
465
+ tutorial?: NiceComponentTutorial;
466
+ }
467
+
468
+ export declare function NiceFormBuilder({ initialSchema, fields, onChange, onExport, onPreview, className, style, tutorial, }: NiceFormBuilderProps): JSX.Element;
375
469
 
376
470
  export declare const NiceFormBuilderAI: default_2.ForwardRefExoticComponent<NiceFormBuilderAIProps & default_2.RefAttributes<NiceFormBuilderAIRef>>;
377
471
 
@@ -431,6 +525,8 @@ export declare interface NiceFormBuilderProps {
431
525
  className?: string;
432
526
  /** Style */
433
527
  style?: default_2.CSSProperties;
528
+ /** Optional guided tour. `true` = built-in; array/object = custom steps. Shows a "?" button. */
529
+ tutorial?: NiceComponentTutorial;
434
530
  }
435
531
 
436
532
  export declare const NiceFormDesigner: default_2.FC<NiceFormDesignerProps>;
@@ -474,6 +570,192 @@ export declare interface NiceFormDesignerProps extends NiceStandardProps {
474
570
  onLoadTemplate?: (templateId: string) => FormTemplate | null;
475
571
  /** Enable validation */
476
572
  enableValidation?: boolean;
573
+ /** Optional guided tour. `true` = built-in; array/object = custom steps. Shows a "?" button. */
574
+ tutorial?: NiceComponentTutorial;
575
+ }
576
+
577
+ export declare const NiceI18nEditor: ForwardRefExoticComponent<NiceI18nEditorProps & RefAttributes<HTMLDivElement>>;
578
+
579
+ export declare interface NiceI18nEditorProps extends NiceBaseProps {
580
+ /** `{ [locale]: { [key]: value } }` (controlled). */
581
+ value: NiceI18nValue;
582
+ /** Change callback with the full updated map. */
583
+ onChange: (value: NiceI18nValue) => void;
584
+ /** Locale columns to show. Defaults to the locales present in `value`. */
585
+ locales?: string[];
586
+ /** Allow adding/removing locales. Default `true`. */
587
+ allowEditLocales?: boolean;
588
+ /** Allow adding/removing/renaming keys. Default `true`. */
589
+ allowEditKeys?: boolean;
590
+ /** Highlight empty cells as missing translations. Default `true`. */
591
+ highlightMissing?: boolean;
592
+ /** Render read-only. */
593
+ readOnly?: boolean;
594
+ /** Optional guided tour. `true` = built-in; array/object = custom steps. Shows a "?" button. */
595
+ tutorial?: NiceComponentTutorial_2;
596
+ }
597
+
598
+ export declare type NiceI18nValue = Record<string, Record<string, string>>;
599
+
600
+ export declare const NiceManifestEditor: ForwardRefExoticComponent<NiceManifestEditorProps & RefAttributes<HTMLDivElement>>;
601
+
602
+ export declare interface NiceManifestEditorProps extends NiceStandardProps {
603
+ /** The manifest object being edited (controlled). */
604
+ value: Record<string, unknown>;
605
+ /** Section descriptors — each renders a NiceSchemaForm over the manifest. */
606
+ sections: NiceManifestSection[];
607
+ /** Change callback with the full updated manifest. */
608
+ onChange: (manifest: Record<string, unknown>) => void;
609
+ /** Offer a Form ⇄ JSON toggle in each section. Default `true`. */
610
+ jsonView?: boolean;
611
+ /** When provided, adds a "Scripts" tab hosting a NiceScriptRunner. */
612
+ scriptRunner?: NiceScriptRunnerProps;
613
+ /** Lifecycle triggers — when provided, adds a "Lifecycle" tab. */
614
+ triggers?: NiceLifecycleTrigger[];
615
+ /** Current hook bindings. */
616
+ bindings?: NiceHookBinding[];
617
+ /** Handlers offered in the lifecycle binding picker. */
618
+ handlers?: NiceLifecycleHandlerOption[];
619
+ /** Bindings change callback. */
620
+ onBindingsChange?: (bindings: NiceHookBinding[]) => void;
621
+ /** Revisions — when provided, adds a "History" tab. */
622
+ revisions?: NiceRevision[];
623
+ /** Rollback callback for the history tab. */
624
+ onRollback?: (id: string) => void;
625
+ /** Lazy content resolver for the history diff. */
626
+ loadContent?: (id: string) => Promise<string>;
627
+ /** Logs for the bottom dock — when provided, a NiceLogConsole is shown. */
628
+ logs?: NiceLogEntry[];
629
+ /** Clear-logs callback. */
630
+ onClearLogs?: () => void;
631
+ /** Extra tabs appended after the built-in ones (e.g. payment / webhook panels). */
632
+ extraTabs?: NiceConsoleTab[];
633
+ /** Manifest-level validation surfaced in the status bar. */
634
+ validate?: (manifest: Record<string, unknown>) => NiceSchemaFormError[];
635
+ /** Console theme. Default `'light'`. */
636
+ theme?: 'dark' | 'light';
637
+ /** Editor height. Default `560`. */
638
+ height?: number | string;
639
+ /** Optional guided tour. `true` = built-in; array/object = custom steps. Shows a "?" button. */
640
+ tutorial?: NiceComponentTutorial;
641
+ }
642
+
643
+ /** One editable manifest section, described by a JSON Schema or field model. */
644
+ export declare interface NiceManifestSection {
645
+ id: string;
646
+ title: string;
647
+ icon?: React.ReactNode;
648
+ /** JSON Schema describing this section's fields (subset of the manifest). */
649
+ schema?: JsonSchema;
650
+ /** Or the repo's field-descriptor model. */
651
+ fields?: FormFieldDefinition[];
652
+ /** Per-field UI overrides forwarded to NiceSchemaForm. */
653
+ uiSchema?: Record<string, Partial<NiceFormItem>>;
654
+ }
655
+
656
+ /** Pluggable persistence — implement over a filesystem, API, or in-memory store. */
657
+ export declare interface NiceModuleDataProvider {
658
+ listModules(): Promise<NiceModuleSummary[]>;
659
+ loadModule(id: string): Promise<NiceModuleFiles>;
660
+ saveModule(id: string, files: NiceModuleFiles): Promise<void>;
661
+ createModule?(input: {
662
+ id: string;
663
+ name?: string;
664
+ }): Promise<NiceModuleSummary>;
665
+ }
666
+
667
+ export declare const NiceModuleEditor: ForwardRefExoticComponent<NiceModuleEditorProps & RefAttributes<HTMLDivElement>>;
668
+
669
+ export declare interface NiceModuleEditorProps extends NiceStandardProps {
670
+ /** Persistence adapter. */
671
+ dataProvider: NiceModuleDataProvider;
672
+ /** Manifest sections (schema-driven). Provide the real target schema (e.g. OmniVerk). */
673
+ manifestSections: NiceManifestSection[];
674
+ /** Entity-editor configuration (schemas, ER preview slot). */
675
+ entityConfig?: NiceModuleEntityConfig;
676
+ /** Locales offered in the i18n editor. */
677
+ locales?: string[];
678
+ /** Extra module-level validation, merged with manifest-section schema validation. */
679
+ validate?: (files: NiceModuleFiles) => NiceSchemaFormError[];
680
+ /** Wires a Scripts tab (NiceScriptRunner). */
681
+ scriptRunner?: NiceScriptRunnerProps;
682
+ /** Wires a Lifecycle tab. */
683
+ triggers?: NiceLifecycleTrigger[];
684
+ bindings?: NiceHookBinding[];
685
+ handlers?: NiceLifecycleHandlerOption[];
686
+ onBindingsChange?: (bindings: NiceHookBinding[]) => void;
687
+ /** Wires a History tab. */
688
+ revisions?: NiceRevision[];
689
+ onRollback?: (id: string) => void;
690
+ loadContent?: (id: string) => Promise<string>;
691
+ /** Console theme. Default `'light'`. */
692
+ theme?: 'dark' | 'light';
693
+ /** Editor height. Default `640`. */
694
+ height?: number | string;
695
+ /** Optional guided tour. `true` = built-in tour; array/object = custom steps. Shows a "?" button. */
696
+ tutorial?: NiceComponentTutorial;
697
+ }
698
+
699
+ export declare interface NiceModuleEntityConfig {
700
+ entityMetaSchema?: JsonSchema;
701
+ fieldSchema?: JsonSchema;
702
+ fieldsKey?: string;
703
+ nameKey?: string;
704
+ renderErPreview?: (entities: NiceEntity[]) => React.ReactNode;
705
+ }
706
+
707
+ /** The editable files of one module. */
708
+ export declare interface NiceModuleFiles {
709
+ manifest: Record<string, unknown>;
710
+ entities?: NiceEntity[];
711
+ i18n?: NiceI18nValue;
712
+ /** The module's views (`*.view.json`) — unified `NiceViewDefinitionV2` standard. */
713
+ views?: NiceViewDefinitionV2[];
714
+ /** Any extra parts the adapter wants to round-trip untouched. */
715
+ extra?: Record<string, unknown>;
716
+ }
717
+
718
+ /** A module entry shown in the browser. */
719
+ export declare interface NiceModuleSummary {
720
+ id: string;
721
+ name?: string;
722
+ category?: string;
723
+ description?: string;
724
+ }
725
+
726
+ export declare const NiceSchemaForm: ForwardRefExoticComponent<NiceSchemaFormProps & RefAttributes<HTMLDivElement>>;
727
+
728
+ /** A single validation problem produced by {@link validateAgainstJsonSchema}. */
729
+ export declare interface NiceSchemaFormError {
730
+ field: string;
731
+ message: string;
732
+ }
733
+
734
+ export declare interface NiceSchemaFormProps extends NiceStandardProps {
735
+ /** Draft-07 JSON Schema (object schema). Provide this OR `fields`. */
736
+ schema?: JsonSchema;
737
+ /** The repo's own field-descriptor model. Provide this OR `schema`. */
738
+ fields?: FormFieldDefinition[];
739
+ /** Per-field UI overrides merged onto generated items (label, type, colSpan, render, …). */
740
+ uiSchema?: Record<string, Partial<NiceFormItem>>;
741
+ /** The value being edited (controlled). */
742
+ value: Record<string, unknown>;
743
+ /** Change callback with the full updated value. */
744
+ onChange: (value: Record<string, unknown>) => void;
745
+ /** Called whenever validation runs, with the current errors. */
746
+ onValidate?: (errors: NiceSchemaFormError[]) => void;
747
+ /** Offer a Form ⇄ JSON view toggle. Default `false`. */
748
+ showJsonView?: boolean;
749
+ /** Number of layout columns. Default `1`. */
750
+ columns?: number;
751
+ /** Label placement. Default `'top'`. */
752
+ labelPosition?: 'top' | 'left';
753
+ /** Render read-only. */
754
+ readOnly?: boolean;
755
+ /** Validate on every change and show inline errors. Default `true`. */
756
+ liveValidation?: boolean;
757
+ /** Optional guided tour. `true` = built-in; array/object = custom steps. Shows a "?" button. */
758
+ tutorial?: NiceComponentTutorial;
477
759
  }
478
760
 
479
761
  /**
@@ -483,6 +765,15 @@ export declare function schemaToFormItems(schema: FormSchema): any[];
483
765
 
484
766
  export declare function useFormDesigner(): FormDesignerContextValue;
485
767
 
768
+ /** Convert a {@link NiceViewDefinitionV2} back to a {@link FormSchema} (best-effort). */
769
+ export declare function v2ToFormSchema(view: NiceViewDefinitionV2): FormSchema;
770
+
771
+ /**
772
+ * Validate a value object against a (subset of) Draft-07 JSON Schema.
773
+ * Covers required, type, enum, minLength/maxLength, minimum/maximum and pattern.
774
+ */
775
+ export declare function validateAgainstJsonSchema(value: Record<string, unknown>, schema: JsonSchema): NiceSchemaFormError[];
776
+
486
777
  /**
487
778
  * Validate form schema
488
779
  */