@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.
- package/dist/index.cjs.js +55 -29
- package/dist/index.css +1 -1
- package/dist/index.es.js +35325 -13111
- package/dist/index.umd.js +56 -30
- package/dist/types/components/Button.d.ts +2 -3
- package/dist/types/components/Checkbox.d.ts +0 -5
- package/dist/types/components/CollapsibleSection.d.ts +4 -6
- package/dist/types/components/DateInput.d.ts +4 -4
- package/dist/types/components/FormFieldInput.d.ts +6 -1
- package/dist/types/components/Input.d.ts +12 -14
- package/dist/types/components/InputGroup.d.ts +3 -1
- package/dist/types/components/SearchField.d.ts +9 -1
- package/dist/types/components/Select.d.ts +5 -0
- package/dist/types/components/TextArea.d.ts +16 -7
- package/dist/types/editor/SchemaEditorHost.d.ts +0 -4
- package/dist/types/editor/components/ColumnDropZone.d.ts +21 -2
- package/dist/types/editor/components/IconPicker.d.ts +17 -0
- package/dist/types/editor/components/ImportFromDTOButton.d.ts +1 -0
- package/dist/types/editor/components/Palette.d.ts +0 -1
- package/dist/types/editor/components/RelationsProvider.d.ts +28 -0
- package/dist/types/editor/components/RuleBuilder.enhanced.d.ts +13 -0
- package/dist/types/editor/components/RuleBuilder.types.d.ts +129 -0
- package/dist/types/editor/components/SelectInspector.d.ts +8 -0
- package/dist/types/editor/dnd/DraggableField.d.ts +17 -8
- package/dist/types/editor/dnd/EditorDndProvider.d.ts +1 -1
- package/dist/types/editor/dnd/FormRendererDnd.d.ts +13 -0
- package/dist/types/editor/dnd/InlineDropSlot.d.ts +12 -1
- package/dist/types/editor/dnd/RowDnd.d.ts +29 -0
- package/dist/types/editor/dnd/SortableBits.d.ts +11 -0
- package/dist/types/editor/dnd/dndPaths.d.ts +19 -0
- package/dist/types/editor/dnd/renderField.d.ts +24 -0
- package/dist/types/editor/dnd/types.d.ts +44 -1
- package/dist/types/editor/dnd/useFormRendererDeps.d.ts +23 -0
- package/dist/types/editor/importers/generateFromDTO.d.ts +56 -0
- package/dist/types/editor/relations/RelationsOverlay.d.ts +14 -0
- package/dist/types/editor/shortcuts/ShortcutsConfigModal.d.ts +10 -0
- package/dist/types/editor/shortcuts/index.d.ts +3 -0
- package/dist/types/editor/shortcuts/shortcutsConfig.d.ts +48 -0
- package/dist/types/editor/shortcuts/useShortcuts.d.ts +9 -0
- package/dist/types/editor/store.d.ts +27 -0
- package/dist/types/editor/utils/fieldKinds.d.ts +12 -0
- package/dist/types/editor/utils/input-group.d.ts +7 -0
- package/dist/types/editor/utils/layout-utils.d.ts +30 -0
- package/dist/types/types/FormTypes.d.ts +11 -1
- package/package.json +59 -66
- package/dist/types/editor/components/RuleBuilder.d.ts +0 -11
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { RuleExpr } from "../../rules/RuleDSL";
|
|
3
|
+
import type { FieldEntry, FieldSchema, ButtonField, InputGroupField } from "../../types/FormTypes";
|
|
4
|
+
type RuleContainer = {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
rule?: RuleExpr;
|
|
7
|
+
clearTo?: unknown;
|
|
8
|
+
};
|
|
9
|
+
export type RenderFieldDeps = {
|
|
10
|
+
fields: FieldEntry[];
|
|
11
|
+
fieldsByName: Record<string, FieldEntry>;
|
|
12
|
+
control: any;
|
|
13
|
+
errors: Record<string, any>;
|
|
14
|
+
isSubmitting: boolean;
|
|
15
|
+
loadingDefaults: boolean;
|
|
16
|
+
asyncOptionsMap: Record<string, any[]>;
|
|
17
|
+
adapterOptionsMap: Record<string, any[]>;
|
|
18
|
+
evalContainer: (c: RuleContainer | undefined, def: boolean) => boolean;
|
|
19
|
+
disabledMap: Record<string, boolean>;
|
|
20
|
+
registry?: Record<string, unknown>;
|
|
21
|
+
methods: any;
|
|
22
|
+
};
|
|
23
|
+
export declare function renderFieldFactory(deps: RenderFieldDeps): (item: string | FieldSchema | ButtonField | InputGroupField) => React.ReactNode;
|
|
24
|
+
export {};
|
|
@@ -4,6 +4,9 @@ export type FieldIndexPath = {
|
|
|
4
4
|
c: number;
|
|
5
5
|
idx: number;
|
|
6
6
|
};
|
|
7
|
+
export type InputGroupIndexPath = {
|
|
8
|
+
idx: number;
|
|
9
|
+
};
|
|
7
10
|
export type DragData = {
|
|
8
11
|
kind: "field-in-rows";
|
|
9
12
|
name: string;
|
|
@@ -14,9 +17,14 @@ export type DragData = {
|
|
|
14
17
|
tabKey: string;
|
|
15
18
|
name: string;
|
|
16
19
|
path: FieldIndexPath;
|
|
20
|
+
} | {
|
|
21
|
+
kind: "field-in-inputgroup";
|
|
22
|
+
groupName: string;
|
|
23
|
+
name: string;
|
|
24
|
+
path: InputGroupIndexPath;
|
|
17
25
|
} | {
|
|
18
26
|
kind: "palette-field";
|
|
19
|
-
factoryKind: "text" | "number" | "email" | "password" | "select" | "textarea" | "checkbox" | "date" | "file";
|
|
27
|
+
factoryKind: "text" | "number" | "email" | "password" | "select" | "textarea" | "checkbox" | "date" | "file" | "inputGroup";
|
|
20
28
|
} | {
|
|
21
29
|
kind: "rows-section";
|
|
22
30
|
nodeIdx: number;
|
|
@@ -31,6 +39,22 @@ export type DragData = {
|
|
|
31
39
|
nodeIdx: number;
|
|
32
40
|
tabKey: string;
|
|
33
41
|
sIdx: number;
|
|
42
|
+
} | {
|
|
43
|
+
kind: "tab-section";
|
|
44
|
+
nodeIdx: number;
|
|
45
|
+
tabKey: string;
|
|
46
|
+
sIdx: number;
|
|
47
|
+
} | {
|
|
48
|
+
kind: "row-in-section";
|
|
49
|
+
li: number;
|
|
50
|
+
sIdx: number;
|
|
51
|
+
rIdx: number;
|
|
52
|
+
} | {
|
|
53
|
+
kind: "row-in-tab-section";
|
|
54
|
+
li: number;
|
|
55
|
+
tabKey: string;
|
|
56
|
+
sIdx: number;
|
|
57
|
+
rIdx: number;
|
|
34
58
|
};
|
|
35
59
|
export type DropTarget = {
|
|
36
60
|
scope: "rows-column";
|
|
@@ -59,4 +83,23 @@ export type DropTarget = {
|
|
|
59
83
|
nodeIdx: number;
|
|
60
84
|
tabKey: string;
|
|
61
85
|
insertAt: number;
|
|
86
|
+
} | {
|
|
87
|
+
scope: "input-group";
|
|
88
|
+
groupName: string;
|
|
89
|
+
insertAt: number;
|
|
90
|
+
} | {
|
|
91
|
+
scope: "input-group";
|
|
92
|
+
groupName: string;
|
|
93
|
+
insertAt: number;
|
|
94
|
+
} | {
|
|
95
|
+
scope: "row-slot";
|
|
96
|
+
li: number;
|
|
97
|
+
sIdx: number;
|
|
98
|
+
insertAt: number;
|
|
99
|
+
} | {
|
|
100
|
+
scope: "tab-row-slot";
|
|
101
|
+
li: number;
|
|
102
|
+
tabKey: string;
|
|
103
|
+
sIdx: number;
|
|
104
|
+
insertAt: number;
|
|
62
105
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RuleExpr } from "../../rules/RuleDSL";
|
|
2
|
+
import { FormSchema, FieldSchema } from "../../types/FormTypes";
|
|
3
|
+
type RuleContainer = {
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
rule?: RuleExpr;
|
|
6
|
+
clearTo?: unknown;
|
|
7
|
+
};
|
|
8
|
+
export declare function useFormRendererDeps(schema: FormSchema, externalResolver?: any, serviceRegistry?: Record<string, unknown>): {
|
|
9
|
+
methods: import("react-hook-form").UseFormReturn<Record<string, unknown>, any, Record<string, unknown>>;
|
|
10
|
+
control: import("react-hook-form").Control<Record<string, unknown>, any, Record<string, unknown>>;
|
|
11
|
+
formState: import("react-hook-form").FormState<Record<string, unknown>>;
|
|
12
|
+
fields: import("../../types/FormTypes").FieldEntry[];
|
|
13
|
+
fieldsByName: Record<string, FieldSchema>;
|
|
14
|
+
asyncOptionsMap: Record<string, import("../../hooks/useAsyncSelectOptions").Option[]>;
|
|
15
|
+
adapterOptionsMap: any;
|
|
16
|
+
disabledMap: {
|
|
17
|
+
[x: string]: boolean;
|
|
18
|
+
};
|
|
19
|
+
evalContainer: (container: RuleContainer | undefined, whenDisabled: boolean) => boolean;
|
|
20
|
+
registry: Record<string, unknown> | undefined;
|
|
21
|
+
layout: import("../../types/FormTypes").LayoutNode[];
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { FieldEntry, FieldSchema, FormSchema } from "../../types/FormTypes";
|
|
2
|
+
/** =======================
|
|
3
|
+
* Tipos y opciones
|
|
4
|
+
* ======================= */
|
|
5
|
+
export type Primitive = string | number | boolean | null | undefined | Date;
|
|
6
|
+
export type AnyDTO = Record<string, any>;
|
|
7
|
+
export type TypeOverride = "text" | "number" | "email" | "password" | "textarea" | "select" | "checkbox" | "date" | "file" | "tel" | "url";
|
|
8
|
+
export type SelectSource = {
|
|
9
|
+
kind: string;
|
|
10
|
+
params?: Record<string, any>;
|
|
11
|
+
} | {
|
|
12
|
+
options: Array<{
|
|
13
|
+
label: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
17
|
+
export type GenerateFromDTOOptions = {
|
|
18
|
+
flatten?: boolean;
|
|
19
|
+
maxDepth?: number;
|
|
20
|
+
exclude?: Array<string | RegExp>;
|
|
21
|
+
typeOverrides?: Array<{
|
|
22
|
+
match: string | RegExp;
|
|
23
|
+
type: TypeOverride;
|
|
24
|
+
}>;
|
|
25
|
+
labelOverrides?: Record<string, string>;
|
|
26
|
+
requiredStrategy?: (args: {
|
|
27
|
+
name: string;
|
|
28
|
+
inputType: FieldSchema["type"];
|
|
29
|
+
sample?: unknown;
|
|
30
|
+
}) => boolean;
|
|
31
|
+
selectSourceResolver?: (name: string) => SelectSource | undefined;
|
|
32
|
+
widthStrategy?: (args: {
|
|
33
|
+
name: string;
|
|
34
|
+
inputType: FieldSchema["type"];
|
|
35
|
+
}) => string | undefined;
|
|
36
|
+
textareaStrategy?: (args: {
|
|
37
|
+
name: string;
|
|
38
|
+
sample?: string;
|
|
39
|
+
}) => {
|
|
40
|
+
isTextArea: boolean;
|
|
41
|
+
maxLength?: number;
|
|
42
|
+
} | undefined;
|
|
43
|
+
sortComparator?: (a: FieldSchema, b: FieldSchema) => number;
|
|
44
|
+
formTitle?: string;
|
|
45
|
+
formId?: string;
|
|
46
|
+
};
|
|
47
|
+
/** =======================
|
|
48
|
+
* Core: DTO → FieldEntry[]
|
|
49
|
+
* ======================= */
|
|
50
|
+
export declare function generateFieldsFromDTO(dto: AnyDTO, opts?: GenerateFromDTOOptions): FieldEntry[];
|
|
51
|
+
export declare function generateFormFromDTO(dto: AnyDTO, opts?: GenerateFromDTOOptions): FormSchema;
|
|
52
|
+
/** API de alto nivel:
|
|
53
|
+
* - Si pasas un OBJETO → genera del objeto (como antes).
|
|
54
|
+
* - Si pasas un STRING con `export interface ...` → lo parsea y respeta opcionales.
|
|
55
|
+
*/
|
|
56
|
+
export declare function generateFormFromTypeDef(input: string | AnyDTO, opts?: GenerateFromDTOOptions): FormSchema;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FormSchema } from "../../types/FormTypes";
|
|
3
|
+
export type RelationsOverlayProps = {
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
anchors: Record<string, {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
w: number;
|
|
9
|
+
h: number;
|
|
10
|
+
}>;
|
|
11
|
+
schema: FormSchema | null;
|
|
12
|
+
};
|
|
13
|
+
export declare const RelationsOverlay: React.FC<RelationsOverlayProps>;
|
|
14
|
+
export declare const RelationsOverlayRenderer: React.FC;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ShortcutAction, ShortcutConfig } from './shortcutsConfig';
|
|
3
|
+
interface ShortcutsConfigModalProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
config: Record<ShortcutAction, ShortcutConfig>;
|
|
7
|
+
onSave: (config: Record<ShortcutAction, ShortcutConfig>) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const ShortcutsConfigModal: React.FC<ShortcutsConfigModalProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sistema de configuración de shortcuts para el editor de formularios
|
|
3
|
+
*/
|
|
4
|
+
export type ShortcutAction = 'undo' | 'redo' | 'save' | 'saveAs' | 'toggleRelations' | 'togglePreview' | 'deleteField' | 'duplicateField' | 'copy' | 'paste' | 'selectAll' | 'newSchema' | 'importSchema' | 'exportSchema';
|
|
5
|
+
export interface ShortcutConfig {
|
|
6
|
+
key: string;
|
|
7
|
+
ctrl?: boolean;
|
|
8
|
+
shift?: boolean;
|
|
9
|
+
alt?: boolean;
|
|
10
|
+
meta?: boolean;
|
|
11
|
+
description: string;
|
|
12
|
+
action: ShortcutAction;
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Configuración por defecto de shortcuts
|
|
17
|
+
*/
|
|
18
|
+
export declare const DEFAULT_SHORTCUTS: Record<ShortcutAction, ShortcutConfig>;
|
|
19
|
+
/**
|
|
20
|
+
* Carga la configuración de shortcuts desde localStorage
|
|
21
|
+
*/
|
|
22
|
+
export declare function loadShortcutsConfig(): Record<ShortcutAction, ShortcutConfig>;
|
|
23
|
+
/**
|
|
24
|
+
* Guarda la configuración de shortcuts en localStorage
|
|
25
|
+
*/
|
|
26
|
+
export declare function saveShortcutsConfig(config: Record<ShortcutAction, ShortcutConfig>): void;
|
|
27
|
+
/**
|
|
28
|
+
* Resetea la configuración a los valores por defecto
|
|
29
|
+
*/
|
|
30
|
+
export declare function resetShortcutsConfig(): Record<ShortcutAction, ShortcutConfig>;
|
|
31
|
+
/**
|
|
32
|
+
* Verifica si un evento de teclado coincide con un shortcut
|
|
33
|
+
*/
|
|
34
|
+
export declare function matchesShortcut(event: KeyboardEvent, config: ShortcutConfig): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Genera una representación legible del shortcut
|
|
37
|
+
*/
|
|
38
|
+
export declare function formatShortcut(config: ShortcutConfig): string;
|
|
39
|
+
/**
|
|
40
|
+
* Valida que no haya conflictos entre shortcuts
|
|
41
|
+
*/
|
|
42
|
+
export declare function validateShortcuts(config: Record<ShortcutAction, ShortcutConfig>): {
|
|
43
|
+
valid: boolean;
|
|
44
|
+
conflicts: Array<{
|
|
45
|
+
action1: ShortcutAction;
|
|
46
|
+
action2: ShortcutAction;
|
|
47
|
+
}>;
|
|
48
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ShortcutAction, ShortcutConfig } from './shortcutsConfig';
|
|
2
|
+
export type ShortcutHandler = (event: KeyboardEvent) => void | boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Hook para gestionar shortcuts del editor
|
|
5
|
+
*/
|
|
6
|
+
export declare function useShortcuts(handlers: Partial<Record<ShortcutAction, ShortcutHandler>>): {
|
|
7
|
+
config: Record<ShortcutAction, ShortcutConfig>;
|
|
8
|
+
updateConfig: (newConfig: Record<ShortcutAction, ShortcutConfig>) => void;
|
|
9
|
+
};
|
|
@@ -21,6 +21,7 @@ export type Selection = {
|
|
|
21
21
|
} | {
|
|
22
22
|
kind: "none";
|
|
23
23
|
};
|
|
24
|
+
type FieldDomRegistry = Record<string, HTMLElement | null>;
|
|
24
25
|
export type ColumnPreset = "1" | "2" | "3" | "4" | "1/3-2/3" | "2/3-1/3" | "1/4-3/4" | "3/4-1/4";
|
|
25
26
|
type IndexPath = {
|
|
26
27
|
s: number;
|
|
@@ -29,13 +30,36 @@ type IndexPath = {
|
|
|
29
30
|
idx: number;
|
|
30
31
|
};
|
|
31
32
|
type EditorState = {
|
|
33
|
+
previewMode: boolean;
|
|
32
34
|
schema: FormSchema;
|
|
33
35
|
selection: Selection;
|
|
34
36
|
past: FormSchema[];
|
|
35
37
|
future: FormSchema[];
|
|
38
|
+
fieldPick: FieldPickState;
|
|
39
|
+
relationsEnabled: boolean;
|
|
40
|
+
toggleRelations: (v?: boolean) => void;
|
|
41
|
+
fieldDom: FieldDomRegistry;
|
|
42
|
+
registerFieldEl: (name: string, el: HTMLElement | null) => void;
|
|
43
|
+
showRelations: boolean;
|
|
44
|
+
fieldAnchors: Record<string, AnchorPoint>;
|
|
45
|
+
registerFieldAnchor: (name: string, pt: AnchorPoint) => void;
|
|
46
|
+
unregisterFieldAnchor: (name: string) => void;
|
|
47
|
+
};
|
|
48
|
+
type FieldPickState = {
|
|
49
|
+
armed: boolean;
|
|
50
|
+
forField?: string;
|
|
51
|
+
fieldKey?: "visibleWhen" | "disabledWhen" | "clearWhen";
|
|
52
|
+
};
|
|
53
|
+
type AnchorPoint = {
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
w: number;
|
|
57
|
+
h: number;
|
|
36
58
|
};
|
|
37
59
|
type EditorActions = {
|
|
38
60
|
changeFieldType: (name: string, newType: "text" | "number" | "email" | "password" | "select" | "textarea" | "checkbox" | "date" | "file") => void;
|
|
61
|
+
setPreviewMode: (v: boolean) => void;
|
|
62
|
+
togglePreview: () => void;
|
|
39
63
|
setSchema: (updater: (draft: FormSchema) => void) => void;
|
|
40
64
|
setSelection: (sel: Selection) => void;
|
|
41
65
|
undo: () => void;
|
|
@@ -122,6 +146,9 @@ type EditorActions = {
|
|
|
122
146
|
insertExistingFieldAtAt: (rowsNodeIdx: number, name: string, sectionIdx: number, rowIdx: number, colIdx: number, atIdx: number) => void;
|
|
123
147
|
addFieldAndPlaceAtAt: (rowsNodeIdx: number, fieldTemplate: Omit<FieldSchema, "name"> & Partial<Pick<FieldSchema, "name">>, sectionIdx: number, rowIdx: number, colIdx: number, atIdx: number) => void;
|
|
124
148
|
moveSectionAcrossNodes: (fromNodeIdx: number, fromSectionIdx: number, toNodeIdx: number, insertAt: number) => void;
|
|
149
|
+
armFieldPick: (forField: string, fieldKey: "visibleWhen" | "disabledWhen" | "clearWhen") => void;
|
|
150
|
+
cancelFieldPick: () => void;
|
|
151
|
+
completeFieldPick: (pickedFieldName: string) => void;
|
|
125
152
|
};
|
|
126
153
|
export declare const useEditorStore: import("zustand").UseBoundStore<import("zustand").StoreApi<EditorState & EditorActions>>;
|
|
127
154
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type FieldKind = "text" | "number" | "email" | "password" | "tel" | "url" | "textarea" | "select" | "checkbox" | "date" | "file" | "search" | "inputGroup" | "section-layout" | "tabs-layout";
|
|
3
|
+
/** Colores (variables del tema) por tipo de componente */
|
|
4
|
+
export declare const KIND_COLOR_VAR: Record<string, string>;
|
|
5
|
+
export declare function getKindColor(kind?: string): string;
|
|
6
|
+
/** Icono (outline) por tipo de componente */
|
|
7
|
+
export declare function getKindIcon(kind?: string): React.ReactNode;
|
|
8
|
+
/** Opciones estándar para el Inspector */
|
|
9
|
+
export declare const TYPE_OPTIONS_RICH: Array<{
|
|
10
|
+
value: FieldKind;
|
|
11
|
+
label: string;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { applySmartInputGroups } from "./input-group";
|
|
2
|
+
type FormSchema = any;
|
|
3
|
+
type SectionizeOptions = {
|
|
4
|
+
/** "smart" decide por sección; o fuerza 1..4 */
|
|
5
|
+
columns?: 1 | 2 | 3 | 4 | "smart";
|
|
6
|
+
generalTitle?: string;
|
|
7
|
+
titleCase?: boolean;
|
|
8
|
+
/** Estrategia custom para decidir full-span; si no, heurística por defecto */
|
|
9
|
+
fullSpanStrategy?: (field: any) => boolean;
|
|
10
|
+
/** Fusionar secciones diminutas para reducir ruido */
|
|
11
|
+
mergeTinySections?: boolean;
|
|
12
|
+
/** Nº mínimo de campos “normales” por sección antes de fusionar */
|
|
13
|
+
minFieldsPerSection?: number;
|
|
14
|
+
/** Agrupar por concepto/alias dentro de cada sección */
|
|
15
|
+
groupByConcept?: boolean;
|
|
16
|
+
/** "keep" deja todos; "adjacent" contiguos; "drop-secondary" colapsa duplicados */
|
|
17
|
+
collapseConceptDuplicates?: "keep" | "adjacent" | "drop-secondary";
|
|
18
|
+
/** NUEVO: activa bloques semánticos (Empresa, Contacto, etc.) */
|
|
19
|
+
entityBlocks?: "auto" | "off";
|
|
20
|
+
/** NUEVO: mapa para personalizar match → título de bloque */
|
|
21
|
+
entityTitles?: Partial<Record<EntityKey, string>>;
|
|
22
|
+
};
|
|
23
|
+
export declare function toNColumnsLayout(form: FormSchema, n: 1 | 2 | 3 | 4): FormSchema;
|
|
24
|
+
type EntityKey = "identifiers" | "company" | "contact" | "address" | "dates" | "money" | "web" | "general";
|
|
25
|
+
export declare function autoSectionizeAndLayout(form: FormSchema, opts?: SectionizeOptions): FormSchema;
|
|
26
|
+
export declare function composeSmartForm(form: FormSchema, opts?: {
|
|
27
|
+
sectionize?: Parameters<typeof autoSectionizeAndLayout>[1];
|
|
28
|
+
groups?: Parameters<typeof applySmartInputGroups>[1];
|
|
29
|
+
}): FormSchema;
|
|
30
|
+
export {};
|
|
@@ -11,7 +11,7 @@ export type Condition = {
|
|
|
11
11
|
/**
|
|
12
12
|
* Tipo de campo atómico admitido.
|
|
13
13
|
*/
|
|
14
|
-
export type FieldType = "text" | "email" | "number" | "password" | "select" | "date" | "optionGroup" | "button" | "textarea" | "file" | "inputGroup" | "checkbox" | "search";
|
|
14
|
+
export type FieldType = "text" | "email" | "url" | "tel" | "number" | "password" | "select" | "date" | "optionGroup" | "button" | "textarea" | "file" | "inputGroup" | "checkbox" | "search";
|
|
15
15
|
type FormCtx = {
|
|
16
16
|
getValues: UseFormGetValues<any>;
|
|
17
17
|
watch: UseFormWatch<any>;
|
|
@@ -95,6 +95,16 @@ export interface FieldSchema {
|
|
|
95
95
|
label: string;
|
|
96
96
|
value: any;
|
|
97
97
|
}[]>;
|
|
98
|
+
/** Clave para buscar el proveedor de búsqueda en el registro (alternativa a searchFn inline) */
|
|
99
|
+
searchSource?: string;
|
|
100
|
+
/** Modo de búsqueda: 'button' (click para buscar) o 'debounced' (al escribir) */
|
|
101
|
+
searchMode?: "button" | "debounced";
|
|
102
|
+
/** Mínimo de caracteres para buscar (modo debounced) */
|
|
103
|
+
minChars?: number;
|
|
104
|
+
/** Tiempo de espera para buscar (modo debounced) */
|
|
105
|
+
debounceMs?: number;
|
|
106
|
+
/** Función para resolver valor inicial (edición) */
|
|
107
|
+
resolveByValue?: (value: string, ctx?: FormCtx) => Promise<Option | null>;
|
|
98
108
|
/** Valores por defecto sincrónicos. */
|
|
99
109
|
defaultValue?: Record<string, unknown>;
|
|
100
110
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dipusevilla/componentes-iu",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
4
4
|
"description": "Librería de componentes React de Dipusevilla",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -10,94 +10,87 @@
|
|
|
10
10
|
"dipusevilla"
|
|
11
11
|
],
|
|
12
12
|
"author": "Dipusevilla <desarrolloinpro@dipusevilla.es>",
|
|
13
|
+
"license": "ISC",
|
|
13
14
|
"main": "dist/index.cjs.js",
|
|
14
15
|
"module": "dist/index.es.js",
|
|
15
16
|
"unpkg": "dist/index.umd.js",
|
|
16
17
|
"types": "dist/types/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": "./dist/index.es.js",
|
|
21
|
+
"require": "./dist/index.cjs.js"
|
|
22
|
+
},
|
|
23
|
+
"./style.css": "./dist/index.css"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
17
28
|
"scripts": {
|
|
18
|
-
"build:types": "tsc --project tsconfig.build.json",
|
|
19
29
|
"build": "vite build && npm run build:types",
|
|
20
|
-
"
|
|
30
|
+
"build:types": "tsc --project tsconfig.build.json",
|
|
31
|
+
"build-storybook": "storybook build",
|
|
21
32
|
"dev": "vite",
|
|
22
33
|
"lint": "eslint .",
|
|
34
|
+
"prepublishOnly": "npm run build",
|
|
23
35
|
"preview": "vite preview",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"publish": "npm publish --access public"
|
|
27
|
-
},
|
|
28
|
-
"peerDependencies": {
|
|
29
|
-
"react": "^19.1.0",
|
|
30
|
-
"react-dom": "^19.1.0"
|
|
36
|
+
"publish": "npm publish --access public",
|
|
37
|
+
"storybook": "storybook dev -p 6006"
|
|
31
38
|
},
|
|
32
39
|
"dependencies": {
|
|
33
40
|
"@dnd-kit/core": "^6.3.1",
|
|
34
41
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
35
42
|
"@dnd-kit/sortable": "^10.0.0",
|
|
36
|
-
"@headlessui/react": "^2.2.
|
|
43
|
+
"@headlessui/react": "^2.2.9",
|
|
37
44
|
"@heroicons/react": "^2.2.0",
|
|
38
|
-
"@hookform/resolvers": "^5.
|
|
45
|
+
"@hookform/resolvers": "^5.2.2",
|
|
39
46
|
"clsx": "^2.1.1",
|
|
40
|
-
"i18next": "^25.2
|
|
41
|
-
"immer": "^10.
|
|
42
|
-
"react-hook-form": "^7.
|
|
43
|
-
"react-i18next": "^
|
|
44
|
-
"react-router-dom": "^7.9.
|
|
45
|
-
"tailwind-merge": "^3.
|
|
46
|
-
"yup": "^1.
|
|
47
|
+
"i18next": "^25.6.2",
|
|
48
|
+
"immer": "^10.2.0",
|
|
49
|
+
"react-hook-form": "^7.66.0",
|
|
50
|
+
"react-i18next": "^16.3.3",
|
|
51
|
+
"react-router-dom": "^7.9.6",
|
|
52
|
+
"tailwind-merge": "^3.4.0",
|
|
53
|
+
"yup": "^1.7.1",
|
|
47
54
|
"zustand": "^5.0.8"
|
|
48
55
|
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"react": "^19.2.0",
|
|
58
|
+
"react-dom": "^19.2.0"
|
|
59
|
+
},
|
|
49
60
|
"devDependencies": {
|
|
50
|
-
"@chromatic-com/storybook": "
|
|
51
|
-
"@eslint/js": "^9.
|
|
52
|
-
"@storybook/addon-
|
|
53
|
-
"@storybook/
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"eslint-plugin-react-hooks": "^5.2.0",
|
|
73
|
-
"eslint-plugin-react-refresh": "^0.4.19",
|
|
74
|
-
"eslint-plugin-storybook": "^0.12.0",
|
|
75
|
-
"globals": "^16.0.0",
|
|
76
|
-
"playwright": "^1.52.0",
|
|
77
|
-
"postcss": "^8.5.4",
|
|
78
|
-
"storybook": "^8.6.14",
|
|
61
|
+
"@chromatic-com/storybook": "4.1.2",
|
|
62
|
+
"@eslint/js": "^9.39.1",
|
|
63
|
+
"@storybook/addon-onboarding": "^10.0.7",
|
|
64
|
+
"@storybook/react-vite": "^10.0.7",
|
|
65
|
+
"@tailwindcss/postcss": "^4.1.17",
|
|
66
|
+
"@tailwindcss/vite": "^4.1.17",
|
|
67
|
+
"@types/node": "^24.10.1",
|
|
68
|
+
"@types/react": "^19.2.5",
|
|
69
|
+
"@types/react-dom": "^19.2.3",
|
|
70
|
+
"@types/uuid": "^11.0.0",
|
|
71
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
72
|
+
"@vitest/browser": "^4.0.9",
|
|
73
|
+
"@vitest/coverage-v8": "^4.0.9",
|
|
74
|
+
"autoprefixer": "^10.4.22",
|
|
75
|
+
"eslint": "^9.39.1",
|
|
76
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
77
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
78
|
+
"eslint-plugin-storybook": "^10.0.7",
|
|
79
|
+
"globals": "^16.5.0",
|
|
80
|
+
"playwright": "^1.56.1",
|
|
81
|
+
"postcss": "^8.5.6",
|
|
82
|
+
"storybook": "10.0.7",
|
|
79
83
|
"storybook-dark-mode": "^4.0.2",
|
|
80
|
-
"tailwindcss": "^4.1.
|
|
81
|
-
"typescript": "~5.
|
|
82
|
-
"typescript-eslint": "^8.
|
|
83
|
-
"vite": "^6.
|
|
84
|
-
"vite-plugin-svgr": "^4.
|
|
85
|
-
"vitest": "^
|
|
84
|
+
"tailwindcss": "^4.1.17",
|
|
85
|
+
"typescript": "~5.9.3",
|
|
86
|
+
"typescript-eslint": "^8.46.4",
|
|
87
|
+
"vite": "^6.4.1",
|
|
88
|
+
"vite-plugin-svgr": "^4.5.0",
|
|
89
|
+
"vitest": "^4.0.9"
|
|
86
90
|
},
|
|
87
|
-
"license": "ISC",
|
|
88
91
|
"eslintConfig": {
|
|
89
92
|
"extends": [
|
|
90
93
|
"plugin:storybook/recommended"
|
|
91
94
|
]
|
|
92
|
-
}
|
|
93
|
-
"exports": {
|
|
94
|
-
".": {
|
|
95
|
-
"import": "./dist/index.es.js",
|
|
96
|
-
"require": "./dist/index.cjs.js"
|
|
97
|
-
},
|
|
98
|
-
"./style.css": "./dist/index.css"
|
|
99
|
-
},
|
|
100
|
-
"files": [
|
|
101
|
-
"dist"
|
|
102
|
-
]
|
|
95
|
+
}
|
|
103
96
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { RuleExpr } from "../../rules/RuleDSL";
|
|
2
|
-
type Props = {
|
|
3
|
-
value?: RuleExpr;
|
|
4
|
-
onChange: (expr: RuleExpr) => void;
|
|
5
|
-
fieldOptions: Array<{
|
|
6
|
-
label: string;
|
|
7
|
-
value: string;
|
|
8
|
-
}>;
|
|
9
|
-
};
|
|
10
|
-
export declare function RuleBuilder({ value, onChange, fieldOptions }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export {};
|