extended-dynamic-forms
Version:
Extended React JSON Schema Form (RJSF) v6 with custom components, widgets, templates, layouts, and form events
36 lines (34 loc) • 1.19 kB
TypeScript
import { RJSFSchema } from '@rjsf/utils';
export interface JsonPatchOperation {
op: 'add' | 'remove' | 'replace';
path: string;
value?: any;
}
export interface CustomSchemaOperation {
op: 'require' | 'optional';
path: string;
field: string;
}
export type SchemaEffect = JsonPatchOperation | CustomSchemaOperation;
/**
* Apply a series of effects (JSON Patch or custom) to a schema
*/
export declare function applySchemaEffects(schema: RJSFSchema, effects: SchemaEffect[]): RJSFSchema;
/**
* Helper to extract parent path from a field path
* e.g., "/properties/address/properties/street" -> "/properties/address"
*/
export declare function fieldPathToParentPath(fieldPath: string): string;
/**
* Helper to extract field name from a path
* e.g., "/properties/address/properties/street" -> "street"
*/
export declare function extractFieldName(fieldPath: string): string;
/**
* Create a require effect
*/
export declare function createRequireEffect(parentPath: string, fieldName: string): CustomSchemaOperation;
/**
* Create an optional effect
*/
export declare function createOptionalEffect(parentPath: string, fieldName: string): CustomSchemaOperation;