extended-dynamic-forms 0.1.15 → 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.
- package/LICENSE +21 -0
- package/README.md +859 -551
- package/dist/extended-dynamic-forms.standalone.js +882 -0
- package/dist/style.css +1 -1
- package/examples/conditional-v2-example.tsx +64 -0
- package/examples/dynamic-array-items-example.tsx +211 -0
- package/examples/form-devtools-example.tsx +386 -0
- package/examples/global-ui-rules-example.tsx +356 -0
- package/examples/vanilla-js/README.md +212 -0
- package/examples/vanilla-js/basic-form.html +142 -0
- package/examples/vanilla-js/conditional-form.html +159 -0
- package/examples/vanilla-js/wizard-form.html +185 -0
- package/package.json +53 -37
- package/dist/ExtendedForm.d.ts +0 -4
- package/dist/components/arrays/ArrayFieldItemTemplate.d.ts +0 -3
- package/dist/components/arrays/ArrayFieldTemplate.d.ts +0 -3
- package/dist/components/arrays/index.d.ts +0 -2
- package/dist/components/fields/AddressField.d.ts +0 -4
- package/dist/components/fields/CurrencyField.d.ts +0 -4
- package/dist/components/fields/PhoneField.d.ts +0 -4
- package/dist/components/index.d.ts +0 -15
- package/dist/components/ui/badge.d.ts +0 -9
- package/dist/components/ui/button.d.ts +0 -11
- package/dist/components/ui/calendar.d.ts +0 -8
- package/dist/components/ui/card.d.ts +0 -8
- package/dist/components/ui/checkbox.d.ts +0 -4
- package/dist/components/ui/date-picker.d.ts +0 -13
- package/dist/components/ui/input.d.ts +0 -5
- package/dist/components/ui/label.d.ts +0 -5
- package/dist/components/ui/popover.d.ts +0 -6
- package/dist/components/ui/select.d.ts +0 -13
- package/dist/components/ui/slider.d.ts +0 -4
- package/dist/components/ui/textarea.d.ts +0 -5
- package/dist/conditionals/ConditionalForm.d.ts +0 -7
- package/dist/conditionals/index.d.ts +0 -4
- package/dist/conditionals/initialStateUtils.d.ts +0 -18
- package/dist/conditionals/types.d.ts +0 -65
- package/dist/conditionals/utils.d.ts +0 -22
- package/dist/events/FormEventContext.d.ts +0 -20
- package/dist/events/FormEventHub.d.ts +0 -27
- package/dist/events/FormEventManager.d.ts +0 -10
- package/dist/events/index.d.ts +0 -4
- package/dist/index.d.ts +0 -15
- package/dist/index.es.js +0 -15405
- package/dist/index.umd.js +0 -116
- package/dist/layouts/grid/GridLayout.d.ts +0 -11
- package/dist/layouts/horizontal/HorizontalLayout.d.ts +0 -10
- package/dist/layouts/index.d.ts +0 -3
- package/dist/layouts/vertical/VerticalLayout.d.ts +0 -9
- package/dist/lib/utils.d.ts +0 -3
- package/dist/types/index.d.ts +0 -47
- package/dist/utils/formDataUtils.d.ts +0 -22
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/schemaUtils.d.ts +0 -24
- package/dist/utils/validationUtils.d.ts +0 -26
- package/dist/vanilla-wrapper.d.ts +0 -35
- package/dist/widgets/date/DateWidget.d.ts +0 -4
- package/dist/widgets/enhanced/EnhancedWidgets.d.ts +0 -36
- package/dist/widgets/file/FileWidget.d.ts +0 -4
- package/dist/widgets/index.d.ts +0 -33
- package/dist/widgets/input/ColorWidget.d.ts +0 -4
- package/dist/widgets/input/RangeWidget.d.ts +0 -4
- package/dist/widgets/input/RatingWidget.d.ts +0 -4
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ConditionalRule, ConditionalState } from './types';
|
|
2
|
-
|
|
3
|
-
interface FieldEventMapping {
|
|
4
|
-
field: string;
|
|
5
|
-
events: Array<{
|
|
6
|
-
type: 'show' | 'hide' | 'require' | 'unrequire' | 'disable' | 'enable';
|
|
7
|
-
rule: ConditionalRule;
|
|
8
|
-
}>;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Analyze rules to determine which fields are affected by which events
|
|
12
|
-
*/
|
|
13
|
-
export declare function analyzeRules(rules: ConditionalRule[]): Map<string, FieldEventMapping>;
|
|
14
|
-
/**
|
|
15
|
-
* Determine initial state based on rules and initial form data
|
|
16
|
-
*/
|
|
17
|
-
export declare function determineInitialState(rules: ConditionalRule[], initialFormData: any, debug?: boolean): Promise<ConditionalState>;
|
|
18
|
-
export {};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { ExtendedFormProps } from '../types';
|
|
2
|
-
|
|
3
|
-
export type ConditionOperator = 'equals' | 'notEquals' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual' | 'contains' | 'notContains' | 'in' | 'notIn' | 'empty' | 'notEmpty';
|
|
4
|
-
export interface FieldCondition {
|
|
5
|
-
equals?: any;
|
|
6
|
-
notEquals?: any;
|
|
7
|
-
greaterThan?: number;
|
|
8
|
-
lessThan?: number;
|
|
9
|
-
greaterThanOrEqual?: number;
|
|
10
|
-
lessThanOrEqual?: number;
|
|
11
|
-
contains?: string;
|
|
12
|
-
notContains?: string;
|
|
13
|
-
in?: any[];
|
|
14
|
-
notIn?: any[];
|
|
15
|
-
empty?: boolean;
|
|
16
|
-
notEmpty?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export interface ConditionalRule {
|
|
19
|
-
conditions: {
|
|
20
|
-
[fieldPath: string]: FieldCondition;
|
|
21
|
-
} & {
|
|
22
|
-
all?: Array<{
|
|
23
|
-
[fieldPath: string]: FieldCondition;
|
|
24
|
-
}>;
|
|
25
|
-
any?: Array<{
|
|
26
|
-
[fieldPath: string]: FieldCondition;
|
|
27
|
-
}>;
|
|
28
|
-
};
|
|
29
|
-
event: {
|
|
30
|
-
type: 'show' | 'hide' | 'require' | 'unrequire' | 'disable' | 'enable';
|
|
31
|
-
params: {
|
|
32
|
-
fields: string[];
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export interface ConditionalFormProps extends ExtendedFormProps {
|
|
37
|
-
conditionalRules: ConditionalRule[];
|
|
38
|
-
debug?: boolean;
|
|
39
|
-
}
|
|
40
|
-
export interface RuleEngineEvent {
|
|
41
|
-
type: string;
|
|
42
|
-
params: any;
|
|
43
|
-
}
|
|
44
|
-
export interface RuleEngineCondition {
|
|
45
|
-
fact: string;
|
|
46
|
-
operator: string;
|
|
47
|
-
value: any;
|
|
48
|
-
}
|
|
49
|
-
export interface RuleEngineRule {
|
|
50
|
-
conditions: {
|
|
51
|
-
all?: RuleEngineCondition[];
|
|
52
|
-
any?: RuleEngineCondition[];
|
|
53
|
-
};
|
|
54
|
-
event: RuleEngineEvent;
|
|
55
|
-
}
|
|
56
|
-
export interface ConditionalState {
|
|
57
|
-
hiddenFields: Set<string>;
|
|
58
|
-
disabledFields: Set<string>;
|
|
59
|
-
requiredFields: Set<string>;
|
|
60
|
-
}
|
|
61
|
-
export interface ConditionalContext {
|
|
62
|
-
state: ConditionalState;
|
|
63
|
-
updateState: (updates: Partial<ConditionalState>) => void;
|
|
64
|
-
evaluateRules: (formData: any) => void;
|
|
65
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { RJSFSchema, UiSchema } from '@rjsf/utils';
|
|
2
|
-
import { ConditionalRule, ConditionalState } from './types';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Convert our conditional rules to json-rules-engine format
|
|
6
|
-
*/
|
|
7
|
-
export declare function convertToEngineRules(rules: ConditionalRule[]): any[];
|
|
8
|
-
/**
|
|
9
|
-
* Apply conditional state to schema
|
|
10
|
-
*/
|
|
11
|
-
export declare function applyConditionalState(schema: RJSFSchema, uiSchema: UiSchema, state: ConditionalState, debug?: boolean): {
|
|
12
|
-
schema: RJSFSchema;
|
|
13
|
-
uiSchema: UiSchema;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Flatten nested objects for fact extraction
|
|
17
|
-
*/
|
|
18
|
-
export declare function flattenFormData(obj: any, prefix?: string, separator?: string): Record<string, any>;
|
|
19
|
-
/**
|
|
20
|
-
* Extract field value from form data using field path
|
|
21
|
-
*/
|
|
22
|
-
export declare function getFieldValue(formData: any, fieldPath: string): any;
|
|
@@ -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
|
-
}
|
package/dist/events/index.d.ts
DELETED
|
@@ -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,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export * from './components';
|
|
3
|
-
export * from './widgets';
|
|
4
|
-
export * from './layouts';
|
|
5
|
-
export * from './events';
|
|
6
|
-
export * from './types';
|
|
7
|
-
export * from './utils';
|
|
8
|
-
export * from './lib/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 { generateTheme } from '@rjsf/shadcn';
|
|
13
|
-
export { ExtendedForm } from './ExtendedForm';
|
|
14
|
-
export { ConditionalForm } from './conditionals';
|
|
15
|
-
export type { ConditionalFormProps, ConditionalRule, FieldCondition, ConditionalState } from './conditionals/types';
|