@dipusevilla/componentes-iu 1.1.6 → 1.1.8
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.cjs.js +58 -58
- package/dist/index.css +1 -1
- package/dist/index.es.js +11799 -11461
- package/dist/index.umd.js +101 -101
- package/dist/types/components/FormRenderer.d.ts +2 -1
- package/dist/types/editor/SchemaEditorHost.d.ts +2 -1
- package/dist/types/editor/components/VariantSelector.d.ts +1 -0
- package/dist/types/editor/dnd/useFormRendererDeps.d.ts +1 -1
- package/dist/types/editor/store.d.ts +6 -0
- package/dist/types/editor/utils/adapterGenerator.d.ts +1 -1
- package/dist/types/types/EndpointTypes.d.ts +4 -2
- package/dist/types/types/FormTypes.d.ts +24 -0
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type Resolver } from "react-hook-form";
|
|
2
2
|
import type { FormSchema } from "../types/FormTypes";
|
|
3
|
-
export declare function FormRenderer({ schema, resolver: externalResolver, serviceRegistry, }: {
|
|
3
|
+
export declare function FormRenderer({ schema, resolver: externalResolver, serviceRegistry, activeVariantId, }: {
|
|
4
4
|
schema: FormSchema;
|
|
5
5
|
resolver?: Resolver<any>;
|
|
6
6
|
serviceRegistry?: Record<string, unknown>;
|
|
7
|
+
activeVariantId?: string;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,6 +12,7 @@ export type SchemaEditorHostProps = {
|
|
|
12
12
|
rightPanelOpen?: boolean;
|
|
13
13
|
onRightPanelOpenChange?: (open: boolean) => void;
|
|
14
14
|
className?: string;
|
|
15
|
+
axiosInstance?: any;
|
|
15
16
|
};
|
|
16
|
-
export declare function SchemaEditorHost({ title, baseDir, fs, services, onSchemaChange, rightPanel, rightPanelWidth, rightPanelDefaultOpen, rightPanelOpen, onRightPanelOpenChange, className, }: SchemaEditorHostProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function SchemaEditorHost({ title, baseDir, fs, services, onSchemaChange, rightPanel, rightPanelWidth, rightPanelDefaultOpen, rightPanelOpen, onRightPanelOpenChange, className, axiosInstance, }: SchemaEditorHostProps): import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
export default SchemaEditorHost;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function VariantSelector(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,7 +5,7 @@ type RuleContainer = {
|
|
|
5
5
|
rule?: RuleExpr;
|
|
6
6
|
clearTo?: unknown;
|
|
7
7
|
};
|
|
8
|
-
export declare function useFormRendererDeps(schema: FormSchema, externalResolver?: any, serviceRegistry?: Record<string, unknown
|
|
8
|
+
export declare function useFormRendererDeps(schema: FormSchema, externalResolver?: any, serviceRegistry?: Record<string, unknown>, activeVariantId?: string): {
|
|
9
9
|
methods: import("react-hook-form").UseFormReturn<Record<string, unknown>, any, Record<string, unknown>>;
|
|
10
10
|
control: import("react-hook-form").Control<Record<string, unknown>, any, Record<string, unknown>>;
|
|
11
11
|
formState: import("react-hook-form").FormState<Record<string, unknown>>;
|
|
@@ -39,6 +39,7 @@ type EditorState = {
|
|
|
39
39
|
past: FormSchema[];
|
|
40
40
|
future: FormSchema[];
|
|
41
41
|
fieldPick: FieldPickState;
|
|
42
|
+
activeVariantId: string | null;
|
|
42
43
|
relationsEnabled: boolean;
|
|
43
44
|
fieldDom: FieldDomRegistry;
|
|
44
45
|
showRelations: boolean;
|
|
@@ -75,6 +76,11 @@ type EditorActions = {
|
|
|
75
76
|
redo: () => void;
|
|
76
77
|
resetHistory: () => void;
|
|
77
78
|
recoverOrphans: () => void;
|
|
79
|
+
setActiveVariant: (key: string | null) => void;
|
|
80
|
+
addVariant: (key: string, label: string) => void;
|
|
81
|
+
removeVariant: (key: string) => void;
|
|
82
|
+
renameVariant: (key: string, label: string) => void;
|
|
83
|
+
setVariantOverride: (fieldKey: string, override: Partial<import("../types/FormTypes").VariantOverride>) => void;
|
|
78
84
|
addField: (field: FieldEntry) => void;
|
|
79
85
|
removeField: (name: string) => void;
|
|
80
86
|
updateField: (name: string, updater: (f: FieldSchema) => void) => void;
|
|
@@ -6,4 +6,4 @@ export interface GeneratedAdapter {
|
|
|
6
6
|
/**
|
|
7
7
|
* Generate adapter functions from parsed OpenAPI for the services registry
|
|
8
8
|
*/
|
|
9
|
-
export declare function generateAdapters(parsed: ParsedOpenAPI): Record<string, (query: string, ctx: any) => Promise<any>>;
|
|
9
|
+
export declare function generateAdapters(parsed: ParsedOpenAPI, axiosInstance?: any): Record<string, (query: string, ctx: any) => Promise<any>>;
|
|
@@ -4,14 +4,16 @@
|
|
|
4
4
|
export interface EndpointParameter {
|
|
5
5
|
/** Nombre del parámetro */
|
|
6
6
|
name: string;
|
|
7
|
-
/** Tipo de valor: estático, referencia a campo
|
|
8
|
-
type: 'static' | 'field' | 'system';
|
|
7
|
+
/** Tipo de valor: estático, referencia a campo, variable de sistema o storage */
|
|
8
|
+
type: 'static' | 'field' | 'system' | 'session' | 'local';
|
|
9
9
|
/** Valor estático (si type === 'static') */
|
|
10
10
|
value?: any;
|
|
11
11
|
/** Referencia a campo del formulario (si type === 'field') */
|
|
12
12
|
fieldRef?: string;
|
|
13
13
|
/** Clave de variable de sistema (si type === 'system') */
|
|
14
14
|
systemVar?: string;
|
|
15
|
+
/** Clave de almacenamiento (si type === 'session' | 'local') */
|
|
16
|
+
storageKey?: string;
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* Configuración completa de un endpoint
|
|
@@ -327,6 +327,30 @@ export interface FormSchema {
|
|
|
327
327
|
onloadEndpoints?: EndpointConfig[];
|
|
328
328
|
/** Variables de sistema definidas por el usuario */
|
|
329
329
|
variables?: SystemVariable[];
|
|
330
|
+
/** Variantes del esquema (para distintos contextos de uso) */
|
|
331
|
+
variants?: FormVariant[];
|
|
332
|
+
}
|
|
333
|
+
export interface VariantOverride {
|
|
334
|
+
/** Ocultar campo en esta variante */
|
|
335
|
+
hidden?: boolean;
|
|
336
|
+
/** Forzar deshabilitado */
|
|
337
|
+
disabled?: boolean;
|
|
338
|
+
/** Clase CSS extra para el contenedor */
|
|
339
|
+
className?: string;
|
|
340
|
+
/** Sobrescribir etiqueta */
|
|
341
|
+
label?: string;
|
|
342
|
+
/** Sobrescribir placeholder */
|
|
343
|
+
placeholder?: string;
|
|
344
|
+
/** Sobrescribir validaciones */
|
|
345
|
+
validation?: FieldSchema['validation'];
|
|
346
|
+
/** Sobrescribir valor por defecto */
|
|
347
|
+
defaultValue?: any;
|
|
348
|
+
}
|
|
349
|
+
export interface FormVariant {
|
|
350
|
+
key: string;
|
|
351
|
+
label: string;
|
|
352
|
+
/** Mapa de overrides por nombre de campo */
|
|
353
|
+
overrides: Record<string, VariantOverride>;
|
|
330
354
|
}
|
|
331
355
|
export interface SystemVariable {
|
|
332
356
|
key: string;
|