@syncfusion/ej2-react-form-renderer 0.1.0-beta

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 (48) hide show
  1. package/README.md +148 -0
  2. package/index.d.ts +6 -0
  3. package/index.js +6 -0
  4. package/license +13 -0
  5. package/package.json +49 -0
  6. package/src/CheckboxGroup.d.ts +12 -0
  7. package/src/CheckboxGroup.js +48 -0
  8. package/src/CustomTabComponent.d.ts +13 -0
  9. package/src/CustomTabComponent.js +35 -0
  10. package/src/DataGridComponent.d.ts +29 -0
  11. package/src/DataGridComponent.js +160 -0
  12. package/src/FormRenderer.d.ts +63 -0
  13. package/src/FormRenderer.js +567 -0
  14. package/src/FormValidator.d.ts +479 -0
  15. package/src/FormValidator.js +579 -0
  16. package/src/StaticHtmlRenderer.d.ts +8 -0
  17. package/src/StaticHtmlRenderer.js +21 -0
  18. package/src/index.d.ts +6 -0
  19. package/src/index.js +6 -0
  20. package/src/json-converter.d.ts +170 -0
  21. package/src/json-converter.js +1180 -0
  22. package/src/parser.d.ts +99 -0
  23. package/src/parser.js +749 -0
  24. package/src/renderFormField.d.ts +19 -0
  25. package/src/renderFormField.js +202 -0
  26. package/src/types/FormSchema.d.ts +177 -0
  27. package/src/types/FormSchema.js +1 -0
  28. package/src/utils.js +60 -0
  29. package/styles/bootstrap-dark.css +26 -0
  30. package/styles/bootstrap.css +26 -0
  31. package/styles/bootstrap4.css +26 -0
  32. package/styles/bootstrap5-dark.css +26 -0
  33. package/styles/bootstrap5.3-dark.css +26 -0
  34. package/styles/bootstrap5.3.css +26 -0
  35. package/styles/bootstrap5.css +26 -0
  36. package/styles/fluent-dark.css +26 -0
  37. package/styles/fluent.css +26 -0
  38. package/styles/fluent2-dark.css +26 -0
  39. package/styles/fluent2.css +26 -0
  40. package/styles/form-renderer.base.css +473 -0
  41. package/styles/material-dark.css +26 -0
  42. package/styles/material.css +26 -0
  43. package/styles/material3-dark.css +26 -0
  44. package/styles/material3.css +26 -0
  45. package/styles/tailwind-dark.css +26 -0
  46. package/styles/tailwind.css +26 -0
  47. package/styles/tailwind3-dark.css +10 -0
  48. package/styles/tailwind3.css +26 -0
