@dipusevilla/componentes-iu 1.1.2 → 1.1.4
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 +139 -28
- package/dist/index.css +1 -1
- package/dist/index.es.js +13660 -12696
- package/dist/index.umd.js +140 -29
- package/dist/types/components/Checkbox.d.ts +2 -1
- package/dist/types/components/DateInput.d.ts +2 -2
- package/dist/types/components/FileUploader.d.ts +2 -1
- package/dist/types/components/FormFieldInput.d.ts +1 -1
- package/dist/types/components/FormLabel.d.ts +1 -1
- package/dist/types/components/Input.d.ts +1 -1
- package/dist/types/components/Modal.d.ts +1 -0
- package/dist/types/components/OptionGroup.d.ts +2 -1
- package/dist/types/components/SearchField.d.ts +1 -1
- package/dist/types/components/Select.d.ts +1 -1
- package/dist/types/components/TextArea.d.ts +1 -1
- package/dist/types/editor/components/EndpointBrowser.d.ts +11 -0
- package/dist/types/editor/components/EndpointConfigModal.d.ts +17 -0
- package/dist/types/editor/components/EndpointParameterConfig.d.ts +14 -0
- package/dist/types/editor/components/FieldPicker.d.ts +19 -0
- package/dist/types/editor/components/InlineEdit.d.ts +11 -0
- package/dist/types/editor/components/ServiceManagerDialog.d.ts +5 -0
- package/dist/types/editor/components/SimpleFileExplorer.d.ts +1 -1
- package/dist/types/editor/components/canvas/CanvasColumn.d.ts +15 -0
- package/dist/types/editor/components/canvas/CanvasField.d.ts +16 -0
- package/dist/types/editor/components/canvas/CanvasInputGroupChild.d.ts +12 -0
- package/dist/types/editor/components/canvas/CanvasRow.d.ts +13 -0
- package/dist/types/editor/components/canvas/CanvasSection.d.ts +12 -0
- package/dist/types/editor/components/canvas/CanvasTabsNode.d.ts +16 -0
- package/dist/types/editor/components/canvas/CollapseToggle.d.ts +9 -0
- package/dist/types/editor/dnd/DraggableTabChip.d.ts +2 -1
- package/dist/types/editor/dnd/renderField.d.ts +2 -0
- package/dist/types/editor/dnd/useFormRendererDeps.d.ts +2 -2
- package/dist/types/editor/hooks/useFieldNode.d.ts +6 -0
- package/dist/types/editor/hooks/useSchemaDefinitions.d.ts +5 -0
- package/dist/types/editor/types/endpointMetadata.d.ts +59 -0
- package/dist/types/editor/utils/adapterGenerator.d.ts +10 -0
- package/dist/types/editor/utils/metadataGenerator.d.ts +6 -0
- package/dist/types/editor/utils/openApiParserEnhanced.d.ts +37 -0
- package/dist/types/editor/utils/persistence.d.ts +4 -0
- package/dist/types/types/FormTypes.d.ts +27 -0
- package/dist/types/utils/endpointHelpers.d.ts +16 -0
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { Control } from 'react-hook-form';
|
|
2
3
|
export interface CheckboxProps {
|
|
3
4
|
/** --- Modo RHF (controlado) --- */
|
|
@@ -6,7 +7,7 @@ export interface CheckboxProps {
|
|
|
6
7
|
rules?: any;
|
|
7
8
|
defaultValue?: boolean;
|
|
8
9
|
/** --- Props comunes --- */
|
|
9
|
-
label?: string;
|
|
10
|
+
label?: string | React.ReactNode;
|
|
10
11
|
labelHidden?: boolean;
|
|
11
12
|
disabled?: boolean;
|
|
12
13
|
size?: 'sm' | 'md' | 'lg';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type InputHTMLAttributes } from "react";
|
|
1
|
+
import React, { type InputHTMLAttributes } from "react";
|
|
2
2
|
import type { Control, RegisterOptions } from "react-hook-form";
|
|
3
3
|
type Size = "sm" | "md" | "lg";
|
|
4
4
|
export interface DateInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "name" | "defaultValue"> {
|
|
@@ -11,7 +11,7 @@ export interface DateInputProps extends Omit<InputHTMLAttributes<HTMLInputElemen
|
|
|
11
11
|
showTime?: boolean;
|
|
12
12
|
size?: Size;
|
|
13
13
|
width?: string;
|
|
14
|
-
label?: string;
|
|
14
|
+
label?: string | React.ReactNode;
|
|
15
15
|
labelHidden?: boolean;
|
|
16
16
|
hasError?: boolean;
|
|
17
17
|
errorMessage?: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { Control } from 'react-hook-form';
|
|
2
3
|
type Size = 'sm' | 'md' | 'lg';
|
|
3
4
|
export interface FileUploaderProps {
|
|
@@ -9,7 +10,7 @@ export interface FileUploaderProps {
|
|
|
9
10
|
accept?: string;
|
|
10
11
|
size?: Size;
|
|
11
12
|
width?: string;
|
|
12
|
-
label?: string;
|
|
13
|
+
label?: string | React.ReactNode;
|
|
13
14
|
labelHidden?: boolean;
|
|
14
15
|
disabled?: boolean;
|
|
15
16
|
hasError?: boolean;
|
|
@@ -4,7 +4,7 @@ import type { InputType } from "./Input";
|
|
|
4
4
|
type SvgCmp = React.FC<React.SVGProps<SVGSVGElement>>;
|
|
5
5
|
export interface FormFieldInputProps {
|
|
6
6
|
name: string;
|
|
7
|
-
label?: string;
|
|
7
|
+
label?: string | React.ReactNode;
|
|
8
8
|
type?: InputType;
|
|
9
9
|
size?: "sm" | "md" | "lg";
|
|
10
10
|
width?: string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { Control } from 'react-hook-form';
|
|
2
3
|
import { Option } from '../types/FormTypes';
|
|
3
4
|
type Size = 'sm' | 'md' | 'lg';
|
|
4
5
|
export interface OptionGroupProps {
|
|
5
6
|
/** Etiqueta accesible / visible para todo el grupo */
|
|
6
|
-
groupLabel?: string;
|
|
7
|
+
groupLabel?: string | React.ReactNode;
|
|
7
8
|
/** Array de opciones a renderizar */
|
|
8
9
|
options: Option[];
|
|
9
10
|
control: Control<any>;
|
|
@@ -11,7 +11,7 @@ export interface SearchFieldProps {
|
|
|
11
11
|
control: Control<any>;
|
|
12
12
|
searchFn: (query: string, ctx?: FormCtx) => Promise<Option[]>;
|
|
13
13
|
resolveByValue?: (value: string, ctx?: FormCtx) => Promise<Option | null>;
|
|
14
|
-
label?: string;
|
|
14
|
+
label?: string | React.ReactNode;
|
|
15
15
|
size?: "sm" | "md" | "lg";
|
|
16
16
|
width?: string;
|
|
17
17
|
disabled?: boolean;
|
|
@@ -9,7 +9,7 @@ export interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaE
|
|
|
9
9
|
defaultValue?: string;
|
|
10
10
|
size?: Size;
|
|
11
11
|
width?: string;
|
|
12
|
-
label?: string;
|
|
12
|
+
label?: string | React.ReactNode;
|
|
13
13
|
labelHidden?: boolean;
|
|
14
14
|
hasError?: boolean;
|
|
15
15
|
errorMessage?: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EndpointMetadata } from '../types/endpointMetadata';
|
|
3
|
+
export interface EndpointBrowserProps {
|
|
4
|
+
/** Tipo de endpoints a mostrar */
|
|
5
|
+
filterType?: 'options' | 'search';
|
|
6
|
+
/** Endpoint actualmente seleccionado */
|
|
7
|
+
selectedKey?: string;
|
|
8
|
+
/** Callback cuando se selecciona un endpoint */
|
|
9
|
+
onSelect: (endpoint: EndpointMetadata) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const EndpointBrowser: React.FC<EndpointBrowserProps>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EndpointConfig, FieldSchema } from '../../types/FormTypes';
|
|
3
|
+
export interface EndpointConfigModalProps {
|
|
4
|
+
/** Si el modal está abierto */
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
/** Callback para cerrar el modal */
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
/** Configuración actual del endpoint */
|
|
9
|
+
currentConfig?: EndpointConfig | string;
|
|
10
|
+
/** Tipo de endpoint a configurar */
|
|
11
|
+
endpointType: 'options' | 'search';
|
|
12
|
+
/** Callback cuando se confirma la configuración */
|
|
13
|
+
onConfirm: (config: EndpointConfig) => void;
|
|
14
|
+
/** Campos disponibles del formulario para referencias */
|
|
15
|
+
availableFields: FieldSchema[];
|
|
16
|
+
}
|
|
17
|
+
export declare const EndpointConfigModal: React.FC<EndpointConfigModalProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EndpointParameter, FieldSchema } from '../../types/FormTypes';
|
|
3
|
+
import type { EndpointParameterMetadata } from '../types/endpointMetadata';
|
|
4
|
+
export interface EndpointParameterConfigProps {
|
|
5
|
+
/** Metadata del parámetro */
|
|
6
|
+
paramMeta: EndpointParameterMetadata;
|
|
7
|
+
/** Valor actual del parámetro */
|
|
8
|
+
value?: EndpointParameter;
|
|
9
|
+
/** Callback cuando cambia la configuración */
|
|
10
|
+
onChange: (param: EndpointParameter) => void;
|
|
11
|
+
/** Campos disponibles para referencias */
|
|
12
|
+
availableFields: FieldSchema[];
|
|
13
|
+
}
|
|
14
|
+
export declare const EndpointParameterConfig: React.FC<EndpointParameterConfigProps>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FieldSchema } from '../../types/FormTypes';
|
|
3
|
+
export interface FieldPickerProps {
|
|
4
|
+
/** Campos disponibles para seleccionar */
|
|
5
|
+
fields: FieldSchema[];
|
|
6
|
+
/** Campo actualmente seleccionado */
|
|
7
|
+
selectedField?: string;
|
|
8
|
+
/** Callback cuando se selecciona un campo */
|
|
9
|
+
onSelect: (fieldName: string) => void;
|
|
10
|
+
/** Callback para cerrar el picker */
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
/** Mostrar como modal (default) o inline */
|
|
13
|
+
mode?: 'modal' | 'inline';
|
|
14
|
+
/** Título del picker */
|
|
15
|
+
title?: string;
|
|
16
|
+
/** Filtrar por tipos de campo específicos */
|
|
17
|
+
filterTypes?: string[];
|
|
18
|
+
}
|
|
19
|
+
export declare const FieldPicker: React.FC<FieldPickerProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface InlineEditProps {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (value: string) => void;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
inputClassName?: string;
|
|
8
|
+
autoFocus?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const InlineEdit: React.FC<InlineEditProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SectionColumn } from "../../../types/FormTypes";
|
|
3
|
+
interface CanvasColumnProps {
|
|
4
|
+
col: SectionColumn;
|
|
5
|
+
widthClass: string;
|
|
6
|
+
nodeIdx: number;
|
|
7
|
+
sIdx: number;
|
|
8
|
+
rIdx: number;
|
|
9
|
+
cIdx: number;
|
|
10
|
+
parentType: "rows" | "tabs";
|
|
11
|
+
tabKey?: string;
|
|
12
|
+
confirmDelete: (title: string, message: React.ReactNode, onConfirm: () => void) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const CanvasColumn: React.NamedExoticComponent<CanvasColumnProps>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FieldSchema } from "../../../types/FormTypes";
|
|
3
|
+
interface CanvasFieldProps {
|
|
4
|
+
field: string | FieldSchema | any;
|
|
5
|
+
index: number;
|
|
6
|
+
nodeIdx: number;
|
|
7
|
+
sIdx: number;
|
|
8
|
+
rIdx: number;
|
|
9
|
+
cIdx: number;
|
|
10
|
+
parentType: "rows" | "tabs";
|
|
11
|
+
tabKey?: string;
|
|
12
|
+
onDelete: () => void;
|
|
13
|
+
confirmDelete: (title: string, message: React.ReactNode, onConfirm: () => void) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const CanvasField: React.NamedExoticComponent<CanvasFieldProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FieldSchema } from "../../../types/FormTypes";
|
|
3
|
+
interface CanvasInputGroupChildProps {
|
|
4
|
+
fieldOrName: string | FieldSchema;
|
|
5
|
+
groupName: string;
|
|
6
|
+
index: number;
|
|
7
|
+
onRemove: () => void;
|
|
8
|
+
setSelection: (sel: any) => void;
|
|
9
|
+
confirmDelete: (title: string, message: React.ReactNode, onConfirm: () => void) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const CanvasInputGroupChild: React.MemoExoticComponent<({ fieldOrName, groupName, index, onRemove, setSelection, confirmDelete, }: CanvasInputGroupChildProps) => import("react/jsx-runtime").JSX.Element>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SectionRowObject } from "../../../types/FormTypes";
|
|
3
|
+
interface CanvasRowProps {
|
|
4
|
+
row: SectionRowObject;
|
|
5
|
+
nodeIdx: number;
|
|
6
|
+
sIdx: number;
|
|
7
|
+
rIdx: number;
|
|
8
|
+
parentType: "rows" | "tabs";
|
|
9
|
+
tabKey?: string;
|
|
10
|
+
confirmDelete: (title: string, message: React.ReactNode, onConfirm: () => void) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const CanvasRow: React.NamedExoticComponent<CanvasRowProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SectionBlock } from "../../../types/FormTypes";
|
|
3
|
+
interface CanvasSectionProps {
|
|
4
|
+
section: SectionBlock;
|
|
5
|
+
nodeIdx: number;
|
|
6
|
+
sIdx: number;
|
|
7
|
+
parentType: "rows" | "tabs";
|
|
8
|
+
tabKey?: string;
|
|
9
|
+
confirmDelete: (title: string, message: React.ReactNode, onConfirm: () => void) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const CanvasSection: React.NamedExoticComponent<CanvasSectionProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { LayoutNode } from "../../../types/FormTypes";
|
|
3
|
+
interface CanvasTabsNodeProps {
|
|
4
|
+
node: LayoutNode & {
|
|
5
|
+
type: "tabs";
|
|
6
|
+
};
|
|
7
|
+
nodeIdx: number;
|
|
8
|
+
draggedTabSection: {
|
|
9
|
+
nodeIdx: number;
|
|
10
|
+
tabKey: string;
|
|
11
|
+
sIdx: number;
|
|
12
|
+
} | null;
|
|
13
|
+
confirmDelete: (title: string, message: React.ReactNode, onConfirm: () => void) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const CanvasTabsNode: React.NamedExoticComponent<CanvasTabsNodeProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function CollapseToggle({ expanded, onClick, labelExpanded, labelCollapsed, titleExpanded, titleCollapsed, className, }: {
|
|
2
|
+
expanded: boolean;
|
|
3
|
+
onClick: () => void;
|
|
4
|
+
labelExpanded: string;
|
|
5
|
+
labelCollapsed: string;
|
|
6
|
+
titleExpanded?: string;
|
|
7
|
+
titleCollapsed?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,9 +2,10 @@ export declare function TabDropSlot({ nodeIdx, insertAt }: {
|
|
|
2
2
|
nodeIdx: number;
|
|
3
3
|
insertAt: number;
|
|
4
4
|
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
export declare function DraggableTabChip({ nodeIdx, index, tabKey, label, }: {
|
|
5
|
+
export declare function DraggableTabChip({ nodeIdx, index, tabKey, label, onRename, }: {
|
|
6
6
|
nodeIdx: number;
|
|
7
7
|
index: number;
|
|
8
8
|
tabKey: string;
|
|
9
9
|
label: string;
|
|
10
|
+
onRename?: (val: string) => void;
|
|
10
11
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -20,6 +20,8 @@ export type RenderFieldDeps = {
|
|
|
20
20
|
registry?: Record<string, unknown>;
|
|
21
21
|
methods: any;
|
|
22
22
|
translateFn: (key: string | undefined, fallback?: string) => string;
|
|
23
|
+
onUpdateField?: (name: string, patch: any) => void;
|
|
24
|
+
isDesignMode?: boolean;
|
|
23
25
|
};
|
|
24
26
|
export declare function renderFieldFactory(deps: RenderFieldDeps): (item: string | FieldSchema | ButtonField | InputGroupField) => React.ReactNode;
|
|
25
27
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RuleExpr } from "../../rules/RuleDSL";
|
|
2
|
-
import { FormSchema, FieldSchema } from "../../types/FormTypes";
|
|
2
|
+
import { FormSchema, FieldSchema, Option } from "../../types/FormTypes";
|
|
3
3
|
type RuleContainer = {
|
|
4
4
|
enabled?: boolean;
|
|
5
5
|
rule?: RuleExpr;
|
|
@@ -12,7 +12,7 @@ export declare function useFormRendererDeps(schema: FormSchema, externalResolver
|
|
|
12
12
|
fields: import("../../types/FormTypes").FieldEntry[];
|
|
13
13
|
fieldsByName: Record<string, FieldSchema>;
|
|
14
14
|
asyncOptionsMap: Record<string, import("../../hooks/useAsyncSelectOptions").Option[]>;
|
|
15
|
-
adapterOptionsMap:
|
|
15
|
+
adapterOptionsMap: Record<string, Option[]>;
|
|
16
16
|
disabledMap: {
|
|
17
17
|
[x: string]: boolean;
|
|
18
18
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FieldSchema, InputGroupField } from "../../types/FormTypes";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the field definition for a given name.
|
|
4
|
+
* Uses a granular selector to avoid re-rendering when other fields change.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useFieldNode(name: string | undefined): FieldSchema | InputGroupField | undefined;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metadata types for endpoints
|
|
3
|
+
* This metadata is generated dynamically from OpenAPI specs
|
|
4
|
+
*/
|
|
5
|
+
export interface EndpointParameterMetadata {
|
|
6
|
+
/** Nombre del parámetro */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Tipo de dato esperado */
|
|
9
|
+
type: 'string' | 'number' | 'boolean';
|
|
10
|
+
/** Si el parámetro es requerido */
|
|
11
|
+
required: boolean;
|
|
12
|
+
/** Descripción legible del parámetro */
|
|
13
|
+
description?: string;
|
|
14
|
+
/** De dónde puede venir el valor */
|
|
15
|
+
source?: 'static' | 'field' | 'both';
|
|
16
|
+
}
|
|
17
|
+
export interface EndpointMetadata {
|
|
18
|
+
/** Clave única en el registry */
|
|
19
|
+
key: string;
|
|
20
|
+
/** Nombre del controller al que pertenece */
|
|
21
|
+
controller: string;
|
|
22
|
+
/** Nombre legible del endpoint */
|
|
23
|
+
name: string;
|
|
24
|
+
/** Descripción del endpoint */
|
|
25
|
+
description?: string;
|
|
26
|
+
/** Tipo de endpoint: opciones para Select o búsqueda para SearchField */
|
|
27
|
+
type: 'options' | 'search';
|
|
28
|
+
/** Parámetros que acepta el endpoint */
|
|
29
|
+
parameters?: EndpointParameterMetadata[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Updates or adds endpoint metadata dynamically
|
|
33
|
+
* (used when importing OpenAPI)
|
|
34
|
+
*/
|
|
35
|
+
export declare function updateEndpointMetadata(newMetadata: Record<string, EndpointMetadata>): void;
|
|
36
|
+
/**
|
|
37
|
+
* Gets metadata for a specific endpoint by key
|
|
38
|
+
*/
|
|
39
|
+
export declare function getEndpointMetadata(key: string): EndpointMetadata | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Groups endpoints by controller
|
|
42
|
+
*/
|
|
43
|
+
export declare function getEndpointsByController(): Record<string, EndpointMetadata[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Filters endpoints by type (options or search)
|
|
46
|
+
*/
|
|
47
|
+
export declare function getEndpointsByType(type: 'options' | 'search'): EndpointMetadata[];
|
|
48
|
+
/**
|
|
49
|
+
* Searches endpoints by text (name, description, key)
|
|
50
|
+
*/
|
|
51
|
+
export declare function searchEndpoints(query: string): EndpointMetadata[];
|
|
52
|
+
/**
|
|
53
|
+
* Gets all metadata entries
|
|
54
|
+
*/
|
|
55
|
+
export declare function getAllEndpointMetadata(): Record<string, EndpointMetadata>;
|
|
56
|
+
/**
|
|
57
|
+
* Clears all metadata (useful for testing)
|
|
58
|
+
*/
|
|
59
|
+
export declare function clearEndpointMetadata(): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ParsedOpenAPI } from './openApiParserEnhanced';
|
|
2
|
+
import type { Option } from '../../types/FormTypes';
|
|
3
|
+
export interface GeneratedAdapter {
|
|
4
|
+
key: string;
|
|
5
|
+
fn: (query: string, ctx: any) => Promise<Option[]>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Generate adapter functions from parsed OpenAPI for the services registry
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateAdapters(parsed: ParsedOpenAPI): Record<string, (query: string, ctx: any) => Promise<Option[]>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ParsedOpenAPI } from './openApiParserEnhanced';
|
|
2
|
+
import type { EndpointMetadata } from '../types/endpointMetadata';
|
|
3
|
+
/**
|
|
4
|
+
* Generate endpoint metadata from parsed OpenAPI for the endpoint browser
|
|
5
|
+
*/
|
|
6
|
+
export declare function generateEndpointMetadata(parsed: ParsedOpenAPI): Record<string, EndpointMetadata>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface ParsedOpenAPI {
|
|
2
|
+
controllers: ParsedController[];
|
|
3
|
+
endpoints: ParsedEndpoint[];
|
|
4
|
+
schemas: Record<string, any>;
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ParsedController {
|
|
9
|
+
name: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
endpoints: ParsedEndpoint[];
|
|
12
|
+
}
|
|
13
|
+
export interface ParsedEndpoint {
|
|
14
|
+
key: string;
|
|
15
|
+
controller: string;
|
|
16
|
+
operationId: string;
|
|
17
|
+
path: string;
|
|
18
|
+
method: string;
|
|
19
|
+
summary?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
parameters: ParsedParameter[];
|
|
22
|
+
requestBody?: any;
|
|
23
|
+
responses: Record<string, any>;
|
|
24
|
+
tags: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface ParsedParameter {
|
|
27
|
+
name: string;
|
|
28
|
+
in: 'query' | 'path' | 'header' | 'cookie' | 'body';
|
|
29
|
+
required: boolean;
|
|
30
|
+
schema: any;
|
|
31
|
+
description?: string;
|
|
32
|
+
type?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Parse OpenAPI 3.x specification with enhanced structure
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseOpenAPIEnhanced(spec: any): ParsedOpenAPI;
|
|
@@ -105,6 +105,10 @@ export interface FieldSchema {
|
|
|
105
105
|
debounceMs?: number;
|
|
106
106
|
/** Función para resolver valor inicial (edición) */
|
|
107
107
|
resolveByValue?: (value: string, ctx?: FormCtx) => Promise<Option | null>;
|
|
108
|
+
/** @deprecated Use endpointConfig instead. Clave simple del registry para opciones (Select) */
|
|
109
|
+
optionSource?: string;
|
|
110
|
+
/** Nueva configuración avanzada de endpoint (reemplaza optionSource/searchSource) */
|
|
111
|
+
endpointConfig?: EndpointConfig;
|
|
108
112
|
/** Valores por defecto sincrónicos. */
|
|
109
113
|
defaultValue?: Record<string, unknown>;
|
|
110
114
|
}
|
|
@@ -121,6 +125,7 @@ export interface ButtonField extends Omit<FieldSchema, "type"> {
|
|
|
121
125
|
*/
|
|
122
126
|
export interface InputGroupField {
|
|
123
127
|
type: "inputGroup";
|
|
128
|
+
name: string;
|
|
124
129
|
/** Etiqueta del grupo. */
|
|
125
130
|
groupLabel: string;
|
|
126
131
|
/** Cada elemento puede ser string (referencia a FieldSchema global)
|
|
@@ -221,6 +226,28 @@ export type Option = {
|
|
|
221
226
|
label?: string;
|
|
222
227
|
value: string | number;
|
|
223
228
|
};
|
|
229
|
+
/**
|
|
230
|
+
* Configuración de parámetro para endpoint
|
|
231
|
+
*/
|
|
232
|
+
export interface EndpointParameter {
|
|
233
|
+
/** Nombre del parámetro */
|
|
234
|
+
name: string;
|
|
235
|
+
/** Tipo de valor: estático o referencia a campo */
|
|
236
|
+
type: 'static' | 'field';
|
|
237
|
+
/** Valor estático (si type === 'static') */
|
|
238
|
+
value?: any;
|
|
239
|
+
/** Referencia a campo del formulario (si type === 'field') */
|
|
240
|
+
fieldRef?: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Configuración completa de un endpoint (para optionSource/searchSource mejorado)
|
|
244
|
+
*/
|
|
245
|
+
export interface EndpointConfig {
|
|
246
|
+
/** Clave del endpoint en el registry (ej: "encargo.organosAdjudicacion") */
|
|
247
|
+
key: string;
|
|
248
|
+
/** Parámetros configurados para el endpoint */
|
|
249
|
+
parameters?: Record<string, EndpointParameter>;
|
|
250
|
+
}
|
|
224
251
|
export type ConditionalProp = VisibilityRule | {
|
|
225
252
|
watchField: string;
|
|
226
253
|
watchValue: unknown | ((vals: Record<string, unknown>) => boolean);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { EndpointConfig, EndpointParameter } from '../types/FormTypes';
|
|
2
|
+
import type { UseFormGetValues } from 'react-hook-form';
|
|
3
|
+
/**
|
|
4
|
+
* Resuelve los parámetros de un EndpointConfig convirtiendo referencias
|
|
5
|
+
* a campos en valores actuales del formulario
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveEndpointParameters(parameters: Record<string, EndpointParameter> | undefined, getValues: UseFormGetValues<any>): Record<string, any>;
|
|
8
|
+
/**
|
|
9
|
+
* Obtiene la clave del registry desde optionSource (string) o endpointConfig (objeto)
|
|
10
|
+
* Mantiene compatibilidad hacia atrás
|
|
11
|
+
*/
|
|
12
|
+
export declare function getEndpointKey(optionSource: string | undefined, endpointConfig: EndpointConfig | undefined): string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Determina si un campo tiene configuración de endpoint (nueva o legacy)
|
|
15
|
+
*/
|
|
16
|
+
export declare function hasEndpointConfig(field: any): boolean;
|