extended-dynamic-forms 0.1.17 → 0.1.18

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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +835 -393
  3. package/dist/extended-dynamic-forms.standalone.js +882 -0
  4. package/dist/style.css +1 -1
  5. package/examples/conditional-v2-example.tsx +64 -0
  6. package/examples/dynamic-array-items-example.tsx +211 -0
  7. package/examples/form-devtools-example.tsx +386 -0
  8. package/examples/global-ui-rules-example.tsx +356 -0
  9. package/examples/vanilla-js/README.md +212 -0
  10. package/examples/vanilla-js/basic-form.html +142 -0
  11. package/examples/vanilla-js/conditional-form.html +159 -0
  12. package/examples/vanilla-js/wizard-form.html +185 -0
  13. package/package.json +40 -47
  14. package/dist/ExtendedForm.d.ts +0 -4
  15. package/dist/WizardForm.d.ts +0 -26
  16. package/dist/components/arrays/ArrayFieldItemTemplate.d.ts +0 -3
  17. package/dist/components/arrays/ArrayFieldTemplate.d.ts +0 -3
  18. package/dist/components/arrays/index.d.ts +0 -2
  19. package/dist/components/fields/AddressField.d.ts +0 -3
  20. package/dist/components/fields/CurrencyField.d.ts +0 -4
  21. package/dist/components/fields/PhoneField.d.ts +0 -4
  22. package/dist/components/index.d.ts +0 -24
  23. package/dist/components/templates/FieldTemplate.d.ts +0 -4
  24. package/dist/components/templates/SubmitButton.d.ts +0 -4
  25. package/dist/components/templates/index.d.ts +0 -2
  26. package/dist/conditionals/ConditionalActions.d.ts +0 -13
  27. package/dist/conditionals/ConditionalContext.d.ts +0 -32
  28. package/dist/conditionals/DynamicArrayConditionalEngine.d.ts +0 -77
  29. package/dist/conditionals/SimpleConditionalEngine.d.ts +0 -41
  30. package/dist/conditionals/SmartJsonRulesTransformer.d.ts +0 -10
  31. package/dist/conditionals/index.d.ts +0 -7
  32. package/dist/events/FormEventContext.d.ts +0 -20
  33. package/dist/events/FormEventHub.d.ts +0 -27
  34. package/dist/events/FormEventManager.d.ts +0 -10
  35. package/dist/events/index.d.ts +0 -4
  36. package/dist/index.d.ts +0 -14
  37. package/dist/index.es.js +0 -44459
  38. package/dist/index.umd.js +0 -399
  39. package/dist/layouts/index.d.ts +0 -2
  40. package/dist/layouts/wizard/ProgressIndicator.d.ts +0 -10
  41. package/dist/layouts/wizard/StepNavigation.d.ts +0 -11
  42. package/dist/layouts/wizard/WizardLayout.d.ts +0 -31
  43. package/dist/layouts/wizard/WizardNavigation.d.ts +0 -16
  44. package/dist/layouts/wizard/WizardObjectFieldTemplate.d.ts +0 -4
  45. package/dist/layouts/wizard/WizardSectionTemplate.d.ts +0 -11
  46. package/dist/layouts/wizard/index.d.ts +0 -7
  47. package/dist/types/index.d.ts +0 -88
  48. package/dist/utils/formDataUtils.d.ts +0 -22
  49. package/dist/utils/index.d.ts +0 -4
  50. package/dist/utils/schemaUtils.d.ts +0 -24
  51. package/dist/utils/validationUtils.d.ts +0 -26
  52. package/dist/vanilla-wrapper.d.ts +0 -33
  53. package/dist/widgets/date/DateWidget.d.ts +0 -4
  54. package/dist/widgets/enhanced/EnhancedWidgets.d.ts +0 -36
  55. package/dist/widgets/file/FileWidget.d.ts +0 -4
  56. package/dist/widgets/index.d.ts +0 -33
  57. package/dist/widgets/input/ColorWidget.d.ts +0 -4
  58. package/dist/widgets/input/RangeWidget.d.ts +0 -4
  59. package/dist/widgets/input/RatingWidget.d.ts +0 -4
