@anri1214/dynamic-forms-mui-mcp 0.1.5
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 +22 -0
- package/README.md +214 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +394 -0
- package/dist/prompts/generateBackendEndpoint.d.ts +5 -0
- package/dist/prompts/generateBackendEndpoint.d.ts.map +1 -0
- package/dist/prompts/generateBackendEndpoint.js +33 -0
- package/dist/prompts/generateFormConfig.d.ts +5 -0
- package/dist/prompts/generateFormConfig.d.ts.map +1 -0
- package/dist/prompts/generateFormConfig.js +94 -0
- package/dist/resources/examples.d.ts +9 -0
- package/dist/resources/examples.d.ts.map +1 -0
- package/dist/resources/examples.js +16 -0
- package/dist/resources/fieldDocs.d.ts +5 -0
- package/dist/resources/fieldDocs.d.ts.map +1 -0
- package/dist/resources/fieldDocs.js +39 -0
- package/dist/resources/jsonSchema.d.ts +5 -0
- package/dist/resources/jsonSchema.d.ts.map +1 -0
- package/dist/resources/jsonSchema.js +8 -0
- package/dist/schema/0.1/examples/crud.json +128 -0
- package/dist/schema/0.1/examples/filters.json +82 -0
- package/dist/schema/0.1/examples/registration.json +119 -0
- package/dist/schema/0.1/fieldTypes.json +213 -0
- package/dist/schema/0.1/formSchema.json +806 -0
- package/dist/schema/versions.json +6 -0
- package/dist/schemaLoader.d.ts +37 -0
- package/dist/schemaLoader.d.ts.map +1 -0
- package/dist/schemaLoader.js +89 -0
- package/dist/tools/generateSchema.d.ts +30 -0
- package/dist/tools/generateSchema.d.ts.map +1 -0
- package/dist/tools/generateSchema.js +58 -0
- package/dist/tools/getFieldConfig.d.ts +18 -0
- package/dist/tools/getFieldConfig.d.ts.map +1 -0
- package/dist/tools/getFieldConfig.js +25 -0
- package/dist/tools/listFieldTypes.d.ts +13 -0
- package/dist/tools/listFieldTypes.d.ts.map +1 -0
- package/dist/tools/listFieldTypes.js +14 -0
- package/dist/tools/validateSchema.d.ts +10 -0
- package/dist/tools/validateSchema.d.ts.map +1 -0
- package/dist/tools/validateSchema.js +32 -0
- package/dist/types.d.ts +19 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateFormConfig.d.ts","sourceRoot":"","sources":["../../src/prompts/generateFormConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,MAAM,EACvB,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,CA0FR"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a prompt that helps generate a FormSchema JSON configuration.
|
|
3
|
+
*/
|
|
4
|
+
export function generateFormConfigPrompt(formDescription, fieldHints) {
|
|
5
|
+
return `You are a form configuration expert for the @ai-hub/dynamic-forms-mui library.
|
|
6
|
+
Generate a complete, valid FormSchema JSON object based on the requirements below.
|
|
7
|
+
|
|
8
|
+
## Form Requirements
|
|
9
|
+
${formDescription}
|
|
10
|
+
|
|
11
|
+
${fieldHints ? `## Additional Field Hints\n${fieldHints}` : ''}
|
|
12
|
+
|
|
13
|
+
## FormSchema Structure
|
|
14
|
+
|
|
15
|
+
The output must be a JSON object with this structure:
|
|
16
|
+
\`\`\`json
|
|
17
|
+
{
|
|
18
|
+
"sections": [
|
|
19
|
+
{
|
|
20
|
+
"id": "string (unique section ID)",
|
|
21
|
+
"title": "string (section heading)",
|
|
22
|
+
"description": "string (optional)",
|
|
23
|
+
"fields": ["fieldKey1", "fieldKey2"]
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"fields": {
|
|
27
|
+
"fieldKey": {
|
|
28
|
+
"type": "text|password|email|number|textarea|select|multiselect|checkbox|radio|switch|date|dateRange|file",
|
|
29
|
+
"label": "string (field label)",
|
|
30
|
+
"placeholder": "string (optional)",
|
|
31
|
+
"helperText": "string (optional)",
|
|
32
|
+
"defaultValue": "any (optional)",
|
|
33
|
+
"disabled": "boolean (optional)",
|
|
34
|
+
"showIf": "Condition (optional)",
|
|
35
|
+
"validation": "ValidationRules (optional)"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
\`\`\`
|
|
40
|
+
|
|
41
|
+
## Field Type Quick Reference
|
|
42
|
+
|
|
43
|
+
| Type | Extra Props | Key Validations |
|
|
44
|
+
|------|-------------|-----------------|
|
|
45
|
+
| text | autoComplete | required, minLength, maxLength, pattern |
|
|
46
|
+
| password | autoComplete | required, minLength, hasUppercase, hasLowercase, hasNumber, hasSpecialChar, matchField |
|
|
47
|
+
| email | autoComplete | required, email, asyncValidation |
|
|
48
|
+
| number | min, max, step | required, min, max |
|
|
49
|
+
| textarea | rows | required, minLength, maxLength |
|
|
50
|
+
| select | options, optionsSource | required |
|
|
51
|
+
| multiselect | options, optionsSource | required |
|
|
52
|
+
| checkbox | — | required |
|
|
53
|
+
| radio | options, optionsSource, direction | required |
|
|
54
|
+
| switch | — | required |
|
|
55
|
+
| date | includeTime, minDate, maxDate, format | required, minDate, maxDate |
|
|
56
|
+
| dateRange | includeTime, minDate, maxDate, format | required |
|
|
57
|
+
| file | accept, maxSize, multiple | required, maxSize, minFiles, maxFiles |
|
|
58
|
+
|
|
59
|
+
## Validation Messages
|
|
60
|
+
Add custom messages via \`validation.messages\` for better UX:
|
|
61
|
+
\`\`\`json
|
|
62
|
+
"validation": {
|
|
63
|
+
"required": true,
|
|
64
|
+
"messages": { "required": "This field is required" }
|
|
65
|
+
}
|
|
66
|
+
\`\`\`
|
|
67
|
+
|
|
68
|
+
## Conditional Visibility (showIf)
|
|
69
|
+
\`\`\`json
|
|
70
|
+
"showIf": { "field": "otherField", "operator": "equals", "value": "someValue" }
|
|
71
|
+
\`\`\`
|
|
72
|
+
Operators: equals, notEquals, in, notIn, isEmpty, isNotEmpty, gt, gte, lt, lte
|
|
73
|
+
Composite: { "and": [...conditions] } or { "or": [...conditions] }
|
|
74
|
+
|
|
75
|
+
## Dynamic Options (optionsSource)
|
|
76
|
+
\`\`\`json
|
|
77
|
+
"optionsSource": {
|
|
78
|
+
"apiUrl": "/api/items",
|
|
79
|
+
"queryParams": [{ "key": "parentId", "dependsOn": "parentField" }],
|
|
80
|
+
"valueKey": "id",
|
|
81
|
+
"labelKey": "name"
|
|
82
|
+
}
|
|
83
|
+
\`\`\`
|
|
84
|
+
|
|
85
|
+
## Rules
|
|
86
|
+
1. Group related fields into logical sections
|
|
87
|
+
2. Use meaningful field keys (camelCase)
|
|
88
|
+
3. Add validation for all required fields
|
|
89
|
+
4. Include helpful placeholder text and helper text
|
|
90
|
+
5. Use cross-field validation (matchField) for confirmation fields
|
|
91
|
+
6. Output ONLY valid JSON — no comments, no trailing commas
|
|
92
|
+
|
|
93
|
+
Generate the FormSchema JSON now.`;
|
|
94
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns available example names for a given library version.
|
|
3
|
+
*/
|
|
4
|
+
export declare function listExamples(version: string): string[];
|
|
5
|
+
/**
|
|
6
|
+
* Returns a specific example by name for a given library version, or null if not found.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getExample(version: string, name: string): string | null;
|
|
9
|
+
//# sourceMappingURL=examples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"examples.d.ts","sourceRoot":"","sources":["../../src/resources/examples.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAEtD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIvE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { loadExampleNames, loadExample } from '../schemaLoader.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns available example names for a given library version.
|
|
4
|
+
*/
|
|
5
|
+
export function listExamples(version) {
|
|
6
|
+
return loadExampleNames(version);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Returns a specific example by name for a given library version, or null if not found.
|
|
10
|
+
*/
|
|
11
|
+
export function getExample(version, name) {
|
|
12
|
+
const example = loadExample(version, name);
|
|
13
|
+
if (!example)
|
|
14
|
+
return null;
|
|
15
|
+
return JSON.stringify(example, null, 2);
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldDocs.d.ts","sourceRoot":"","sources":["../../src/resources/fieldDocs.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAyC5D"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { loadFieldTypes } from '../schemaLoader.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a formatted documentation string for all field types for a given library version.
|
|
4
|
+
*/
|
|
5
|
+
export function getFieldDocsResource(version) {
|
|
6
|
+
const fieldTypesData = loadFieldTypes(version);
|
|
7
|
+
const docs = fieldTypesData.fieldTypes.map((ft) => {
|
|
8
|
+
const lines = [
|
|
9
|
+
`## ${ft.type}`,
|
|
10
|
+
'',
|
|
11
|
+
ft.description,
|
|
12
|
+
'',
|
|
13
|
+
`**Config interface:** \`${ft.config}\``,
|
|
14
|
+
'',
|
|
15
|
+
];
|
|
16
|
+
if (ft.specificProps.length > 0) {
|
|
17
|
+
lines.push(`**Specific props:** ${ft.specificProps.map((p) => `\`${p}\``).join(', ')}`);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
lines.push('**Specific props:** none');
|
|
21
|
+
}
|
|
22
|
+
lines.push('');
|
|
23
|
+
lines.push(`**Applicable validations:** ${ft.applicableValidations.map((v) => `\`${v}\``).join(', ')}`);
|
|
24
|
+
lines.push('');
|
|
25
|
+
lines.push('**Example:**');
|
|
26
|
+
lines.push('```json');
|
|
27
|
+
lines.push(JSON.stringify(ft.example, null, 2));
|
|
28
|
+
lines.push('```');
|
|
29
|
+
lines.push('');
|
|
30
|
+
return lines.join('\n');
|
|
31
|
+
});
|
|
32
|
+
return [
|
|
33
|
+
`# Dynamic Forms MUI — Field Types Reference (v${version})`,
|
|
34
|
+
'',
|
|
35
|
+
`Total field types: ${fieldTypesData.fieldTypes.length}`,
|
|
36
|
+
'',
|
|
37
|
+
...docs,
|
|
38
|
+
].join('\n');
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonSchema.d.ts","sourceRoot":"","sources":["../../src/resources/jsonSchema.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG7D"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { loadFormSchema } from '../schemaLoader.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the full FormSchema JSON Schema as a formatted string for a given library version.
|
|
4
|
+
*/
|
|
5
|
+
export function getFormSchemaResource(version) {
|
|
6
|
+
const formSchema = loadFormSchema(version);
|
|
7
|
+
return JSON.stringify(formSchema, null, 2);
|
|
8
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Product CRUD Form",
|
|
3
|
+
"description": "A CRUD form for creating/editing a product entity with categories, pricing, and image upload",
|
|
4
|
+
"schema": {
|
|
5
|
+
"sections": [
|
|
6
|
+
{
|
|
7
|
+
"id": "basic",
|
|
8
|
+
"title": "Basic Information",
|
|
9
|
+
"fields": ["name", "description", "category"]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"id": "pricing",
|
|
13
|
+
"title": "Pricing",
|
|
14
|
+
"fields": ["price", "currency", "discount"]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "media",
|
|
18
|
+
"title": "Media",
|
|
19
|
+
"fields": ["images"]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "settings",
|
|
23
|
+
"title": "Settings",
|
|
24
|
+
"fields": ["isActive", "isFeatured"]
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"fields": {
|
|
28
|
+
"name": {
|
|
29
|
+
"type": "text",
|
|
30
|
+
"label": "Product Name",
|
|
31
|
+
"placeholder": "Enter product name",
|
|
32
|
+
"validation": {
|
|
33
|
+
"required": true,
|
|
34
|
+
"minLength": 3,
|
|
35
|
+
"maxLength": 200
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"description": {
|
|
39
|
+
"type": "textarea",
|
|
40
|
+
"label": "Description",
|
|
41
|
+
"rows": 4,
|
|
42
|
+
"placeholder": "Describe the product...",
|
|
43
|
+
"validation": {
|
|
44
|
+
"maxLength": 2000
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"category": {
|
|
48
|
+
"type": "select",
|
|
49
|
+
"label": "Category",
|
|
50
|
+
"optionsSource": {
|
|
51
|
+
"apiUrl": "/api/categories",
|
|
52
|
+
"valueKey": "id",
|
|
53
|
+
"labelKey": "name"
|
|
54
|
+
},
|
|
55
|
+
"validation": {
|
|
56
|
+
"required": true
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"price": {
|
|
60
|
+
"type": "number",
|
|
61
|
+
"label": "Price",
|
|
62
|
+
"min": 0,
|
|
63
|
+
"step": 0.01,
|
|
64
|
+
"validation": {
|
|
65
|
+
"required": true,
|
|
66
|
+
"min": 0
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"currency": {
|
|
70
|
+
"type": "select",
|
|
71
|
+
"label": "Currency",
|
|
72
|
+
"options": [
|
|
73
|
+
{ "value": "USD", "label": "USD ($)" },
|
|
74
|
+
{ "value": "EUR", "label": "EUR (\u20ac)" },
|
|
75
|
+
{ "value": "UAH", "label": "UAH (\u20b4)" }
|
|
76
|
+
],
|
|
77
|
+
"validation": {
|
|
78
|
+
"required": true
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"discount": {
|
|
82
|
+
"type": "number",
|
|
83
|
+
"label": "Discount (%)",
|
|
84
|
+
"min": 0,
|
|
85
|
+
"max": 100,
|
|
86
|
+
"step": 1,
|
|
87
|
+
"helperText": "Optional discount percentage",
|
|
88
|
+
"showIf": {
|
|
89
|
+
"field": "price",
|
|
90
|
+
"operator": "gt",
|
|
91
|
+
"value": 0
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"images": {
|
|
95
|
+
"type": "file",
|
|
96
|
+
"label": "Product Images",
|
|
97
|
+
"accept": "image/*",
|
|
98
|
+
"multiple": true,
|
|
99
|
+
"maxSize": 10485760,
|
|
100
|
+
"validation": {
|
|
101
|
+
"maxSize": 10485760,
|
|
102
|
+
"maxFiles": 5,
|
|
103
|
+
"messages": {
|
|
104
|
+
"maxSize": "Each image must be under 10MB",
|
|
105
|
+
"maxFiles": "Maximum 5 images allowed"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"isActive": {
|
|
110
|
+
"type": "switch",
|
|
111
|
+
"label": "Active",
|
|
112
|
+
"defaultValue": true,
|
|
113
|
+
"helperText": "Whether the product is visible to customers"
|
|
114
|
+
},
|
|
115
|
+
"isFeatured": {
|
|
116
|
+
"type": "switch",
|
|
117
|
+
"label": "Featured",
|
|
118
|
+
"defaultValue": false,
|
|
119
|
+
"showIf": {
|
|
120
|
+
"field": "isActive",
|
|
121
|
+
"operator": "equals",
|
|
122
|
+
"value": true
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Search & Filter Form",
|
|
3
|
+
"description": "A filter/search form with dependent dropdowns and date range filtering",
|
|
4
|
+
"schema": {
|
|
5
|
+
"sections": [
|
|
6
|
+
{
|
|
7
|
+
"id": "search",
|
|
8
|
+
"title": "Search",
|
|
9
|
+
"fields": ["query", "status"]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"id": "dateFilter",
|
|
13
|
+
"title": "Date Filter",
|
|
14
|
+
"fields": ["dateRange"]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "categoryFilter",
|
|
18
|
+
"title": "Category Filter",
|
|
19
|
+
"description": "City depends on the selected country",
|
|
20
|
+
"fields": ["country", "city", "tags"]
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"fields": {
|
|
24
|
+
"query": {
|
|
25
|
+
"type": "text",
|
|
26
|
+
"label": "Search",
|
|
27
|
+
"placeholder": "Search by name or keyword..."
|
|
28
|
+
},
|
|
29
|
+
"status": {
|
|
30
|
+
"type": "select",
|
|
31
|
+
"label": "Status",
|
|
32
|
+
"options": [
|
|
33
|
+
{ "value": "all", "label": "All" },
|
|
34
|
+
{ "value": "active", "label": "Active" },
|
|
35
|
+
{ "value": "inactive", "label": "Inactive" },
|
|
36
|
+
{ "value": "pending", "label": "Pending" }
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"dateRange": {
|
|
40
|
+
"type": "dateRange",
|
|
41
|
+
"label": "Date Range",
|
|
42
|
+
"format": "dd/MM/yyyy"
|
|
43
|
+
},
|
|
44
|
+
"country": {
|
|
45
|
+
"type": "select",
|
|
46
|
+
"label": "Country",
|
|
47
|
+
"optionsSource": {
|
|
48
|
+
"apiUrl": "/api/countries",
|
|
49
|
+
"valueKey": "code",
|
|
50
|
+
"labelKey": "name"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"city": {
|
|
54
|
+
"type": "select",
|
|
55
|
+
"label": "City",
|
|
56
|
+
"helperText": "Select a country first",
|
|
57
|
+
"optionsSource": {
|
|
58
|
+
"apiUrl": "/api/cities",
|
|
59
|
+
"queryParams": [
|
|
60
|
+
{ "key": "countryCode", "dependsOn": "country" }
|
|
61
|
+
],
|
|
62
|
+
"valueKey": "id",
|
|
63
|
+
"labelKey": "name"
|
|
64
|
+
},
|
|
65
|
+
"showIf": {
|
|
66
|
+
"field": "country",
|
|
67
|
+
"operator": "isNotEmpty"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"tags": {
|
|
71
|
+
"type": "multiselect",
|
|
72
|
+
"label": "Tags",
|
|
73
|
+
"optionsSource": {
|
|
74
|
+
"apiUrl": "/api/tags",
|
|
75
|
+
"valueKey": "id",
|
|
76
|
+
"labelKey": "name"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "User Registration Form",
|
|
3
|
+
"description": "A typical user registration form with email, password, and personal information",
|
|
4
|
+
"schema": {
|
|
5
|
+
"sections": [
|
|
6
|
+
{
|
|
7
|
+
"id": "credentials",
|
|
8
|
+
"title": "Account Credentials",
|
|
9
|
+
"fields": ["email", "password", "confirmPassword"]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"id": "personalInfo",
|
|
13
|
+
"title": "Personal Information",
|
|
14
|
+
"fields": ["firstName", "lastName", "dateOfBirth"]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "preferences",
|
|
18
|
+
"title": "Preferences",
|
|
19
|
+
"fields": ["newsletter", "termsAccepted"]
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"fields": {
|
|
23
|
+
"email": {
|
|
24
|
+
"type": "email",
|
|
25
|
+
"label": "Email Address",
|
|
26
|
+
"placeholder": "user@example.com",
|
|
27
|
+
"validation": {
|
|
28
|
+
"required": true,
|
|
29
|
+
"email": true,
|
|
30
|
+
"asyncValidation": {
|
|
31
|
+
"apiUrl": "/api/check-email",
|
|
32
|
+
"queryParams": [{ "key": "email" }],
|
|
33
|
+
"debounce": 500,
|
|
34
|
+
"message": "This email is already registered"
|
|
35
|
+
},
|
|
36
|
+
"messages": {
|
|
37
|
+
"required": "Email is required",
|
|
38
|
+
"email": "Please enter a valid email address"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"password": {
|
|
43
|
+
"type": "password",
|
|
44
|
+
"label": "Password",
|
|
45
|
+
"validation": {
|
|
46
|
+
"required": true,
|
|
47
|
+
"minLength": 8,
|
|
48
|
+
"hasUppercase": true,
|
|
49
|
+
"hasLowercase": true,
|
|
50
|
+
"hasNumber": true,
|
|
51
|
+
"hasSpecialChar": true,
|
|
52
|
+
"messages": {
|
|
53
|
+
"required": "Password is required",
|
|
54
|
+
"minLength": "Password must be at least 8 characters",
|
|
55
|
+
"hasUppercase": "Must contain at least one uppercase letter",
|
|
56
|
+
"hasLowercase": "Must contain at least one lowercase letter",
|
|
57
|
+
"hasNumber": "Must contain at least one digit",
|
|
58
|
+
"hasSpecialChar": "Must contain at least one special character"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"confirmPassword": {
|
|
63
|
+
"type": "password",
|
|
64
|
+
"label": "Confirm Password",
|
|
65
|
+
"validation": {
|
|
66
|
+
"required": true,
|
|
67
|
+
"matchField": "password",
|
|
68
|
+
"messages": {
|
|
69
|
+
"required": "Please confirm your password",
|
|
70
|
+
"matchField": "Passwords do not match"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"firstName": {
|
|
75
|
+
"type": "text",
|
|
76
|
+
"label": "First Name",
|
|
77
|
+
"validation": {
|
|
78
|
+
"required": true,
|
|
79
|
+
"minLength": 2,
|
|
80
|
+
"maxLength": 50
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"lastName": {
|
|
84
|
+
"type": "text",
|
|
85
|
+
"label": "Last Name",
|
|
86
|
+
"validation": {
|
|
87
|
+
"required": true,
|
|
88
|
+
"minLength": 2,
|
|
89
|
+
"maxLength": 50
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"dateOfBirth": {
|
|
93
|
+
"type": "date",
|
|
94
|
+
"label": "Date of Birth",
|
|
95
|
+
"format": "dd/MM/yyyy",
|
|
96
|
+
"validation": {
|
|
97
|
+
"required": true
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"newsletter": {
|
|
101
|
+
"type": "switch",
|
|
102
|
+
"label": "Subscribe to newsletter",
|
|
103
|
+
"defaultValue": false
|
|
104
|
+
},
|
|
105
|
+
"termsAccepted": {
|
|
106
|
+
"type": "checkbox",
|
|
107
|
+
"label": "I accept the Terms of Service and Privacy Policy",
|
|
108
|
+
"defaultValue": false,
|
|
109
|
+
"validation": {
|
|
110
|
+
"required": true,
|
|
111
|
+
"messages": {
|
|
112
|
+
"required": "You must accept the terms to continue"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|