@dipusevilla/componentes-iu 1.0.56 → 1.0.57

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 (46) hide show
  1. package/dist/index.cjs.js +55 -29
  2. package/dist/index.css +1 -1
  3. package/dist/index.es.js +35325 -13111
  4. package/dist/index.umd.js +56 -30
  5. package/dist/types/components/Button.d.ts +2 -3
  6. package/dist/types/components/Checkbox.d.ts +0 -5
  7. package/dist/types/components/CollapsibleSection.d.ts +4 -6
  8. package/dist/types/components/DateInput.d.ts +4 -4
  9. package/dist/types/components/FormFieldInput.d.ts +6 -1
  10. package/dist/types/components/Input.d.ts +12 -14
  11. package/dist/types/components/InputGroup.d.ts +3 -1
  12. package/dist/types/components/SearchField.d.ts +9 -1
  13. package/dist/types/components/Select.d.ts +5 -0
  14. package/dist/types/components/TextArea.d.ts +16 -7
  15. package/dist/types/editor/SchemaEditorHost.d.ts +0 -4
  16. package/dist/types/editor/components/ColumnDropZone.d.ts +21 -2
  17. package/dist/types/editor/components/IconPicker.d.ts +17 -0
  18. package/dist/types/editor/components/ImportFromDTOButton.d.ts +1 -0
  19. package/dist/types/editor/components/Palette.d.ts +0 -1
  20. package/dist/types/editor/components/RelationsProvider.d.ts +28 -0
  21. package/dist/types/editor/components/RuleBuilder.enhanced.d.ts +13 -0
  22. package/dist/types/editor/components/RuleBuilder.types.d.ts +129 -0
  23. package/dist/types/editor/components/SelectInspector.d.ts +8 -0
  24. package/dist/types/editor/dnd/DraggableField.d.ts +17 -8
  25. package/dist/types/editor/dnd/EditorDndProvider.d.ts +1 -1
  26. package/dist/types/editor/dnd/FormRendererDnd.d.ts +13 -0
  27. package/dist/types/editor/dnd/InlineDropSlot.d.ts +12 -1
  28. package/dist/types/editor/dnd/RowDnd.d.ts +29 -0
  29. package/dist/types/editor/dnd/SortableBits.d.ts +11 -0
  30. package/dist/types/editor/dnd/dndPaths.d.ts +19 -0
  31. package/dist/types/editor/dnd/renderField.d.ts +24 -0
  32. package/dist/types/editor/dnd/types.d.ts +44 -1
  33. package/dist/types/editor/dnd/useFormRendererDeps.d.ts +23 -0
  34. package/dist/types/editor/importers/generateFromDTO.d.ts +56 -0
  35. package/dist/types/editor/relations/RelationsOverlay.d.ts +14 -0
  36. package/dist/types/editor/shortcuts/ShortcutsConfigModal.d.ts +10 -0
  37. package/dist/types/editor/shortcuts/index.d.ts +3 -0
  38. package/dist/types/editor/shortcuts/shortcutsConfig.d.ts +48 -0
  39. package/dist/types/editor/shortcuts/useShortcuts.d.ts +9 -0
  40. package/dist/types/editor/store.d.ts +27 -0
  41. package/dist/types/editor/utils/fieldKinds.d.ts +12 -0
  42. package/dist/types/editor/utils/input-group.d.ts +7 -0
  43. package/dist/types/editor/utils/layout-utils.d.ts +30 -0
  44. package/dist/types/types/FormTypes.d.ts +11 -1
  45. package/package.json +59 -66
  46. package/dist/types/editor/components/RuleBuilder.d.ts +0 -11
@@ -5,12 +5,11 @@ export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
5
5
  size?: "xs" | "sm" | "md" | "lg";
6
6
  width?: string;
7
7
  disabled?: boolean;
8
- /** Componente de icono (pasa un React component desde @heroicons/react) */
9
8
  icon?: React.FC<React.SVGProps<SVGSVGElement>>;
10
9
  iconPosition?: "left" | "right";
11
- /** Etiqueta accesible para botones sin texto */
10
+ shape?: "default" | "circle";
12
11
  ariaLabel?: string;
13
12
  children?: React.ReactNode;
14
13
  onClick?: () => void;
15
14
  };
