extended-dynamic-forms 0.4.2 → 0.5.1

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.
@@ -1,7 +1,12 @@
1
- import { FormProps } from '@rjsf/core';
1
+ import { FormProps, IChangeEvent } from '@rjsf/core';
2
2
  import { RJSFSchema, UiSchema } from '@rjsf/utils';
3
3
 
4
4
  export type WebhookEventType = 'focus' | 'blur' | 'change' | 'submit' | 'stepChange' | 'validationError';
5
+ /** Submit-time field state, expressed as RFC 6901 pointers relative to the answers. */
6
+ export interface SubmissionMeta {
7
+ hiddenFields: string[];
8
+ disabledFields: string[];
9
+ }
5
10
  export interface FormEventHandlers {
6
11
  beforeSubmit?: (data: any) => Promise<any> | any;
7
12
  afterSubmit?: (data: any) => Promise<void> | void;
@@ -17,6 +22,9 @@ export interface FormFieldEvent {
17
22
  timestamp: number;
18
23
  fieldPath?: string[];
19
24
  }
25
+ export type JsonValue = string | number | boolean | null | JsonValue[] | {
26
+ [key: string]: JsonValue;
27
+ };
20
28
  export interface WebhookConfig {
21
29
  url: string;
22
30
  method?: 'POST' | 'PUT' | 'PATCH';
@@ -25,13 +33,25 @@ export interface WebhookConfig {
25
33
  debounceMs?: number;
26
34
  retries?: number;
27
35
  timeout?: number;
36
+ /** Static extra root properties. Reserved event properties are ignored. */
37
+ body?: Record<string, JsonValue>;
38
+ /** Static URL query pairs, appended in order without replacing existing keys. */
39
+ query?: Array<{
40
+ key: string;
41
+ value: string;
42
+ }>;
43
+ /** Literal top-level answer keys; this does not redact fieldValue or errors. */
44
+ formDataFields?: string[];
28
45
  }
29
46
  export interface FieldEventHandlers {
30
47
  onFieldFocus?: (event: FormFieldEvent) => Promise<void> | void;
31
48
  onFieldBlur?: (event: FormFieldEvent) => Promise<void> | void;
32
49
  onFieldChange?: (event: FormFieldEvent) => Promise<void> | void;
33
50
  }
34
- export interface ExtendedFormProps extends Omit<FormProps, 'validator'>, FormEventHandlers, FieldEventHandlers {
51
+ export interface ExtendedFormProps extends Omit<FormProps, 'validator' | 'onSubmit'>, FormEventHandlers, FieldEventHandlers {
52
+ onSubmit?: (data: IChangeEvent & {
53
+ meta?: SubmissionMeta;
54
+ }, event: Parameters<NonNullable<FormProps['onSubmit']>>[1]) => void;
35
55
  schema: RJSFSchema;
36
56
  uiSchema?: UiSchema;
37
57
  webhooks?: WebhookConfig[];
@@ -0,0 +1,5 @@
1
+ /** Trailing-only debounce for dropdown search; cancel discards pending work. */
2
+ export declare function debounce<Args extends unknown[]>(callback: (...args: Args) => void, wait: number): {
3
+ (...args: Args): void;
4
+ cancel: () => void;
5
+ };
@@ -0,0 +1,6 @@
1
+ import { ValidatorType } from '@rjsf/utils';
2
+
3
+ /** Treat null object properties as absent for AJV, without changing answers or array slots. */
4
+ export declare function omitNullProperties(data: unknown): unknown;
5
+ /** RJSF validator for EDF's null-answer contract, including native host-owned Forms. */
6
+ export declare const nullContractValidator: ValidatorType;
@@ -0,0 +1,18 @@
1
+ import { RJSFSchema, UiSchema } from '@rjsf/utils';
2
+ import { SubmissionMeta } from '../types';
3
+ import { UiEffect, Rule } from '../conditionals/v2/types';
4
+
5
+ /** Hidden and disabled fields remain exempt from validation. */
6
+ export declare function isOmittedField(uiSchema?: UiSchema): boolean;
7
+ /** Use RJSF's resolved property metadata, including dependency and reference expansion. */
8
+ export declare function propertyUi(schema: RJSFSchema, key: string, uiSchema?: UiSchema): UiSchema;
9
+ /** Preserve valued answers; only inactive nulls are absent from submission. */
10
+ export declare function omitInactiveNulls<T>(data: T, schema: RJSFSchema | boolean, uiSchema?: UiSchema, context?: unknown, rootSchema?: RJSFSchema, inheritedInactive?: boolean): T;
11
+ /** Restrict flags, never answers, after host transformations or webhook selection. */
12
+ export declare function restrictSubmissionMeta(meta: SubmissionMeta, data: unknown): SubmissionMeta;
13
+ /** Read effective field state, retaining authored rule targets as visibility provenance. */
14
+ export declare function submissionMeta(data: unknown, schema: RJSFSchema, uiSchema: UiSchema, rules?: Rule<UiEffect[]>[], context?: unknown): SubmissionMeta;
15
+ /** ErrorSchema uses numeric object keys, not arrays; dynamic UI still receives real answers. */
16
+ export declare function omitInactiveErrors<T>(errors: T, data: unknown, schema: RJSFSchema | boolean, uiSchema?: UiSchema, context?: unknown, rootSchema?: RJSFSchema): T;
17
+ /** Exempt inactive constraints; schema predicates use the null contract's absent-property view. */
18
+ export declare function activeValidationSchema(schema: RJSFSchema, data: unknown, uiSchema?: UiSchema, context?: unknown, rootSchema?: RJSFSchema): RJSFSchema;
@@ -0,0 +1,4 @@
1
+ import { ErrorTransformer } from '@rjsf/utils';
2
+
3
+ /** Fold redundant conditional wrappers before the host customizes validation feedback. */
4
+ export declare function createErrorTransformer(hostTransform?: ErrorTransformer): ErrorTransformer;
@@ -120,7 +120,7 @@ export declare const getValue: (value: any, options: any, defaultValue?: any) =>
120
120
  /**
121
121
  * Handle change event and return the appropriate value
122
122
  */
123
- export declare const handleChangeValue: (value: any, options: any, defaultEmptyValue?: any) => any;
123
+ export declare const handleChangeValue: (value: any, options: any, defaultEmptyValue?: unknown) => any;
124
124
  /**
125
125
  * Common props for Ant Design form components
126
126
  */
@@ -5,6 +5,7 @@ import { NumberWidget } from './input/NumberWidget';
5
5
  import { TelephoneWidget } from './input/TelephoneWidget';
6
6
  import { EmailWidget } from './input/EmailWidget';
7
7
  import { URLWidget } from './input/URLWidget';
8
+ import { HiddenWidget } from './input/HiddenWidget';
8
9
  import { TextWidget } from './text/TextWidget';
9
10
  import { TextareaWidget } from './text/TextareaWidget';
10
11
  import { PasswordWidget } from './text/PasswordWidget';
@@ -29,6 +30,8 @@ export declare const customWidgets: {
29
30
  TextareaWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
30
31
  password: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
31
32
  PasswordWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
33
+ hidden: typeof HiddenWidget;
34
+ HiddenWidget: typeof HiddenWidget;
32
35
  UpDownWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
33
36
  updown: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
34
37
  number: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
@@ -70,4 +73,4 @@ export declare const customWidgets: {
70
73
  fileUpload: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
71
74
  FileUploadWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
72
75
  };
73
- export { ChoiceWidget, ColorWidget, RangeWidget, RatingWidget, TextWidget, TextareaWidget, PasswordWidget, NumberWidget, TelephoneWidget, EmailWidget, URLWidget, DateWidget, EnhancedDateWidget, DateTimeWidget, FileWidget, FileUploadWidget, TitleWidget, HtmlWidget, SpacerWidget, DividerWidget, };
76
+ export { ChoiceWidget, ColorWidget, RangeWidget, RatingWidget, TextWidget, TextareaWidget, PasswordWidget, HiddenWidget, NumberWidget, TelephoneWidget, EmailWidget, URLWidget, DateWidget, EnhancedDateWidget, DateTimeWidget, FileWidget, FileUploadWidget, TitleWidget, HtmlWidget, SpacerWidget, DividerWidget, };
@@ -0,0 +1,3 @@
1
+ import { WidgetProps } from '@rjsf/utils';
2
+
3
+ export declare function HiddenWidget(props: WidgetProps): import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extended-dynamic-forms",
3
- "version": "0.4.2",
3
+ "version": "0.5.1",
4
4
  "description": "Extended React JSON Schema Form (RJSF) v6 with custom components, widgets, templates, layouts, and form events",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.es.js",
@@ -63,11 +63,11 @@
63
63
  "react-dom": "^18.0.0 || ^19.0.0"
64
64
  },
65
65
  "devDependencies": {
66
- "@rjsf/antd": "6.0.0-beta.17",
67
- "@rjsf/core": "6.0.0-beta.17",
68
- "@rjsf/utils": "6.0.0-beta.17",
69
- "@rjsf/validator-ajv8": "6.0.0-beta.17",
70
- "@types/lodash": "^4.17.20",
66
+ "@ant-design/icons": "^6",
67
+ "@rjsf/antd": "6.11.0",
68
+ "@rjsf/core": "6.11.0",
69
+ "@rjsf/utils": "6.11.0",
70
+ "@rjsf/validator-ajv8": "6.11.0",
71
71
  "@types/node": "^24.0.1",
72
72
  "@types/react": "^18.2.43",
73
73
  "@types/react-dom": "^18.2.17",