@@ -1,77 +0,0 @@
1
- import { RJSFSchema, UiSchema } from '@rjsf/utils';
2
- import { ConditionalRule, ConditionalEvent, ConditionalActions, ConditionalEngineInstance } from '../types';
3
-
4
- export declare class DynamicArrayConditionalEngine implements ConditionalEngineInstance {
5
- private originalRules;
6
- private engine;
7
- private expandedRules;
8
- constructor(rules: ConditionalRule[], schema: RJSFSchema, uiSchema?: UiSchema, extraActions?: ConditionalActions);
9
- /**
10
- * Expand array patterns like directors[*] based on actual form data
11
- */
12
- expandArrayPatterns(rules: ConditionalRule[], formData: any): ConditionalRule[];
13
- /**
14
- * Check if a rule contains array patterns like [*]
15
- */
16
- private hasArrayPatterns;
17
- /**
18
- * Expand a single rule that contains array patterns
19
- */
20
- private expandSingleRule;
21
- /**
22
- * Find all array patterns like "directors[*]" in a rule
23
- */
24
- private findArrayPatterns;
25
- /**
26
- * Expand a rule for a specific array index
27
- */
28
- private expandRuleForIndex;
29
- /**
30
- * Get nested value from object using dot notation
31
- */
32
- private getNestedValue;
33
- /**
34
- * Pre-process uiSchema to ensure array items have proper template structure
35
- */
36
- private preprocessUiSchemaForArrays;
37
- /**
38
- * Main processing method - implement ConditionalEngineInstance interface
39
- */
40
- processFormData(formData: any): Promise<{
41
- schema: RJSFSchema;
42
- uiSchema: UiSchema;
43
- formData: any;
44
- }>;
45
- /**
46
- * Get the original unexpanded rules
47
- */
48
- getOriginalRules(): ConditionalRule[];
49
- /**
50
- * Get the current expanded rules
51
- */
52
- getCurrentRules(): ConditionalRule[];
53
- /**
54
- * Manually set rules (useful for testing)
55
- */
56
- setRules(rules: ConditionalRule[]): void;
57
- /**
58
- * Add a rule to the engine (implement ConditionalEngineInstance interface)
59
- */
60
- addRule(rule: ConditionalRule): void;
61
- /**
62
- * Run the conditional engine and return events (implement ConditionalEngineInstance interface)
63
- */
64
- run(formData: any): Promise<ConditionalEvent[]>;
65
- /**
66
- * Add an action to the engine (for ConditionalContext compatibility)
67
- */
68
- addAction(actionType: string, actionFunction: any): void;
69
- /**
70
- * Remove an action from the engine (for ConditionalContext compatibility)
71
- */
72
- removeAction(actionType: string): void;
73
- /**
74
- * Get available actions (for ConditionalContext compatibility)
75
- */
76
- getAvailableActions(): string[];
77
- }
@@ -1,41 +0,0 @@
1
- import { RJSFSchema, UiSchema } from '@rjsf/utils';
2
- import { ConditionalRule, ConditionalEvent, ConditionalActions, ConditionalEngineInstance } from '../types';
3
-
4
- export declare class SimpleConditionalEngine implements ConditionalEngineInstance {
5
- private rules;
6
- private actions;
7
- private originalSchema;
8
- private originalUiSchema;
9
- constructor(rules: ConditionalRule[], schema: RJSFSchema, uiSchema?: UiSchema, extraActions?: ConditionalActions);
10
- /**
11
- * Get nested value from object using dot notation with array index support
12
- */
13
- private getNestedValue;
14
- /**
15
- * Evaluate a single condition against form data
16
- */
17
- private evaluateCondition;
18
- /**
19
- * Evaluate field-level condition
20
- */
21
- private evaluateFieldCondition;
22
- addRule(rule: ConditionalRule): void;
23
- run(formData: any): Promise<ConditionalEvent[]>;
24
- processEvents(events: ConditionalEvent[], schema: RJSFSchema, uiSchema: UiSchema, formData: any): {
25
- schema: RJSFSchema;
26
- uiSchema: UiSchema;
27
- };
28
- processFormData(formData: any): Promise<{
29
- schema: RJSFSchema;
30
- uiSchema: UiSchema;
31
- formData: any;
32
- }>;
33
- runAndProcess(formData: any, schema: RJSFSchema, uiSchema: UiSchema): Promise<{
34
- schema: RJSFSchema;
35
- uiSchema: UiSchema;
36
- events: ConditionalEvent[];
37
- }>;
38
- getAvailableActions(): string[];
39
- addAction(actionType: string, actionFunction: any): void;
40
- removeAction(actionType: string): void;
41
- }
@@ -1,10 +0,0 @@
1
- import { ConditionalRule } from '../types';
2
-
3
- /**
4
- * Smart transformation of JSON Rules Engine rules to internal format
5
- *
6
- * Handles show/hide pairs intelligently by converting them to single remove rules
7
- * Also handles rules that are already in internal format
8
- */
9
- export declare function smartTransformJsonRulesEngine(rules: any[]): ConditionalRule[];
10
- export { smartTransformJsonRulesEngine as transformJsonRulesEngine };
@@ -1,7 +0,0 @@
1
- export { SimpleConditionalEngine as ConditionalProcessor } from './SimpleConditionalEngine';
2
- export { SimpleConditionalEngine } from './SimpleConditionalEngine';
3
- export { DynamicArrayConditionalEngine } from './DynamicArrayConditionalEngine';
4
- export { defaultActions, remove, require, uiAppend, uiOverride, uiReplace, enable, disable, optional, show, } from './ConditionalActions';
5
- export { smartTransformJsonRulesEngine as transformJsonRulesEngine } from './SmartJsonRulesTransformer';
6
- export { smartTransformJsonRulesEngine } from './SmartJsonRulesTransformer';
7
- export { default as Engine } from 'json-rules-engine-simplified';
@@ -1,20 +0,0 @@
1
- import { default as React, ReactNode } from 'react';
2
- import { FormEventHub } from './FormEventHub';
3
-
4
- interface FormEventContextType {
5
- eventHub: FormEventHub;
6
- formData?: any;
7
- }
8
- interface FormEventProviderProps {
9
- eventHub: FormEventHub;
10
- formData?: any;
11
- children: ReactNode;
12
- }
13
- export declare const FormEventProvider: React.FC<FormEventProviderProps>;
14
- export declare const useFormEventHub: () => FormEventContextType;
15
- export declare const useFieldEventHandlers: (fieldId: string, schema?: any, fieldPath?: string[]) => {
16
- onFocus: (value: any) => Promise<void>;
17
- onBlur: (value: any) => Promise<void>;
18
- onChange: (value: any) => Promise<void>;
19
- };
20
- export {};
@@ -1,27 +0,0 @@
1
- import { FormEventHandlers, FieldEventHandlers, WebhookConfig } from '../types';
2
-
3
- export declare class FormEventHub {
4
- private formHandlers;
5
- private fieldHandlers;
6
- private webhooks;
7
- private debounceTimers;
8
- private webhookQueue;
9
- private isProcessingQueue;
10
- constructor(formHandlers: FormEventHandlers, fieldHandlers?: FieldEventHandlers, webhooks?: WebhookConfig[]);
11
- handleBeforeSubmit(data: any): Promise<any>;
12
- handleAfterSubmit(data: any): Promise<void>;
13
- handleBeforeValidation(data: any): Promise<any>;
14
- handleAfterValidation(data: any, errors: any): Promise<void>;
15
- handleFieldEvent(eventType: 'focus' | 'blur' | 'change', fieldId: string, fieldValue: any, schema?: any, formData?: any, fieldPath?: string[]): Promise<void>;
16
- private processWebhooks;
17
- private debounceWebhook;
18
- private queueWebhook;
19
- private processWebhookQueue;
20
- private callWebhook;
21
- createFieldEventHandlers(fieldId: string, schema?: any, formData?: any, fieldPath?: string[]): {
22
- onFocus: (value: any) => Promise<void>;
23
- onBlur: (value: any) => Promise<void>;
24
- onChange: (value: any) => Promise<void>;
25
- };
26
- cleanup(): void;
27
- }
@@ -1,10 +0,0 @@
1
- import { FormEventHandlers } from '../types';
2
-
3
- export declare class FormEventManager {
4
- private handlers;
5
- constructor(handlers: FormEventHandlers);
6
- handleBeforeSubmit(data: any): Promise<any>;
7
- handleAfterSubmit(data: any): Promise<void>;
8
- handleBeforeValidation(data: any): Promise<any>;
9
- handleAfterValidation(data: any, errors: any): Promise<void>;
10
- }
@@ -1,4 +0,0 @@
1
- export { FormEventManager } from './FormEventManager';
2
- export { FormEventHub } from './FormEventHub';
3
- export { FormEventProvider, useFormEventHub, useFieldEventHandlers, } from './FormEventContext';
4
- export type { FormEventHandlers, FieldEventHandlers, FormFieldEvent, WebhookConfig, } from '../types';
package/dist/index.d.ts DELETED
@@ -1,14 +0,0 @@
1
-
2
- export * from './components';
3
- export * from './widgets';
4
- export * from './layouts';
5
- export * from './events';
6
- export * from './conditionals';
7
- export * from './types';
8
- export * from './utils';
9
- export type { FormProps, IChangeEvent } from '@rjsf/core';
10
- export type { RJSFSchema, UiSchema, WidgetProps, FieldProps, ArrayFieldTemplateProps, ObjectFieldTemplateProps, FieldTemplateProps, ErrorSchema, RJSFValidationError, } from '@rjsf/utils';
11
- export { default as validator } from '@rjsf/validator-ajv8';
12
- export { ExtendedForm } from './ExtendedForm';
13
- export { WizardForm } from './WizardForm';
14
- export type { WizardFormProps, WizardStep } from './WizardForm';