16
- export declare function Button({ type, variant, size, width, disabled, icon: IconComponent, iconPosition, ariaLabel, children, onClick, className: buttonClassName, ...rest }: ButtonProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function Button({ type, variant, size, width, disabled, icon: IconComponent, iconPosition, shape, ariaLabel, children, onClick, className: buttonClassName, ...rest }: ButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -17,9 +17,4 @@ export interface CheckboxProps {
17
17
  checked?: boolean;
18
18
  onChange?: (checked: boolean) => void;
19
19
  }
20
- /**
21
- * Checkbox que soporta 2 modos:
22
- * - Controlado por React Hook Form (si se pasa `control`)
23
- * - Headless (sin RHF) usando `checked`/`onChange`
24
- */
25
20
  export declare function Checkbox({ control, name, rules, defaultValue, label, labelHidden, disabled, size, className, hasError, errorMessage, checked, onChange, }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
@@ -1,15 +1,13 @@
1
- import type { ReactNode } from 'react';
2
- export type CollapsibleSectionType = 'default' | 'plain' | 'soft' | 'ghost';
1
+ import { type ReactNode } from "react";
2
+ export type CollapsibleSectionType = "default" | "plain" | "soft" | "ghost";
3
3
  export interface CollapsibleSectionProps {
4
4
  title: string;
5
5
  children: ReactNode;
6
6
  defaultOpen?: boolean;
7
7
  className?: string;
8
- /** Variante visual del contenedor (default = actual) */
9
8
  type?: CollapsibleSectionType;
10
- /** Clases extra para el contenedor del contenido (dentro del área colapsable) */
11
9
  contentClassName?: string;
12
- /** Clases extra para el header (el botón) */
13
10
  headerClassName?: string;
11
+ forceOpen?: boolean;
14
12
  }
15
- export declare function CollapsibleSection({ title, children, defaultOpen, className, type, contentClassName, headerClassName, }: CollapsibleSectionProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function CollapsibleSection({ title, children, defaultOpen, className, type, contentClassName, headerClassName, forceOpen, }: CollapsibleSectionProps): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
- import { type InputHTMLAttributes } from 'react';
2
- import type { Control, RegisterOptions } from 'react-hook-form';
3
- type Size = 'sm' | 'md' | 'lg';
4
- export interface DateInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'name' | 'defaultValue'> {
1
+ import { type InputHTMLAttributes } from "react";
2
+ import type { Control, RegisterOptions } from "react-hook-form";
3
+ type Size = "sm" | "md" | "lg";
4
+ export interface DateInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "name" | "defaultValue"> {
5
5
  /** React Hook Form control, ahora con Control<any> */
6
6
  control?: Control<any>;
7
7
  name?: string;
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { type FieldValues, type RegisterOptions } from "react-hook-form";
3
3
  import type { InputType } from "./Input";
4
+ type SvgCmp = React.FC<React.SVGProps<SVGSVGElement>>;
4
5
  export interface FormFieldInputProps {
5
6
  name: string;
6
7
  label?: string;
@@ -16,7 +17,11 @@ export interface FormFieldInputProps {
16
17
  suffixButton?: React.ReactNode;
17
18
  hasError?: boolean;
18
19
  errorMessage?: string;
20
+ labelPrefixIcon?: SvgCmp;
21
+ labelSuffixIcon?: SvgCmp;
22
+ prefixIcon?: SvgCmp;
23
+ suffixIcon?: SvgCmp;
19
24
  }
20
- declare function FormFieldInputComponent({ name, label, type, size, width, placeholder, validation, loadingDefaults, disabled, info }: FormFieldInputProps): import("react/jsx-runtime").JSX.Element;
25
+ declare function FormFieldInputComponent({ name, label, type, size, width, placeholder, validation, loadingDefaults, disabled, info, suffixButton, hasError, errorMessage, labelPrefixIcon, labelSuffixIcon, prefixIcon, suffixIcon, }: FormFieldInputProps): import("react/jsx-runtime").JSX.Element;
21
26
  export declare const FormFieldInput: React.MemoExoticComponent<typeof FormFieldInputComponent>;
22
27
  export {};
@@ -2,6 +2,7 @@ import React, { type InputHTMLAttributes } from "react";
2
2
  import type { Control, FieldValues, RegisterOptions, FieldPath } from "react-hook-form";
3
3
  export type InputType = "text" | "number" | "email" | "password" | "tel" | "url" | "select";
4
4
  type Size = "sm" | "md" | "lg";
5
+ type SvgCmp = React.FC<React.SVGProps<SVGSVGElement>>;
5
6
  export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "name" | "defaultValue"> {
6
7
  type?: InputType;
7
8
  size?: Size;
@@ -10,29 +11,26 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
10
11
  labelHidden?: boolean;
11
12
  hasError?: boolean;
12
13
  errorMessage?: string;
13
- prefixIcon?: React.FC<React.SVGProps<SVGSVGElement>>;
14
- suffixIcon?: React.FC<React.SVGProps<SVGSVGElement>>;
14
+ /** Iconos en la etiqueta */
15
+ labelPrefixIcon?: SvgCmp;
16
+ labelSuffixIcon?: SvgCmp;
17
+ /** Ayuda/tooltip en la etiqueta (mostrada con <InfoButton/>) */
18
+ info?: string | React.ReactNode;
19
+ infoAriaLabel?: string;
20
+ /** Iconos dentro del input */
21
+ prefixIcon?: SvgCmp;
22
+ suffixIcon?: SvgCmp;
15
23
  separator?: React.ReactNode;
16
24
  suffixButton?: React.ReactNode;
17
25
  disabled?: boolean;
18
- /** Si se proporciona `control`, el input es controlado por RHF */
19
26
  control?: Control<any>;
20
27
  name?: FieldPath<FieldValues>;
21
28
  rules?: RegisterOptions<FieldValues, FieldPath<FieldValues>>;
22
29
  defaultValue?: unknown;
23
- /**
24
- * Si reservar un espacio fijo debajo para el mensaje de error.
25
- * Por defecto: true si es controlado (con `control`), false si es no controlado.
26
- */
27
30
  reserveErrorSpace?: boolean;
28
- /**
29
- * Alias (deprecado) para desactivar la reserva de espacio de error.
30
- * Si lo usas: effectiveReserveErrorSpace = !disableErrorPlaceholder
31
- */
32
31
  disableErrorPlaceholder?: boolean;
33
- /** Estado de carga con skeleton */
34
32
  loading?: boolean;
33
+ showPasswordToggle?: boolean;
35
34
  }
36
- export declare function Input({ id, type, size, width, label, labelHidden, hasError, errorMessage, prefixIcon, suffixIcon, separator, suffixButton, disabled, control, name, rules, defaultValue, reserveErrorSpace, disableErrorPlaceholder, // <- alias deprecado
37
- loading, className: inputClassName, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
35
+ export declare function Input({ id, type, size, width, label, labelHidden, hasError, errorMessage, labelPrefixIcon, labelSuffixIcon, info, infoAriaLabel, prefixIcon, suffixIcon, separator, suffixButton, disabled, control, name, rules, defaultValue, reserveErrorSpace, disableErrorPlaceholder, loading, showPasswordToggle, className: inputClassName, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
38
36
  export {};
@@ -19,5 +19,7 @@ export interface InputGroupProps {
19
19
  showVisibleLabel?: boolean;
20
20
  size?: Size;
21
21
  width?: string;
22
+ /** NEW: por defecto false → ignora width de los hijos y reparte a partes iguales */
23
+ respectChildWidths?: boolean;
22
24
  }
23
- export declare function InputGroup({ groupLabel, inputs, separator, useSeparator, className, showVisibleLabel, size, width, }: InputGroupProps): import("react/jsx-runtime").JSX.Element;
25
+ export declare function InputGroup({ groupLabel, inputs, separator, useSeparator, className, showVisibleLabel, size, width, respectChildWidths, }: InputGroupProps): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,11 @@
1
+ import React from "react";
1
2
  import { type Control, useFormContext } from "react-hook-form";
2
3
  import { Option } from "../types/FormTypes";
3
4
  type FormCtx = {
4
5
  getValues: ReturnType<typeof useFormContext>["getValues"];
5
6
  watch: ReturnType<typeof useFormContext>["watch"];
6
7
  };
8
+ type HeroIconComponent = React.FC<React.SVGProps<SVGSVGElement>>;
7
9
  export interface SearchFieldProps {
8
10
  name: string;
9
11
  control: Control<any>;
@@ -16,6 +18,12 @@ export interface SearchFieldProps {
16
18
  searchMode?: "button" | "debounced";
17
19
  minChars?: number;
18
20
  debounceMs?: number;
21
+ /** Icon props for label */
22
+ labelPrefixIcon?: HeroIconComponent;
23
+ labelSuffixIcon?: HeroIconComponent;
24
+ /** Icon props for input field */
25
+ prefixIcon?: HeroIconComponent;
26
+ suffixIcon?: HeroIconComponent;
19
27
  }
20
- export declare function SearchField({ name, control, searchFn, resolveByValue, label, size, width, disabled, searchMode, minChars, debounceMs, }: SearchFieldProps): import("react/jsx-runtime").JSX.Element;
28
+ export declare function SearchField({ name, control, searchFn, resolveByValue, label, size, width, disabled, searchMode, minChars, debounceMs, labelPrefixIcon, labelSuffixIcon, prefixIcon, suffixIcon, }: SearchFieldProps): import("react/jsx-runtime").JSX.Element;
21
29
  export {};
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import { type Control } from "react-hook-form";
3
3
  import { Option } from "../types/FormTypes";
4
4
  type Size = "sm" | "md" | "lg";
5
+ type Mode = "native" | "menu";
5
6
  export interface SelectProps {
6
7
  control?: Control<any>;
7
8
  name?: string;
@@ -25,6 +26,10 @@ export interface SelectProps {
25
26
  suffixButton?: React.ReactNode;
26
27
  loading?: boolean;
27
28
  coerceFirstValid?: boolean;
29
+ mode?: Mode;
30
+ renderTrigger?: (current: Option | undefined) => React.ReactNode;
31
+ renderOption?: (opt: Option, selected: boolean) => React.ReactNode;
32
+ popupWidth?: number | string;
28
33
  }
29
34
  export declare function Select(props: SelectProps): import("react/jsx-runtime").JSX.Element;
30
35
  export {};
@@ -1,10 +1,11 @@
1
- import React, { type TextareaHTMLAttributes } from 'react';
2
- import type { Control } from 'react-hook-form';
3
- type Size = 'sm' | 'md' | 'lg';
4
- export interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size' | 'name' | 'defaultValue'> {
1
+ import React, { type TextareaHTMLAttributes } from "react";
2
+ import type { Control, FieldValues, RegisterOptions, FieldPath } from "react-hook-form";
3
+ type Size = "sm" | "md" | "lg";
4
+ type SvgCmp = React.FC<React.SVGProps<SVGSVGElement>>;
5
+ export interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "name" | "defaultValue"> {
5
6
  control?: Control<any>;
6
- name?: string;
7
- rules?: any;
7
+ name?: FieldPath<FieldValues>;
8
+ rules?: RegisterOptions<FieldValues, FieldPath<FieldValues>>;
8
9
  defaultValue?: string;
9
10
  size?: Size;
10
11
  width?: string;
@@ -16,6 +17,14 @@ export interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaE
16
17
  showCounter?: boolean;
17
18
  className?: string;
18
19
  suffixButton?: React.ReactNode;
20
+ labelPrefixIcon?: SvgCmp;
21
+ labelSuffixIcon?: SvgCmp;
22
+ info?: string | React.ReactNode;
23
+ infoAriaLabel?: string;
24
+ prefixIcon?: SvgCmp;
25
+ suffixIcon?: SvgCmp;
26
+ reserveErrorSpace?: boolean;
27
+ disableErrorPlaceholder?: boolean;
19
28
  }
20
- export declare function TextArea({ control, name, rules, defaultValue, size, width, label, labelHidden, hasError, errorMessage, maxLength, showCounter, className, suffixButton, ...textareaProps }: TextAreaProps): import("react/jsx-runtime").JSX.Element;
29
+ export declare function TextArea({ control, name, rules, defaultValue, size, width, label, labelHidden, hasError, errorMessage, maxLength, showCounter, className, suffixButton, labelPrefixIcon, labelSuffixIcon, info, infoAriaLabel, prefixIcon, suffixIcon, reserveErrorSpace, disableErrorPlaceholder, id, ...textareaProps }: TextAreaProps): import("react/jsx-runtime").JSX.Element;
21
30
  export {};
@@ -7,13 +7,9 @@ export type SchemaEditorHostProps = {
7
7
  services: ServicesAdapter;
8
8
  onSchemaChange?: (schema: unknown) => void;
9
9
  rightPanel?: React.ReactNode;
10
- /** ancho del panel derecho cuando está visible (ej: "320px") */
11
10
  rightPanelWidth?: string;
12
- /** si el panel debe arrancar abierto (por defecto: false) */
13
11
  rightPanelDefaultOpen?: boolean;
14
- /** control externo opcional */
15
12
  rightPanelOpen?: boolean;
16
- /** callback al cambiar visibilidad del panel (si lo controlas tú) */
17
13
  onRightPanelOpenChange?: (open: boolean) => void;
18
14
  className?: string;
19
15
  };
@@ -4,7 +4,7 @@ type MovePos = {
4
4
  c: number;
5
5
  idx: number;
6
6
  };
7
- type Props = {
7
+ type BaseProps = {
8
8
  widthLabel?: string;
9
9
  fields: string[];
10
10
  indices: {
@@ -22,5 +22,24 @@ type Props = {
22
22
  placeDisabled?: boolean;
23
23
  readOnly?: boolean;
24
24
  };
25
- export declare function ColumnDropZone({ widthLabel, fields, indices, canMoveLeft, canMoveRight, onSelect, onMove, onDuplicate, onRemoveAt, onPlaceLast, placeDisabled, readOnly }: Props): import("react/jsx-runtime").JSX.Element;
25
+ type DndRows = {
26
+ /** Activa DnD para ROWS (fuera de tabs) */
27
+ dnd?: {
28
+ scope: "rows-column";
29
+ droppableIdBase?: string;
30
+ rowsNodeIdx: number;
31
+ };
32
+ };
33
+ type DndTabs = {
34
+ /** Activa DnD para TABS */
35
+ dnd?: {
36
+ scope: "tabs-column";
37
+ droppableIdBase?: string;
38
+ tabKey: string;
39
+ };
40
+ };
41
+ type Props = BaseProps & (DndRows | DndTabs | {
42
+ dnd?: undefined;
43
+ });
44
+ export declare function ColumnDropZone({ widthLabel, fields, indices, canMoveLeft, canMoveRight, onSelect, onMove, onDuplicate, onRemoveAt, onPlaceLast, placeDisabled, readOnly, dnd, }: Props): import("react/jsx-runtime").JSX.Element;
26
45
  export {};
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ export type HeroStyle = "outline" | "solid";
3
+ export type HeroIconComponent = React.FC<React.SVGProps<SVGSVGElement>>;
4
+ export interface IconPickerValue {
5
+ name: string;
6
+ style: HeroStyle;
7
+ }
8
+ export interface IconPickerProps {
9
+ value?: IconPickerValue;
10
+ onChange?: (value?: IconPickerValue, Icon?: HeroIconComponent) => void;
11
+ buttonLabel?: string;
12
+ disabled?: boolean;
13
+ className?: string;
14
+ }
15
+ export declare function resolveHeroicon(name: string, style: HeroStyle): HeroIconComponent | null;
16
+ export declare const IconPicker: React.FC<IconPickerProps>;
17
+ export default IconPicker;
@@ -0,0 +1 @@
1
+ export declare function ImportFromDTOButton(): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,3 @@
1
- /** MIME types para DnD con el FormRendererEditable (se conservan por compatibilidad) */
2
1
  export declare const DRAG_MIME_FIELD = "application/x-ds-field-template";
3
2
  export declare const DRAG_MIME_LAYOUT = "application/x-ds-layout-kind";
4
3
  export declare function Palette(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import type { FormSchema } from "../../types/FormTypes";
3
+ type AnchorPoint = {
4
+ x: number;
5
+ y: number;
6
+ w: number;
7
+ h: number;
8
+ };
9
+ type Ctx = {
10
+ enabled: boolean;
11
+ toggle: (v?: boolean) => void;
12
+ registerFieldEl: (name: string, el: HTMLElement | null) => void;
13
+ anchors: Record<string, AnchorPoint>;
14
+ schema: FormSchema | null;
15
+ setSchema: (s: FormSchema | null) => void;
16
+ };
17
+ export declare const useRelations: () => Ctx;
18
+ /** Hook de conveniencia para registrar el contenedor DOM de un campo por name */
19
+ export declare const useRelationAnchor: (name?: string) => (el: HTMLElement | null) => void;
20
+ export declare const RelationsProvider: React.FC<{
21
+ children: React.ReactNode;
22
+ }>;
23
+ export declare function edgesFromSchema(schema: FormSchema): {
24
+ from: string;
25
+ to: string;
26
+ kind: "visibleWhen" | "disabledWhen" | "clearWhen";
27
+ }[];
28
+ export {};
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import type { RuleExpr } from "../../rules/RuleDSL";
3
+ import type { FieldType } from "../../types/FormTypes";
4
+ import type { Option } from "../../types/FormTypes";
5
+ export interface RuleBuilderEnhancedProps {
6
+ value?: RuleExpr;
7
+ fieldOptions: Option[];
8
+ fieldTypes: Record<string, FieldType>;
9
+ onChange: (rule?: RuleExpr) => void;
10
+ fieldPickerSuffix?: React.ReactNode;
11
+ showHelp?: boolean;
12
+ }
13
+ export declare function RuleBuilderEnhanced({ value, fieldOptions, fieldTypes, onChange, fieldPickerSuffix, showHelp, }: RuleBuilderEnhancedProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,129 @@
1
+ /**
2
+ * ============================================================================
3
+ * RULE BUILDER - SYSTEM DE TIPOS Y ESTRATEGIAS
4
+ * ============================================================================
5
+ *
6
+ * Este fichero define la arquitectura para reglas específicas por tipo de campo.
7
+ * Estrategia:
8
+ * 1. Cada tipo de campo tiene operadores permitidos y configuración específica
9
+ * 2. Los operadores se adaptan dinámicamente al campo seleccionado
10
+ * 3. Validación en tiempo real basada en el contexto del campo
11
+ *
12
+ * Autor: Desarrollador Senior con 20+ años de experiencia
13
+ * Fecha: 2025-11-21
14
+ * ============================================================================
15
+ */
16
+ import type { RuleExpr } from "../../rules/RuleDSL";
17
+ import type { FieldType } from "../../types/FormTypes";
18
+ /** ===========================================================================
19
+ * OPERADORES EXTENDIDOS
20
+ * ============================================================================ */
21
+ /**
22
+ * Operadores base ya soportados por RuleDSL
23
+ */
24
+ export type BaseOp = "eq" | "neq" | "in" | "notIn" | "gt" | "gte" | "lt" | "lte";
25
+ /**
26
+ * Operadores extendidos que se transformarán a operadores base
27
+ * Estos son "sugar syntax" para mejorar la UX, se compilan a RuleExpr válidos
28
+ */
29
+ export type ExtendedOp = "isEmpty" | "isNotEmpty" | "contains" | "notContains" | "startsWith" | "endsWith" | "matches" | "isTrue" | "isFalse" | "hasAnyValue" | "hasNoValue" | "inRange" | "today" | "inPast" | "inFuture";
30
+ export type OpType = BaseOp | ExtendedOp;
31
+ /** ===========================================================================
32
+ * CONFIGURACIÓN DE OPERADORES POR TIPO
33
+ * ============================================================================ */
34
+ /**
35
+ * Metadatos de un operador
36
+ */
37
+ export interface OperatorConfig {
38
+ /** Código del operador */
39
+ op: OpType;
40
+ /** Etiqueta visible en la UI */
41
+ label: string;
42
+ /** Descripción/ayuda para el usuario */
43
+ description?: string;
44
+ /** Tipo de input para el valor */
45
+ inputType: "single" | "multi" | "none" | "range" | "pattern";
46
+ /** Placeholder para el input */
47
+ placeholder?: string;
48
+ /** Ícono sugerido (HeroIcon name) */
49
+ icon?: string;
50
+ /** Función para compilar a RuleExpr válido */
51
+ compile?: (field: string, value: any) => RuleExpr;
52
+ }
53
+ /**
54
+ * Estrategia de reglas para un tipo de campo específico
55
+ */
56
+ export interface FieldTypeRuleStrategy {
57
+ /** Tipo de campo al que aplica */
58
+ fieldType: FieldType;
59
+ /** Operadores disponibles para este tipo */
60
+ operators: OperatorConfig[];
61
+ /** Operador por defecto */
62
+ defaultOperator: OpType;
63
+ /** Validador personalizado para valores */
64
+ validateValue?: (op: OpType, value: any) => {
65
+ valid: boolean;
66
+ message?: string;
67
+ };
68
+ /** Placeholder por defecto para inputs */
69
+ defaultPlaceholder?: string;
70
+ /** Ayuda contextual para el usuario */
71
+ helpText?: string;
72
+ }
73
+ /** ===========================================================================
74
+ * CATÁLOGO DE OPERADORES
75
+ * ============================================================================ */
76
+ /**
77
+ * Operadores comunes para campos de texto
78
+ */
79
+ export declare const TEXT_OPERATORS: OperatorConfig[];
80
+ /**
81
+ * Operadores para campos numéricos
82
+ */
83
+ export declare const NUMBER_OPERATORS: OperatorConfig[];
84
+ /**
85
+ * Operadores para checkboxes/booleanos
86
+ */
87
+ export declare const BOOLEAN_OPERATORS: OperatorConfig[];
88
+ /**
89
+ * Operadores para selects
90
+ */
91
+ export declare const SELECT_OPERATORS: OperatorConfig[];
92
+ /**
93
+ * Operadores para fechas
94
+ */
95
+ export declare const DATE_OPERATORS: OperatorConfig[];
96
+ /**
97
+ * Operadores para textarea (similar a text pero con énfasis en contenido)
98
+ */
99
+ export declare const TEXTAREA_OPERATORS: OperatorConfig[];
100
+ /**
101
+ * Operadores para file (foco en si hay archivo o no)
102
+ */
103
+ export declare const FILE_OPERATORS: OperatorConfig[];
104
+ /** ===========================================================================
105
+ * MAPEO DE ESTRATEGIAS POR TIPO DE CAMPO
106
+ * ============================================================================ */
107
+ export declare const FIELD_TYPE_STRATEGIES: Record<FieldType, FieldTypeRuleStrategy>;
108
+ /** ===========================================================================
109
+ * UTILIDADES
110
+ * ============================================================================ */
111
+ /**
112
+ * Obtiene la estrategia de reglas para un tipo de campo
113
+ */
114
+ export declare function getStrategyForFieldType(fieldType: FieldType): FieldTypeRuleStrategy;
115
+ /**
116
+ * Obtiene la configuración de un operador específico para un tipo de campo
117
+ */
118
+ export declare function getOperatorConfig(fieldType: FieldType, op: OpType): OperatorConfig | undefined;
119
+ /**
120
+ * Compila un operador extendido a RuleExpr válido
121
+ */
122
+ export declare function compileOperator(op: OpType, field: string, value: any, fieldType: FieldType): RuleExpr;
123
+ /**
124
+ * Valida un valor según el operador y tipo de campo
125
+ */
126
+ export declare function validateOperatorValue(fieldType: FieldType, op: OpType, value: any): {
127
+ valid: boolean;
128
+ message?: string;
129
+ };
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import type { FieldSchema } from "../../types/FormTypes";
3
+ export declare const SelectInspector: React.FC<{
4
+ field: FieldSchema;
5
+ updateField: (name: string, fn: (f: any) => void) => void;
6
+ services: any;
7
+ show: (msg: string, type?: "success" | "error" | "warning" | "info") => void;
8
+ }>;
@@ -1,18 +1,27 @@
1
- import type { FieldIndexPath } from "./types";
2
- type RowsProps = {
1
+ import React from "react";
2
+ import type { FieldIndexPath, InputGroupIndexPath } from "./types";
3
+ type BaseCommon = {
4
+ name: string;
5
+ onSelect: () => void;
6
+ icon?: React.ReactNode;
7
+ /** Si true, NO se abre el inspector al clicar el título (se renderiza como <span>) */
8
+ disableSelect?: boolean;
9
+ };
10
+ type RowsProps = BaseCommon & {
3
11
  kind: "field-in-rows";
4
12
  rowsNodeIdx: number;
5
- name: string;
6
13
  path: FieldIndexPath;
7
- onSelect: () => void;
8
14
  };
9
- type TabsProps = {
15
+ type TabsProps = BaseCommon & {
10
16
  kind: "field-in-tabs";
11
17
  tabKey: string;
12
- name: string;
13
18
  path: FieldIndexPath;
14
- onSelect: () => void;
15
19
  };
16
- type Props = RowsProps | TabsProps;
20
+ type InputGroupProps = BaseCommon & {
21
+ kind: "field-in-inputgroup";
22
+ groupName: string;
23
+ path: InputGroupIndexPath;
24
+ };
25
+ type Props = RowsProps | TabsProps | InputGroupProps;
17
26
  export declare function DraggableField(p: Props): import("react/jsx-runtime").JSX.Element;
18
27
  export {};
@@ -1,2 +1,2 @@
1
1
  import { PropsWithChildren } from "react";
2
- export default function EditorDndProvider({ children, }: PropsWithChildren<object>): import("react/jsx-runtime").JSX.Element;
2
+ export default function EditorDndProvider({ children }: PropsWithChildren<object>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import type { FormSchema, FieldEntry } from "../../types/FormTypes";
2
+ import { type RenderFieldDeps } from "./renderField";
3
+ type Props = {
4
+ schema: FormSchema;
5
+ onSchemaChange: (next: FormSchema) => void;
6
+ deps: Omit<RenderFieldDeps, "fields" | "fieldsByName"> & {
7
+ fields: FieldEntry[];
8
+ fieldsByName: Record<string, FieldEntry>;
9
+ };
10
+ layoutEditMode?: boolean;
11
+ };
12
+ export declare function FormRendererDnd({ schema, onSchemaChange, deps, layoutEditMode }: Props): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -5,6 +5,8 @@ type RowsColProps = {
5
5
  r: number;
6
6
  c: number;
7
7
  insertAt: number;
8
+ suppressHint?: boolean;
9
+ suppressAll?: boolean;
8
10
  };
9
11
  type TabsColProps = {
10
12
  scope: "tabs-column";
@@ -13,7 +15,16 @@ type TabsColProps = {
13
15
  r: number;
14
16
  c: number;
15
17
  insertAt: number;
18
+ suppressHint?: boolean;
19
+ suppressAll?: boolean;
16
20
  };
17
- type Props = RowsColProps | TabsColProps;
21
+ type InputGroupProps = {
22
+ scope: "input-group";
23
+ groupName: string;
24
+ insertAt: number;
25
+ suppressHint?: boolean;
26
+ suppressAll?: boolean;
27
+ };
28
+ type Props = RowsColProps | TabsColProps | InputGroupProps;
18
29
  export declare function InlineDropSlot(props: Props): import("react/jsx-runtime").JSX.Element;
19
30
  export {};
@@ -0,0 +1,29 @@
1
+ type RowSlotProps = {
2
+ scope: "row-slot";
3
+ li: number;
4
+ sIdx: number;
5
+ insertAt: number;
6
+ } | {
7
+ scope: "tab-row-slot";
8
+ li: number;
9
+ tabKey: string;
10
+ sIdx: number;
11
+ insertAt: number;
12
+ };
13
+ export declare function RowDropSlot(props: RowSlotProps): import("react/jsx-runtime").JSX.Element;
14
+ type RowHandleProps = {
15
+ kind: "row-in-section";
16
+ li: number;
17
+ sIdx: number;
18
+ rIdx: number;
19
+ visible?: boolean;
20
+ } | {
21
+ kind: "row-in-tab-section";
22
+ li: number;
23
+ tabKey: string;
24
+ sIdx: number;
25
+ rIdx: number;
26
+ visible?: boolean;
27
+ };
28
+ export declare function DraggableRowHandle(props: RowHandleProps): import("react/jsx-runtime").JSX.Element;
29
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ type SortableFieldProps = {
3
+ id: string;
4
+ children: React.ReactNode;
5
+ onDelete?: (encodedId: string) => void;
6
+ fieldName?: string;
7
+ /** Cuando es true, se desactivan marcos, asa y borrar, y se deshabilita el drag&drop */
8
+ chromeDisabled?: boolean;
9
+ };
10
+ export declare function SortableField({ id, children, onDelete, fieldName, chromeDisabled, }: SortableFieldProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,19 @@
1
+ export type FieldPath = {
2
+ /** índice del nodo en schema.layout */
3
+ li: number;
4
+ /** índice de pestaña si el nodo es tabs */
5
+ tabIdx?: number;
6
+ sectionIdx: number;
7
+ rowIdx: number;
8
+ colIdx: number;
9
+ fieldIdx: number;
10
+ };
11
+ /** li:0|t:1|s:0|r:0|c:0|f:2 (si no hay tabs, omite t) */
12
+ export declare function encodePath(p: FieldPath): string;
13
+ export declare function decodePath(id: string): FieldPath;
14
+ /**
15
+ * Mueve una referencia de campo dentro del layout.
16
+ * Clona solo `layout` para evitar DataCloneError por funciones en el schema.
17
+ */
18
+ export declare function moveFieldInSchema(schema: any, from: FieldPath, to: FieldPath): any;
19
+ export declare function removeFieldRefInSchema(schema: any, at: FieldPath): any;