@nice2dev/ui-forms 1.3.11 → 1.3.12

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
@@ -11,6 +11,7 @@ import { NiceHookBinding } from '@nice2dev/ui';
11
11
  import { NiceRbacModel } from '@nice2dev/ui';
12
12
  import { NiceScriptRunnerProps } from '@nice2dev/ui';
13
13
  import { NiceStandardProps } from '@nice2dev/ui';
14
+ import { NiceTabItem } from '@nice2dev/ui';
14
15
  import { NiceViewDefinition } from '@nice2dev/ui';
15
16
  import { NiceWorkflowDefinition } from '@nice2dev/ui';
16
17
  import { RefAttributes } from 'react';
@@ -377,45 +378,56 @@ export declare interface NiceArrayFileKindOptions {
377
378
  export declare const NiceDevelopmentStudio: ForwardRefExoticComponent<NiceDevelopmentStudioProps & RefAttributes<HTMLDivElement>>;
378
379
 
379
380
  export declare interface NiceDevelopmentStudioProps extends NiceStandardProps {
380
- /** Where modules come from and go to. Without it the studio shows an empty explorer. */
381
+ /** Where modules come from and go to. Without it the studio shows an empty tree. */
381
382
  provider?: NiceStudioProvider;
382
383
  /**
383
384
  * How the host's modules look (file kinds, manifest sections, languages, rules, generator).
384
385
  * A function gets the translator, for translated section titles. Default: the native format.
385
386
  */
386
387
  preset?: NiceStudioPreset | ((t: (key: string, fallback: string) => string) => NiceStudioPreset);
387
- /** A module to open at start (e.g. from a `?module=` link). */
388
+ /** A module to show at start (e.g. from a `?module=` link). */
388
389
  defaultModule?: NiceStudioModuleKey;
389
- /** Which explorer tree shows first. Default `'modules'`. */
390
+ /** `'templates'` opens the tree's Templates row at start. Default `'modules'`. */
390
391
  defaultExplorerTab?: 'modules' | 'templates';
392
+ /**
393
+ * `'standard'` (default): forms only — files without a form stay as they are and out of sight.
394
+ * `'advanced'`: also the module's files with their source, entries without a designer as JSON
395
+ * and the log of what the studio did.
396
+ */
397
+ displayMode?: 'standard' | 'advanced';
398
+ /** The host's own actions above the tree (e.g. "Open a folder…"). */
399
+ actions?: NiceStudioAction[];
391
400
  /** A module was opened. */
392
401
  onModuleOpen?: (key: NiceStudioModuleKey) => void;
393
402
  /** A module was saved. */
394
403
  onSaved?: (key: NiceStudioModuleKey, result: Extract<NiceStudioWriteResult, {
395
404
  ok: true;
396
405
  }>) => void;
397
- /** A provider call failed (also logged in the output panel). */
406
+ /** A provider call failed (also shown in the status bar). */
398
407
  onError?: (error: unknown, context: string) => void;
399
408
  /** Show the changed files before saving. Default `true`. */
400
409
  reviewBeforeSave?: boolean;
401
410
  /** Runs script files (`script` documents) in a NiceScriptRunner. */
402
411
  scriptRunner?: Omit<NiceScriptRunnerProps, 'value' | 'onChange'>;
403
- /** The host's own preview of a view (e.g. its runtime renderer), next to the designer. */
412
+ /** The host's own preview of a view (e.g. its runtime renderer): small in the preview, full beside the designer. */
404
413
  renderViewPreview?: (ctx: NiceStudioViewPreviewContext) => React.ReactNode;
405
- /** Extra panels on a module's overview (payments, webhooks, …). */
414
+ /** Extra parts of a module (payments, webhooks, …): rows under the module, opened full-screen. */
406
415
  modulePanels?: (ctx: NiceStudioModulePanelContext) => NiceStudioPanel[];
407
416
  /** Browse and read only. */
408
417
  readOnly?: boolean;
409
- /** Console theme. Default `'light'`. */
418
+ /** @deprecated No effect since 1.3.12: the studio follows the page theme. */
410
419
  theme?: 'dark' | 'light';
411
420
  /** Studio height. Default `720`. */
412
421
  height?: number | string;
413
- /** Explorer width in px. Default `300`. */
422
+ /** The tree's least width in px; it takes the room the preview leaves. Default `320`. */
414
423
  explorerWidth?: number;
424
+ /** Width of the preview beside the tree, in px. Default `260`. */
425
+ previewWidth?: number;
415
426
  /** Optional guided tour. `true` = built-in tour; array/object = custom steps. Shows a "?" button. */
416
427
  tutorial?: NiceComponentTutorial;
417
428
  }
418
429
 
430
+ /** An entity definition (the OmniVerk ModuleEntity shape by default). */
419
431
  export declare type NiceEntity = Record<string, unknown>;
420
432
 
421
433
  export declare const NiceEntityEditor: ForwardRefExoticComponent<NiceEntityEditorProps & RefAttributes<HTMLDivElement>>;
@@ -445,6 +457,35 @@ export declare interface NiceEntityEditorProps extends NiceStandardProps {
445
457
  tutorial?: NiceComponentTutorial;
446
458
  }
447
459
 
460
+ export declare const NiceEntityForm: ForwardRefExoticComponent<NiceEntityFormProps & RefAttributes<HTMLDivElement>>;
461
+
462
+ export declare interface NiceEntityFormProps extends NiceStandardProps {
463
+ /** The entity being edited (controlled). Omit it to let the form keep its own. */
464
+ value?: NiceEntity;
465
+ /** Initial entity when uncontrolled. */
466
+ defaultValue?: NiceEntity;
467
+ /** Change callback with the whole updated entity. */
468
+ onChange?: (entity: NiceEntity) => void;
469
+ /** JSON Schema for entity metadata (name, table, flags …). Defaults to the OmniVerk shape. */
470
+ entityMetaSchema?: JsonSchema;
471
+ /** JSON Schema for a single field. Defaults to the OmniVerk ModuleEntityField shape. */
472
+ fieldSchema?: JsonSchema;
473
+ /** Property holding the entity's fields. Default `'fields'`. */
474
+ fieldsKey?: string;
475
+ /** Property holding the entity's validation rules (NiceFieldValidationRule[]). Default `'validations'`. */
476
+ validationsKey?: string;
477
+ /** The open tab: `'general'`, `'fields'`, `'validation'` or an extra tab's id. Omit it to let the form keep its own. */
478
+ activeTab?: string;
479
+ /** Initial tab when uncontrolled. Default `'general'`. */
480
+ defaultActiveTab?: string;
481
+ /** The user switched tabs. */
482
+ onActiveTabChange?: (tab: string) => void;
483
+ /** More tabs after Validation (e.g. an ER diagram). */
484
+ extraTabs?: NiceTabItem[];
485
+ /** Render read-only. */
486
+ readOnly?: boolean;
487
+ }
488
+
448
489
  export declare const NiceI18nEditor: ForwardRefExoticComponent<NiceI18nEditorProps & RefAttributes<HTMLDivElement>>;
449
490
 
450
491
  export declare interface NiceI18nEditorProps extends NiceBaseProps {
@@ -662,6 +703,16 @@ export declare interface NiceSchemaFormProps extends NiceStandardProps {
662
703
  tutorial?: NiceComponentTutorial;
663
704
  }
664
705
 
706
+ /** A host's own action in the studio's tree header (e.g. "Open a folder…"). */
707
+ export declare interface NiceStudioAction {
708
+ key: string;
709
+ label: string;
710
+ /** NiceIcon name. */
711
+ icon?: string;
712
+ disabled?: boolean;
713
+ onSelect: () => void;
714
+ }
715
+
665
716
  /** What a file kind's decode and encode know about the module. */
666
717
  export declare interface NiceStudioCodecContext {
667
718
  moduleId: string;
@@ -861,7 +912,7 @@ export declare interface NiceStudioPackage {
861
912
  readOnly?: boolean;
862
913
  }
863
914
 
864
- /** An extra panel on a module's overview (payments, webhooks — anything host-specific). */
915
+ /** An extra part of a module (payments, webhooks — anything host-specific): a row under the module in the tree, its content full-screen. */
865
916
  export declare interface NiceStudioPanel {
866
917
  key: string;
867
918
  label: string;