extended-dynamic-forms 0.1.22 → 0.2.0

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.
@@ -34,7 +34,6 @@ export interface ExtendedFormProps extends Omit<FormProps, 'validator'>, FormEve
34
34
  schema: RJSFSchema;
35
35
  uiSchema?: UiSchema;
36
36
  webhooks?: WebhookConfig[];
37
- conditionals?: ConditionalConfig;
38
37
  }
39
38
  export interface CustomWidgetProps {
40
39
  label?: string;
@@ -46,43 +45,3 @@ export interface CustomWidgetProps {
46
45
  help?: string;
47
46
  rawErrors?: string[];
48
47
  }
49
- export interface ConditionalRule {
50
- conditions: Record<string, any>;
51
- event: ConditionalEvent;
52
- order?: number;
53
- priority?: number;
54
- }
55
- export interface ConditionalEvent {
56
- type: string;
57
- params?: Record<string, any>;
58
- }
59
- export interface ConditionalAction {
60
- (params: any, schema: RJSFSchema, uiSchema: UiSchema, formData: any): void;
61
- propTypes?: any;
62
- validate?: (params: any, schema: RJSFSchema, uiSchema: UiSchema) => void;
63
- }
64
- export interface ConditionalActions {
65
- [actionType: string]: ConditionalAction;
66
- }
67
- export interface ConditionalEngine {
68
- new (rules: ConditionalRule[], schema: RJSFSchema): ConditionalEngineInstance;
69
- }
70
- export interface ConditionalEngineInstance {
71
- addRule(rule: ConditionalRule): void;
72
- run(formData: any): Promise<ConditionalEvent[]>;
73
- }
74
- export interface ConditionalConfig {
75
- rules?: ConditionalRule[];
76
- engine?: ConditionalEngine;
77
- extraActions?: ConditionalActions;
78
- onSchemaChange?: (schemas: {
79
- schema: RJSFSchema;
80
- uiSchema: UiSchema;
81
- }) => void;
82
- }
83
- export interface ConditionalState {
84
- currentSchema: RJSFSchema;
85
- currentUiSchema: UiSchema;
86
- rules: ConditionalRule[];
87
- isProcessing: boolean;
88
- }
@@ -12,7 +12,6 @@ declare function createForm(config: {
12
12
  onChange?: (data: any) => void;
13
13
  onSubmit?: (data: any) => void;
14
14
  onError?: (errors: any) => void;
15
- conditionals?: any;
16
15
  webhooks?: any;
17
16
  widgets?: any;
18
17
  fields?: any;
@@ -27,7 +26,6 @@ declare function createWizardForm(config: {
27
26
  formData?: any;
28
27
  onStepChange?: (step: number, data: any) => void;
29
28
  onSubmit?: (data: any) => void;
30
- conditionals?: any;
31
29
  webhooks?: any;
32
30
  }): {
33
31
  destroy: () => void;
@@ -83,25 +81,25 @@ declare const ExtendedDynamicForms: {
83
81
  WizardSectionTemplate: React.FC<import('./layouts/wizard/WizardSectionTemplate').WizardSectionTemplateProps>;
84
82
  SubmitButton: React.FC<import('@rjsf/utils').SubmitButtonProps>;
85
83
  customWidgets: {
86
- TextWidget: typeof ExtendedDynamicFormsExports.EnhancedTextWidget;
87
- TextareaWidget: typeof ExtendedDynamicFormsExports.EnhancedTextareaWidget;
88
- SelectWidget: typeof ExtendedDynamicFormsExports.EnhancedSelectWidget;
89
- CheckboxWidget: typeof ExtendedDynamicFormsExports.EnhancedCheckboxWidget;
90
- RadioWidget: typeof ExtendedDynamicFormsExports.EnhancedRadioWidget;
91
- UpDownWidget: typeof ExtendedDynamicFormsExports.EnhancedNumberWidget;
92
- FileWidget: typeof ExtendedDynamicFormsExports.FileUploadWidget;
93
- tel: typeof ExtendedDynamicFormsExports.TelephoneWidget;
94
- email: typeof ExtendedDynamicFormsExports.EmailWidget;
95
- url: typeof ExtendedDynamicFormsExports.URLWidget;
96
- password: typeof ExtendedDynamicFormsExports.PasswordWidget;
97
- date: typeof import('./widgets/enhanced/EnhancedWidgets').DateWidget;
98
- 'datetime-local': typeof ExtendedDynamicFormsExports.DateTimeWidget;
99
- TelWidget: typeof ExtendedDynamicFormsExports.TelephoneWidget;
100
- EmailWidget: typeof ExtendedDynamicFormsExports.EmailWidget;
101
- URLWidget: typeof ExtendedDynamicFormsExports.URLWidget;
102
- PasswordWidget: typeof ExtendedDynamicFormsExports.PasswordWidget;
103
- DateWidget: typeof import('./widgets/enhanced/EnhancedWidgets').DateWidget;
104
- DateTimeWidget: typeof ExtendedDynamicFormsExports.DateTimeWidget;
84
+ TextWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
85
+ TextareaWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
86
+ SelectWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
87
+ CheckboxWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
88
+ RadioWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
89
+ UpDownWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
90
+ FileWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
91
+ tel: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
92
+ email: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
93
+ url: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
94
+ password: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
95
+ date: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
96
+ 'datetime-local': React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
97
+ TelWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
98
+ EmailWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
99
+ URLWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
100
+ PasswordWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
101
+ DateWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
102
+ DateTimeWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
105
103
  color: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
106
104
  file: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
107
105
  range: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
@@ -112,38 +110,38 @@ declare const ExtendedDynamicForms: {
112
110
  FileWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
113
111
  RangeWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
114
112
  RatingWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
115
- EnhancedTextWidget: typeof ExtendedDynamicFormsExports.EnhancedTextWidget;
116
- EnhancedTextareaWidget: typeof ExtendedDynamicFormsExports.EnhancedTextareaWidget;
117
- EnhancedSelectWidget: typeof ExtendedDynamicFormsExports.EnhancedSelectWidget;
118
- EnhancedCheckboxWidget: typeof ExtendedDynamicFormsExports.EnhancedCheckboxWidget;
119
- EnhancedRadioWidget: typeof ExtendedDynamicFormsExports.EnhancedRadioWidget;
120
- EnhancedNumberWidget: typeof ExtendedDynamicFormsExports.EnhancedNumberWidget;
121
- TelephoneWidget: typeof ExtendedDynamicFormsExports.TelephoneWidget;
122
- EmailWidget: typeof ExtendedDynamicFormsExports.EmailWidget;
123
- URLWidget: typeof ExtendedDynamicFormsExports.URLWidget;
124
- PasswordWidget: typeof ExtendedDynamicFormsExports.PasswordWidget;
125
- DateTimeWidget: typeof ExtendedDynamicFormsExports.DateTimeWidget;
126
- FileUploadWidget: typeof ExtendedDynamicFormsExports.FileUploadWidget;
113
+ EnhancedTextWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
114
+ EnhancedTextareaWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
115
+ EnhancedSelectWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
116
+ EnhancedCheckboxWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
117
+ EnhancedRadioWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
118
+ EnhancedNumberWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
119
+ TelephoneWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
120
+ EmailWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
121
+ URLWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
122
+ PasswordWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
123
+ DateTimeWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
124
+ FileUploadWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
127
125
  enhancedWidgets: {
128
- TextWidget: typeof ExtendedDynamicFormsExports.EnhancedTextWidget;
129
- TextareaWidget: typeof ExtendedDynamicFormsExports.EnhancedTextareaWidget;
130
- SelectWidget: typeof ExtendedDynamicFormsExports.EnhancedSelectWidget;
131
- CheckboxWidget: typeof ExtendedDynamicFormsExports.EnhancedCheckboxWidget;
132
- RadioWidget: typeof ExtendedDynamicFormsExports.EnhancedRadioWidget;
133
- UpDownWidget: typeof ExtendedDynamicFormsExports.EnhancedNumberWidget;
134
- FileWidget: typeof ExtendedDynamicFormsExports.FileUploadWidget;
135
- tel: typeof ExtendedDynamicFormsExports.TelephoneWidget;
136
- email: typeof ExtendedDynamicFormsExports.EmailWidget;
137
- url: typeof ExtendedDynamicFormsExports.URLWidget;
138
- password: typeof ExtendedDynamicFormsExports.PasswordWidget;
139
- date: typeof import('./widgets/enhanced/EnhancedWidgets').DateWidget;
140
- 'datetime-local': typeof ExtendedDynamicFormsExports.DateTimeWidget;
141
- TelWidget: typeof ExtendedDynamicFormsExports.TelephoneWidget;
142
- EmailWidget: typeof ExtendedDynamicFormsExports.EmailWidget;
143
- URLWidget: typeof ExtendedDynamicFormsExports.URLWidget;
144
- PasswordWidget: typeof ExtendedDynamicFormsExports.PasswordWidget;
145
- DateWidget: typeof import('./widgets/enhanced/EnhancedWidgets').DateWidget;
146
- DateTimeWidget: typeof ExtendedDynamicFormsExports.DateTimeWidget;
126
+ TextWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
127
+ TextareaWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
128
+ SelectWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
129
+ CheckboxWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
130
+ RadioWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
131
+ UpDownWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
132
+ FileWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
133
+ tel: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
134
+ email: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
135
+ url: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
136
+ password: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
137
+ date: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
138
+ 'datetime-local': React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
139
+ TelWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
140
+ EmailWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
141
+ URLWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
142
+ PasswordWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
143
+ DateWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
144
+ DateTimeWidget: React.FC<ExtendedDynamicFormsExports.WidgetProps<any, ExtendedDynamicFormsExports.RJSFSchema, any>>;
147
145
  };
148
146
  WizardLayout: React.FC<import('./layouts/wizard/WizardLayout').WizardLayoutProps>;
149
147
  ProgressIndicator: React.FC<import('./layouts/wizard/ProgressIndicator').ProgressIndicatorProps>;
@@ -158,22 +156,21 @@ declare const ExtendedDynamicForms: {
158
156
  onBlur: (value: any) => Promise<void>;
159
157
  onChange: (value: any) => Promise<void>;
160
158
  };
161
- ConditionalProcessor: typeof ExtendedDynamicFormsExports.ConditionalProcessor;
162
- SimpleConditionalEngine: typeof ExtendedDynamicFormsExports.ConditionalProcessor;
163
- DynamicArrayConditionalEngine: typeof ExtendedDynamicFormsExports.DynamicArrayConditionalEngine;
164
- defaultActions: ExtendedDynamicFormsExports.ConditionalActions;
165
- remove: ExtendedDynamicFormsExports.ConditionalAction;
166
- require: ExtendedDynamicFormsExports.ConditionalAction;
167
- uiAppend: ExtendedDynamicFormsExports.ConditionalAction;
168
- uiOverride: ExtendedDynamicFormsExports.ConditionalAction;
169
- uiReplace: ExtendedDynamicFormsExports.ConditionalAction;
170
- enable: ExtendedDynamicFormsExports.ConditionalAction;
171
- disable: ExtendedDynamicFormsExports.ConditionalAction;
172
- optional: ExtendedDynamicFormsExports.ConditionalAction;
173
- show: ExtendedDynamicFormsExports.ConditionalAction;
174
- transformJsonRulesEngine: typeof ExtendedDynamicFormsExports.transformJsonRulesEngine;
175
- smartTransformJsonRulesEngine: typeof ExtendedDynamicFormsExports.transformJsonRulesEngine;
176
- Engine: any;
159
+ createConditionalEngineHook: typeof ExtendedDynamicFormsExports.createConditionalEngineHook;
160
+ useConditionalUi: ExtendedDynamicFormsExports.ConditionalEngineHook<ExtendedDynamicFormsExports.UiEffect[]>;
161
+ useConditionalSchema: ExtendedDynamicFormsExports.ConditionalEngineHook<ExtendedDynamicFormsExports.SchemaEffect[]>;
162
+ useConditionalValidation: ExtendedDynamicFormsExports.ConditionalEngineHook<ExtendedDynamicFormsExports.ValidationEffect>;
163
+ createDynamicArrayItemsUiSchema: typeof ExtendedDynamicFormsExports.createDynamicArrayItemsUiSchema;
164
+ mergeItemUiSchema: typeof ExtendedDynamicFormsExports.mergeItemUiSchema;
165
+ arrayItemPatterns: {
166
+ hideField: (fieldName: string, condition: (itemData: any) => boolean) => ExtendedDynamicFormsExports.ArrayItemConditionalFn;
167
+ requireField: (fieldName: string, condition: (itemData: any) => boolean) => ExtendedDynamicFormsExports.ArrayItemConditionalFn;
168
+ applyIndexStyles: (totalItems: number) => ExtendedDynamicFormsExports.ArrayItemConditionalFn;
169
+ };
170
+ uiEngineConfig: ExtendedDynamicFormsExports.EngineConfig<ExtendedDynamicFormsExports.UiEffect[], ExtendedDynamicFormsExports.UiSchema>;
171
+ schemaEngineConfig: ExtendedDynamicFormsExports.EngineConfig<ExtendedDynamicFormsExports.SchemaEffect[], ExtendedDynamicFormsExports.RJSFSchema>;
172
+ validationEngineConfig: ExtendedDynamicFormsExports.EngineConfig<ExtendedDynamicFormsExports.ValidationEffect, import('./conditionals/v2/engines/validationEngineConfig').ValidationConfig>;
173
+ createCustomValidate: typeof ExtendedDynamicFormsExports.createCustomValidate;
177
174
  deepEquals(obj1: any, obj2: any): boolean;
178
175
  formDataUtils: {
179
176
  cloneFormData: (data: any) => any;
@@ -197,7 +194,6 @@ declare const ExtendedDynamicForms: {
197
194
  isInRange: (value: number, min?: number, max?: number) => boolean;
198
195
  getValidationMessage: (type: string, params?: any) => string;
199
196
  };
200
- useFormDevTools(formData: any, uiRules?: import('./conditionals/v2').Rule<import('./conditionals/v2').UiEffect>[], schemaRules?: import('./conditionals/v2').Rule<import('./conditionals/v2').SchemaEffect>[], validationRules?: import('./conditionals/v2').Rule<import('./conditionals/v2').ValidationEffect>[], options?: ExtendedDynamicFormsExports.DevToolsOptions): ExtendedDynamicFormsExports.DevToolsOutput;
201
197
  createForm: typeof createForm;
202
198
  createWizardForm: typeof createWizardForm;
203
199
  React: typeof React;
@@ -1,36 +1,37 @@
1
+ import { default as React, FC } from 'react';
1
2
  import { WidgetProps } from '@rjsf/utils';
2
3
 
3
- export declare function EnhancedTextWidget(props: WidgetProps): import("react/jsx-runtime").JSX.Element;
4
- export declare function EnhancedTextareaWidget(props: WidgetProps): import("react/jsx-runtime").JSX.Element;
5
- export declare function EnhancedSelectWidget(props: WidgetProps): import("react/jsx-runtime").JSX.Element;
6
- export declare function EnhancedCheckboxWidget(props: WidgetProps): import("react/jsx-runtime").JSX.Element;
7
- export declare function EnhancedRadioWidget(props: WidgetProps): import("react/jsx-runtime").JSX.Element;
8
- export declare function EnhancedNumberWidget(props: WidgetProps): import("react/jsx-runtime").JSX.Element;
9
- export declare function TelephoneWidget(props: WidgetProps): import("react/jsx-runtime").JSX.Element;
10
- export declare function EmailWidget(props: WidgetProps): import("react/jsx-runtime").JSX.Element;
11
- export declare function URLWidget(props: WidgetProps): import("react/jsx-runtime").JSX.Element;
12
- export declare function PasswordWidget(props: WidgetProps): import("react/jsx-runtime").JSX.Element;
13
- export declare function DateWidget(props: WidgetProps): import("react/jsx-runtime").JSX.Element;
14
- export declare function DateTimeWidget(props: WidgetProps): import("react/jsx-runtime").JSX.Element;
15
- export declare function FileUploadWidget(props: WidgetProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare const EnhancedTextWidget: FC<WidgetProps>;
5
+ export declare const EnhancedTextareaWidget: FC<WidgetProps>;
6
+ export declare const EnhancedSelectWidget: FC<WidgetProps>;
7
+ export declare const EnhancedCheckboxWidget: FC<WidgetProps>;
8
+ export declare const EnhancedRadioWidget: FC<WidgetProps>;
9
+ export declare const EnhancedNumberWidget: FC<WidgetProps>;
10
+ export declare const TelephoneWidget: FC<WidgetProps>;
11
+ export declare const EmailWidget: FC<WidgetProps>;
12
+ export declare const URLWidget: FC<WidgetProps>;
13
+ export declare const PasswordWidget: FC<WidgetProps>;
14
+ export declare const DateWidget: FC<WidgetProps>;
15
+ export declare const DateTimeWidget: FC<WidgetProps>;
16
+ export declare const FileUploadWidget: FC<WidgetProps>;
16
17
  export declare const customWidgets: {
17
- TextWidget: typeof EnhancedTextWidget;
18
- TextareaWidget: typeof EnhancedTextareaWidget;
19
- SelectWidget: typeof EnhancedSelectWidget;
20
- CheckboxWidget: typeof EnhancedCheckboxWidget;
21
- RadioWidget: typeof EnhancedRadioWidget;
22
- UpDownWidget: typeof EnhancedNumberWidget;
23
- FileWidget: typeof FileUploadWidget;
24
- tel: typeof TelephoneWidget;
25
- email: typeof EmailWidget;
26
- url: typeof URLWidget;
27
- password: typeof PasswordWidget;
28
- date: typeof DateWidget;
29
- 'datetime-local': typeof DateTimeWidget;
30
- TelWidget: typeof TelephoneWidget;
31
- EmailWidget: typeof EmailWidget;
32
- URLWidget: typeof URLWidget;
33
- PasswordWidget: typeof PasswordWidget;
34
- DateWidget: typeof DateWidget;
35
- DateTimeWidget: typeof DateTimeWidget;
18
+ TextWidget: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
19
+ TextareaWidget: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
20
+ SelectWidget: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
21
+ CheckboxWidget: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
22
+ RadioWidget: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
23
+ UpDownWidget: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
24
+ FileWidget: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
25
+ tel: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
26
+ email: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
27
+ url: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
28
+ password: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
29
+ date: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
30
+ 'datetime-local': React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
31
+ TelWidget: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
32
+ EmailWidget: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
33
+ URLWidget: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
34
+ PasswordWidget: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
35
+ DateWidget: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
36
+ DateTimeWidget: React.FC<WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
36
37
  };
@@ -6,25 +6,25 @@ import { RatingWidget } from './input/RatingWidget';
6
6
  import { customWidgets as enhancedWidgets, EnhancedTextWidget, EnhancedTextareaWidget, EnhancedSelectWidget, EnhancedCheckboxWidget, EnhancedRadioWidget, EnhancedNumberWidget, TelephoneWidget, EmailWidget, URLWidget, PasswordWidget, DateTimeWidget, FileUploadWidget } from './enhanced/EnhancedWidgets';
7
7
 
8
8
  export declare const customWidgets: {
9
- TextWidget: typeof EnhancedTextWidget;
10
- TextareaWidget: typeof EnhancedTextareaWidget;
11
- SelectWidget: typeof EnhancedSelectWidget;
12
- CheckboxWidget: typeof EnhancedCheckboxWidget;
13
- RadioWidget: typeof EnhancedRadioWidget;
14
- UpDownWidget: typeof EnhancedNumberWidget;
15
- FileWidget: typeof FileUploadWidget;
16
- tel: typeof TelephoneWidget;
17
- email: typeof EmailWidget;
18
- url: typeof URLWidget;
19
- password: typeof PasswordWidget;
20
- date: typeof import('./enhanced/EnhancedWidgets').DateWidget;
21
- 'datetime-local': typeof DateTimeWidget;
22
- TelWidget: typeof TelephoneWidget;
23
- EmailWidget: typeof EmailWidget;
24
- URLWidget: typeof URLWidget;
25
- PasswordWidget: typeof PasswordWidget;
26
- DateWidget: typeof import('./enhanced/EnhancedWidgets').DateWidget;
27
- DateTimeWidget: typeof DateTimeWidget;
9
+ TextWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
10
+ TextareaWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
11
+ SelectWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
12
+ CheckboxWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
13
+ RadioWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
14
+ UpDownWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
15
+ FileWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
16
+ tel: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
17
+ email: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
18
+ url: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
19
+ password: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
20
+ date: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
21
+ 'datetime-local': import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
22
+ TelWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
23
+ EmailWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
24
+ URLWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
25
+ PasswordWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
26
+ DateWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
27
+ DateTimeWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
28
28
  color: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
29
29
  file: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
30
30
  range: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ExtendedForm } from '../src/ExtendedForm';
3
3
  import { RJSFSchema, UiSchema } from '@rjsf/utils';
4
- import { useConditionalUi, UiRule } from '../src/conditionals/v2';
4
+ import { useConditionalUi, UiRule, JsonLogicRule } from '../src/conditionals/v2';
5
5
 
6
6
  const schema: RJSFSchema = {
7
7
  type: 'object',
@@ -40,7 +40,7 @@ export function ConditionalV2Example() {
40
40
  const uiRules: UiRule[] = [
41
41
  {
42
42
  name: 'Hide shipping address when not required',
43
- condition: (data) => !data.requiresShipping,
43
+ condition: { "!": { "var": "requiresShipping" } } as JsonLogicRule,
44
44
  effect: [
45
45
  { op: 'add', path: '/shippingAddress/ui:widget', value: 'hidden' }
46
46
  ]
@@ -18,6 +18,7 @@ import {
18
18
  UiEffect,
19
19
  SchemaEffect,
20
20
  ValidationEffect,
21
+ JsonLogicRule,
21
22
  } from '../src/conditionals/v2/types';
22
23
  import {
23
24
  useConditionalUi,
@@ -80,15 +81,14 @@ const baseUiSchema: UiSchema = {
80
81
  const uiRules: Rule<UiEffect>[] = [
81
82
  {
82
83
  name: 'Hide shipping address when not required',
83
- condition: formData => !formData.requiresShipping,
84
+ condition: { "!": { "var": "requiresShipping" } } as JsonLogicRule,
84
85
  effect: [
85
86
  { op: 'add', path: '/shippingAddress/ui:widget', value: 'hidden' },
86
87
  ],
87
88
  },
88
89
  {
89
90
  name: 'Show state dropdown for US/Canada',
90
- condition: formData =>
91
- formData.country === 'USA' || formData.country === 'Canada',
91
+ condition: { "or": [{ "==": [{ "var": "country" }, "USA"] }, { "==": [{ "var": "country" }, "Canada"] }] } as JsonLogicRule,
92
92
  effect: [
93
93
  {
94
94
  op: 'add',
@@ -103,12 +103,12 @@ const uiRules: Rule<UiEffect>[] = [
103
103
  const schemaRules: Rule<SchemaEffect>[] = [
104
104
  {
105
105
  name: 'Add spouse fields when married',
106
- condition: formData => formData.maritalStatus === 'married',
106
+ condition: { "===": [{ "var": "maritalStatus" }, "married"] } as JsonLogicRule,
107
107
  effect: [{ op: 'add', path: '/required/-', value: 'spouseName' }],
108
108
  },
109
109
  {
110
110
  name: 'Remove spouse field when not married',
111
- condition: formData => formData.maritalStatus !== 'married',
111
+ condition: { "!==": [{ "var": "maritalStatus" }, "married"] } as JsonLogicRule,
112
112
  effect: [{ op: 'remove', path: '/properties/spouseName' }],
113
113
  },
114
114
  ];
@@ -119,8 +119,7 @@ const validationRules: Rule<ValidationEffect>[] = [
119
119
  name: 'US ZIP code format validation',
120
120
  effect: {
121
121
  name: 'US ZIP code format',
122
- isActive: formData =>
123
- formData.country === 'USA' && formData.requiresShipping,
122
+ isActive: { "and": [{ "==": [{ "var": "country" }, "USA"] }, { "var": "requiresShipping" }] } as JsonLogicRule,
124
123
  validate: (errors, formData) => {
125
124
  if (
126
125
  formData.shippingAddress?.zip &&
@@ -139,8 +138,7 @@ const validationRules: Rule<ValidationEffect>[] = [
139
138
  name: 'Canadian postal code validation',
140
139
  effect: {
141
140
  name: 'Canadian postal code',
142
- isActive: formData =>
143
- formData.country === 'Canada' && formData.requiresShipping,
141
+ isActive: { "and": [{ "==": [{ "var": "country" }, "Canada"] }, { "var": "requiresShipping" }] } as JsonLogicRule,
144
142
  validate: (errors, formData) => {
145
143
  if (
146
144
  formData.shippingAddress?.zip &&
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ExtendedForm } from '../src/ExtendedForm';
3
3
  import { RJSFSchema, UiSchema, IChangeEvent } from '@rjsf/utils';
4
- import { useConditionalUi, UiRule } from '../src/conditionals/v2';
4
+ import { useConditionalUi, UiRule, JsonLogicRule } from '../src/conditionals/v2';
5
5
 
6
6
  /**
7
7
  * Global UI Rules Example
@@ -175,7 +175,7 @@ const globalUiRules: UiRule[] = [
175
175
  // Rule 1: Show shipping address when shipping is required
176
176
  {
177
177
  name: 'Show shipping address when shipping required',
178
- condition: (formData) => formData.requiresShipping === true,
178
+ condition: { "===": [{ "var": "requiresShipping" }, true] } as JsonLogicRule,
179
179
  effect: [
180
180
  { op: 'remove', path: '/shippingAddress/ui:widget' }
181
181
  ],
@@ -185,7 +185,7 @@ const globalUiRules: UiRule[] = [
185
185
  // Rule 2: Show delivery instructions when shipping is required
186
186
  {
187
187
  name: 'Show delivery instructions when shipping required',
188
- condition: (formData) => formData.requiresShipping === true,
188
+ condition: { "===": [{ "var": "requiresShipping" }, true] } as JsonLogicRule,
189
189
  effect: [
190
190
  { op: 'replace', path: '/deliveryInstructions/ui:widget', value: 'textarea' }
191
191
  ],
@@ -195,7 +195,7 @@ const globalUiRules: UiRule[] = [
195
195
  // Rule 3: Show express shipping option when shipping is required
196
196
  {
197
197
  name: 'Show express shipping option when shipping required',
198
- condition: (formData) => formData.requiresShipping === true,
198
+ condition: { "===": [{ "var": "requiresShipping" }, true] } as JsonLogicRule,
199
199
  effect: [
200
200
  { op: 'remove', path: '/expressShipping/ui:widget' }
201
201
  ],
@@ -205,9 +205,12 @@ const globalUiRules: UiRule[] = [
205
205
  // Rule 4: Show state dropdown only for USA
206
206
  {
207
207
  name: 'Show state field for USA',
208
- condition: (formData) =>
209
- formData.requiresShipping === true &&
210
- formData.shippingAddress?.country === 'USA',
208
+ condition: {
209
+ "and": [
210
+ { "===": [{ "var": "requiresShipping" }, true] },
211
+ { "===": [{ "var": "shippingAddress.country" }, "USA"] }
212
+ ]
213
+ } as JsonLogicRule,
211
214
  effect: [
212
215
  { op: 'remove', path: '/shippingAddress/state/ui:widget' },
213
216
  { op: 'add', path: '/shippingAddress/province/ui:widget', value: 'hidden' },
@@ -219,9 +222,12 @@ const globalUiRules: UiRule[] = [
219
222
  // Rule 5: Show province dropdown only for Canada
220
223
  {
221
224
  name: 'Show province field for Canada',
222
- condition: (formData) =>
223
- formData.requiresShipping === true &&
224
- formData.shippingAddress?.country === 'Canada',
225
+ condition: {
226
+ "and": [
227
+ { "===": [{ "var": "requiresShipping" }, true] },
228
+ { "===": [{ "var": "shippingAddress.country" }, "Canada"] }
229
+ ]
230
+ } as JsonLogicRule,
225
231
  effect: [
226
232
  { op: 'add', path: '/shippingAddress/state/ui:widget', value: 'hidden' },
227
233
  { op: 'remove', path: '/shippingAddress/province/ui:widget' },
@@ -233,9 +239,12 @@ const globalUiRules: UiRule[] = [
233
239
  // Rule 6: Show region text field for Mexico and Other
234
240
  {
235
241
  name: 'Show region field for Mexico and Other countries',
236
- condition: (formData) =>
237
- formData.requiresShipping === true &&
238
- ['Mexico', 'Other'].includes(formData.shippingAddress?.country),
242
+ condition: {
243
+ "and": [
244
+ { "===": [{ "var": "requiresShipping" }, true] },
245
+ { "in": [{ "var": "shippingAddress.country" }, ["Mexico", "Other"]] }
246
+ ]
247
+ } as JsonLogicRule,
239
248
  effect: [
240
249
  { op: 'add', path: '/shippingAddress/state/ui:widget', value: 'hidden' },
241
250
  { op: 'add', path: '/shippingAddress/province/ui:widget', value: 'hidden' },
@@ -247,9 +256,12 @@ const globalUiRules: UiRule[] = [
247
256
  // Rule 7: Show international details only for "Other" countries
248
257
  {
249
258
  name: 'Show international details for non-North American countries',
250
- condition: (formData) =>
251
- formData.requiresShipping === true &&
252
- formData.shippingAddress?.country === 'Other',
259
+ condition: {
260
+ "and": [
261
+ { "===": [{ "var": "requiresShipping" }, true] },
262
+ { "===": [{ "var": "shippingAddress.country" }, "Other"] }
263
+ ]
264
+ } as JsonLogicRule,
253
265
  effect: [
254
266
  { op: 'replace', path: '/shippingAddress/internationalDetails/ui:widget', value: 'textarea' }
255
267
  ],
@@ -259,9 +271,12 @@ const globalUiRules: UiRule[] = [
259
271
  // Rule 8: Reorder fields to put international details at end when visible
260
272
  {
261
273
  name: 'Reorder fields for international shipping',
262
- condition: (formData) =>
263
- formData.requiresShipping === true &&
264
- formData.shippingAddress?.country === 'Other',
274
+ condition: {
275
+ "and": [
276
+ { "===": [{ "var": "requiresShipping" }, true] },
277
+ { "===": [{ "var": "shippingAddress.country" }, "Other"] }
278
+ ]
279
+ } as JsonLogicRule,
265
280
  effect: [
266
281
  {
267
282
  op: 'replace',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extended-dynamic-forms",
3
- "version": "0.1.22",
3
+ "version": "0.2.0",
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",
@@ -20,6 +20,11 @@
20
20
  "require": "./dist/index.umd.js",
21
21
  "types": "./dist/index.d.ts"
22
22
  },
23
+ "./conditionals/v2": {
24
+ "import": "./dist/index.es.js",
25
+ "require": "./dist/index.umd.js",
26
+ "types": "./dist/index.d.ts"
27
+ },
23
28
  "./dist/style.css": "./dist/style.css"
24
29
  },
25
30
  "scripts": {
@@ -36,7 +41,10 @@
36
41
  "prepublishOnly": "npm run build",
37
42
  "playground": "cd playground && npm install && npm run dev",
38
43
  "playground:build": "cd playground && npm run build",
39
- "serve:examples": "npx http-server examples/vanilla-js -p 8080 -o"
44
+ "serve:examples": "npx http-server examples/vanilla-js -p 8080 -o",
45
+ "setup:dev": "git clone https://github.com/rjsf-team/react-jsonschema-form ../react-jsonschema-form && cd ../react-jsonschema-form && npm install && npm run build",
46
+ "link:rjsf": "cd ../react-jsonschema-form/packages/core && npm link && cd ../antd && npm link && cd ../utils && npm link && cd ../validator-ajv8 && npm link",
47
+ "dev:install": "npm run setup:dev && npm run link:rjsf && npm install"
40
48
  },
41
49
  "keywords": [
42
50
  "react",
@@ -95,8 +103,10 @@
95
103
  "vitest": "^1.0.0"
96
104
  },
97
105
  "dependencies": {
106
+ "@types/json-logic-js": "^2.0.8",
98
107
  "date-fns": "^4.1.0",
99
108
  "dayjs": "^1.11.13",
109
+ "json-logic-js": "^2.0.5",
100
110
  "json-rules-engine-simplified": "^0.2.0"
101
111
  },
102
112
  "type": "module"
@@ -1,13 +0,0 @@
1
- import { ConditionalAction, ConditionalActions } from '../types';
2
-
3
- declare const remove: ConditionalAction;
4
- declare const require: ConditionalAction;
5
- declare const uiAppend: ConditionalAction;
6
- declare const uiOverride: ConditionalAction;
7
- declare const uiReplace: ConditionalAction;
8
- declare const enable: ConditionalAction;
9
- declare const disable: ConditionalAction;
10
- declare const optional: ConditionalAction;
11
- declare const show: ConditionalAction;
12
- export declare const defaultActions: ConditionalActions;
13
- export { remove, require, uiAppend, uiOverride, uiReplace, enable, disable, optional, show, };