@@ -0,0 +1,170 @@
1
+ import type { FormSchema, FormComponent } from '../FormBuilder/types/FormSchema';
2
+ export declare const generateId: (type: string) => string;
3
+ export interface SplitSchema {
4
+ dataSchema: DataSchema;
5
+ uiSchema: UISchema;
6
+ }
7
+ export interface DataSchema {
8
+ version: string;
9
+ properties: Record<string, DataField>;
10
+ }
11
+ export interface DataField {
12
+ id: string;
13
+ type: 'string' | 'number' | 'boolean' | 'array' | 'any' | 'button' | 'message' | 'sign' | 'image' | 'file' | 'color' | 'grid';
14
+ label?: string;
15
+ format?: 'date' | 'date-time' | 'time' | 'email' | 'url';
16
+ defaultValue?: any;
17
+ content?: string;
18
+ buttonType?: string;
19
+ textboxType?: string;
20
+ options?: string[] | any[];
21
+ required?: boolean;
22
+ minLength?: number;
23
+ maxLength?: number;
24
+ minValue?: number;
25
+ maxValue?: number;
26
+ minDate?: string;
27
+ maxDate?: string;
28
+ minTime?: string;
29
+ maxTime?: string;
30
+ pattern?: string;
31
+ }
32
+ export interface UISchema {
33
+ properties: Record<string, UIField>;
34
+ layout: LayoutNode[];
35
+ }
36
+ export interface UIField {
37
+ widget: string;
38
+ _configured?: boolean;
39
+ [key: string]: any;
40
+ }
41
+ export type LayoutNode = FieldNode | TableNode | PanelNode | TabsNode | CardNode;
42
+ export interface FieldNode {
43
+ type: 'field';
44
+ propertyId: string;
45
+ }
46
+ export interface TableNode {
47
+ type: 'table';
48
+ id: string;
49
+ label?: string;
50
+ cssClass?: string;
51
+ hideBorders?: boolean;
52
+ rows: number;
53
+ cols: number;
54
+ cells: TableCell[][];
55
+ columnWidths?: {
56
+ widths: (number | null)[];
57
+ };
58
+ }
59
+ export interface TableCell {
60
+ row: number;
61
+ col: number;
62
+ children: LayoutNode[];
63
+ }
64
+ export interface PanelNode {
65
+ type: 'panel';
66
+ id: string;
67
+ label?: string;
68
+ cssClass?: string;
69
+ hideBorders?: boolean;
70
+ hideLabel?: boolean;
71
+ children: LayoutNode[];
72
+ }
73
+ export interface TabsNode {
74
+ type: 'tabs';
75
+ id: string;
76
+ cssClass?: string;
77
+ label?: string;
78
+ tabOptions?: string[];
79
+ tabs: TabItem[];
80
+ }
81
+ export interface TabItem {
82
+ header: string;
83
+ children: LayoutNode[];
84
+ }
85
+ export interface CardNode {
86
+ type: 'card';
87
+ id: string;
88
+ label?: string;
89
+ cssClass?: string;
90
+ hideLabel?: boolean;
91
+ cardTitle?: string;
92
+ cardSubtitle?: string;
93
+ enableAction?: boolean;
94
+ actionButtonLabel?: string;
95
+ actionButtonType?: 'button' | 'submit';
96
+ children: LayoutNode[];
97
+ }
98
+ /**
99
+ * Convert label to camelCase identifier
100
+ * Examples:
101
+ * "First Name" → "firstName"
102
+ * "Email Address" → "emailAddress"
103
+ * "Date of Birth" → "dateOfBirth"
104
+ * "Phone Number (Mobile)" → "phoneNumberMobile"
105
+ */
106
+ export declare function labelToFieldKey(label: string, fallbackId?: string): string;
107
+ /**
108
+ * Ensure field key is unique by appending a number if needed
109
+ */
110
+ export declare function makeUniqueFieldKey(baseKey: string, existingKeys: Set<string>, originalId?: string): string;
111
+ export declare function splitSchema(heartSchema: FormSchema): SplitSchema;
112
+ /**
113
+ * Merge split schemas back into heart schema
114
+ * Supports both simple merge and fuzzy matching for re-import scenarios
115
+ */
116
+ export declare function mergeSchema(split: SplitSchema, existingUISchema?: UISchema): FormSchema;
117
+ /**
118
+ * Infer widget type from semantic data type
119
+ */
120
+ export declare function inferWidgetFromType(type: string, format?: string, hasOptions?: boolean): string;
121
+ export interface FieldMatchResult {
122
+ existingId: string;
123
+ newDataId: string;
124
+ confidence: 'exact' | 'high' | 'medium' | 'low';
125
+ method: 'id' | 'label-exact' | 'label-fuzzy' | 'new';
126
+ similarity?: number;
127
+ }
128
+ /**
129
+ * Match a new data field with existing UI schema field
130
+ * Preserves existing ID for stability
131
+ */
132
+ export declare function matchFieldWithIDPreservation(newDataField: DataField, existingUISchema: UISchema): FieldMatchResult;
133
+ /**
134
+ * Merge with ID remapping for re-import scenarios
135
+ * Preserves existing IDs to maintain layout stability
136
+ */
137
+ export declare function mergeWithIDRemapping(newDataSchema: DataSchema, existingUISchema: UISchema): FormSchema;
138
+ /**
139
+ * Extract all field IDs from layout tree
140
+ */
141
+ export declare function extractFieldIdsFromLayout(layout: LayoutNode[]): Set<string>;
142
+ /**
143
+ * Find unmatched fields (in data schema but not in layout)
144
+ */
145
+ export declare function findUnmatchedFields(dataSchema: DataSchema, layout: LayoutNode[]): string[];
146
+ /**
147
+ * Convert parser output (FormComponent[]) to DataSchema format
148
+ * This allows parser results to be merged with existing UI schemas
149
+ */
150
+ export declare function convertComponentsToDataSchema(components: FormComponent[]): DataSchema;
151
+ /**
152
+ * Convert parser output to a simple linear layout
153
+ * Used when no existing UI schema is present
154
+ */
155
+ export declare function convertComponentsToUISchema(components: FormComponent[]): UISchema;
156
+ /**
157
+ * Generate default UI properties for each data field
158
+ * Used by renderers when only data schema is provided
159
+ */
160
+ export declare function generateUIPropertiesFromData(dataSchema: DataSchema): Record<string, UIField>;
161
+ /**
162
+ * Generate sequential layout from data schema
163
+ * Used by renderers when only data schema is provided
164
+ */
165
+ export declare function generateLayoutFromData(dataSchema: DataSchema): FieldNode[];
166
+ /**
167
+ * Generate minimal data schema from UI schema
168
+ * Used by renderers when only UI schema is provided
169
+ */
170
+ export declare function generateDataSchemaFromUI(uiSchema: UISchema): DataSchema;